diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index f87afc29..e8b8ee61 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -4,7 +4,6 @@ on: tags-ignore: - '*.*' paths-ignore: - - "pom.xml" - "*.md" branches: - release/* diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5554efe3..3883a1a9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -40,7 +40,7 @@ jobs: echo TEST_REUSABLE_TOKEN=${{ secrets.TEST_REUSABLE_TOKEN }} >> .env - name: Build & Run tests with Maven - run: mvn -B package -f pom.xml + run: mvn -B package -f pom.xml -Dmaven.javadoc.skip=true - name: Codecov uses: codecov/codecov-action@v2.1.0 diff --git a/.github/workflows/shared-build-and-deploy.yml b/.github/workflows/shared-build-and-deploy.yml index 89332762..c9cadd2c 100644 --- a/.github/workflows/shared-build-and-deploy.yml +++ b/.github/workflows/shared-build-and-deploy.yml @@ -126,6 +126,7 @@ jobs: - name: Publish package run: mvn --batch-mode deploy -P ${{ inputs.profile }} + env: SERVER_USERNAME: ${{ secrets.server-username }} SERVER_PASSWORD: ${{ secrets.server-password }} diff --git a/README.md b/README.md index cee75d31..7c80d174 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,11 @@ The Skyflow Java SDK is designed to help with integrating Skyflow into a Java ba - [Update](#update) - [Delete](#delete) - [Query](#query) +- [Detect](#detect) + - [Deidentify Text](#deidentify-text) + - [Reidentify Text](#reidentify-text) + - [Deidentify File](#deidentify-file) + - [Get Run](#get-run) - [Connections](#connections) - [Invoke a connection](#invoke-a-connection) - [Authenticate with bearer tokens](#authenticate-with-bearer-tokens) @@ -1756,6 +1761,653 @@ Sample response: } ``` +# Detect +Skyflow Detect enables you to deidentify and reidentify sensitive data in text and files, supporting advanced privacy-preserving workflows. The Detect API supports the following operations: + +## Deidentify Text +To deidentify text, use the `deidentifyText` method. The `DeidentifyTextRequest` class creates a deidentify text request, which includes the text to be deidentified. Additionally, you can provide optional parameters using the `DeidentifyTextOptions` class. + +### Construct an deidentify text request + +```java +import com.skyflow.enums.DetectEntities; +import com.skyflow.vault.detect.DateTransformation; +import com.skyflow.vault.detect.DeidentifyTextRequest; +import com.skyflow.vault.detect.TokenFormat; +import com.skyflow.vault.detect.Transformations; +import com.skyflow.vault.detect.DeidentifyTextResponse; + +import java.util.ArrayList; +import java.util.List; + +/** + * This example demonstrate to build deidentify text request. + */ +public class DeidentifyTextSchema { + + public static void main(String[] args) { + + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + + // Step 2: Configure the options for deidentify text + + // Replace with the entity you want to detect + List detectEntitiesList = new ArrayList<>(); + detectEntitiesList.add(DetectEntities.SSN); + + // Replace with the entity you want to detect with vault token + List vaultTokenList = new ArrayList<>(); + vaultTokenList.add(DetectEntities.CREDIT_CARD); + + // Replace with the entity you want to detect with entity only + List entityOnlyList = new ArrayList<>(); + entityOnlyList.add(DetectEntities.SSN); + + // Replace with the entity you want to detect with entity unique counter + List entityUniqueCounterList = new ArrayList<>(); + entityUniqueCounterList.add(DetectEntities.SSN); + + // Replace with the regex patterns you want to allow during deidentification + List allowRegexList = new ArrayList<>(); + allowRegexList.add(""); + + // Replace with the regex patterns you want to restrict during deidentification + List restrictRegexList = new ArrayList<>(); + restrictRegexList.add("YOUR_RESTRICT_REGEX_LIST"); + + // Configure Token Format + TokenFormat tokenFormat = TokenFormat.builder() + .vaultToken(vaultTokenList) + .entityOnly(entityOnlyList) + .entityUniqueCounter(entityUniqueCounterList) + .build(); + + // Configure Transformation + List detectEntitiesTransformationList = new ArrayList<>(); + detectEntitiesTransformationList.add(DetectEntities.DOB); // Replace with the entity you want to transform + + DateTransformation dateTransformation = new DateTransformation(20, 5, detectEntitiesTransformationList); + Transformations transformations = new Transformations(dateTransformation); + + // Step 3: Create a deidentify text request for the vault + DeidentifyTextRequest deidentifyTextRequest = DeidentifyTextRequest.builder() + .text("") // Replace with the text you want to deidentify + .entities(detectEntitiesList) + .allowRegexList(allowRegexList) + .restrictRegexList(restrictRegexList) + .tokenFormat(tokenFormat) + .transformations(transformations) + .build(); + + // Step 4: Use the Skyflow client to perform the deidentifyText operation + // Replace with your actual vault ID + DeidentifyTextResponse deidentifyTextResponse = skyflowClient.detect("").deidentifyText(deidentifyTextRequest); + + // Step 5: Print the response + System.out.println("Deidentify text Response: " + deidentifyTextResponse); + } +} + +``` + +## An [example](https://github.com/skyflowapi/skyflow-java/blob/beta-release/25.6.2/samples/src/main/java/com/example/detect/DeidentifyTextExample.java) of deidentify text: +```java +import java.util.ArrayList; +import java.util.List; + +import com.skyflow.enums.DetectEntities; +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.DateTransformation; +import com.skyflow.vault.detect.DeidentifyTextRequest; +import com.skyflow.vault.detect.DeidentifyTextResponse; +import com.skyflow.vault.detect.TokenFormat; +import com.skyflow.vault.detect.Transformations; + +/** + * Skyflow Deidentify Text Example + *

+ * This example demonstrates how to use the Skyflow SDK to deidentify text data + * across multiple vaults. It includes: + * 1. Setting up credentials and vault configurations. + * 2. Creating a Skyflow client with multiple vaults. + * 3. Performing deidentify of text with various options. + * 4. Handling responses and errors. + */ + +public class DeidentifyTextExample { + public static void main(String[] args) throws SkyflowException { + + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + + // Step 2: Configuring the different options for deidentify + + // Replace with the entity you want to detect + List detectEntitiesList = new ArrayList<>(); + detectEntitiesList.add(DetectEntities.SSN); + detectEntitiesList.add(DetectEntities.CREDIT_CARD); + + // Replace with the entity you want to detect with vault token + List vaultTokenList = new ArrayList<>(); + vaultTokenList.add(DetectEntities.SSN); + vaultTokenList.add(DetectEntities.CREDIT_CARD); + + // Configure Token Format + TokenFormat tokenFormat = TokenFormat.builder() + .vaultToken(vaultTokenList) + .build(); + + // Configure Transformation for deidentified entities + List detectEntitiesTransformationList = new ArrayList<>(); + detectEntitiesTransformationList.add(DetectEntities.DOB); // Replace with the entity you want to transform + + DateTransformation dateTransformation = new DateTransformation(20, 5, detectEntitiesTransformationList); + Transformations transformations = new Transformations(dateTransformation); + + // Step 3: invoking Deidentify text on the vault + try { + // Create a deidentify text request for the vault + DeidentifyTextRequest deidentifyTextRequest = DeidentifyTextRequest.builder() + .text("My SSN is 123-45-6789 and my card is 4111 1111 1111 1111.") // Replace with your deidentify text + .entities(detectEntitiesList) + .tokenFormat(tokenFormat) + .transformations(transformations) + .build(); + // Replace `9f27764a10f7946fe56b3258e117` with the acutal vault id + DeidentifyTextResponse deidentifyTextResponse = skyflowClient.detect("9f27764a10f7946fe56b3258e117").deidentifyText(deidentifyTextRequest); + + System.out.println("Deidentify text Response: " + deidentifyTextResponse); + } catch (SkyflowException e) { + System.err.println("Error occurred during deidentify: "); + e.printStackTrace(); // Print the exception for debugging purposes + } + } +} +``` + +Sample Response: +```json +{ + "processedText": "My SSN is [SSN_IWdexZe] and my card is [CREDIT_CARD_rUzMjdQ].", + "entities": [ + { + "token": "SSN_IWdexZe", + "value": "123-45-6789", + "textIndex": { + "start": 10, + "end": 21 + }, + "processedIndex": { + "start": 10, + "end": 23 + }, + "entity": "SSN", + "scores": { + "SSN": 0.9384 + } + }, + { + "token": "CREDIT_CARD_rUzMjdQ", + "value": "4111 1111 1111 1111", + "textIndex": { + "start": 37, + "end": 56 + }, + "processedIndex": { + "start": 39, + "end": 60 + }, + "entity": "CREDIT_CARD", + "scores": { + "CREDIT_CARD": 0.9051 + } + } + ], + "wordCount": 9, + "charCount": 57 +} +``` + +## Reidentify Text +To reidentify text, use the `reidentifyText` method. The `ReidentifyTextRequest` class creates a reidentify text request, which includes the redacted or deidentified text to be reidentified. Additionally, you can provide optional parameters using the ReidentifyTextOptions class to control how specific entities are returned (as redacted, masked, or plain text). + +### Construct an reidentify text request + +```java +import com.skyflow.enums.DetectEntities; +import com.skyflow.vault.detect.ReidentifyTextRequest; +import com.skyflow.vault.detect.ReidentifyTextResponse; + +import java.util.ArrayList; +import java.util.List; + +/** + * This example demonstrates how to build a reidentify text request. + */ +public class ReidentifyTextSchema { + public static void main(String[] args) { + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + + // Step 2: Configuring the different options for reidentify + List maskedEntity = new ArrayList<>(); + maskedEntity.add(DetectEntities.CREDIT_CARD); // Replace with the entity you want to mask + + List plainTextEntity = new ArrayList<>(); + plainTextEntity.add(DetectEntities.SSN); // Replace with the entity you want to keep in plain text + + // List redactedEntity = new ArrayList<>(); + // redactedEntity.add(DetectEntities.SSN); // Replace with the entity you want to redact + + + // Step 3: Create a reidentify text request with the configured entities + ReidentifyTextRequest reidentifyTextRequest = ReidentifyTextRequest.builder() + .text("My SSN is [SSN_IWdexZe] and my card is [CREDIT_CARD_rUzMjdQ].") // Replace with your deidentify text + .maskedEntities(maskedEntity) +// .redactedEntities(redactedEntity) + .plainTextEntities(plainTextEntity) + .build(); + + // Step 4: Invoke reidentify text on the vault + ReidentifyTextResponse reidentifyTextResponse = skyflowClient.detect("").reidentifyText(reidentifyTextRequest); + System.out.println("Reidentify text Response: " + reidentifyTextResponse); + } +} +``` + +## An [example](https://github.com/skyflowapi/skyflow-java/blob/beta-release/25.6.2/samples/src/main/java/com/example/detect/ReidentifyTextExample.java) of Reidentify text + +```java +import com.skyflow.enums.DetectEntities; +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.ReidentifyTextRequest; +import com.skyflow.vault.detect.ReidentifyTextResponse; + +import java.util.ArrayList; +import java.util.List; + +/** + * Skyflow Reidentify Text Example + *

+ * This example demonstrates how to use the Skyflow SDK to reidentify text data + * across multiple vaults. It includes: + * 1. Setting up credentials and vault configurations. + * 2. Creating a Skyflow client with multiple vaults. + * 3. Performing reidentify of text with various options. + * 4. Handling responses and errors. + */ + +public class ReidentifyTextExample { + public static void main(String[] args) throws SkyflowException { + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + + // Step 2: Configuring the different options for reidentify + List maskedEntity = new ArrayList<>(); + maskedEntity.add(DetectEntities.CREDIT_CARD); // Replace with the entity you want to mask + + List plainTextEntity = new ArrayList<>(); + plainTextEntity.add(DetectEntities.SSN); // Replace with the entity you want to keep in plain text + + try { + // Step 3: Create a reidentify text request with the configured options + ReidentifyTextRequest reidentifyTextRequest = ReidentifyTextRequest.builder() + .text("My SSN is [SSN_IWdexZe] and my card is [CREDIT_CARD_rUzMjdQ].") // Replace with your deidentify text + .maskedEntities(maskedEntity) + .plainTextEntities(plainTextEntity) + .build(); + + // Step 4: Invoke Reidentify text on the vault + // Replace `9f27764a10f7946fe56b3258e117` with the acutal vault id + ReidentifyTextResponse reidentifyTextResponse = skyflowClient.detect("9f27764a10f7946fe56b3258e117").reidentifyText(reidentifyTextRequest); + + // Handle the response from the reidentify text request + System.out.println("Reidentify text Response: " + reidentifyTextResponse); + } catch (SkyflowException e) { + System.err.println("Error occurred during reidentify : "); + e.printStackTrace(); + } + } +} +``` + +Sample Response: + +```json +{ + "processedText":"My SSN is 123-45-6789 and my card is XXXXX1111." +} +``` + +## Deidentify file +To deidentify files, use the `deidentifyFile` method. The `DeidentifyFileRequest` class creates a deidentify file request, which includes the file to be deidentified (such as images, PDFs, audio, documents, spreadsheets, or presentations). Additionally, you can provide optional parameters using the DeidentifyFileOptions class to control how entities are detected and deidentified, as well as how the output is generated for different file types. + +### Construct an deidentify file request + +```java +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.Env; +import com.skyflow.enums.LogLevel; +import com.skyflow.enums.MaskingMethod; +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.DeidentifyFileRequest; +import com.skyflow.vault.detect.DeidentifyFileResponse; + +import java.io.File; + +/** + * This example demonstrates how to build a deidentify file request. + */ + +public class DeidentifyFileSchema { + + public static void main(String[] args) { + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + + // Step 2: Create a deidentify file request with all options + + // Create file object + File file = new File(""); // Replace with the path to the file you want to deidentify + + // Create file input using the file object + FileInput fileInput = FileInput.builder() + .file(file) + // .filePath("") // Alternatively, you can use .filePath() + .build(); + + // Output configuration + String outputDirectory = ""; // Replace with the desired output directory to save the deidentified file + + // Entities to detect + // List detectEntities = new ArrayList<>(); + // detectEntities.add(DetectEntities.IP_ADDRESS); // Replace with the entities you want to detect + + // Image-specific options + // Boolean outputProcessedImage = true; // Include processed image in output + // Boolean outputOcrText = true; // Include OCR text in output + MaskingMethod maskingMethod = MaskingMethod.BLACKBOX; // Masking method for images + + // PDF-specific options + // Integer pixelDensity = 15; // Pixel density for PDF processing + // Integer maxResolution = 2000; // Max resolution for PDF + + // Audio-specific options + // Boolean outputProcessedAudio = true; // Include processed audio + // DetectOutputTranscriptions outputTanscription = DetectOutputTranscriptions.PLAINTEXT_TRANSCRIPTION; // Transcription type + + // Audio bleep configuration + // AudioBleep audioBleep = AudioBleep.builder() + // .frequency(5D) // Pitch in Hz + // .startPadding(7D) // Padding at start (seconds) + // .stopPadding(8D) // Padding at end (seconds) + // .build(); + + Integer waitTime = 20; // Max wait time for response (max 64 seconds) + + DeidentifyFileRequest deidentifyFileRequest = DeidentifyFileRequest.builder() + .file(fileInput) + .waitTime(waitTime) + .entities(detectEntities) + .outputDirectory(outputDirectory) + .maskingMethod(maskingMethod) + // .outputProcessedImage(outputProcessedImage) + // .outputOcrText(outputOcrText) + // .pixelDensity(pixelDensity) + // .maxResolution(maxResolution) + // .outputProcessedAudio(outputProcessedAudio) + // .outputTranscription(outputTanscription) + // .bleep(audioBleep) + .build(); + + + DeidentifyFileResponse deidentifyFileResponse = skyflowClient.detect("").deidentifyFile(deidentifyFileRequest); + System.out.println("Deidentify file response: " + deidentifyFileResponse.toString()); + } +} +``` + +## An [example](https://github.com/skyflowapi/skyflow-java/blob/beta-release/25.6.2/samples/src/main/java/com/example/detect/DeidentifyFileExample.java) of Deidentify file + +```java +import java.io.File; + +import com.skyflow.enums.MaskingMethod; +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.DeidentifyFileRequest; +import com.skyflow.vault.detect.DeidentifyFileResponse; + +/** + * Skyflow Deidentify File Example + *

+ * This example demonstrates how to use the Skyflow SDK to deidentify file + * It has all available options for deidentifying files. + * Supported file types: images (jpg, png, etc.), pdf, audio (mp3, wav), documents, spreadsheets, presentations, structured text. + * It includes: + * 1. Configure credentials + * 2. Set up vault configuration + * 3. Create a deidentify file request with all options + * 4. Call deidentifyFile to deidentify file. + * 5. Handle response and errors + */ +public class DeidentifyFileExample { + + public static void main(String[] args) throws SkyflowException { + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + try { + // Step 2: Create a deidentify file request with all options + + + // Create file object + File file = new File("sensitive-folder/personal-info.txt"); // Replace with the path to the file you want to deidentify + + // Create file input using the file object + FileInput fileInput = FileInput.builder() + .file(file) + // .filePath("") // Alternatively, you can use .filePath() + .build(); + + // Output configuration + String outputDirectory = "deidenfied-file/"; // Replace with the desired output directory to save the deidentified file + + // Entities to detect + // List detectEntities = new ArrayList<>(); + // detectEntities.add(DetectEntities.IP_ADDRESS); // Replace with the entities you want to detect + + // Image-specific options + // Boolean outputProcessedImage = true; // Include processed image in output + // Boolean outputOcrText = true; // Include OCR text in output + MaskingMethod maskingMethod = MaskingMethod.BLACKBOX; // Masking method for images + + Integer waitTime = 20; // Max wait time for response (max 64 seconds) + + DeidentifyFileRequest deidentifyFileRequest = DeidentifyFileRequest.builder() + .file(fileInput) + .waitTime(waitTime) + .outputDirectory(outputDirectory) + .maskingMethod(maskingMethod) + .build(); + + // Step 3: Invoking deidentifyFile + // Replace `9f27764a10f7946fe56b3258e117` with the acutal vault id + DeidentifyFileResponse deidentifyFileResponse = skyflowClient.detect("9f27764a10f7946fe56b3258e117").deidentifyFile(deidentifyFileRequest); + System.out.println("Deidentify file response: " + deidentifyFileResponse.toString()); + } catch (SkyflowException e) { + System.err.println("Error occurred during deidentify file: "); + e.printStackTrace(); + } + } +} + +``` + +Sample response: + +```json +{ + "file": { + "name": "deidentified.txt", + "size": 33, + "type": "", + "lastModified": 1751355183039 + }, + "fileBase64": "bXkgY2FyZCBudW1iZXIgaXMgW0NSRURJVF", + "type": "redacted_file", + "extension": "txt", + "wordCount": 11, + "charCount": 61, + "sizeInKb": 0, + "entities": [ + { + "file": "bmFtZTogW05BTUVfMV0gCm==", + "type": "entities", + "extension": "json" + } + ], + "runId": "undefined", + "status": "success" +} + +``` + +**Supported file types:** +- Documents: `doc`, `docx`, `pdf` +- PDFs: `pdf` +- Images: `bmp`, `jpeg`, `jpg`, `png`, `tif`, `tiff` +- Structured text: `json`, `xml` +- Spreadsheets: `csv`, `xls`, `xlsx` +- Presentations: `ppt`, `pptx` +- Audio: `mp3`, `wav` + +**Note:** +- Transformations cannot be applied to Documents, Images, or PDFs file formats. + +- The `waitTime` option must be ≤ 64 seconds; otherwise, an error is thrown. + +- If the API takes more than 64 seconds to process the file, it will return only the run ID in the response. + +Sample response (when the API takes more than 64 seconds): +```json +{ + "file": null, + "fileBase64": null, + "type": null, + "extension": null, + "wordCount": null, + "charCount": null, + "sizeInKb": null, + "durationInSeconds": null, + "pageCount": null, + "slideCount": null, + "entities": null, + "runId": "1273a8c6-c498-4293-a9d6-389864cd3a44", + "status": "IN_PROGRESS", + "errors": null +} +``` + +## Get run: +To retrieve the results of a previously started file `deidentification operation`, use the `getDetectRun` method. +The `GetDetectRunRequest` class is initialized with the `runId` returned from a prior deidentifyFile call. +This method allows you to fetch the final results of the file processing operation once they are available. + +### Construct an get run request + +```java +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.DeidentifyFileResponse; +import com.skyflow.vault.detect.GetDetectRunRequest; + +/** + * Skyflow Get Detect Run Example + */ + +public class GetDetectRunSchema { + + public static void main(String[] args) { + try { + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + + // Step 2: Create a get detect run request + GetDetectRunRequest getDetectRunRequest = GetDetectRunRequest.builder() + .runId("") // Replace with the runId from deidentifyFile call + .build(); + + // Step 3: Call getDetectRun to poll for file processing results + // Replace with your actual vault ID + DeidentifyFileResponse deidentifyFileResponse = skyflowClient.detect("").getDetectRun(getDetectRunRequest); + System.out.println("Get Detect Run Response: " + deidentifyFileResponse); + } catch (SkyflowException e) { + System.err.println("Error occurred during get detect run: "); + e.printStackTrace(); + } + } +} + +``` + +## An [example](https://github.com/skyflowapi/skyflow-java/blob/beta-release/25.6.2/samples/src/main/java/com/example/detect/GetDetectRunExample.java) of get run +```java +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.Env; +import com.skyflow.enums.LogLevel; +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.DeidentifyFileResponse; +import com.skyflow.vault.detect.GetDetectRunRequest; + +/** + * Skyflow Get Detect Run Example + *

+ * This example demonstrates how to: + * 1. Configure credentials + * 2. Set up vault configuration + * 3. Create a get detect run request + * 4. Call getDetectRun to poll for file processing results + * 5. Handle response and errors + */ +public class GetDetectRunExample { + public static void main(String[] args) throws SkyflowException { + // Step 1: Initialise the Skyflow client by configuring the credentials & vault config. + try { + + // Step 2: Create a get detect run request + GetDetectRunRequest getDetectRunRequest = GetDetectRunRequest.builder() + .runId("e0038196-4a20-422b-bad7-e0477117f9bb") // Replace with the runId from deidentifyFile call + .build(); + + // Step 3: Call getDetectRun to poll for file processing results + // Replace `9f27764a10f7946fe56b3258e117` with the acutal vault id + DeidentifyFileResponse deidentifyFileResponse = skyflowClient.detect("9f27764a10f7946fe56b3258e117").getDetectRun(getDetectRunRequest); + System.out.println("Get Detect Run Response: " + deidentifyFileResponse); + } catch (SkyflowException e) { + System.err.println("Error occurred during get detect run: "); + e.printStackTrace(); + } + } +} +``` + +Sample Response: + +```json +{ + "file": "bmFtZTogW05BTET0JfMV0K", + "type": "redacted_file", + "extension": "txt", + "wordCount": 11, + "charCount": 61, + "sizeInKb": 0.0, + "entities": [ + { + "file": "gW05BTUVfMV0gCmNhcmQ0K", + "type": "entities", + "extension": "json" + } + ], + "runId": "e0038196-4a20-422b-bad7-e0477117f9bb", + "status": "success" +} + +``` + # Connections Skyflow Connections is a gateway service that uses tokenization to securely send and receive data between your systems and first- or third-party services. The [connections](https://github.com/skyflowapi/skyflow-java/tree/main/src/main/java/com/skyflow/vault/connection) module invokes both inbound and/or outbound connections. diff --git a/pom.xml b/pom.xml index 84dfe438..832fd901 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.skyflow skyflow-java - 2.0.0-beta.1-dev.ec349a9 + 2.0.0-beta.2 jar ${project.groupId}:${project.artifactId} @@ -45,6 +45,30 @@ + + com.squareup.okhttp3 + okhttp + 4.12.0 + compile + + + com.fasterxml.jackson.core + jackson-databind + 2.17.2 + compile + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + 2.17.2 + compile + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.17.2 + compile + io.github.cdimascio @@ -117,6 +141,12 @@ 2.0.9 test + + org.junit.jupiter + junit-jupiter + 5.13.2 + compile + @@ -140,10 +170,7 @@ 3.2.0 - :com.skyflow.generated.rest - :com.skyflow.generated.rest.api - :com.skyflow.generated.rest.auth - :com.skyflow.generated.rest.models + com.skyflow.generated.rest.* @@ -276,5 +303,4 @@ - diff --git a/samples/src/main/java/com/example/detect/DeidentifyFileExample.java b/samples/src/main/java/com/example/detect/DeidentifyFileExample.java new file mode 100644 index 00000000..7f573d33 --- /dev/null +++ b/samples/src/main/java/com/example/detect/DeidentifyFileExample.java @@ -0,0 +1,114 @@ +package com.example.detect; + +import java.io.File; + +import com.skyflow.Skyflow; +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.Env; +import com.skyflow.enums.LogLevel; +import com.skyflow.enums.MaskingMethod; +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.DeidentifyFileRequest; +import com.skyflow.vault.detect.DeidentifyFileResponse; +import com.skyflow.vault.detect.FileInput; + +/** + * Skyflow Deidentify File Example + *

+ * This example demonstrates how to use the Skyflow SDK to deidentify file + * It has all available options for deidentifying files. + * Supported file types: images (jpg, png, etc.), pdf, audio (mp3, wav), documents, spreadsheets, presentations, structured text. + * It includes: + * 1. Configure credentials + * 2. Set up vault configuration + * 3. Create a deidentify file request with all options + * 4. Call deidentifyFile to deidentify file. + * 5. Handle response and errors + */ +public class DeidentifyFileExample { + + public static void main(String[] args) throws SkyflowException { + // Step 1: Set up credentials for the first vault configuration + Credentials credentials = new Credentials(); + credentials.setPath(""); // Replace with the path to the credentials file + + // Step 2: Configure the vault config + VaultConfig vaultConfig = new VaultConfig(); + vaultConfig.setVaultId(""); // Replace with the ID of the vault + vaultConfig.setClusterId(""); // Replace with the cluster ID of the vault + vaultConfig.setEnv(Env.PROD); // Set the environment (e.g., DEV, STAGE, PROD) + vaultConfig.setCredentials(credentials); // Associate the credentials with the vault + + // Step 3: Create a Skyflow client + Skyflow skyflowClient = Skyflow.builder() + .setLogLevel(LogLevel.DEBUG) // Enable debugging for detailed logs + .addVaultConfig(vaultConfig) // Add the vault configuration + .build(); + + try { + + // Step 4: Create a deidentify file request with all options + + // Create file object + File file = new File("") // Alternatively, you can use .filePath() + .build(); + + // Output configuration + String outputDirectory = ""; // Replace with the desired output directory to save the deidentified file + + // Entities to detect + // List detectEntities = new ArrayList<>(); + // detectEntities.add(DetectEntities.IP_ADDRESS); // Replace with the entities you want to detect + + // Image-specific options + // Boolean outputProcessedImage = true; // Include processed image in output + // Boolean outputOcrText = true; // Include OCR text in output + MaskingMethod maskingMethod = MaskingMethod.BLACKBOX; // Masking method for images + + // PDF-specific options + // Integer pixelDensity = 15; // Pixel density for PDF processing + // Integer maxResolution = 2000; // Max resolution for PDF + + // Audio-specific options + // Boolean outputProcessedAudio = true; // Include processed audio + // DetectOutputTranscriptions outputTanscription = DetectOutputTranscriptions.PLAINTEXT_TRANSCRIPTION; // Transcription type + + // Audio bleep configuration + // AudioBleep audioBleep = AudioBleep.builder() + // .frequency(5D) // Pitch in Hz + // .startPadding(7D) // Padding at start (seconds) + // .stopPadding(8D) // Padding at end (seconds) + // .build(); + + Integer waitTime = 20; // Max wait time for response (max 64 seconds) + + DeidentifyFileRequest deidentifyFileRequest = DeidentifyFileRequest.builder() + .file(fileInput) + .waitTime(waitTime) + // .entities(detectEntities) + .outputDirectory(outputDirectory) + .maskingMethod(maskingMethod) + // .outputProcessedImage(outputProcessedImage) + // .outputOcrText(outputOcrText) + // .pixelDensity(pixelDensity) + // .maxResolution(maxResolution) + // .outputProcessedAudio(outputProcessedAudio) + // .outputTranscription(outputTanscription) + // .bleep(audioBleep) + .build(); + + + DeidentifyFileResponse deidentifyFileResponse = skyflowClient.detect(vaultConfig.getVaultId()).deidentifyFile(deidentifyFileRequest); + System.out.println("Deidentify file response: " + deidentifyFileResponse.toString()); + } catch (SkyflowException e) { + System.err.println("Error occurred during deidentify file: "); + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/samples/src/main/java/com/example/detect/DeidentifyTextExample.java b/samples/src/main/java/com/example/detect/DeidentifyTextExample.java new file mode 100644 index 00000000..837dde00 --- /dev/null +++ b/samples/src/main/java/com/example/detect/DeidentifyTextExample.java @@ -0,0 +1,142 @@ +package com.example.detect; + +import java.util.ArrayList; +import java.util.List; + +import com.skyflow.Skyflow; +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.DetectEntities; +import com.skyflow.enums.Env; +import com.skyflow.enums.LogLevel; +import com.skyflow.errors.SkyflowException; +import com.skyflow.vault.detect.DeidentifyTextRequest; +import com.skyflow.vault.detect.DeidentifyTextResponse; +import com.skyflow.vault.detect.TokenFormat; + +/** + * Skyflow Deidentify Text Example + *

+ * This example demonstrates how to use the Skyflow SDK to deidentify text data + * across multiple vaults. It includes: + * 1. Setting up credentials and vault configurations. + * 2. Creating a Skyflow client with multiple vaults. + * 3. Performing deidentify of text with various options. + * 4. Handling responses and errors. + */ + +public class DeidentifyTextExample { + public static void main(String[] args) throws SkyflowException { + + // Step 1: Set up credentials for the first vault configuration + Credentials credentials = new Credentials(); + credentials.setPath(""); // Replace with the path to the credentials file + + // Step 2: Configure the first vault (Blitz) + VaultConfig blitzConfig = new VaultConfig(); + blitzConfig.setVaultId(""); // Replace with the ID of the first vault + blitzConfig.setClusterId(""); // Replace with the cluster ID of the first vault + blitzConfig.setEnv(Env.DEV); // Set the environment (e.g., DEV, STAGE, PROD) + blitzConfig.setCredentials(credentials); // Associate the credentials with the vault + + // Step 3: Configure the second vault (Stage) + VaultConfig stageConfig = new VaultConfig(); + stageConfig.setVaultId(""); // Replace with the ID of the second vault + stageConfig.setClusterId(""); // Replace with the cluster ID of the second vault + stageConfig.setEnv(Env.STAGE); // Set the environment for the second vault + + // Step 4: Set up credentials for the Skyflow client + Credentials skyflowCredentials = new Credentials(); + skyflowCredentials.setPath(""); // Replace with the path to another credentials file + + // Step 5: Create a Skyflow client and add vault configurations + Skyflow skyflowClient = Skyflow.builder() + .setLogLevel(LogLevel.DEBUG) // Enable debugging for detailed logs + .addVaultConfig(blitzConfig) // Add the first vault configuration + .addVaultConfig(stageConfig) // Add the second vault configuration + .addSkyflowCredentials(skyflowCredentials) // Add general Skyflow credentials + .build(); + + // Step 6: Configuring the different options for deidentify + // Replace with the entity you want to detect + List detectEntitiesList = new ArrayList<>(); + detectEntitiesList.add(DetectEntities.SSN); + detectEntitiesList.add(DetectEntities.CREDIT_CARD); + + // Replace with the entity you want to detect with vault token + List vaultTokenList = new ArrayList<>(); + vaultTokenList.add(DetectEntities.SSN); + vaultTokenList.add(DetectEntities.CREDIT_CARD); + + // Replace with the entity you want to detect with entity only + // List entityOnlyList = new ArrayList<>(); + // entityOnlyList.add(DetectEntities.SSN); + + // Replace with the entity you want to detect with entity unique counter + // List entityUniqueCounterList = new ArrayList<>(); + // entityUniqueCounterList.add(DetectEntities.SSN); + + // Replace with the regex patterns you want to allow during deidentification + // List allowRegexList = new ArrayList<>(); + // allowRegexList.add(""); + + // Replace with the regex patterns you want to restrict during deidentification + // List restrictRegexList = new ArrayList<>(); + // restrictRegexList.add("YOUR_RESTRICT_REGEX_LIST"); + + // Configure Token Format + TokenFormat tokenFormat = TokenFormat.builder() + .vaultToken(vaultTokenList) + // .entityOnly(entityOnlyList) + // .entityUniqueCounter(entityUniqueCounterList) + .build(); + + // Configure Transformation for deidentified entities + // List detectEntitiesTransformationList = new ArrayList<>(); + // detectEntitiesTransformationList.add(DetectEntities.DOB); // Replace with the entity you want to transform + // detectEntitiesTransformationList.add(DetectEntities.DATE); + + // DateTransformation dateTransformation = new DateTransformation(20, 5, detectEntitiesTransformationList); + // Transformations transformations = new Transformations(dateTransformation); + + // Example 1: Deidentify text on the first vault + try { + // Create a deidentify text request for the first vault + DeidentifyTextRequest deidentifyTextRequest = DeidentifyTextRequest.builder() + .text("My SSN is 123-45-6789 and my card is 4111 1111 1111 1111.") // Replace with the text you want to deidentify + .entities(detectEntitiesList) + // .allowRegexList(allowRegexList) + // .restrictRegexList(restrictRegexList) + .tokenFormat(tokenFormat) + // .transformations(transformations) + .build(); + + + DeidentifyTextResponse deidentifyTextResponse = skyflowClient.detect(blitzConfig.getVaultId()).deidentifyText(deidentifyTextRequest); + + System.out.println("Deidentify text Response (Vault1): " + deidentifyTextResponse); + } catch (SkyflowException e) { + System.err.println("Error occurred during deidentify (Vault1): "); + e.printStackTrace(); + } + // Example 2: Deidentify text on the second vault + try { + // Create a deidentify text request for the second vault + DeidentifyTextRequest deidentifyTextRequest2 = DeidentifyTextRequest.builder() + .text("My SSN is 123-45-6789 and my card is 4111 1111 1111 1111.") // Replace with the text you want to deidentify + .entities(detectEntitiesList) + // .allowRegexList(allowRegexList) + // .restrictRegexList(restrictRegexList) + .tokenFormat(tokenFormat) + // .transformations(transformations) + .build(); + + DeidentifyTextResponse deidentifyTextResponse2 = skyflowClient.detect(stageConfig.getVaultId()).deidentifyText(deidentifyTextRequest2); + System.out.println("Deidentify text Response (Vault2): " + deidentifyTextResponse2); + + } catch (SkyflowException e) { + System.err.println("Error occurred during deidentify (Vault2): "); + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/samples/src/main/java/com/example/detect/GetDetectRunExample.java b/samples/src/main/java/com/example/detect/GetDetectRunExample.java new file mode 100644 index 00000000..09fc2bc4 --- /dev/null +++ b/samples/src/main/java/com/example/detect/GetDetectRunExample.java @@ -0,0 +1,55 @@ +package com.example.detect; + +import com.skyflow.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.SkyflowException; +import com.skyflow.vault.detect.DeidentifyFileResponse; +import com.skyflow.vault.detect.GetDetectRunRequest; + +/** + * Skyflow Get Detect Run Example + *

+ * This example demonstrates how to: + * 1. Configure credentials + * 2. Set up vault configuration + * 3. Create a get detect run request + * 4. Call getDetectRun to poll for file processing results + * 5. Handle response and errors + */ +public class GetDetectRunExample { + public static void main(String[] args) throws SkyflowException { + // Step 1: Configure credentials + Credentials credentials = new Credentials(); + credentials.setPath(""); // Replace with the path to the credentials file + + // Step 2: Configure the vault config + VaultConfig vaultConfig = new VaultConfig(); + vaultConfig.setVaultId(""); // Replace with the ID of the vault + vaultConfig.setClusterId(""); // Replace with the cluster ID of the vault + vaultConfig.setEnv(Env.PROD); // Set the environment (e.g., DEV, STAGE, PROD) + vaultConfig.setCredentials(credentials); // Associate the credentials with the vault + + // Step 3: Create a Skyflow client + Skyflow skyflowClient = Skyflow.builder() + .setLogLevel(LogLevel.DEBUG) // Enable debugging for detailed logs + .addVaultConfig(vaultConfig) // Add the vault configuration + .build(); + + try { + // Step 4: Create a get detect run request + GetDetectRunRequest getDetectRunRequest = GetDetectRunRequest.builder() + .runId("") // Replace with the runId from deidentifyFile call + .build(); + + // Step 5: Call getDetectRun to poll for file processing results + DeidentifyFileResponse deidentifyFileResponse = skyflowClient.detect(vaultConfig.getVaultId()).getDetectRun(getDetectRunRequest); + System.out.println("Get Detect Run Response: " + deidentifyFileResponse); + } catch (SkyflowException e) { + System.err.println("Error occurred during get detect run: "); + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/Skyflow.java b/src/main/java/com/skyflow/Skyflow.java index 6866bd43..8e51da57 100644 --- a/src/main/java/com/skyflow/Skyflow.java +++ b/src/main/java/com/skyflow/Skyflow.java @@ -14,6 +14,7 @@ import com.skyflow.utils.logger.LogUtil; import com.skyflow.utils.validations.Validations; import com.skyflow.vault.controller.ConnectionController; +import com.skyflow.vault.controller.DetectController; import com.skyflow.vault.controller.VaultController; import java.util.LinkedHashMap; @@ -101,18 +102,49 @@ public VaultController vault(String vaultId) throws SkyflowException { return controller; } - public ConnectionController connection() { - String connectionId = (String) this.builder.connectionsMap.keySet().toArray()[0]; + + public ConnectionController connection() throws SkyflowException { + Object[] array = this.builder.connectionsMap.keySet().toArray(); + if (array.length < 1) { + LogUtil.printErrorLog(ErrorLogs.CONNECTION_CONFIG_DOES_NOT_EXIST.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.ConnectionIdNotInConfigList.getMessage()); + } + String connectionId = (String) array[0]; return this.connection(connectionId); } - public ConnectionController connection(String connectionId) { - return this.builder.connectionsMap.get(connectionId); + public ConnectionController connection(String connectionId) throws SkyflowException { + ConnectionController controller = this.builder.connectionsMap.get(connectionId); + if (controller == null) { + LogUtil.printErrorLog(ErrorLogs.CONNECTION_CONFIG_DOES_NOT_EXIST.getLog()); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.ConnectionIdNotInConfigList.getMessage()); + } + return controller; + } + + public DetectController detect() throws SkyflowException { + Object[] array = this.builder.detectClientsMap.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 detectId = (String) array[0]; + return this.detect(detectId); + } + + public DetectController detect(String vaultId) throws SkyflowException { + DetectController controller = this.builder.detectClientsMap.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 { private final LinkedHashMap connectionsMap; private final LinkedHashMap vaultClientsMap; + private final LinkedHashMap detectClientsMap; private final LinkedHashMap vaultConfigMap; private final LinkedHashMap connectionConfigMap; private Credentials skyflowCredentials; @@ -120,6 +152,7 @@ public static final class SkyflowClientBuilder { public SkyflowClientBuilder() { this.vaultClientsMap = new LinkedHashMap<>(); + this.detectClientsMap = new LinkedHashMap<>(); this.vaultConfigMap = new LinkedHashMap<>(); this.connectionsMap = new LinkedHashMap<>(); this.connectionConfigMap = new LinkedHashMap<>(); @@ -139,8 +172,11 @@ public SkyflowClientBuilder addVaultConfig(VaultConfig vaultConfig) throws Skyfl } else { this.vaultConfigMap.put(vaultConfig.getVaultId(), vaultConfig); this.vaultClientsMap.put(vaultConfig.getVaultId(), new VaultController(vaultConfig, this.skyflowCredentials)); + this.detectClientsMap.put(vaultConfig.getVaultId(), new DetectController(vaultConfig, this.skyflowCredentials)); LogUtil.printInfoLog(Utils.parameterizedString( InfoLogs.VAULT_CONTROLLER_INITIALIZED.getLog(), vaultConfig.getVaultId())); + LogUtil.printInfoLog(Utils.parameterizedString( + InfoLogs.DETECT_CONTROLLER_INITIALIZED.getLog(), vaultConfig.getVaultId())); } return this; } @@ -226,6 +262,9 @@ public SkyflowClientBuilder addSkyflowCredentials(Credentials credentials) throw for (VaultController vault : this.vaultClientsMap.values()) { vault.setCommonCredentials(this.skyflowCredentials); } + for (DetectController detect : this.detectClientsMap.values()) { + detect.setCommonCredentials(this.skyflowCredentials); + } for (ConnectionController connection : this.connectionsMap.values()) { connection.setCommonCredentials(this.skyflowCredentials); } diff --git a/src/main/java/com/skyflow/VaultClient.java b/src/main/java/com/skyflow/VaultClient.java index eb1cc3fa..7536a2c1 100644 --- a/src/main/java/com/skyflow/VaultClient.java +++ b/src/main/java/com/skyflow/VaultClient.java @@ -2,15 +2,30 @@ import com.skyflow.config.Credentials; import com.skyflow.config.VaultConfig; +import com.skyflow.enums.DetectEntities; +import com.skyflow.enums.DetectOutputTranscriptions; 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.api.QueryApi; -import com.skyflow.generated.rest.api.RecordsApi; -import com.skyflow.generated.rest.api.TokensApi; -import com.skyflow.generated.rest.auth.HttpBearerAuth; -import com.skyflow.generated.rest.models.*; +import com.skyflow.generated.rest.ApiClientBuilder; +import com.skyflow.generated.rest.resources.files.FilesClient; +import com.skyflow.generated.rest.resources.files.requests.*; +import com.skyflow.generated.rest.resources.files.types.*; +import com.skyflow.generated.rest.resources.query.QueryClient; +import com.skyflow.generated.rest.resources.records.RecordsClient; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBatchOperationBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceInsertRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceUpdateRecordBody; +import com.skyflow.generated.rest.resources.strings.StringsClient; +import com.skyflow.generated.rest.resources.strings.requests.DeidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.requests.ReidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.types.ReidentifyStringRequestFormat; +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.logs.InfoLogs; import com.skyflow.serviceaccount.util.Token; import com.skyflow.utils.Constants; @@ -19,6 +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.tokens.ColumnValue; import com.skyflow.vault.tokens.DetokenizeData; import com.skyflow.vault.tokens.DetokenizeRequest; @@ -26,16 +44,14 @@ import io.github.cdimascio.dotenv.Dotenv; import io.github.cdimascio.dotenv.DotenvException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; + public class VaultClient { - private final RecordsApi recordsApi; - private final TokensApi tokensApi; - private final QueryApi queryApi; - private final ApiClient apiClient; private final VaultConfig vaultConfig; + private final ApiClientBuilder apiClientBuilder; + private ApiClient apiClient; private Credentials commonCredentials; private Credentials finalCredentials; private String token; @@ -45,28 +61,29 @@ protected VaultClient(VaultConfig vaultConfig, Credentials credentials) { super(); this.vaultConfig = vaultConfig; this.commonCredentials = credentials; - this.apiClient = new ApiClient(); - apiClient.addDefaultHeader(Constants.SDK_METRICS_HEADER_KEY, Utils.getMetrics().toString()); - this.recordsApi = new RecordsApi(this.apiClient); - this.tokensApi = new TokensApi(this.apiClient); - this.queryApi = new QueryApi(this.apiClient); + this.apiClientBuilder = new ApiClientBuilder(); + this.apiClient = null; updateVaultURL(); } - protected RecordsApi getRecordsApi() { - return recordsApi; + protected RecordsClient getRecordsApi() { + return this.apiClient.records(); + } + + protected TokensClient getTokensApi() { + return this.apiClient.tokens(); } - protected TokensApi getTokensApi() { - return tokensApi; + protected StringsClient getDetectTextApi() { + return this.apiClient.strings(); } - protected QueryApi getQueryApi() { - return queryApi; + protected FilesClient getDetectFileAPi(){ + return this.apiClient.files(); } - protected ApiClient getApiClient() { - return apiClient; + protected QueryClient getQueryApi() { + return this.apiClient.query(); } protected VaultConfig getVaultConfig() { @@ -84,121 +101,690 @@ protected void updateVaultConfig() throws SkyflowException { } protected V1DetokenizePayload getDetokenizePayload(DetokenizeRequest request) { - V1DetokenizePayload payload = new V1DetokenizePayload(); - payload.setContinueOnError(request.getContinueOnError()); - payload.setDownloadURL(request.getDownloadURL()); + List recordRequests = new ArrayList<>(); + for (DetokenizeData detokenizeDataRecord : request.getDetokenizeData()) { - V1DetokenizeRecordRequest recordRequest = new V1DetokenizeRecordRequest(); - recordRequest.setToken(detokenizeDataRecord.getToken()); - recordRequest.setRedaction(detokenizeDataRecord.getRedactionType().getRedaction()); - payload.addDetokenizationParametersItem(recordRequest); + V1DetokenizeRecordRequest recordRequest = V1DetokenizeRecordRequest.builder() + .token(detokenizeDataRecord.getToken()) + .redaction(detokenizeDataRecord.getRedactionType().getRedaction()) + .build(); + recordRequests.add(recordRequest); } - return payload; + + return V1DetokenizePayload.builder() + .continueOnError(request.getContinueOnError()) + .downloadUrl(request.getDownloadURL()) + .detokenizationParameters(recordRequests) + .build(); } protected RecordServiceInsertRecordBody getBulkInsertRequestBody(InsertRequest request) { - RecordServiceInsertRecordBody insertRecordBody = new RecordServiceInsertRecordBody(); - insertRecordBody.setTokenization(request.getReturnTokens()); - insertRecordBody.setHomogeneous(request.getHomogeneous()); - insertRecordBody.setUpsert(request.getUpsert()); - insertRecordBody.setByot(request.getTokenMode().getBYOT()); - List> values = request.getValues(); List> tokens = request.getTokens(); List records = new ArrayList<>(); + for (int index = 0; index < values.size(); index++) { - V1FieldRecords record = new V1FieldRecords(); - record.setFields(values.get(index)); + V1FieldRecords.Builder recordBuilder = V1FieldRecords.builder().fields(values.get(index)); if (tokens != null && index < tokens.size()) { - record.setTokens(tokens.get(index)); + recordBuilder.tokens(tokens.get(index)); } - records.add(record); + records.add(recordBuilder.build()); } - insertRecordBody.setRecords(records); - return insertRecordBody; + + return RecordServiceInsertRecordBody.builder() + .tokenization(request.getReturnTokens()) + .homogeneous(request.getHomogeneous()) + .upsert(request.getUpsert()) + .byot(request.getTokenMode().getBYOT()) + .records(records) + .build(); } protected RecordServiceBatchOperationBody getBatchInsertRequestBody(InsertRequest request) { - RecordServiceBatchOperationBody insertRequestBody = new RecordServiceBatchOperationBody(); - insertRequestBody.setContinueOnError(true); - insertRequestBody.setByot(request.getTokenMode().getBYOT()); - ArrayList> values = request.getValues(); ArrayList> tokens = request.getTokens(); List records = new ArrayList<>(); for (int index = 0; index < values.size(); index++) { - V1BatchRecord record = new V1BatchRecord(); - record.setMethod(BatchRecordMethod.POST); - record.setTableName(request.getTable()); - record.setUpsert(request.getUpsert()); - record.setTokenization(request.getReturnTokens()); - record.setFields(values.get(index)); + V1BatchRecord.Builder recordBuilder = V1BatchRecord.builder() + .method(BatchRecordMethod.POST) + .tableName(request.getTable()) + .upsert(request.getUpsert()) + .tokenization(request.getReturnTokens()) + .fields(values.get(index)); + if (tokens != null && index < tokens.size()) { - record.setTokens(tokens.get(index)); + recordBuilder.tokens(tokens.get(index)); } - records.add(record); + + records.add(recordBuilder.build()); } - insertRequestBody.setRecords(records); - return insertRequestBody; + return RecordServiceBatchOperationBody.builder() + .continueOnError(true) + .byot(request.getTokenMode().getBYOT()) + .records(records) + .build(); } protected RecordServiceUpdateRecordBody getUpdateRequestBody(UpdateRequest request) { - RecordServiceUpdateRecordBody updateRequestBody = new RecordServiceUpdateRecordBody(); - updateRequestBody.byot(request.getTokenMode().getBYOT()); - updateRequestBody.setTokenization(request.getReturnTokens()); + RecordServiceUpdateRecordBody.Builder updateRequestBodyBuilder = RecordServiceUpdateRecordBody.builder(); + updateRequestBodyBuilder.byot(request.getTokenMode().getBYOT()); + updateRequestBodyBuilder.tokenization(request.getReturnTokens()); + V1FieldRecords.Builder recordBuilder = V1FieldRecords.builder(); HashMap values = request.getData(); + + if (values != null) { + recordBuilder.fields(values); + } + HashMap tokens = request.getTokens(); - V1FieldRecords record = new V1FieldRecords(); - record.setFields(values); if (tokens != null) { - record.setTokens(tokens); + recordBuilder.tokens(tokens); } - updateRequestBody.setRecord(record); - return updateRequestBody; + + updateRequestBodyBuilder.record(recordBuilder.build()); + + return updateRequestBodyBuilder.build(); } protected V1TokenizePayload getTokenizePayload(TokenizeRequest request) { - V1TokenizePayload payload = new V1TokenizePayload(); + List tokenizationParameters = new ArrayList<>(); + for (ColumnValue columnValue : request.getColumnValues()) { - V1TokenizeRecordRequest recordRequest = new V1TokenizeRecordRequest(); - recordRequest.setValue(columnValue.getValue()); - recordRequest.setColumnGroup(columnValue.getColumnGroup()); - payload.addTokenizationParametersItem(recordRequest); + V1TokenizeRecordRequest.Builder recordBuilder = V1TokenizeRecordRequest.builder(); + String value = columnValue.getValue(); + recordBuilder.value(value); + String columnGroup = columnValue.getColumnGroup(); + recordBuilder.columnGroup(columnGroup); + tokenizationParameters.add(recordBuilder.build()); } - return payload; + + V1TokenizePayload.Builder payloadBuilder = V1TokenizePayload.builder(); + + if (!tokenizationParameters.isEmpty()) { + payloadBuilder.tokenizationParameters(tokenizationParameters); + } + + return payloadBuilder.build(); } protected void setBearerToken() throws SkyflowException { prioritiseCredentials(); Validations.validateCredentials(this.finalCredentials); if (this.finalCredentials.getApiKey() != null) { - setApiKey(); - return; + LogUtil.printInfoLog(InfoLogs.REUSE_API_KEY.getLog()); + token=this.finalCredentials.getApiKey(); } 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()); } - HttpBearerAuth Bearer = (HttpBearerAuth) this.apiClient.getAuthentication("Bearer"); - Bearer.setBearerToken(token); + this.apiClientBuilder.token(token); + this.apiClient = this.apiClientBuilder.build(); + } + + protected DeidentifyTextResponse getDeIdentifyTextResponse(DeidentifyStringResponse deidentifyStringResponse) { + List entities = deidentifyStringResponse.getEntities() != null + ? deidentifyStringResponse.getEntities().stream() + .map(this::convertDetectedEntityToEntityInfo) + .collect(Collectors.toList()) + : null; + + return new DeidentifyTextResponse( + deidentifyStringResponse.getProcessedText(), + entities, + deidentifyStringResponse.getWordCount(), + deidentifyStringResponse.getCharacterCount() + ); + } + + protected DeidentifyStringRequest getDeidentifyStringRequest(DeidentifyTextRequest deIdentifyTextRequest, String vaultId) throws SkyflowException { + List entities = deIdentifyTextRequest.getEntities(); + + List mappedEntityTypes = null; + if (entities != null) { + mappedEntityTypes = deIdentifyTextRequest.getEntities().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList()); + } + + TokenFormat tokenFormat = deIdentifyTextRequest.getTokenFormat(); + + Optional> vaultToken = Optional.empty(); + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(deIdentifyTextRequest.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(deIdentifyTextRequest.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(deIdentifyTextRequest.getTransformations())); + + if (tokenFormat != null) { + if (tokenFormat.getVaultToken() != null && !tokenFormat.getVaultToken().isEmpty()) { + vaultToken = Optional.of(tokenFormat.getVaultToken().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + + if (tokenFormat.getEntityOnly() != null && !tokenFormat.getEntityOnly().isEmpty()) { + entityTypes = Optional.of(tokenFormat.getEntityOnly().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + + if (tokenFormat.getEntityUniqueCounter() != null && !tokenFormat.getEntityUniqueCounter().isEmpty()) { + entityUniqueCounter = Optional.of(tokenFormat.getEntityUniqueCounter().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + } + + TokenType tokenType = TokenType.builder() + .vaultToken(vaultToken) + .entityOnly(entityTypes) + .entityUnqCounter(entityUniqueCounter) + .build(); + + + return DeidentifyStringRequest.builder() + .vaultId(vaultId) + .text(deIdentifyTextRequest.getText()) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + } + + protected ReidentifyStringRequest getReidentifyStringRequest(ReidentifyTextRequest reidentifyTextRequest, String vaultId) throws SkyflowException { + List maskEntities = null; + List redactedEntities = null; + List plaintextEntities = null; + + if (reidentifyTextRequest.getMaskedEntities() != null) { + maskEntities = reidentifyTextRequest.getMaskedEntities().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList()); + } + + if (reidentifyTextRequest.getPlainTextEntities() != null) { + plaintextEntities = reidentifyTextRequest.getPlainTextEntities().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList()); + } + + if (reidentifyTextRequest.getRedactedEntities() != null) { + redactedEntities = reidentifyTextRequest.getRedactedEntities().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList()); + } + + ReidentifyStringRequestFormat reidentifyStringRequestFormat = ReidentifyStringRequestFormat.builder() + .masked(maskEntities) + .plaintext(plaintextEntities) + .redacted(redactedEntities) + .build(); + + + return ReidentifyStringRequest.builder() + .text(reidentifyTextRequest.getText()) + .vaultId(vaultId) + .format(reidentifyStringRequestFormat) + .build(); } - private void setApiKey() { - if (apiKey == null) { - apiKey = this.finalCredentials.getApiKey(); + + private EntityInfo convertDetectedEntityToEntityInfo(DetectedEntity detectedEntity) { + TextIndex textIndex = new TextIndex( + detectedEntity.getLocation().get().getStartIndex().orElse(0), + detectedEntity.getLocation().get().getEndIndex().orElse(0) + ); + TextIndex processedIndex = new TextIndex( + detectedEntity.getLocation().get().getStartIndexProcessed().orElse(0), + detectedEntity.getLocation().get().getEndIndexProcessed().orElse(0) + ); + + Map entityScores = detectedEntity.getEntityScores() + .map(doubleMap -> doubleMap.entrySet().stream() + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue + ))) + .orElse(Collections.emptyMap()); + + + return new EntityInfo( + detectedEntity.getToken().orElse(""), + detectedEntity.getValue().orElse(""), + textIndex, + processedIndex, + detectedEntity.getEntityType().orElse(""), + entityScores); + } + + + private Transformations getTransformations(com.skyflow.vault.detect.Transformations transformations) { + if (transformations == null || transformations.getShiftDates() == null) { + return null; + } + + List entityTypes = null; + if (!transformations.getShiftDates().getEntities().isEmpty()) { + entityTypes = transformations.getShiftDates().getEntities().stream() + .map(entity -> TransformationsShiftDatesEntityTypesItem.valueOf(entity.name())) + .collect(Collectors.toList()); } else { - LogUtil.printInfoLog(InfoLogs.REUSE_API_KEY.getLog()); + entityTypes = Collections.emptyList(); + } + + return Transformations.builder() + .shiftDates(TransformationsShiftDates.builder() + .maxDays(transformations.getShiftDates().getMax()) + .minDays(transformations.getShiftDates().getMin()) + .entityTypes(entityTypes) + .build()) + .build(); + } + + private List getEntityTypes(List entities){ + List mappedEntityTypes = null; + if (entities != null) { + mappedEntityTypes = entities.stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList()); + } + + return mappedEntityTypes; + } + + 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(); + + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + if (tokenFormat != null) { + + if (tokenFormat.getEntityOnly() != null && !tokenFormat.getEntityOnly().isEmpty()) { + entityTypes = Optional.of(tokenFormat.getEntityOnly().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + + if (tokenFormat.getEntityUniqueCounter() != null && !tokenFormat.getEntityUniqueCounter().isEmpty()) { + entityUniqueCounter = Optional.of(tokenFormat.getEntityUniqueCounter().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + } + + TokenTypeWithoutVault tokenType = TokenTypeWithoutVault.builder() + .entityOnly(entityTypes) + .entityUnqCounter(entityUniqueCounter) + .build(); + + DeidentifyTextRequestFile file = DeidentifyTextRequestFile.builder() + .base64(base64Content) + .build(); + + // Build the final request + com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest req = + com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest.builder() + .vaultId(vaultId) + .file(file) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + + return req; + } + + + protected DeidentifyAudioRequest getDeidentifyAudioRequest(DeidentifyFileRequest request, String vaultId, String base64Content, String dataFormat) throws SkyflowException { + List mappedEntityTypes = getEntityTypes(request.getEntities()); + + TokenFormat tokenFormat = request.getTokenFormat(); + + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + if (tokenFormat != null) { + + if (tokenFormat.getEntityOnly() != null && !tokenFormat.getEntityOnly().isEmpty()) { + entityTypes = Optional.of(tokenFormat.getEntityOnly().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + + if (tokenFormat.getEntityUniqueCounter() != null && !tokenFormat.getEntityUniqueCounter().isEmpty()) { + entityUniqueCounter = Optional.of(tokenFormat.getEntityUniqueCounter().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + } + + TokenTypeWithoutVault tokenType = TokenTypeWithoutVault.builder() + .entityOnly(entityTypes) + .entityUnqCounter(entityUniqueCounter) + .build(); + + DeidentifyAudioRequestFile deidentifyAudioRequestFile = DeidentifyAudioRequestFile.builder().base64(base64Content).dataFormat(mapAudioDataFormat(dataFormat)).build(); + DetectOutputTranscriptions transcription = request.getOutputTranscription(); + DeidentifyAudioRequestOutputTranscription outputTranscriptionType = null; + if (transcription != null) { + outputTranscriptionType = DeidentifyAudioRequestOutputTranscription.valueOf(transcription.name()); + } + + return DeidentifyAudioRequest.builder() + .vaultId(vaultId) + .file(deidentifyAudioRequestFile) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .entityTypes(mappedEntityTypes) + .bleepFrequency(request.getBleep() != null ? request.getBleep().getFrequency() : null) + .bleepGain(request.getBleep() != null ? request.getBleep().getGain() : null) + .bleepStartPadding(request.getBleep() != null ? request.getBleep().getStartPadding() : null) + .bleepStopPadding(request.getBleep() != null ? request.getBleep().getStopPadding() : null) + .outputProcessedAudio(request.getOutputProcessedAudio()) + .outputTranscription(outputTranscriptionType) + .tokenType(tokenType) + .transformations(transformations) + .build(); + } + + protected DeidentifyPdfRequest getDeidentifyPdfRequest(DeidentifyFileRequest request, String vaultId, String base64Content) { + List mappedEntityTypes = getEntityTypes(request.getEntities()); + + TokenFormat tokenFormat = request.getTokenFormat(); + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + if (tokenFormat != null) { + if (tokenFormat.getEntityOnly() != null && !tokenFormat.getEntityOnly().isEmpty()) { + entityTypes = Optional.of(tokenFormat.getEntityOnly().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + + if (tokenFormat.getEntityUniqueCounter() != null && !tokenFormat.getEntityUniqueCounter().isEmpty()) { + entityUniqueCounter = Optional.of(tokenFormat.getEntityUniqueCounter().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + } + + TokenTypeWithoutVault tokenType = TokenTypeWithoutVault.builder() + .entityOnly(entityTypes) + .entityUnqCounter(entityUniqueCounter) + .build(); + + DeidentifyPdfRequestFile file = DeidentifyPdfRequestFile.builder() + .base64(base64Content) + .build(); + + return DeidentifyPdfRequest.builder() + .vaultId(vaultId) + .file(file) + .density(request.getPixelDensity() != null ? request.getPixelDensity().intValue() : null) + .maxResolution(request.getMaxResolution() != null ? request.getMaxResolution().intValue() : null) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + } + + protected DeidentifyImageRequest getDeidentifyImageRequest(DeidentifyFileRequest request, String vaultId, String base64Content, String format) { + List mappedEntityTypes = getEntityTypes(request.getEntities()); + + TokenFormat tokenFormat = request.getTokenFormat(); + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter); + + DeidentifyImageRequestFile file = DeidentifyImageRequestFile.builder() + .base64(base64Content) + .dataFormat(DeidentifyImageRequestFileDataFormat.valueOf(format.toUpperCase())) + .build(); + + Optional maskingMethod = Optional.empty(); + if (request.getMaskingMethod() != null) { + maskingMethod = Optional.of(DeidentifyImageRequestMaskingMethod.valueOf(request.getMaskingMethod().name())); + } + + return DeidentifyImageRequest.builder() + .vaultId(vaultId) + .file(file) + .entityTypes(mappedEntityTypes) + .maskingMethod(maskingMethod) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .outputProcessedImage(request.getOutputProcessedImage()) + .outputOcrText(request.getOutputOcrText()) + .build(); + } + + protected DeidentifyPresentationRequest getDeidentifyPresentationRequest(DeidentifyFileRequest request, String vaultId, String base64Content, String format) { + List mappedEntityTypes = getEntityTypes(request.getEntities()); + TokenFormat tokenFormat = request.getTokenFormat(); + + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter); + + DeidentifyPresentationRequestFile file = DeidentifyPresentationRequestFile.builder() + .base64(base64Content) + .dataFormat(DeidentifyPresentationRequestFileDataFormat.valueOf(format.toUpperCase())) + .build(); + + return DeidentifyPresentationRequest.builder() + .vaultId(vaultId) + .file(file) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + } + + protected DeidentifySpreadsheetRequest getDeidentifySpreadsheetRequest(DeidentifyFileRequest request, String vaultId, String base64Content, String format) { + List mappedEntityTypes = getEntityTypes(request.getEntities()); + TokenFormat tokenFormat = request.getTokenFormat(); + + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter); + + DeidentifySpreadsheetRequestFile file = DeidentifySpreadsheetRequestFile.builder() + .base64(base64Content) + .dataFormat(DeidentifySpreadsheetRequestFileDataFormat.valueOf(format.toUpperCase())) + .build(); + + return DeidentifySpreadsheetRequest.builder() + .vaultId(vaultId) + .file(file) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + } + + protected DeidentifyStructuredTextRequest getDeidentifyStructuredTextRequest(DeidentifyFileRequest request, String vaultId, String base64Content, String format) { + List mappedEntityTypes = getEntityTypes(request.getEntities()); + TokenFormat tokenFormat = request.getTokenFormat(); + + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter); + + DeidentifyStructuredTextRequestFile file = DeidentifyStructuredTextRequestFile.builder() + .base64(base64Content) + .dataFormat(DeidentifyStructuredTextRequestFileDataFormat.valueOf(format.toUpperCase())) + .build(); + + return DeidentifyStructuredTextRequest.builder() + .vaultId(vaultId) + .file(file) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + } + + protected DeidentifyDocumentRequest getDeidentifyDocumentRequest(DeidentifyFileRequest request, String vaultId, String base64Content, String format) { + List mappedEntityTypes = getEntityTypes(request.getEntities()); + TokenFormat tokenFormat = request.getTokenFormat(); + + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter); + + DeidentifyDocumentRequestFile file = DeidentifyDocumentRequestFile.builder() + .base64(base64Content) + .dataFormat(DeidentifyDocumentRequestFileDataFormat.valueOf(format.toUpperCase())) + .build(); + + return DeidentifyDocumentRequest.builder() + .vaultId(vaultId) + .file(file) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + } + + protected com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest getDeidentifyGenericFileRequest( + DeidentifyFileRequest request, String vaultId, String base64Content, String fileExtension) { + + List mappedEntityTypes = getEntityTypes(request.getEntities()); + + TokenFormat tokenFormat = request.getTokenFormat(); + + Optional> entityTypes = Optional.empty(); + Optional> entityUniqueCounter = Optional.empty(); + Optional> allowRegex = Optional.ofNullable(request.getAllowRegexList()); + Optional> restrictRegex = Optional.ofNullable(request.getRestrictRegexList()); + Optional transformations = Optional.ofNullable(getTransformations(request.getTransformations())); + + if (tokenFormat != null) { + if (tokenFormat.getEntityOnly() != null && !tokenFormat.getEntityOnly().isEmpty()) { + entityTypes = Optional.of(tokenFormat.getEntityOnly().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + + if (tokenFormat.getEntityUniqueCounter() != null && !tokenFormat.getEntityUniqueCounter().isEmpty()) { + entityUniqueCounter = Optional.of(tokenFormat.getEntityUniqueCounter().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + } + + TokenTypeWithoutVault tokenType = TokenTypeWithoutVault.builder() + .entityOnly(entityTypes) + .entityUnqCounter(entityUniqueCounter) + .build(); + + DeidentifyFileRequestFile file = + DeidentifyFileRequestFile.builder() + .base64(base64Content) + .dataFormat(fileExtension != null ? DeidentifyFileRequestFileDataFormat.valueOf(fileExtension.toUpperCase()) : null) + .build(); + + return com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest.builder() + .vaultId(vaultId) + .file(file) + .entityTypes(mappedEntityTypes) + .tokenType(tokenType) + .allowRegex(allowRegex) + .restrictRegex(restrictRegex) + .transformations(transformations) + .build(); + } + + private TokenTypeWithoutVault buildTokenType(TokenFormat tokenFormat, + Optional> entityTypes, + Optional> entityUniqueCounter) { + + if (tokenFormat != null) { + if (tokenFormat.getEntityOnly() != null && !tokenFormat.getEntityOnly().isEmpty()) { + entityTypes = Optional.of(tokenFormat.getEntityOnly().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + + if (tokenFormat.getEntityUniqueCounter() != null && !tokenFormat.getEntityUniqueCounter().isEmpty()) { + entityUniqueCounter = Optional.of(tokenFormat.getEntityUniqueCounter().stream() + .map(detectEntity -> EntityType.valueOf(detectEntity.name())) + .collect(Collectors.toList())); + } + } + + return TokenTypeWithoutVault.builder() + .entityOnly(entityTypes) + .entityUnqCounter(entityUniqueCounter) + .build(); + } + + private DeidentifyAudioRequestFileDataFormat mapAudioDataFormat(String dataFormat) throws SkyflowException { + switch (dataFormat) { + case "mp3": + return DeidentifyAudioRequestFileDataFormat.MP_3; + case "wav": + return DeidentifyAudioRequestFileDataFormat.WAV; + default: + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidAudioFileType.getMessage()); } - HttpBearerAuth Bearer = (HttpBearerAuth) this.apiClient.getAuthentication("Bearer"); - Bearer.setBearerToken(apiKey); } private void updateVaultURL() { String vaultURL = Utils.getVaultURL(this.vaultConfig.getClusterId(), this.vaultConfig.getEnv()); - this.apiClient.setBasePath(vaultURL); + this.apiClientBuilder.url(vaultURL); } private void prioritiseCredentials() throws SkyflowException { diff --git a/src/main/java/com/skyflow/enums/DeidentifyFileStatus.java b/src/main/java/com/skyflow/enums/DeidentifyFileStatus.java new file mode 100644 index 00000000..e17c6d0c --- /dev/null +++ b/src/main/java/com/skyflow/enums/DeidentifyFileStatus.java @@ -0,0 +1,16 @@ +package com.skyflow.enums; + +public enum DeidentifyFileStatus { + IN_PROGRESS("IN_PROGRESS"), + SUCCESS("SUCCESS"); + + private final String value; + + DeidentifyFileStatus(String value) { + this.value = value; + } + + public String value() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/enums/DetectEntities.java b/src/main/java/com/skyflow/enums/DetectEntities.java new file mode 100644 index 00000000..f2c21eff --- /dev/null +++ b/src/main/java/com/skyflow/enums/DetectEntities.java @@ -0,0 +1,83 @@ +package com.skyflow.enums; + + +public enum DetectEntities { + ACCOUNT_NUMBER("account_number"), + AGE("age"), + ALL("all"), + BANK_ACCOUNT("bank_account"), + BLOOD_TYPE("blood_type"), + CONDITION("condition"), + CORPORATE_ACTION("corporate_action"), + CREDIT_CARD("credit_card"), + CREDIT_CARD_EXPIRATION("credit_card_expiration"), + CVV("cvv"), + DATE("date"), + DATE_INTERVAL("date_interval"), + DOB("dob"), + DOSE("dose"), + DRIVER_LICENSE("driver_license"), + DRUG("drug"), + DURATION("duration"), + EMAIL_ADDRESS("email_address"), + EVENT("event"), + FILENAME("filename"), + FINANCIAL_METRIC("financial_metric"), + GENDER_SEXUALITY("gender_sexuality"), + HEALTHCARE_NUMBER("healthcare_number"), + INJURY("injury"), + IP_ADDRESS("ip_address"), + LANGUAGE("language"), + LOCATION("location"), + LOCATION_ADDRESS("location_address"), + LOCATION_ADDRESS_STREET("location_address_street"), + LOCATION_CITY("location_city"), + LOCATION_COORDINATE("location_coordinate"), + LOCATION_COUNTRY("location_country"), + LOCATION_STATE("location_state"), + LOCATION_ZIP("location_zip"), + MARITAL_STATUS("marital_status"), + MEDICAL_CODE("medical_code"), + MEDICAL_PROCESS("medical_process"), + MONEY("money"), + NAME("name"), + NAME_FAMILY("name_family"), + NAME_GIVEN("name_given"), + NAME_MEDICAL_PROFESSIONAL("name_medical_professional"), + NUMERICAL_PII("numerical_pii"), + OCCUPATION("occupation"), + ORGANIZATION("organization"), + ORGANIZATION_MEDICAL_FACILITY("organization_medical_facility"), + ORIGIN("origin"), + PASSPORT_NUMBER("passport_number"), + PASSWORD("password"), + PHONE_NUMBER("phone_number"), + PHYSICAL_ATTRIBUTE("physical_attribute"), + POLITICAL_AFFILIATION("political_affiliation"), + PRODUCT("product"), + RELIGION("religion"), + ROUTING_NUMBER("routing_number"), + SSN("ssn"), + STATISTICS("statistics"), + TIME("time"), + TREND("trend"), + URL("url"), + USERNAME("username"), + VEHICLE_ID("vehicle_id"), + ZODIAC_SIGN("zodiac_sign"); + + private final String detectEntities; + + DetectEntities(String detectEntities) { + this.detectEntities = detectEntities; + } + + public String getDetectEntities() { + return detectEntities; + } + + @Override + public String toString() { + return detectEntities; + } +} diff --git a/src/main/java/com/skyflow/enums/DetectOutputTranscriptions.java b/src/main/java/com/skyflow/enums/DetectOutputTranscriptions.java new file mode 100644 index 00000000..43251c61 --- /dev/null +++ b/src/main/java/com/skyflow/enums/DetectOutputTranscriptions.java @@ -0,0 +1,24 @@ +package com.skyflow.enums; + +public enum DetectOutputTranscriptions { + DIARIZED_TRANSCRIPTION("diarized_transcription"), + MEDICAL_DIARIZED_TRANSCRIPTION("medical_diarized_transcription"), + MEDICAL_TRANSCRIPTION("medical_transcription"), + PLAINTEXT_TRANSCRIPTION("plaintext_transcription"), + TRANSCRIPTION("transcription"); + + private final String detectOutputTranscriptions; + + DetectOutputTranscriptions(String detectOutputTranscriptions) { + this.detectOutputTranscriptions = detectOutputTranscriptions; + } + + public String getDetectOutputTranscriptions() { + return detectOutputTranscriptions; + } + + @Override + public String toString() { + return detectOutputTranscriptions; + } +} diff --git a/src/main/java/com/skyflow/enums/InterfaceName.java b/src/main/java/com/skyflow/enums/InterfaceName.java index 643bf9da..98992f21 100644 --- a/src/main/java/com/skyflow/enums/InterfaceName.java +++ b/src/main/java/com/skyflow/enums/InterfaceName.java @@ -9,6 +9,7 @@ public enum InterfaceName { QUERY("query"), TOKENIZE("tokenize"), FILE_UPLOAD("file upload"), + DETECT("detect"), INVOKE_CONNECTION("invoke connection"); private final String interfaceName; diff --git a/src/main/java/com/skyflow/enums/MaskingMethod.java b/src/main/java/com/skyflow/enums/MaskingMethod.java new file mode 100644 index 00000000..e3ff252c --- /dev/null +++ b/src/main/java/com/skyflow/enums/MaskingMethod.java @@ -0,0 +1,21 @@ +package com.skyflow.enums; + +public enum MaskingMethod { + BLACKBOX("blackbox"), + BLUR("blur"); + + private final String maskingMethod; + + MaskingMethod(String maskingMethod) { + this.maskingMethod = maskingMethod; + } + + public String getMaskingMethod() { + return maskingMethod; + } + + @Override + public String toString() { + return maskingMethod; + } +} diff --git a/src/main/java/com/skyflow/enums/RedactionType.java b/src/main/java/com/skyflow/enums/RedactionType.java index af86a560..9c76cc7d 100644 --- a/src/main/java/com/skyflow/enums/RedactionType.java +++ b/src/main/java/com/skyflow/enums/RedactionType.java @@ -1,20 +1,21 @@ package com.skyflow.enums; -import com.skyflow.generated.rest.models.RedactionEnumREDACTION; + +import com.skyflow.generated.rest.types.RedactionEnumRedaction; public enum RedactionType { - PLAIN_TEXT(RedactionEnumREDACTION.PLAIN_TEXT), - MASKED(RedactionEnumREDACTION.MASKED), - DEFAULT(RedactionEnumREDACTION.DEFAULT), - REDACTED(RedactionEnumREDACTION.REDACTED); + PLAIN_TEXT(RedactionEnumRedaction.PLAIN_TEXT), + MASKED(RedactionEnumRedaction.MASKED), + DEFAULT(RedactionEnumRedaction.DEFAULT), + REDACTED(RedactionEnumRedaction.REDACTED); - private final RedactionEnumREDACTION redaction; + private final RedactionEnumRedaction redaction; - RedactionType(RedactionEnumREDACTION redaction) { + RedactionType(RedactionEnumRedaction redaction) { this.redaction = redaction; } - public RedactionEnumREDACTION getRedaction() { + public RedactionEnumRedaction getRedaction() { return redaction; } diff --git a/src/main/java/com/skyflow/enums/TokenMode.java b/src/main/java/com/skyflow/enums/TokenMode.java index 28564bb5..63e9b8a9 100644 --- a/src/main/java/com/skyflow/enums/TokenMode.java +++ b/src/main/java/com/skyflow/enums/TokenMode.java @@ -1,24 +1,24 @@ package com.skyflow.enums; -import com.skyflow.generated.rest.models.V1BYOT; +import com.skyflow.generated.rest.types.V1Byot; public enum TokenMode { - DISABLE(V1BYOT.DISABLE), - ENABLE(V1BYOT.ENABLE), - ENABLE_STRICT(V1BYOT.ENABLE_STRICT); + DISABLE(V1Byot.DISABLE), + ENABLE(V1Byot.ENABLE), + ENABLE_STRICT(V1Byot.ENABLE_STRICT); - private final V1BYOT byot; + private final V1Byot byot; - TokenMode(V1BYOT byot) { + TokenMode(V1Byot byot) { this.byot = byot; } - public V1BYOT getBYOT() { + public V1Byot getBYOT() { return byot; } @Override public String toString() { - return String.valueOf(byot); + return byot.toString(); } } diff --git a/src/main/java/com/skyflow/enums/TokenType.java b/src/main/java/com/skyflow/enums/TokenType.java new file mode 100644 index 00000000..4a619e9c --- /dev/null +++ b/src/main/java/com/skyflow/enums/TokenType.java @@ -0,0 +1,27 @@ +package com.skyflow.enums; + +public enum TokenType { + VAULT_TOKEN("vault_token"), + ENTITY_UNIQUE_COUNTER("entity_unq_counter"), + ENTITY_ONLY("entity_only"); + + private final String tokenType; + + TokenType(String tokenType) { + this.tokenType = tokenType; + } + + public String getTokenType() { + return tokenType; + } + + public String getDefault() { + return ENTITY_UNIQUE_COUNTER.getTokenType(); + } + + @Override + public String toString() { + return tokenType; + } +} + diff --git a/src/main/java/com/skyflow/errors/ErrorMessage.java b/src/main/java/com/skyflow/errors/ErrorMessage.java index 33833443..df075bca 100644 --- a/src/main/java/com/skyflow/errors/ErrorMessage.java +++ b/src/main/java/com/skyflow/errors/ErrorMessage.java @@ -124,6 +124,29 @@ public enum ErrorMessage { InvalidRequestBody("%s0 Validation error. Invalid request body. Specify the request body as an object."), EmptyRequestBody("%s0 Validation error. Request body can't be empty. Specify a valid request body."), + // detect + InvalidTextInDeIdentify("%s0 Validation error. The text field is required and must be a non-empty string. Specify a valid text."), + InvalidTextInReIdentify("%s0 Validation error. The text field is required and must be a non-empty string. Specify a valid text."), + + //Detect Files + InvalidNullFileInDeIdentifyFile("%s0 Validation error. The file field is required and must not be null. Specify a valid file object."), + InvalidFilePath("%s0 Validation error. The file path is invalid. Specify a valid file path."), + BothFileAndFilePathProvided("%s0 Validation error. Both file and filePath are provided. Specify either file object or filePath, not both."), + FileNotFoundToDeidentify("%s0 Validation error. The file to deidentify was not found at the specified path. Verify the file path and try again."), + FileNotReadableToDeidentify("%s0 Validation error. The file to deidentify is not readable. Check the file permissions and try again."), + InvalidPixelDensityToDeidentifyFile("%s0 Validation error. Should be a positive integer. Specify a valid pixel density."), + InvalidMaxResolution("%s0 Validation error. Should be a positive integer. Specify a valid max resolution."), + OutputDirectoryNotFound("%s0 Validation error. The output directory for deidentified files was not found at the specified path. Verify the output directory path and try again."), + InvalidPermission("%s0 Validation error. The output directory for deidentified files is not writable. Check the directory permissions and try again."), + InvalidWaitTime("%s0 Validation error. The wait time for deidentify file operation should be a positive integer. Specify a valid wait time."), + WaitTimeExceedsLimit("%s0 Validation error. The wait time for deidentify file operation exceeds the maximum limit of 64 seconds. Specify a wait time less than or equal to 60 seconds."), + InvalidOrEmptyRunId("%s0 Validation error. The run ID is invalid or empty. Specify a valid run ID."), + FailedToEncodeFile("%s0 Validation error. Failed to encode the file. Ensure the file is in a supported format and try again."), + 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."), + 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.") ; diff --git a/src/main/java/com/skyflow/generated/rest/ApiCallback.java b/src/main/java/com/skyflow/generated/rest/ApiCallback.java deleted file mode 100644 index 84a241d3..00000000 --- a/src/main/java/com/skyflow/generated/rest/ApiCallback.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.

  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import java.io.IOException; - -import java.util.Map; -import java.util.List; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/src/main/java/com/skyflow/generated/rest/ApiClient.java b/src/main/java/com/skyflow/generated/rest/ApiClient.java index bb0391a4..296a553f 100644 --- a/src/main/java/com/skyflow/generated/rest/ApiClient.java +++ b/src/main/java/com/skyflow/generated/rest/ApiClient.java @@ -1,1615 +1,92 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. +/** + * This file was auto-generated by Fern from our API Definition. */ - - package com.skyflow.generated.rest; -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; -import okhttp3.internal.tls.OkHostnameVerifier; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okio.Buffer; -import okio.BufferedSink; -import okio.Okio; - -import javax.net.ssl.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.URI; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.SecureRandom; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.text.DateFormat; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.Suppliers; +import com.skyflow.generated.rest.resources.audit.AuditClient; +import com.skyflow.generated.rest.resources.authentication.AuthenticationClient; +import com.skyflow.generated.rest.resources.binlookup.BinLookupClient; +import com.skyflow.generated.rest.resources.deprecated.DeprecatedClient; +import com.skyflow.generated.rest.resources.files.FilesClient; +import com.skyflow.generated.rest.resources.query.QueryClient; +import com.skyflow.generated.rest.resources.records.RecordsClient; +import com.skyflow.generated.rest.resources.strings.StringsClient; +import com.skyflow.generated.rest.resources.tokens.TokensClient; import java.util.function.Supplier; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import com.skyflow.generated.rest.auth.Authentication; -import com.skyflow.generated.rest.auth.HttpBasicAuth; -import com.skyflow.generated.rest.auth.HttpBearerAuth; -import com.skyflow.generated.rest.auth.ApiKeyAuth; - -/** - *

ApiClient class.

- */ public class ApiClient { + protected final ClientOptions clientOptions; - private String basePath = "https://identifier.vault.skyflowapis.com"; - protected List servers = new ArrayList(Arrays.asList( - new ServerConfiguration( - "https://identifier.vault.skyflowapis.com", - "Production", - new HashMap() - ), - new ServerConfiguration( - "https://identifier.vault.skyflowapis-preview.com", - "Sandbox", - new HashMap() - ) - )); - protected Integer serverIndex = 0; - protected Map serverVariables = null; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private Map defaultCookieMap = new HashMap(); - private String tempFolderPath = null; - - private Map authentications; - - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; - - private InputStream sslCaCert; - private boolean verifyingSsl; - private KeyManager[] keyManagers; - - private OkHttpClient httpClient; - private JSON json; - - private HttpLoggingInterceptor loggingInterceptor; - - /** - * Basic constructor for ApiClient - */ - public ApiClient() { - init(); - initHttpClient(); - - // Setup authentications (key: authentication name, value: authentication). - authentications.put("Bearer", new HttpBearerAuth("bearer")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /** - * Basic constructor with custom OkHttpClient - * - * @param client a {@link okhttp3.OkHttpClient} object - */ - public ApiClient(OkHttpClient client) { - init(); - - httpClient = client; - - // Setup authentications (key: authentication name, value: authentication). - authentications.put("Bearer", new HttpBearerAuth("bearer")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - private void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - private void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor: interceptors) { - builder.addInterceptor(interceptor); - } - - httpClient = builder.build(); - } - - private void init() { - verifyingSsl = true; - - json = new JSON(); - - // Set default User-Agent. - setUserAgent("OpenAPI-Generator/v1/java"); - - authentications = new HashMap(); - } - - /** - * Get base path - * - * @return Base path - */ - public String getBasePath() { - return basePath; - } - - /** - * Set base path - * - * @param basePath Base path of the URL (e.g https://identifier.vault.skyflowapis.com - * @return An instance of OkHttpClient - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - this.serverIndex = null; - return this; - } - - public List getServers() { - return servers; - } - - public ApiClient setServers(List servers) { - this.servers = servers; - return this; - } - - public Integer getServerIndex() { - return serverIndex; - } - - public ApiClient setServerIndex(Integer serverIndex) { - this.serverIndex = serverIndex; - return this; - } - - public Map getServerVariables() { - return serverVariables; - } - - public ApiClient setServerVariables(Map serverVariables) { - this.serverVariables = serverVariables; - return this; - } - - /** - * Get HTTP client - * - * @return An instance of OkHttpClient - */ - public OkHttpClient getHttpClient() { - return httpClient; - } - - /** - * Set HTTP client, which must never be null. - * - * @param newHttpClient An instance of OkHttpClient - * @return Api Client - * @throws java.lang.NullPointerException when newHttpClient is null - */ - public ApiClient setHttpClient(OkHttpClient newHttpClient) { - this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); - return this; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - /** - * True if isVerifyingSsl flag is on - * - * @return True if isVerifySsl flag is on - */ - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - * - * @param verifyingSsl True to verify TLS/SSL connection - * @return ApiClient - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - /** - * Get SSL CA cert. - * - * @return Input stream to the SSL CA cert - */ - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - * - * @param sslCaCert input stream for SSL CA cert - * @return ApiClient - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - /** - *

Getter for the field keyManagers.

- * - * @return an array of {@link javax.net.ssl.KeyManager} objects - */ - public KeyManager[] getKeyManagers() { - return keyManagers; - } - - /** - * Configure client keys to use for authorization in an SSL session. - * Use null to reset to default. - * - * @param managers The KeyManagers to use - * @return ApiClient - */ - public ApiClient setKeyManagers(KeyManager[] managers) { - this.keyManagers = managers; - applySslSettings(); - return this; - } - - /** - *

Getter for the field dateFormat.

- * - * @return a {@link java.text.DateFormat} object - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - *

Setter for the field dateFormat.

- * - * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link com.skyflow.generated.rest.ApiClient} object - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - JSON.setDateFormat(dateFormat); - return this; - } - - /** - *

Set SqlDateFormat.

- * - * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link com.skyflow.generated.rest.ApiClient} object - */ - public ApiClient setSqlDateFormat(DateFormat dateFormat) { - JSON.setSqlDateFormat(dateFormat); - return this; - } - - /** - *

Set OffsetDateTimeFormat.

- * - * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link com.skyflow.generated.rest.ApiClient} object - */ - public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - JSON.setOffsetDateTimeFormat(dateFormat); - return this; - } - - /** - *

Set LocalDateFormat.

- * - * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link com.skyflow.generated.rest.ApiClient} object - */ - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - JSON.setLocalDateFormat(dateFormat); - return this; - } - - /** - *

Set LenientOnJson.

- * - * @param lenientOnJson a boolean - * @return a {@link com.skyflow.generated.rest.ApiClient} object - */ - public ApiClient setLenientOnJson(boolean lenientOnJson) { - JSON.setLenientOnJson(lenientOnJson); - return this; - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set access token for the first Bearer authentication. - * @param bearerToken Bearer token - */ - public void setBearerToken(String bearerToken) { - setBearerToken(() -> bearerToken); - } - - /** - * Helper method to set the supplier of access tokens for Bearer authentication. - * - * @param tokenSupplier The supplier of bearer tokens - */ - public void setBearerToken(Supplier tokenSupplier) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); - return; - } - } - throw new RuntimeException("No Bearer authentication configured!"); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - * - * @param username Username - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - * - * @param password Password - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - * - * @param accessToken Access token - */ - public void setAccessToken(String accessToken) { - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set credentials for AWSV4 Signature - * - * @param accessKey Access Key - * @param secretKey Secret Key - * @param region Region - * @param service Service to access to - */ - public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { - throw new RuntimeException("No AWS4 authentication configured!"); - } - - /** - * Helper method to set credentials for AWSV4 Signature - * - * @param accessKey Access Key - * @param secretKey Secret Key - * @param sessionToken Session Token - * @param region Region - * @param service Service to access to - */ - public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { - throw new RuntimeException("No AWS4 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return ApiClient - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } + protected final Supplier auditClient; - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); - } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } + protected final Supplier binLookupClient; - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } + protected final Supplier recordsClient; - /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } + protected final Supplier tokensClient; - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); - } + protected final Supplier queryClient; - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link java.lang.Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } + protected final Supplier authenticationClient; - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); - } + protected final Supplier deprecatedClient; - /** - * Sets the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link java.lang.Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - * @return Api client - */ - public ApiClient setReadTimeout(int readTimeout) { - httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } + protected final Supplier stringsClient; - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); - } + protected final Supplier filesClient; - /** - * Sets the write timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link java.lang.Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); - return this; + public ApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.auditClient = Suppliers.memoize(() -> new AuditClient(clientOptions)); + this.binLookupClient = Suppliers.memoize(() -> new BinLookupClient(clientOptions)); + this.recordsClient = Suppliers.memoize(() -> new RecordsClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); + this.queryClient = Suppliers.memoize(() -> new QueryClient(clientOptions)); + this.authenticationClient = Suppliers.memoize(() -> new AuthenticationClient(clientOptions)); + this.deprecatedClient = Suppliers.memoize(() -> new DeprecatedClient(clientOptions)); + this.stringsClient = Suppliers.memoize(() -> new StringsClient(clientOptions)); + this.filesClient = Suppliers.memoize(() -> new FilesClient(clientOptions)); } - - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { - //Serialize to json string and remove the " enclosing characters - String jsonStr = JSON.serialize(param); - return jsonStr.substring(1, jsonStr.length() - 1); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { - b.append(","); - } - b.append(o); - } - return b.toString(); - } else { - return String.valueOf(param); - } + public AuditClient audit() { + return this.auditClient.get(); } - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - * Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; + public BinLookupClient binLookup() { + return this.binLookupClient.get(); } - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - * Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Collection value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; + public RecordsClient records() { + return this.recordsClient.get(); } - /** - * Formats the specified free-form query parameters to a list of {@code Pair} objects. - * - * @param value The free-form query parameters. - * @return A list of {@code Pair} objects. - */ - public List freeFormParameterToPairs(Object value) { - List params = new ArrayList<>(); - - // preconditions - if (value == null || !(value instanceof Map )) { - return params; - } - - final Map valuesMap = (Map) value; - - for (Map.Entry entry : valuesMap.entrySet()) { - params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); - } - - return params; + public TokensClient tokens() { + return this.tokensClient.get(); } - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString(String collectionFormat, Collection value) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * returns null. If it matches "any", JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return null; - } - - if (contentTypes[0].equals("*/*")) { - return "application/json"; - } - - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - - return contentTypes[0]; + public QueryClient query() { + return this.queryClient.get(); } - /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } + public AuthenticationClient authentication() { + return this.authenticationClient.get(); } - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws com.skyflow.generated.rest.ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); - } - - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code(), - response.headers().toMultimap(), - respBody); - } + public DeprecatedClient deprecated() { + return this.deprecatedClient.get(); } - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws com.skyflow.generated.rest.ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create((File) obj, MediaType.parse(contentType)); - } else if ("text/plain".equals(contentType) && obj instanceof String) { - return RequestBody.create((String) obj, MediaType.parse(contentType)); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = JSON.serialize(obj); - } else { - content = null; - } - return RequestBody.create(content, MediaType.parse(contentType)); - } else if (obj instanceof String) { - return RequestBody.create((String) obj, MediaType.parse(contentType)); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } + public StringsClient strings() { + return this.stringsClient.get(); } - /** - * Download file from the given response. - * - * @param response An instance of the Response object - * @throws com.skyflow.generated.rest.ApiException If fail to read file content from response and write to disk - * @return Downloaded file - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } + public FilesClient files() { + return this.filesClient.get(); } - /** - * Prepare file for download - * - * @param response An instance of the Response object - * @return Prepared file for the download - * @throws java.io.IOException If fail to prepare file for download - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } - } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; - } - - if (tempFolderPath == null) - return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws com.skyflow.generated.rest.ApiException If fail to execute the call - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws com.skyflow.generated.rest.ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - - /** - * Execute HTTP call asynchronously. - * - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - * @see #execute(Call, Type) - */ - @SuppressWarnings("unchecked") - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - - @Override - public void onResponse(Call call, Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } catch (Exception e) { - callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); - return; - } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws com.skyflow.generated.rest.ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - - /** - * Build HTTP call with the given options. - * - * @param baseUrl The base URL - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP call - * @throws com.skyflow.generated.rest.ApiException If fail to serialize the request body object - */ - public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); - - return httpClient.newCall(request); - } - - /** - * Build an HTTP request with the given options. - * - * @param baseUrl The base URL - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP request - * @throws com.skyflow.generated.rest.ApiException If fail to serialize the request body object - */ - public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); - - // prepare HTTP request body - RequestBody reqBody; - String contentType = headerParams.get("Content-Type"); - String contentTypePure = contentType; - if (contentTypePure != null && contentTypePure.contains(";")) { - contentTypePure = contentType.substring(0, contentType.indexOf(";")); - } - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentTypePure)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); - } - } else { - reqBody = serialize(body, contentType); - } - - List updatedQueryParams = new ArrayList<>(queryParams); - - // update parameters with authentication settings - updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - - final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); - processHeaderParams(headerParams, reqBuilder); - processCookieParams(cookieParams, reqBuilder); - - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param baseUrl The base URL - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @return The full URL - */ - public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { - final StringBuilder url = new StringBuilder(); - if (baseUrl != null) { - url.append(baseUrl).append(path); - } else { - String baseURL; - if (serverIndex != null) { - if (serverIndex < 0 || serverIndex >= servers.size()) { - throw new ArrayIndexOutOfBoundsException(String.format( - "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() - )); - } - baseURL = servers.get(serverIndex).URL(serverVariables); - } else { - baseURL = basePath; - } - url.append(baseURL).append(path); - } - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); - } - } - } - - if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { - String prefix = url.toString().contains("?") ? "&" : "?"; - for (Pair param : collectionQueryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Set cookie parameters to the request builder, including default cookies. - * - * @param cookieParams Cookie parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { - for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - for (Entry param : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(param.getKey())) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - * @param payload HTTP request body - * @param method HTTP method - * @param uri URI - * @throws com.skyflow.generated.rest.ApiException If fails to update the parameters - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, - Map cookieParams, String payload, String method, URI uri) throws ApiException { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); - } else if (param.getValue() instanceof List) { - List list = (List) param.getValue(); - for (Object item: list) { - if (item instanceof File) { - addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); - } else { - addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); - } - } - } else { - addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. - * - * @param mpBuilder MultipartBody.Builder - * @param key The key of the Header element - * @param file The file to add to the Header - */ - private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); - } - - /** - * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. - * - * @param mpBuilder MultipartBody.Builder - * @param key The key of the Header element - * @param obj The complex object to add to the Header - */ - private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { - RequestBody requestBody; - if (obj instanceof String) { - requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); - } else { - String content; - if (obj != null) { - content = JSON.serialize(obj); - } else { - content = null; - } - requestBody = RequestBody.create(content, MediaType.parse("application/json")); - } - - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); - mpBuilder.addPart(partHeaders, requestBody); - } - - /** - * Get network interceptor to add it to the httpClient to track download progress for - * async requests. - */ - private Interceptor getProgressInterceptor() { - return new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - final Request request = chain.request(); - final Response originalResponse = chain.proceed(request); - if (request.tag() instanceof ApiCallback) { - final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); - } - return originalResponse; - } - }; - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - TrustManager[] trustManagers; - HostnameVerifier hostnameVerifier; - if (!verifyingSsl) { - trustManagers = new TrustManager[]{ - new X509TrustManager() { - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[]{}; - } - } - }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - } else { - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - - if (sslCaCert == null) { - trustManagerFactory.init((KeyStore) null); - } else { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); - } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + (index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); - } - trustManagerFactory.init(caKeyStore); - } - trustManagers = trustManagerFactory.getTrustManagers(); - hostnameVerifier = OkHostnameVerifier.INSTANCE; - } - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = httpClient.newBuilder() - .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) - .hostnameVerifier(hostnameVerifier) - .build(); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); - } - } - - /** - * Convert the HTTP request body to a string. - * - * @param requestBody The HTTP request object - * @return The string representation of the HTTP request body - * @throws com.skyflow.generated.rest.ApiException If fail to serialize the request body object into a string - */ - private String requestBodyToString(RequestBody requestBody) throws ApiException { - if (requestBody != null) { - try { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return buffer.readUtf8(); - } catch (final IOException e) { - throw new ApiException(e); - } - } - - // empty http request body - return ""; + public static ApiClientBuilder builder() { + return new ApiClientBuilder(); } } diff --git a/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java b/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java new file mode 100644 index 00000000..b361812a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/ApiClientBuilder.java @@ -0,0 +1,67 @@ +/** + * 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 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/src/main/java/com/skyflow/generated/rest/ApiException.java b/src/main/java/com/skyflow/generated/rest/ApiException.java deleted file mode 100644 index d10c995e..00000000 --- a/src/main/java/com/skyflow/generated/rest/ApiException.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import java.util.Map; -import java.util.List; - - -/** - *

ApiException class.

- */ -@SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class ApiException extends Exception { - private static final long serialVersionUID = 1L; - - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - /** - *

Constructor for ApiException.

- */ - public ApiException() {} - - /** - *

Constructor for ApiException.

- * - * @param throwable a {@link java.lang.Throwable} object - */ - public ApiException(Throwable throwable) { - super(throwable); - } - - /** - *

Constructor for ApiException.

- * - * @param message the error message - */ - public ApiException(String message) { - super(message); - } - - /** - *

Constructor for ApiException.

- * - * @param message the error message - * @param throwable a {@link java.lang.Throwable} object - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - *

Constructor for ApiException.

- * - * @param message the error message - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - /** - *

Constructor for ApiException.

- * - * @param message the error message - * @param throwable a {@link java.lang.Throwable} object - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - */ - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - /** - *

Constructor for ApiException.

- * - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ - public ApiException(int code, Map> responseHeaders, String responseBody) { - this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); - } - - /** - *

Constructor for ApiException.

- * - * @param code HTTP status code - * @param message a {@link java.lang.String} object - */ - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - /** - *

Constructor for ApiException.

- * - * @param code HTTP status code - * @param message the error message - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } - - /** - * Get the exception message including HTTP response data. - * - * @return The exception message - */ - public String getMessage() { - return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", - super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); - } -} diff --git a/src/main/java/com/skyflow/generated/rest/ApiResponse.java b/src/main/java/com/skyflow/generated/rest/ApiResponse.java deleted file mode 100644 index d3cdb698..00000000 --- a/src/main/java/com/skyflow/generated/rest/ApiResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import java.util.List; -import java.util.Map; - -/** - * API response returned by API call. - */ -public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; - - /** - *

Constructor for ApiResponse.

- * - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - *

Constructor for ApiResponse.

- * - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - /** - *

Get the status code.

- * - * @return the status code - */ - public int getStatusCode() { - return statusCode; - } - - /** - *

Get the headers.

- * - * @return a {@link java.util.Map} of headers - */ - public Map> getHeaders() { - return headers; - } - - /** - *

Get the data.

- * - * @return the data - */ - public T getData() { - return data; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java b/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java new file mode 100644 index 00000000..d36c8141 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/AsyncApiClient.java @@ -0,0 +1,92 @@ +/** + * 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.audit.AsyncAuditClient; +import com.skyflow.generated.rest.resources.authentication.AsyncAuthenticationClient; +import com.skyflow.generated.rest.resources.binlookup.AsyncBinLookupClient; +import com.skyflow.generated.rest.resources.deprecated.AsyncDeprecatedClient; +import com.skyflow.generated.rest.resources.files.AsyncFilesClient; +import com.skyflow.generated.rest.resources.query.AsyncQueryClient; +import com.skyflow.generated.rest.resources.records.AsyncRecordsClient; +import com.skyflow.generated.rest.resources.strings.AsyncStringsClient; +import com.skyflow.generated.rest.resources.tokens.AsyncTokensClient; +import java.util.function.Supplier; + +public class AsyncApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier auditClient; + + protected final Supplier binLookupClient; + + protected final Supplier recordsClient; + + protected final Supplier tokensClient; + + protected final Supplier queryClient; + + protected final Supplier authenticationClient; + + protected final Supplier deprecatedClient; + + protected final Supplier stringsClient; + + protected final Supplier filesClient; + + public AsyncApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.auditClient = Suppliers.memoize(() -> new AsyncAuditClient(clientOptions)); + this.binLookupClient = Suppliers.memoize(() -> new AsyncBinLookupClient(clientOptions)); + this.recordsClient = Suppliers.memoize(() -> new AsyncRecordsClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); + this.queryClient = Suppliers.memoize(() -> new AsyncQueryClient(clientOptions)); + this.authenticationClient = Suppliers.memoize(() -> new AsyncAuthenticationClient(clientOptions)); + this.deprecatedClient = Suppliers.memoize(() -> new AsyncDeprecatedClient(clientOptions)); + this.stringsClient = Suppliers.memoize(() -> new AsyncStringsClient(clientOptions)); + this.filesClient = Suppliers.memoize(() -> new AsyncFilesClient(clientOptions)); + } + + public AsyncAuditClient audit() { + return this.auditClient.get(); + } + + public AsyncBinLookupClient binLookup() { + return this.binLookupClient.get(); + } + + public AsyncRecordsClient records() { + return this.recordsClient.get(); + } + + public AsyncTokensClient tokens() { + return this.tokensClient.get(); + } + + public AsyncQueryClient query() { + return this.queryClient.get(); + } + + public AsyncAuthenticationClient authentication() { + return this.authenticationClient.get(); + } + + public AsyncDeprecatedClient deprecated() { + return this.deprecatedClient.get(); + } + + public AsyncStringsClient strings() { + return this.stringsClient.get(); + } + + public AsyncFilesClient files() { + return this.filesClient.get(); + } + + public static AsyncApiClientBuilder builder() { + return new AsyncApiClientBuilder(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java b/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java new file mode 100644 index 00000000..8e4b8474 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/AsyncApiClientBuilder.java @@ -0,0 +1,67 @@ +/** + * 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 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/src/main/java/com/skyflow/generated/rest/Configuration.java b/src/main/java/com/skyflow/generated/rest/Configuration.java deleted file mode 100644 index 6b12e8bb..00000000 --- a/src/main/java/com/skyflow/generated/rest/Configuration.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class Configuration { - public static final String VERSION = "v1"; - - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/GzipRequestInterceptor.java b/src/main/java/com/skyflow/generated/rest/GzipRequestInterceptor.java deleted file mode 100644 index 2b69f358..00000000 --- a/src/main/java/com/skyflow/generated/rest/GzipRequestInterceptor.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import okhttp3.*; -import okio.Buffer; -import okio.BufferedSink; -import okio.GzipSink; -import okio.Okio; - -import java.io.IOException; - -/** - * Encodes request bodies using gzip. - * - * Taken from https://github.com/square/okhttp/issues/350 - */ -class GzipRequestInterceptor implements Interceptor { - @Override - public Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { - return chain.proceed(originalRequest); - } - - Request compressedRequest = originalRequest.newBuilder() - .header("Content-Encoding", "gzip") - .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) - .build(); - return chain.proceed(compressedRequest); - } - - private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return new RequestBody() { - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() { - return buffer.size(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - sink.write(buffer.snapshot()); - } - }; - } - - private RequestBody gzip(final RequestBody body) { - return new RequestBody() { - @Override - public MediaType contentType() { - return body.contentType(); - } - - @Override - public long contentLength() { - return -1; // We don't know the compressed length in advance! - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); - body.writeTo(gzipSink); - gzipSink.close(); - } - }; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/JSON.java b/src/main/java/com/skyflow/generated/rest/JSON.java deleted file mode 100644 index 8e6e8375..00000000 --- a/src/main/java/com/skyflow/generated/rest/JSON.java +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.util.ISO8601Utils; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonElement; -import io.gsonfire.GsonFireBuilder; -import io.gsonfire.TypeSelector; - -import okio.ByteString; - -import java.io.IOException; -import java.io.StringReader; -import java.lang.reflect.Type; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.ParsePosition; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Date; -import java.util.Locale; -import java.util.Map; -import java.util.HashMap; - -/* - * A JSON utility class - * - * NOTE: in the future, this class may be converted to static, which may break - * backward-compatibility - */ -public class JSON { - private static Gson gson; - private static boolean isLenientOnJson = false; - private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); - private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - - @SuppressWarnings("unchecked") - public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder() - ; - GsonBuilder builder = fireBuilder.createGsonBuilder(); - return builder; - } - - private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { - JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if (null == element) { - throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); - } - return element.getAsString(); - } - - /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. - * - * @param classByDiscriminatorValue The map of discriminator values to Java classes. - * @param discriminatorValue The value of the OpenAPI discriminator in the input data. - * @return The Java class that implements the OpenAPI schema - */ - private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); - if (null == clazz) { - throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); - } - return clazz; - } - - static { - GsonBuilder gsonBuilder = createGson(); - gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); - gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); - gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); - gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); - gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.AuditEventContext.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.AuditEventData.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.AuditEventHTTPInfo.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.GooglerpcStatus.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.ProtobufAny.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.QueryServiceExecuteQueryBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.RecordServiceBatchOperationBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.RecordServiceBulkDeleteRecordBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.RecordServiceInsertRecordBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.RecordServiceUpdateRecordBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1AuditAfterOptions.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1AuditEventResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1AuditResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1AuditResponseEvent.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1AuditResponseEventRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1BINListRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1BINListResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1BatchOperationResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1BatchRecord.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1BulkDeleteRecordResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1BulkGetRecordResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1Card.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1DeleteFileResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1DeleteRecordResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1DetokenizePayload.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1DetokenizeRecordRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1DetokenizeRecordResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1DetokenizeResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1FieldRecords.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1GetFileScanStatusResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1GetQueryResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1InsertRecordResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1RecordMetaProperties.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1TokenizePayload.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1TokenizeRecordRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1TokenizeRecordResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1TokenizeResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1UpdateRecordResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1VaultFieldMapping.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.skyflow.generated.rest.models.V1VaultSchemaConfig.CustomTypeAdapterFactory()); - gson = gsonBuilder.create(); - } - - /** - * Get Gson. - * - * @return Gson - */ - public static Gson getGson() { - return gson; - } - - /** - * Set Gson. - * - * @param gson Gson - */ - public static void setGson(Gson gson) { - JSON.gson = gson; - } - - public static void setLenientOnJson(boolean lenientOnJson) { - isLenientOnJson = lenientOnJson; - } - - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public static String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - @SuppressWarnings("unchecked") - public static T deserialize(String body, Type returnType) { - try { - if (isLenientOnJson) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - if (returnType.equals(String.class)) { - return (T) body; - } else { - throw (e); - } - } - } - - /** - * Gson TypeAdapter for Byte Array type - */ - public static class ByteArrayAdapter extends TypeAdapter { - - @Override - public void write(JsonWriter out, byte[] value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - out.value(ByteString.of(value).base64()); - } - } - - @Override - public byte[] read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String bytesAsBase64 = in.nextString(); - ByteString byteString = ByteString.decodeBase64(bytesAsBase64); - return byteString.toByteArray(); - } - } - } - - /** - * Gson TypeAdapter for JSR310 OffsetDateTime type - */ - public static class OffsetDateTimeTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public OffsetDateTimeTypeAdapter() { - this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); - } - - public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, OffsetDateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public OffsetDateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - if (date.endsWith("+0000")) { - date = date.substring(0, date.length()-5) + "Z"; - } - return OffsetDateTime.parse(date, formatter); - } - } - } - - /** - * Gson TypeAdapter for JSR310 LocalDate type - */ - public static class LocalDateTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public LocalDateTypeAdapter() { - this(DateTimeFormatter.ISO_LOCAL_DATE); - } - - public LocalDateTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return LocalDate.parse(date, formatter); - } - } - } - - public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - offsetDateTimeTypeAdapter.setFormat(dateFormat); - } - - public static void setLocalDateFormat(DateTimeFormatter dateFormat) { - localDateTypeAdapter.setFormat(dateFormat); - } - - /** - * Gson TypeAdapter for java.sql.Date type - * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used - * (more efficient than SimpleDateFormat). - */ - public static class SqlDateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public SqlDateTypeAdapter() {} - - public SqlDateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, java.sql.Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = date.toString(); - } - out.value(value); - } - } - - @Override - public java.sql.Date read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return new java.sql.Date(dateFormat.parse(date).getTime()); - } - return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } - } - - /** - * Gson TypeAdapter for java.util.Date type - * If the dateFormat is null, ISO8601Utils will be used. - */ - public static class DateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public DateTypeAdapter() {} - - public DateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = ISO8601Utils.format(date, true); - } - out.value(value); - } - } - - @Override - public Date read(JsonReader in) throws IOException { - try { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return dateFormat.parse(date); - } - return ISO8601Utils.parse(date, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } catch (IllegalArgumentException e) { - throw new JsonParseException(e); - } - } - } - - public static void setDateFormat(DateFormat dateFormat) { - dateTypeAdapter.setFormat(dateFormat); - } - - public static void setSqlDateFormat(DateFormat dateFormat) { - sqlDateTypeAdapter.setFormat(dateFormat); - } -} diff --git a/src/main/java/com/skyflow/generated/rest/Pair.java b/src/main/java/com/skyflow/generated/rest/Pair.java deleted file mode 100644 index 0f182d02..00000000 --- a/src/main/java/com/skyflow/generated/rest/Pair.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - return true; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/ProgressRequestBody.java b/src/main/java/com/skyflow/generated/rest/ProgressRequestBody.java deleted file mode 100644 index 38d16e94..00000000 --- a/src/main/java/com/skyflow/generated/rest/ProgressRequestBody.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import okhttp3.MediaType; -import okhttp3.RequestBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); - } - }; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/ProgressResponseBody.java b/src/main/java/com/skyflow/generated/rest/ProgressResponseBody.java deleted file mode 100644 index 6bd61b5a..00000000 --- a/src/main/java/com/skyflow/generated/rest/ProgressResponseBody.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import okhttp3.MediaType; -import okhttp3.ResponseBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); - return bytesRead; - } - }; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/ServerConfiguration.java b/src/main/java/com/skyflow/generated/rest/ServerConfiguration.java deleted file mode 100644 index f91ef52d..00000000 --- a/src/main/java/com/skyflow/generated/rest/ServerConfiguration.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import java.util.Map; - -/** - * Representing a Server configuration. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class ServerConfiguration { - public String URL; - public String description; - public Map variables; - - /** - * @param URL A URL to the target host. - * @param description A description of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. - */ - public ServerConfiguration(String URL, String description, Map variables) { - this.URL = URL; - this.description = description; - this.variables = variables; - } - - /** - * Format URL template using given variables. - * - * @param variables A map between a variable name and its value. - * @return Formatted URL. - */ - public String URL(Map variables) { - String url = this.URL; - - // go through variables and replace placeholders - for (Map.Entry variable: this.variables.entrySet()) { - String name = variable.getKey(); - ServerVariable serverVariable = variable.getValue(); - String value = serverVariable.defaultValue; - - if (variables != null && variables.containsKey(name)) { - value = variables.get(name); - if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); - } - } - url = url.replace("{" + name + "}", value); - } - return url; - } - - /** - * Format URL template using default server variables. - * - * @return Formatted URL. - */ - public String URL() { - return URL(null); - } -} diff --git a/src/main/java/com/skyflow/generated/rest/ServerVariable.java b/src/main/java/com/skyflow/generated/rest/ServerVariable.java deleted file mode 100644 index 53b17180..00000000 --- a/src/main/java/com/skyflow/generated/rest/ServerVariable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import java.util.HashSet; - -/** - * Representing a Server Variable for server URL template substitution. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class ServerVariable { - public String description; - public String defaultValue; - public HashSet enumValues = null; - - /** - * @param description A description for the server variable. - * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. - */ - public ServerVariable(String description, String defaultValue, HashSet enumValues) { - this.description = description; - this.defaultValue = defaultValue; - this.enumValues = enumValues; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/StringUtil.java b/src/main/java/com/skyflow/generated/rest/StringUtil.java deleted file mode 100644 index 433e15d7..00000000 --- a/src/main/java/com/skyflow/generated/rest/StringUtil.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest; - -import java.util.Collection; -import java.util.Iterator; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class StringUtil { - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array The array - * @param value The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase(String[] array, String value) { - for (String str : array) { - if (value == null && str == null) { - return true; - } - if (value != null && value.equalsIgnoreCase(str)) { - return true; - } - } - return false; - } - - /** - * Join an array of strings with the given separator. - *

- * Note: This might be replaced by utility method from commons-lang or guava someday - * if one of those libraries is added as dependency. - *

- * - * @param array The array of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(String[] array, String separator) { - int len = array.length; - if (len == 0) { - return ""; - } - - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for (int i = 1; i < len; i++) { - out.append(separator).append(array[i]); - } - return out.toString(); - } - - /** - * Join a list of strings with the given separator. - * - * @param list The list of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(Collection list, String separator) { - Iterator iterator = list.iterator(); - StringBuilder out = new StringBuilder(); - if (iterator.hasNext()) { - out.append(iterator.next()); - } - while (iterator.hasNext()) { - out.append(separator).append(iterator.next()); - } - return out.toString(); - } -} diff --git a/src/main/java/com/skyflow/generated/rest/api/AuditApi.java b/src/main/java/com/skyflow/generated/rest/api/AuditApi.java deleted file mode 100644 index 6b441971..00000000 --- a/src/main/java/com/skyflow/generated/rest/api/AuditApi.java +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.api; - -import com.skyflow.generated.rest.ApiCallback; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.ApiResponse; -import com.skyflow.generated.rest.Configuration; -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ProgressRequestBody; -import com.skyflow.generated.rest.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import com.skyflow.generated.rest.models.GooglerpcStatus; -import com.skyflow.generated.rest.models.V1AuditResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class AuditApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public AuditApi() { - this(Configuration.getDefaultApiClient()); - } - - public AuditApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for auditServiceListAuditEvents - * @param filterOpsAccountID Resources with the specified account ID. (required) - * @param filterOpsContextChangeID ID for the audit event. (optional) - * @param filterOpsContextRequestID ID for the request that caused the event. (optional) - * @param filterOpsContextTraceID ID for the request set by the service that received the request. (optional) - * @param filterOpsContextSessionID ID for the session in which the request was sent. (optional) - * @param filterOpsContextActor Member who sent the request. Depending on `actorType`, this may be a user ID or a service account ID. (optional) - * @param filterOpsContextActorType Type of member who sent the request. (optional, default to NONE) - * @param filterOpsContextAccessType Type of access for the request. (optional, default to ACCESS_NONE) - * @param filterOpsContextIpAddress IP Address of the client that made the request. (optional) - * @param filterOpsContextOrigin HTTP Origin request header (including scheme, hostname, and port) of the request. (optional) - * @param filterOpsContextAuthMode Authentication mode the `actor` used. (optional, default to AUTH_NONE) - * @param filterOpsContextJwtID ID of the JWT token. (optional) - * @param filterOpsContextBearerTokenContextID Embedded User Context. (optional) - * @param filterOpsParentAccountID Resources with the specified parent account ID. (optional) - * @param filterOpsWorkspaceID Resources with the specified workspace ID. (optional) - * @param filterOpsVaultID Resources with the specified vault ID. (optional) - * @param 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\". (optional) - * @param filterOpsActionType Events with the specified action type. (optional, default to NONE) - * @param filterOpsResourceType Resources with the specified type. (optional, default to NONE_API) - * @param filterOpsTags Events with associated tags. If an event matches at least one tag, the event is returned. Comma-separated list. For example, \"login, get\". (optional) - * @param filterOpsResponseCode HTTP response code of the request. (optional) - * @param filterOpsStartTime Start timestamp for the query, in SQL format. (optional) - * @param filterOpsEndTime End timestamp for the query, in SQL format. (optional) - * @param filterOpsApiName Name of the API called in the request. (optional) - * @param filterOpsResponseMessage Response message of the request. (optional) - * @param filterOpsHttpMethod HTTP method of the request. (optional) - * @param filterOpsHttpURI HTTP URI of the request. (optional) - * @param sortOpsSortBy Fully-qualified field by which to sort results. Field names should be in camel case (for example, \"capitalization.camelCase\"). (optional) - * @param sortOpsOrderBy Ascending or descending ordering of results. (optional, default to ASCENDING) - * @param 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. (optional) - * @param 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. (optional) - * @param limit Number of results to return. (optional, default to 25) - * @param offset Record position at which to start returning results. (optional, default to 0) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details -
- - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call auditServiceListAuditEventsCall(String filterOpsAccountID, String filterOpsContextChangeID, String filterOpsContextRequestID, String filterOpsContextTraceID, String filterOpsContextSessionID, String filterOpsContextActor, String filterOpsContextActorType, String filterOpsContextAccessType, String filterOpsContextIpAddress, String filterOpsContextOrigin, String filterOpsContextAuthMode, String filterOpsContextJwtID, String filterOpsContextBearerTokenContextID, String filterOpsParentAccountID, String filterOpsWorkspaceID, String filterOpsVaultID, String filterOpsResourceIDs, String filterOpsActionType, String filterOpsResourceType, String filterOpsTags, Integer filterOpsResponseCode, String filterOpsStartTime, String filterOpsEndTime, String filterOpsApiName, String filterOpsResponseMessage, String filterOpsHttpMethod, String filterOpsHttpURI, String sortOpsSortBy, String sortOpsOrderBy, String afterOpsTimestamp, String afterOpsChangeID, Long limit, Long offset, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1/audit/events"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (filterOpsContextChangeID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.changeID", filterOpsContextChangeID)); - } - - if (filterOpsContextRequestID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.requestID", filterOpsContextRequestID)); - } - - if (filterOpsContextTraceID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.traceID", filterOpsContextTraceID)); - } - - if (filterOpsContextSessionID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.sessionID", filterOpsContextSessionID)); - } - - if (filterOpsContextActor != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.actor", filterOpsContextActor)); - } - - if (filterOpsContextActorType != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.actorType", filterOpsContextActorType)); - } - - if (filterOpsContextAccessType != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.accessType", filterOpsContextAccessType)); - } - - if (filterOpsContextIpAddress != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.ipAddress", filterOpsContextIpAddress)); - } - - if (filterOpsContextOrigin != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.origin", filterOpsContextOrigin)); - } - - if (filterOpsContextAuthMode != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.authMode", filterOpsContextAuthMode)); - } - - if (filterOpsContextJwtID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.jwtID", filterOpsContextJwtID)); - } - - if (filterOpsContextBearerTokenContextID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.context.bearerTokenContextID", filterOpsContextBearerTokenContextID)); - } - - if (filterOpsParentAccountID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.parentAccountID", filterOpsParentAccountID)); - } - - if (filterOpsAccountID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.accountID", filterOpsAccountID)); - } - - if (filterOpsWorkspaceID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.workspaceID", filterOpsWorkspaceID)); - } - - if (filterOpsVaultID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.vaultID", filterOpsVaultID)); - } - - if (filterOpsResourceIDs != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.resourceIDs", filterOpsResourceIDs)); - } - - if (filterOpsActionType != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.actionType", filterOpsActionType)); - } - - if (filterOpsResourceType != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.resourceType", filterOpsResourceType)); - } - - if (filterOpsTags != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.tags", filterOpsTags)); - } - - if (filterOpsResponseCode != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.responseCode", filterOpsResponseCode)); - } - - if (filterOpsStartTime != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.startTime", filterOpsStartTime)); - } - - if (filterOpsEndTime != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.endTime", filterOpsEndTime)); - } - - if (filterOpsApiName != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.apiName", filterOpsApiName)); - } - - if (filterOpsResponseMessage != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.responseMessage", filterOpsResponseMessage)); - } - - if (filterOpsHttpMethod != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.httpMethod", filterOpsHttpMethod)); - } - - if (filterOpsHttpURI != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("filterOps.httpURI", filterOpsHttpURI)); - } - - if (sortOpsSortBy != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("sortOps.sortBy", sortOpsSortBy)); - } - - if (sortOpsOrderBy != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("sortOps.orderBy", sortOpsOrderBy)); - } - - if (afterOpsTimestamp != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("afterOps.timestamp", afterOpsTimestamp)); - } - - if (afterOpsChangeID != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("afterOps.changeID", afterOpsChangeID)); - } - - if (limit != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); - } - - if (offset != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); - } - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call auditServiceListAuditEventsValidateBeforeCall(String filterOpsAccountID, String filterOpsContextChangeID, String filterOpsContextRequestID, String filterOpsContextTraceID, String filterOpsContextSessionID, String filterOpsContextActor, String filterOpsContextActorType, String filterOpsContextAccessType, String filterOpsContextIpAddress, String filterOpsContextOrigin, String filterOpsContextAuthMode, String filterOpsContextJwtID, String filterOpsContextBearerTokenContextID, String filterOpsParentAccountID, String filterOpsWorkspaceID, String filterOpsVaultID, String filterOpsResourceIDs, String filterOpsActionType, String filterOpsResourceType, String filterOpsTags, Integer filterOpsResponseCode, String filterOpsStartTime, String filterOpsEndTime, String filterOpsApiName, String filterOpsResponseMessage, String filterOpsHttpMethod, String filterOpsHttpURI, String sortOpsSortBy, String sortOpsOrderBy, String afterOpsTimestamp, String afterOpsChangeID, Long limit, Long offset, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'filterOpsAccountID' is set - if (filterOpsAccountID == null) { - throw new ApiException("Missing the required parameter 'filterOpsAccountID' when calling auditServiceListAuditEvents(Async)"); - } - - return auditServiceListAuditEventsCall(filterOpsAccountID, filterOpsContextChangeID, filterOpsContextRequestID, filterOpsContextTraceID, filterOpsContextSessionID, filterOpsContextActor, filterOpsContextActorType, filterOpsContextAccessType, filterOpsContextIpAddress, filterOpsContextOrigin, filterOpsContextAuthMode, filterOpsContextJwtID, filterOpsContextBearerTokenContextID, filterOpsParentAccountID, filterOpsWorkspaceID, filterOpsVaultID, filterOpsResourceIDs, filterOpsActionType, filterOpsResourceType, filterOpsTags, filterOpsResponseCode, filterOpsStartTime, filterOpsEndTime, filterOpsApiName, filterOpsResponseMessage, filterOpsHttpMethod, filterOpsHttpURI, sortOpsSortBy, sortOpsOrderBy, afterOpsTimestamp, afterOpsChangeID, limit, offset, _callback); - - } - - /** - * List Audit Events - * Lists audit events that match query parameters. - * @param filterOpsAccountID Resources with the specified account ID. (required) - * @param filterOpsContextChangeID ID for the audit event. (optional) - * @param filterOpsContextRequestID ID for the request that caused the event. (optional) - * @param filterOpsContextTraceID ID for the request set by the service that received the request. (optional) - * @param filterOpsContextSessionID ID for the session in which the request was sent. (optional) - * @param filterOpsContextActor Member who sent the request. Depending on `actorType`, this may be a user ID or a service account ID. (optional) - * @param filterOpsContextActorType Type of member who sent the request. (optional, default to NONE) - * @param filterOpsContextAccessType Type of access for the request. (optional, default to ACCESS_NONE) - * @param filterOpsContextIpAddress IP Address of the client that made the request. (optional) - * @param filterOpsContextOrigin HTTP Origin request header (including scheme, hostname, and port) of the request. (optional) - * @param filterOpsContextAuthMode Authentication mode the `actor` used. (optional, default to AUTH_NONE) - * @param filterOpsContextJwtID ID of the JWT token. (optional) - * @param filterOpsContextBearerTokenContextID Embedded User Context. (optional) - * @param filterOpsParentAccountID Resources with the specified parent account ID. (optional) - * @param filterOpsWorkspaceID Resources with the specified workspace ID. (optional) - * @param filterOpsVaultID Resources with the specified vault ID. (optional) - * @param 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\". (optional) - * @param filterOpsActionType Events with the specified action type. (optional, default to NONE) - * @param filterOpsResourceType Resources with the specified type. (optional, default to NONE_API) - * @param filterOpsTags Events with associated tags. If an event matches at least one tag, the event is returned. Comma-separated list. For example, \"login, get\". (optional) - * @param filterOpsResponseCode HTTP response code of the request. (optional) - * @param filterOpsStartTime Start timestamp for the query, in SQL format. (optional) - * @param filterOpsEndTime End timestamp for the query, in SQL format. (optional) - * @param filterOpsApiName Name of the API called in the request. (optional) - * @param filterOpsResponseMessage Response message of the request. (optional) - * @param filterOpsHttpMethod HTTP method of the request. (optional) - * @param filterOpsHttpURI HTTP URI of the request. (optional) - * @param sortOpsSortBy Fully-qualified field by which to sort results. Field names should be in camel case (for example, \"capitalization.camelCase\"). (optional) - * @param sortOpsOrderBy Ascending or descending ordering of results. (optional, default to ASCENDING) - * @param 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. (optional) - * @param 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. (optional) - * @param limit Number of results to return. (optional, default to 25) - * @param offset Record position at which to start returning results. (optional, default to 0) - * @return V1AuditResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1AuditResponse auditServiceListAuditEvents(String filterOpsAccountID, String filterOpsContextChangeID, String filterOpsContextRequestID, String filterOpsContextTraceID, String filterOpsContextSessionID, String filterOpsContextActor, String filterOpsContextActorType, String filterOpsContextAccessType, String filterOpsContextIpAddress, String filterOpsContextOrigin, String filterOpsContextAuthMode, String filterOpsContextJwtID, String filterOpsContextBearerTokenContextID, String filterOpsParentAccountID, String filterOpsWorkspaceID, String filterOpsVaultID, String filterOpsResourceIDs, String filterOpsActionType, String filterOpsResourceType, String filterOpsTags, Integer filterOpsResponseCode, String filterOpsStartTime, String filterOpsEndTime, String filterOpsApiName, String filterOpsResponseMessage, String filterOpsHttpMethod, String filterOpsHttpURI, String sortOpsSortBy, String sortOpsOrderBy, String afterOpsTimestamp, String afterOpsChangeID, Long limit, Long offset) throws ApiException { - ApiResponse localVarResp = auditServiceListAuditEventsWithHttpInfo(filterOpsAccountID, filterOpsContextChangeID, filterOpsContextRequestID, filterOpsContextTraceID, filterOpsContextSessionID, filterOpsContextActor, filterOpsContextActorType, filterOpsContextAccessType, filterOpsContextIpAddress, filterOpsContextOrigin, filterOpsContextAuthMode, filterOpsContextJwtID, filterOpsContextBearerTokenContextID, filterOpsParentAccountID, filterOpsWorkspaceID, filterOpsVaultID, filterOpsResourceIDs, filterOpsActionType, filterOpsResourceType, filterOpsTags, filterOpsResponseCode, filterOpsStartTime, filterOpsEndTime, filterOpsApiName, filterOpsResponseMessage, filterOpsHttpMethod, filterOpsHttpURI, sortOpsSortBy, sortOpsOrderBy, afterOpsTimestamp, afterOpsChangeID, limit, offset); - return localVarResp.getData(); - } - - /** - * List Audit Events - * Lists audit events that match query parameters. - * @param filterOpsAccountID Resources with the specified account ID. (required) - * @param filterOpsContextChangeID ID for the audit event. (optional) - * @param filterOpsContextRequestID ID for the request that caused the event. (optional) - * @param filterOpsContextTraceID ID for the request set by the service that received the request. (optional) - * @param filterOpsContextSessionID ID for the session in which the request was sent. (optional) - * @param filterOpsContextActor Member who sent the request. Depending on `actorType`, this may be a user ID or a service account ID. (optional) - * @param filterOpsContextActorType Type of member who sent the request. (optional, default to NONE) - * @param filterOpsContextAccessType Type of access for the request. (optional, default to ACCESS_NONE) - * @param filterOpsContextIpAddress IP Address of the client that made the request. (optional) - * @param filterOpsContextOrigin HTTP Origin request header (including scheme, hostname, and port) of the request. (optional) - * @param filterOpsContextAuthMode Authentication mode the `actor` used. (optional, default to AUTH_NONE) - * @param filterOpsContextJwtID ID of the JWT token. (optional) - * @param filterOpsContextBearerTokenContextID Embedded User Context. (optional) - * @param filterOpsParentAccountID Resources with the specified parent account ID. (optional) - * @param filterOpsWorkspaceID Resources with the specified workspace ID. (optional) - * @param filterOpsVaultID Resources with the specified vault ID. (optional) - * @param 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\". (optional) - * @param filterOpsActionType Events with the specified action type. (optional, default to NONE) - * @param filterOpsResourceType Resources with the specified type. (optional, default to NONE_API) - * @param filterOpsTags Events with associated tags. If an event matches at least one tag, the event is returned. Comma-separated list. For example, \"login, get\". (optional) - * @param filterOpsResponseCode HTTP response code of the request. (optional) - * @param filterOpsStartTime Start timestamp for the query, in SQL format. (optional) - * @param filterOpsEndTime End timestamp for the query, in SQL format. (optional) - * @param filterOpsApiName Name of the API called in the request. (optional) - * @param filterOpsResponseMessage Response message of the request. (optional) - * @param filterOpsHttpMethod HTTP method of the request. (optional) - * @param filterOpsHttpURI HTTP URI of the request. (optional) - * @param sortOpsSortBy Fully-qualified field by which to sort results. Field names should be in camel case (for example, \"capitalization.camelCase\"). (optional) - * @param sortOpsOrderBy Ascending or descending ordering of results. (optional, default to ASCENDING) - * @param 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. (optional) - * @param 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. (optional) - * @param limit Number of results to return. (optional, default to 25) - * @param offset Record position at which to start returning results. (optional, default to 0) - * @return ApiResponse<V1AuditResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse auditServiceListAuditEventsWithHttpInfo(String filterOpsAccountID, String filterOpsContextChangeID, String filterOpsContextRequestID, String filterOpsContextTraceID, String filterOpsContextSessionID, String filterOpsContextActor, String filterOpsContextActorType, String filterOpsContextAccessType, String filterOpsContextIpAddress, String filterOpsContextOrigin, String filterOpsContextAuthMode, String filterOpsContextJwtID, String filterOpsContextBearerTokenContextID, String filterOpsParentAccountID, String filterOpsWorkspaceID, String filterOpsVaultID, String filterOpsResourceIDs, String filterOpsActionType, String filterOpsResourceType, String filterOpsTags, Integer filterOpsResponseCode, String filterOpsStartTime, String filterOpsEndTime, String filterOpsApiName, String filterOpsResponseMessage, String filterOpsHttpMethod, String filterOpsHttpURI, String sortOpsSortBy, String sortOpsOrderBy, String afterOpsTimestamp, String afterOpsChangeID, Long limit, Long offset) throws ApiException { - okhttp3.Call localVarCall = auditServiceListAuditEventsValidateBeforeCall(filterOpsAccountID, filterOpsContextChangeID, filterOpsContextRequestID, filterOpsContextTraceID, filterOpsContextSessionID, filterOpsContextActor, filterOpsContextActorType, filterOpsContextAccessType, filterOpsContextIpAddress, filterOpsContextOrigin, filterOpsContextAuthMode, filterOpsContextJwtID, filterOpsContextBearerTokenContextID, filterOpsParentAccountID, filterOpsWorkspaceID, filterOpsVaultID, filterOpsResourceIDs, filterOpsActionType, filterOpsResourceType, filterOpsTags, filterOpsResponseCode, filterOpsStartTime, filterOpsEndTime, filterOpsApiName, filterOpsResponseMessage, filterOpsHttpMethod, filterOpsHttpURI, sortOpsSortBy, sortOpsOrderBy, afterOpsTimestamp, afterOpsChangeID, limit, offset, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * List Audit Events (asynchronously) - * Lists audit events that match query parameters. - * @param filterOpsAccountID Resources with the specified account ID. (required) - * @param filterOpsContextChangeID ID for the audit event. (optional) - * @param filterOpsContextRequestID ID for the request that caused the event. (optional) - * @param filterOpsContextTraceID ID for the request set by the service that received the request. (optional) - * @param filterOpsContextSessionID ID for the session in which the request was sent. (optional) - * @param filterOpsContextActor Member who sent the request. Depending on `actorType`, this may be a user ID or a service account ID. (optional) - * @param filterOpsContextActorType Type of member who sent the request. (optional, default to NONE) - * @param filterOpsContextAccessType Type of access for the request. (optional, default to ACCESS_NONE) - * @param filterOpsContextIpAddress IP Address of the client that made the request. (optional) - * @param filterOpsContextOrigin HTTP Origin request header (including scheme, hostname, and port) of the request. (optional) - * @param filterOpsContextAuthMode Authentication mode the `actor` used. (optional, default to AUTH_NONE) - * @param filterOpsContextJwtID ID of the JWT token. (optional) - * @param filterOpsContextBearerTokenContextID Embedded User Context. (optional) - * @param filterOpsParentAccountID Resources with the specified parent account ID. (optional) - * @param filterOpsWorkspaceID Resources with the specified workspace ID. (optional) - * @param filterOpsVaultID Resources with the specified vault ID. (optional) - * @param 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\". (optional) - * @param filterOpsActionType Events with the specified action type. (optional, default to NONE) - * @param filterOpsResourceType Resources with the specified type. (optional, default to NONE_API) - * @param filterOpsTags Events with associated tags. If an event matches at least one tag, the event is returned. Comma-separated list. For example, \"login, get\". (optional) - * @param filterOpsResponseCode HTTP response code of the request. (optional) - * @param filterOpsStartTime Start timestamp for the query, in SQL format. (optional) - * @param filterOpsEndTime End timestamp for the query, in SQL format. (optional) - * @param filterOpsApiName Name of the API called in the request. (optional) - * @param filterOpsResponseMessage Response message of the request. (optional) - * @param filterOpsHttpMethod HTTP method of the request. (optional) - * @param filterOpsHttpURI HTTP URI of the request. (optional) - * @param sortOpsSortBy Fully-qualified field by which to sort results. Field names should be in camel case (for example, \"capitalization.camelCase\"). (optional) - * @param sortOpsOrderBy Ascending or descending ordering of results. (optional, default to ASCENDING) - * @param 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. (optional) - * @param 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. (optional) - * @param limit Number of results to return. (optional, default to 25) - * @param offset Record position at which to start returning results. (optional, default to 0) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call auditServiceListAuditEventsAsync(String filterOpsAccountID, String filterOpsContextChangeID, String filterOpsContextRequestID, String filterOpsContextTraceID, String filterOpsContextSessionID, String filterOpsContextActor, String filterOpsContextActorType, String filterOpsContextAccessType, String filterOpsContextIpAddress, String filterOpsContextOrigin, String filterOpsContextAuthMode, String filterOpsContextJwtID, String filterOpsContextBearerTokenContextID, String filterOpsParentAccountID, String filterOpsWorkspaceID, String filterOpsVaultID, String filterOpsResourceIDs, String filterOpsActionType, String filterOpsResourceType, String filterOpsTags, Integer filterOpsResponseCode, String filterOpsStartTime, String filterOpsEndTime, String filterOpsApiName, String filterOpsResponseMessage, String filterOpsHttpMethod, String filterOpsHttpURI, String sortOpsSortBy, String sortOpsOrderBy, String afterOpsTimestamp, String afterOpsChangeID, Long limit, Long offset, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = auditServiceListAuditEventsValidateBeforeCall(filterOpsAccountID, filterOpsContextChangeID, filterOpsContextRequestID, filterOpsContextTraceID, filterOpsContextSessionID, filterOpsContextActor, filterOpsContextActorType, filterOpsContextAccessType, filterOpsContextIpAddress, filterOpsContextOrigin, filterOpsContextAuthMode, filterOpsContextJwtID, filterOpsContextBearerTokenContextID, filterOpsParentAccountID, filterOpsWorkspaceID, filterOpsVaultID, filterOpsResourceIDs, filterOpsActionType, filterOpsResourceType, filterOpsTags, filterOpsResponseCode, filterOpsStartTime, filterOpsEndTime, filterOpsApiName, filterOpsResponseMessage, filterOpsHttpMethod, filterOpsHttpURI, sortOpsSortBy, sortOpsOrderBy, afterOpsTimestamp, afterOpsChangeID, limit, offset, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/api/AuthenticationApi.java b/src/main/java/com/skyflow/generated/rest/api/AuthenticationApi.java deleted file mode 100644 index e26da776..00000000 --- a/src/main/java/com/skyflow/generated/rest/api/AuthenticationApi.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Skyflow Management API - * # Management API This API controls aspects of your account and schema, including workspaces, vaults, keys, users, permissions, and more. The Management API is available from two base URIs:
  • Sandbox: https://manage.skyflowapis-preview.com
  • Production: https://manage.skyflowapis.com
When you make an API call, you need to add two headers:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
X-SKYFLOW-ACCOUNT-IDYour Skyflow account ID.X-SKYFLOW-ACCOUNT-ID: h451b763713e4424a7jke1bbkbbc84ef
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.api; - -import com.skyflow.generated.rest.ApiCallback; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.ApiResponse; -import com.skyflow.generated.rest.Configuration; -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ProgressRequestBody; -import com.skyflow.generated.rest.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import com.skyflow.generated.rest.models.GooglerpcStatus; -import com.skyflow.generated.rest.models.V1GetAuthTokenRequest; -import com.skyflow.generated.rest.models.V1GetAuthTokenResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class AuthenticationApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public AuthenticationApi() { - this(Configuration.getDefaultApiClient()); - } - - public AuthenticationApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for authenticationServiceGetAuthToken - * @param body (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details -
- - - - - - -
Status Code Description Response Headers
200 A successful response. -
400 Invalid scope format. -
401 Key expired or JWT token unparseable. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call authenticationServiceGetAuthTokenCall(V1GetAuthTokenRequest body, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/v1/auth/sa/oauth/token"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call authenticationServiceGetAuthTokenValidateBeforeCall(V1GetAuthTokenRequest body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling authenticationServiceGetAuthToken(Async)"); - } - - return authenticationServiceGetAuthTokenCall(body, _callback); - - } - - /** - * Get Bearer Token - * <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> - * @param body (required) - * @return V1GetAuthTokenResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 A successful response. -
400 Invalid scope format. -
401 Key expired or JWT token unparseable. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1GetAuthTokenResponse authenticationServiceGetAuthToken(V1GetAuthTokenRequest body) throws ApiException { - ApiResponse localVarResp = authenticationServiceGetAuthTokenWithHttpInfo(body); - return localVarResp.getData(); - } - - /** - * Get Bearer Token - * <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> - * @param body (required) - * @return ApiResponse<V1GetAuthTokenResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 A successful response. -
400 Invalid scope format. -
401 Key expired or JWT token unparseable. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse authenticationServiceGetAuthTokenWithHttpInfo(V1GetAuthTokenRequest body) throws ApiException { - okhttp3.Call localVarCall = authenticationServiceGetAuthTokenValidateBeforeCall(body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get Bearer Token (asynchronously) - * <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> - * @param body (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 A successful response. -
400 Invalid scope format. -
401 Key expired or JWT token unparseable. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call authenticationServiceGetAuthTokenAsync(V1GetAuthTokenRequest body, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = authenticationServiceGetAuthTokenValidateBeforeCall(body, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/api/BinLookupApi.java b/src/main/java/com/skyflow/generated/rest/api/BinLookupApi.java deleted file mode 100644 index da1a862a..00000000 --- a/src/main/java/com/skyflow/generated/rest/api/BinLookupApi.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.api; - -import com.skyflow.generated.rest.ApiCallback; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.ApiResponse; -import com.skyflow.generated.rest.Configuration; -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ProgressRequestBody; -import com.skyflow.generated.rest.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import com.skyflow.generated.rest.models.GooglerpcStatus; -import com.skyflow.generated.rest.models.V1BINListRequest; -import com.skyflow.generated.rest.models.V1BINListResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class BinLookupApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public BinLookupApi() { - this(Configuration.getDefaultApiClient()); - } - - public BinLookupApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for bINListServiceListCardsOfBIN - * @param body Request to return specific card metadata. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details -
- - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call bINListServiceListCardsOfBINCall(V1BINListRequest body, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/v1/card_lookup"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call bINListServiceListCardsOfBINValidateBeforeCall(V1BINListRequest body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling bINListServiceListCardsOfBIN(Async)"); - } - - return bINListServiceListCardsOfBINCall(body, _callback); - - } - - /** - * Get BIN - * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. - * @param body Request to return specific card metadata. (required) - * @return V1BINListResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1BINListResponse bINListServiceListCardsOfBIN(V1BINListRequest body) throws ApiException { - ApiResponse localVarResp = bINListServiceListCardsOfBINWithHttpInfo(body); - return localVarResp.getData(); - } - - /** - * Get BIN - * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. - * @param body Request to return specific card metadata. (required) - * @return ApiResponse<V1BINListResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse bINListServiceListCardsOfBINWithHttpInfo(V1BINListRequest body) throws ApiException { - okhttp3.Call localVarCall = bINListServiceListCardsOfBINValidateBeforeCall(body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get BIN (asynchronously) - * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. - * @param body Request to return specific card metadata. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call bINListServiceListCardsOfBINAsync(V1BINListRequest body, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = bINListServiceListCardsOfBINValidateBeforeCall(body, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/api/QueryApi.java b/src/main/java/com/skyflow/generated/rest/api/QueryApi.java deleted file mode 100644 index fad624ce..00000000 --- a/src/main/java/com/skyflow/generated/rest/api/QueryApi.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.api; - -import com.skyflow.generated.rest.ApiCallback; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.ApiResponse; -import com.skyflow.generated.rest.Configuration; -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ProgressRequestBody; -import com.skyflow.generated.rest.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import com.skyflow.generated.rest.models.GooglerpcStatus; -import com.skyflow.generated.rest.models.QueryServiceExecuteQueryBody; -import com.skyflow.generated.rest.models.V1GetQueryResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class QueryApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public QueryApi() { - this(Configuration.getDefaultApiClient()); - } - - public QueryApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for queryServiceExecuteQuery - * @param vaultID ID of the vault. (required) - * @param body (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details -
- - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call queryServiceExecuteQueryCall(String vaultID, QueryServiceExecuteQueryBody body, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/query" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call queryServiceExecuteQueryValidateBeforeCall(String vaultID, QueryServiceExecuteQueryBody body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling queryServiceExecuteQuery(Async)"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling queryServiceExecuteQuery(Async)"); - } - - return queryServiceExecuteQueryCall(vaultID, body, _callback); - - } - - /** - * Execute Query - * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support `?` conditional for columns with column-level encryption disabled.</li><ul> - * @param vaultID ID of the vault. (required) - * @param body (required) - * @return V1GetQueryResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1GetQueryResponse queryServiceExecuteQuery(String vaultID, QueryServiceExecuteQueryBody body) throws ApiException { - ApiResponse localVarResp = queryServiceExecuteQueryWithHttpInfo(vaultID, body); - return localVarResp.getData(); - } - - /** - * Execute Query - * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support `?` conditional for columns with column-level encryption disabled.</li><ul> - * @param vaultID ID of the vault. (required) - * @param body (required) - * @return ApiResponse<V1GetQueryResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse queryServiceExecuteQueryWithHttpInfo(String vaultID, QueryServiceExecuteQueryBody body) throws ApiException { - okhttp3.Call localVarCall = queryServiceExecuteQueryValidateBeforeCall(vaultID, body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Execute Query (asynchronously) - * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support `?` conditional for columns with column-level encryption disabled.</li><ul> - * @param vaultID ID of the vault. (required) - * @param body (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call queryServiceExecuteQueryAsync(String vaultID, QueryServiceExecuteQueryBody body, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = queryServiceExecuteQueryValidateBeforeCall(vaultID, body, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/api/RecordsApi.java b/src/main/java/com/skyflow/generated/rest/api/RecordsApi.java deleted file mode 100644 index d8d8257b..00000000 --- a/src/main/java/com/skyflow/generated/rest/api/RecordsApi.java +++ /dev/null @@ -1,1730 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.api; - -import com.skyflow.generated.rest.ApiCallback; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.ApiResponse; -import com.skyflow.generated.rest.Configuration; -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ProgressRequestBody; -import com.skyflow.generated.rest.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import java.io.File; -import com.skyflow.generated.rest.models.GooglerpcStatus; -import com.skyflow.generated.rest.models.RecordServiceBatchOperationBody; -import com.skyflow.generated.rest.models.RecordServiceBulkDeleteRecordBody; -import com.skyflow.generated.rest.models.RecordServiceInsertRecordBody; -import com.skyflow.generated.rest.models.RecordServiceUpdateRecordBody; -import com.skyflow.generated.rest.models.V1BatchOperationResponse; -import com.skyflow.generated.rest.models.V1BulkDeleteRecordResponse; -import com.skyflow.generated.rest.models.V1BulkGetRecordResponse; -import com.skyflow.generated.rest.models.V1DeleteFileResponse; -import com.skyflow.generated.rest.models.V1DeleteRecordResponse; -import com.skyflow.generated.rest.models.V1FieldRecords; -import com.skyflow.generated.rest.models.V1GetFileScanStatusResponse; -import com.skyflow.generated.rest.models.V1InsertRecordResponse; -import com.skyflow.generated.rest.models.V1UpdateRecordResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class RecordsApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public RecordsApi() { - this(Configuration.getDefaultApiClient()); - } - - public RecordsApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for fileServiceDeleteFile - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details -
- - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call fileServiceDeleteFileCall(String vaultID, String tableName, String ID, String columnName, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{tableName}/{ID}/files/{columnName}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "tableName" + "}", localVarApiClient.escapeString(tableName.toString())) - .replace("{" + "ID" + "}", localVarApiClient.escapeString(ID.toString())) - .replace("{" + "columnName" + "}", localVarApiClient.escapeString(columnName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call fileServiceDeleteFileValidateBeforeCall(String vaultID, String tableName, String ID, String columnName, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling fileServiceDeleteFile(Async)"); - } - - // verify the required parameter 'tableName' is set - if (tableName == null) { - throw new ApiException("Missing the required parameter 'tableName' when calling fileServiceDeleteFile(Async)"); - } - - // verify the required parameter 'ID' is set - if (ID == null) { - throw new ApiException("Missing the required parameter 'ID' when calling fileServiceDeleteFile(Async)"); - } - - // verify the required parameter 'columnName' is set - if (columnName == null) { - throw new ApiException("Missing the required parameter 'columnName' when calling fileServiceDeleteFile(Async)"); - } - - return fileServiceDeleteFileCall(vaultID, tableName, ID, columnName, _callback); - - } - - /** - * Delete File - * Deletes a file from the specified record. - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @return V1DeleteFileResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1DeleteFileResponse fileServiceDeleteFile(String vaultID, String tableName, String ID, String columnName) throws ApiException { - ApiResponse localVarResp = fileServiceDeleteFileWithHttpInfo(vaultID, tableName, ID, columnName); - return localVarResp.getData(); - } - - /** - * Delete File - * Deletes a file from the specified record. - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @return ApiResponse<V1DeleteFileResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse fileServiceDeleteFileWithHttpInfo(String vaultID, String tableName, String ID, String columnName) throws ApiException { - okhttp3.Call localVarCall = fileServiceDeleteFileValidateBeforeCall(vaultID, tableName, ID, columnName, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Delete File (asynchronously) - * Deletes a file from the specified record. - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call fileServiceDeleteFileAsync(String vaultID, String tableName, String ID, String columnName, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = fileServiceDeleteFileValidateBeforeCall(vaultID, tableName, ID, columnName, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for fileServiceGetFileScanStatus - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call fileServiceGetFileScanStatusCall(String vaultID, String tableName, String ID, String columnName, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{tableName}/{ID}/files/{columnName}/scan-status" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "tableName" + "}", localVarApiClient.escapeString(tableName.toString())) - .replace("{" + "ID" + "}", localVarApiClient.escapeString(ID.toString())) - .replace("{" + "columnName" + "}", localVarApiClient.escapeString(columnName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call fileServiceGetFileScanStatusValidateBeforeCall(String vaultID, String tableName, String ID, String columnName, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling fileServiceGetFileScanStatus(Async)"); - } - - // verify the required parameter 'tableName' is set - if (tableName == null) { - throw new ApiException("Missing the required parameter 'tableName' when calling fileServiceGetFileScanStatus(Async)"); - } - - // verify the required parameter 'ID' is set - if (ID == null) { - throw new ApiException("Missing the required parameter 'ID' when calling fileServiceGetFileScanStatus(Async)"); - } - - // verify the required parameter 'columnName' is set - if (columnName == null) { - throw new ApiException("Missing the required parameter 'columnName' when calling fileServiceGetFileScanStatus(Async)"); - } - - return fileServiceGetFileScanStatusCall(vaultID, tableName, ID, columnName, _callback); - - } - - /** - * Get File Scan Status - * Returns the anti-virus scan status of a file. - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @return V1GetFileScanStatusResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1GetFileScanStatusResponse fileServiceGetFileScanStatus(String vaultID, String tableName, String ID, String columnName) throws ApiException { - ApiResponse localVarResp = fileServiceGetFileScanStatusWithHttpInfo(vaultID, tableName, ID, columnName); - return localVarResp.getData(); - } - - /** - * Get File Scan Status - * Returns the anti-virus scan status of a file. - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @return ApiResponse<V1GetFileScanStatusResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse fileServiceGetFileScanStatusWithHttpInfo(String vaultID, String tableName, String ID, String columnName) throws ApiException { - okhttp3.Call localVarCall = fileServiceGetFileScanStatusValidateBeforeCall(vaultID, tableName, ID, columnName, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get File Scan Status (asynchronously) - * Returns the anti-virus scan status of a file. - * @param vaultID ID of the vault. (required) - * @param tableName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param columnName Name of the column that contains the file. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call fileServiceGetFileScanStatusAsync(String vaultID, String tableName, String ID, String columnName, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = fileServiceGetFileScanStatusValidateBeforeCall(vaultID, tableName, ID, columnName, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for fileServiceUploadFile - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param fileColumnName Name of the column to store the file in. The column must have a file data type. (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call fileServiceUploadFileCall(String vaultID, String objectName, String ID, File fileColumnName, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{objectName}/{ID}/files" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "objectName" + "}", localVarApiClient.escapeString(objectName.toString())) - .replace("{" + "ID" + "}", localVarApiClient.escapeString(ID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (fileColumnName != null) { - localVarFormParams.put("fileColumnName", fileColumnName); - } - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call fileServiceUploadFileValidateBeforeCall(String vaultID, String objectName, String ID, File fileColumnName, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling fileServiceUploadFile(Async)"); - } - - // verify the required parameter 'objectName' is set - if (objectName == null) { - throw new ApiException("Missing the required parameter 'objectName' when calling fileServiceUploadFile(Async)"); - } - - // verify the required parameter 'ID' is set - if (ID == null) { - throw new ApiException("Missing the required parameter 'ID' when calling fileServiceUploadFile(Async)"); - } - - return fileServiceUploadFileCall(vaultID, objectName, ID, fileColumnName, _callback); - - } - - /** - * Upload File - * Uploads a file to the specified record. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param fileColumnName Name of the column to store the file in. The column must have a file data type. (optional) - * @return V1UpdateRecordResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1UpdateRecordResponse fileServiceUploadFile(String vaultID, String objectName, String ID, File fileColumnName) throws ApiException { - ApiResponse localVarResp = fileServiceUploadFileWithHttpInfo(vaultID, objectName, ID, fileColumnName); - return localVarResp.getData(); - } - - /** - * Upload File - * Uploads a file to the specified record. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param fileColumnName Name of the column to store the file in. The column must have a file data type. (optional) - * @return ApiResponse<V1UpdateRecordResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse fileServiceUploadFileWithHttpInfo(String vaultID, String objectName, String ID, File fileColumnName) throws ApiException { - okhttp3.Call localVarCall = fileServiceUploadFileValidateBeforeCall(vaultID, objectName, ID, fileColumnName, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Upload File (asynchronously) - * Uploads a file to the specified record. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param fileColumnName Name of the column to store the file in. The column must have a file data type. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call fileServiceUploadFileAsync(String vaultID, String objectName, String ID, File fileColumnName, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = fileServiceUploadFileValidateBeforeCall(vaultID, objectName, ID, fileColumnName, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceBatchOperation - * @param vaultID ID of the vault. (required) - * @param body (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceBatchOperationCall(String vaultID, RecordServiceBatchOperationBody body, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceBatchOperationValidateBeforeCall(String vaultID, RecordServiceBatchOperationBody body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceBatchOperation(Async)"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling recordServiceBatchOperation(Async)"); - } - - return recordServiceBatchOperationCall(vaultID, body, _callback); - - } - - /** - * Batch Operation - * Performs multiple record operations in a single transaction. - * @param vaultID ID of the vault. (required) - * @param body (required) - * @return V1BatchOperationResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1BatchOperationResponse recordServiceBatchOperation(String vaultID, RecordServiceBatchOperationBody body) throws ApiException { - ApiResponse localVarResp = recordServiceBatchOperationWithHttpInfo(vaultID, body); - return localVarResp.getData(); - } - - /** - * Batch Operation - * Performs multiple record operations in a single transaction. - * @param vaultID ID of the vault. (required) - * @param body (required) - * @return ApiResponse<V1BatchOperationResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceBatchOperationWithHttpInfo(String vaultID, RecordServiceBatchOperationBody body) throws ApiException { - okhttp3.Call localVarCall = recordServiceBatchOperationValidateBeforeCall(vaultID, body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Batch Operation (asynchronously) - * Performs multiple record operations in a single transaction. - * @param vaultID ID of the vault. (required) - * @param body (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceBatchOperationAsync(String vaultID, RecordServiceBatchOperationBody body, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceBatchOperationValidateBeforeCall(vaultID, body, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceBulkDeleteRecord - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceBulkDeleteRecordCall(String vaultID, String objectName, RecordServiceBulkDeleteRecordBody body, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{objectName}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "objectName" + "}", localVarApiClient.escapeString(objectName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceBulkDeleteRecordValidateBeforeCall(String vaultID, String objectName, RecordServiceBulkDeleteRecordBody body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceBulkDeleteRecord(Async)"); - } - - // verify the required parameter 'objectName' is set - if (objectName == null) { - throw new ApiException("Missing the required parameter 'objectName' when calling recordServiceBulkDeleteRecord(Async)"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling recordServiceBulkDeleteRecord(Async)"); - } - - return recordServiceBulkDeleteRecordCall(vaultID, objectName, body, _callback); - - } - - /** - * Bulk Delete Records - * Deletes the specified records from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @return V1BulkDeleteRecordResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1BulkDeleteRecordResponse recordServiceBulkDeleteRecord(String vaultID, String objectName, RecordServiceBulkDeleteRecordBody body) throws ApiException { - ApiResponse localVarResp = recordServiceBulkDeleteRecordWithHttpInfo(vaultID, objectName, body); - return localVarResp.getData(); - } - - /** - * Bulk Delete Records - * Deletes the specified records from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @return ApiResponse<V1BulkDeleteRecordResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceBulkDeleteRecordWithHttpInfo(String vaultID, String objectName, RecordServiceBulkDeleteRecordBody body) throws ApiException { - okhttp3.Call localVarCall = recordServiceBulkDeleteRecordValidateBeforeCall(vaultID, objectName, body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Bulk Delete Records (asynchronously) - * Deletes the specified records from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceBulkDeleteRecordAsync(String vaultID, String objectName, RecordServiceBulkDeleteRecordBody body, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceBulkDeleteRecordValidateBeforeCall(vaultID, objectName, body, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceBulkGetRecord - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table that contains the records. (required) - * @param skyflowIds `skyflow_id` values of the records to return, with one value per `skyflow_ids` URL parameter. For example, `?skyflow_ids=abc&skyflow_ids=123`.<br /><br />If not specified, returns the first 25 records in the table. (optional) - * @param redaction Redaction level to enforce for the returned records. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param offset Record position at which to start receiving data. (optional, default to 0) - * @param limit Number of record to return. Maximum 25. (optional, default to 25) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @param columnName Name of the column. It must be configured as unique in the schema. If you provide both column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param columnValues Column values of the records to return, with one value per `column_values` URL parameter. For example, `?column_values=abc&column_values=123`.<br /><br />`column_name` is mandatory when providing `column_values`. If you use column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param orderBy Order to return records, based on `skyflow_id` values. To disable, set to `NONE`. (optional, default to ASCENDING) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceBulkGetRecordCall(String vaultID, String objectName, List skyflowIds, String redaction, Boolean tokenization, List fields, String offset, String limit, Boolean downloadURL, String columnName, List columnValues, String orderBy, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{objectName}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "objectName" + "}", localVarApiClient.escapeString(objectName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (skyflowIds != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "skyflow_ids", skyflowIds)); - } - - if (redaction != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("redaction", redaction)); - } - - if (tokenization != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("tokenization", tokenization)); - } - - if (fields != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "fields", fields)); - } - - if (offset != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); - } - - if (limit != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); - } - - if (downloadURL != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("downloadURL", downloadURL)); - } - - if (columnName != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("column_name", columnName)); - } - - if (columnValues != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "column_values", columnValues)); - } - - if (orderBy != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("order_by", orderBy)); - } - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceBulkGetRecordValidateBeforeCall(String vaultID, String objectName, List skyflowIds, String redaction, Boolean tokenization, List fields, String offset, String limit, Boolean downloadURL, String columnName, List columnValues, String orderBy, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceBulkGetRecord(Async)"); - } - - // verify the required parameter 'objectName' is set - if (objectName == null) { - throw new ApiException("Missing the required parameter 'objectName' when calling recordServiceBulkGetRecord(Async)"); - } - - return recordServiceBulkGetRecordCall(vaultID, objectName, skyflowIds, redaction, tokenization, fields, offset, limit, downloadURL, columnName, columnValues, orderBy, _callback); - - } - - /** - * Get Record(s) - * Gets the specified records from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table that contains the records. (required) - * @param skyflowIds `skyflow_id` values of the records to return, with one value per `skyflow_ids` URL parameter. For example, `?skyflow_ids=abc&skyflow_ids=123`.<br /><br />If not specified, returns the first 25 records in the table. (optional) - * @param redaction Redaction level to enforce for the returned records. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param offset Record position at which to start receiving data. (optional, default to 0) - * @param limit Number of record to return. Maximum 25. (optional, default to 25) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @param columnName Name of the column. It must be configured as unique in the schema. If you provide both column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param columnValues Column values of the records to return, with one value per `column_values` URL parameter. For example, `?column_values=abc&column_values=123`.<br /><br />`column_name` is mandatory when providing `column_values`. If you use column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param orderBy Order to return records, based on `skyflow_id` values. To disable, set to `NONE`. (optional, default to ASCENDING) - * @return V1BulkGetRecordResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1BulkGetRecordResponse recordServiceBulkGetRecord(String vaultID, String objectName, List skyflowIds, String redaction, Boolean tokenization, List fields, String offset, String limit, Boolean downloadURL, String columnName, List columnValues, String orderBy) throws ApiException { - ApiResponse localVarResp = recordServiceBulkGetRecordWithHttpInfo(vaultID, objectName, skyflowIds, redaction, tokenization, fields, offset, limit, downloadURL, columnName, columnValues, orderBy); - return localVarResp.getData(); - } - - /** - * Get Record(s) - * Gets the specified records from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table that contains the records. (required) - * @param skyflowIds `skyflow_id` values of the records to return, with one value per `skyflow_ids` URL parameter. For example, `?skyflow_ids=abc&skyflow_ids=123`.<br /><br />If not specified, returns the first 25 records in the table. (optional) - * @param redaction Redaction level to enforce for the returned records. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param offset Record position at which to start receiving data. (optional, default to 0) - * @param limit Number of record to return. Maximum 25. (optional, default to 25) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @param columnName Name of the column. It must be configured as unique in the schema. If you provide both column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param columnValues Column values of the records to return, with one value per `column_values` URL parameter. For example, `?column_values=abc&column_values=123`.<br /><br />`column_name` is mandatory when providing `column_values`. If you use column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param orderBy Order to return records, based on `skyflow_id` values. To disable, set to `NONE`. (optional, default to ASCENDING) - * @return ApiResponse<V1BulkGetRecordResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceBulkGetRecordWithHttpInfo(String vaultID, String objectName, List skyflowIds, String redaction, Boolean tokenization, List fields, String offset, String limit, Boolean downloadURL, String columnName, List columnValues, String orderBy) throws ApiException { - okhttp3.Call localVarCall = recordServiceBulkGetRecordValidateBeforeCall(vaultID, objectName, skyflowIds, redaction, tokenization, fields, offset, limit, downloadURL, columnName, columnValues, orderBy, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get Record(s) (asynchronously) - * Gets the specified records from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table that contains the records. (required) - * @param skyflowIds `skyflow_id` values of the records to return, with one value per `skyflow_ids` URL parameter. For example, `?skyflow_ids=abc&skyflow_ids=123`.<br /><br />If not specified, returns the first 25 records in the table. (optional) - * @param redaction Redaction level to enforce for the returned records. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param offset Record position at which to start receiving data. (optional, default to 0) - * @param limit Number of record to return. Maximum 25. (optional, default to 25) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @param columnName Name of the column. It must be configured as unique in the schema. If you provide both column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param columnValues Column values of the records to return, with one value per `column_values` URL parameter. For example, `?column_values=abc&column_values=123`.<br /><br />`column_name` is mandatory when providing `column_values`. If you use column name or column value, you cannot use `skyflow_ids`. Passing either of these parameters with `skyflow_ids` returns an error. (optional) - * @param orderBy Order to return records, based on `skyflow_id` values. To disable, set to `NONE`. (optional, default to ASCENDING) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceBulkGetRecordAsync(String vaultID, String objectName, List skyflowIds, String redaction, Boolean tokenization, List fields, String offset, String limit, Boolean downloadURL, String columnName, List columnValues, String orderBy, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceBulkGetRecordValidateBeforeCall(vaultID, objectName, skyflowIds, redaction, tokenization, fields, offset, limit, downloadURL, columnName, columnValues, orderBy, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceDeleteRecord - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record to delete. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceDeleteRecordCall(String vaultID, String objectName, String ID, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{objectName}/{ID}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "objectName" + "}", localVarApiClient.escapeString(objectName.toString())) - .replace("{" + "ID" + "}", localVarApiClient.escapeString(ID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceDeleteRecordValidateBeforeCall(String vaultID, String objectName, String ID, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceDeleteRecord(Async)"); - } - - // verify the required parameter 'objectName' is set - if (objectName == null) { - throw new ApiException("Missing the required parameter 'objectName' when calling recordServiceDeleteRecord(Async)"); - } - - // verify the required parameter 'ID' is set - if (ID == null) { - throw new ApiException("Missing the required parameter 'ID' when calling recordServiceDeleteRecord(Async)"); - } - - return recordServiceDeleteRecordCall(vaultID, objectName, ID, _callback); - - } - - /** - * Delete Record - * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record to delete. (required) - * @return V1DeleteRecordResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1DeleteRecordResponse recordServiceDeleteRecord(String vaultID, String objectName, String ID) throws ApiException { - ApiResponse localVarResp = recordServiceDeleteRecordWithHttpInfo(vaultID, objectName, ID); - return localVarResp.getData(); - } - - /** - * Delete Record - * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record to delete. (required) - * @return ApiResponse<V1DeleteRecordResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceDeleteRecordWithHttpInfo(String vaultID, String objectName, String ID) throws ApiException { - okhttp3.Call localVarCall = recordServiceDeleteRecordValidateBeforeCall(vaultID, objectName, ID, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Delete Record (asynchronously) - * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record to delete. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceDeleteRecordAsync(String vaultID, String objectName, String ID, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceDeleteRecordValidateBeforeCall(vaultID, objectName, ID, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceGetRecord - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param redaction Redaction level to enforce for the returned record. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceGetRecordCall(String vaultID, String objectName, String ID, String redaction, Boolean tokenization, List fields, Boolean downloadURL, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{objectName}/{ID}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "objectName" + "}", localVarApiClient.escapeString(objectName.toString())) - .replace("{" + "ID" + "}", localVarApiClient.escapeString(ID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (redaction != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("redaction", redaction)); - } - - if (tokenization != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("tokenization", tokenization)); - } - - if (fields != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "fields", fields)); - } - - if (downloadURL != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("downloadURL", downloadURL)); - } - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceGetRecordValidateBeforeCall(String vaultID, String objectName, String ID, String redaction, Boolean tokenization, List fields, Boolean downloadURL, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceGetRecord(Async)"); - } - - // verify the required parameter 'objectName' is set - if (objectName == null) { - throw new ApiException("Missing the required parameter 'objectName' when calling recordServiceGetRecord(Async)"); - } - - // verify the required parameter 'ID' is set - if (ID == null) { - throw new ApiException("Missing the required parameter 'ID' when calling recordServiceGetRecord(Async)"); - } - - return recordServiceGetRecordCall(vaultID, objectName, ID, redaction, tokenization, fields, downloadURL, _callback); - - } - - /** - * Get Record By ID - * Returns the specified record from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param redaction Redaction level to enforce for the returned record. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @return V1FieldRecords - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1FieldRecords recordServiceGetRecord(String vaultID, String objectName, String ID, String redaction, Boolean tokenization, List fields, Boolean downloadURL) throws ApiException { - ApiResponse localVarResp = recordServiceGetRecordWithHttpInfo(vaultID, objectName, ID, redaction, tokenization, fields, downloadURL); - return localVarResp.getData(); - } - - /** - * Get Record By ID - * Returns the specified record from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param redaction Redaction level to enforce for the returned record. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @return ApiResponse<V1FieldRecords> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceGetRecordWithHttpInfo(String vaultID, String objectName, String ID, String redaction, Boolean tokenization, List fields, Boolean downloadURL) throws ApiException { - okhttp3.Call localVarCall = recordServiceGetRecordValidateBeforeCall(vaultID, objectName, ID, redaction, tokenization, fields, downloadURL, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get Record By ID (asynchronously) - * Returns the specified record from a table. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param redaction Redaction level to enforce for the returned record. Subject to policies assigned to the API caller. (optional, default to DEFAULT) - * @param tokenization If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. (optional) - * @param fields Fields to return for the record, with one value per `fields` URL parameter. For example, `?fields=abc&fields=123`.<br /><br />If not specified, returns all fields. (optional) - * @param downloadURL If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceGetRecordAsync(String vaultID, String objectName, String ID, String redaction, Boolean tokenization, List fields, Boolean downloadURL, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceGetRecordValidateBeforeCall(vaultID, objectName, ID, redaction, tokenization, fields, downloadURL, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceInsertRecord - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceInsertRecordCall(String vaultID, String objectName, RecordServiceInsertRecordBody body, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{objectName}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "objectName" + "}", localVarApiClient.escapeString(objectName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceInsertRecordValidateBeforeCall(String vaultID, String objectName, RecordServiceInsertRecordBody body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceInsertRecord(Async)"); - } - - // verify the required parameter 'objectName' is set - if (objectName == null) { - throw new ApiException("Missing the required parameter 'objectName' when calling recordServiceInsertRecord(Async)"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling recordServiceInsertRecord(Async)"); - } - - return recordServiceInsertRecordCall(vaultID, objectName, body, _callback); - - } - - /** - * Insert Records - * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @return V1InsertRecordResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1InsertRecordResponse recordServiceInsertRecord(String vaultID, String objectName, RecordServiceInsertRecordBody body) throws ApiException { - ApiResponse localVarResp = recordServiceInsertRecordWithHttpInfo(vaultID, objectName, body); - return localVarResp.getData(); - } - - /** - * Insert Records - * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @return ApiResponse<V1InsertRecordResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceInsertRecordWithHttpInfo(String vaultID, String objectName, RecordServiceInsertRecordBody body) throws ApiException { - okhttp3.Call localVarCall = recordServiceInsertRecordValidateBeforeCall(vaultID, objectName, body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Insert Records (asynchronously) - * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param body (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceInsertRecordAsync(String vaultID, String objectName, RecordServiceInsertRecordBody body, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceInsertRecordValidateBeforeCall(vaultID, objectName, body, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceUpdateRecord - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param body (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceUpdateRecordCall(String vaultID, String objectName, String ID, RecordServiceUpdateRecordBody body, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/{objectName}/{ID}" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())) - .replace("{" + "objectName" + "}", localVarApiClient.escapeString(objectName.toString())) - .replace("{" + "ID" + "}", localVarApiClient.escapeString(ID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceUpdateRecordValidateBeforeCall(String vaultID, String objectName, String ID, RecordServiceUpdateRecordBody body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceUpdateRecord(Async)"); - } - - // verify the required parameter 'objectName' is set - if (objectName == null) { - throw new ApiException("Missing the required parameter 'objectName' when calling recordServiceUpdateRecord(Async)"); - } - - // verify the required parameter 'ID' is set - if (ID == null) { - throw new ApiException("Missing the required parameter 'ID' when calling recordServiceUpdateRecord(Async)"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling recordServiceUpdateRecord(Async)"); - } - - return recordServiceUpdateRecordCall(vaultID, objectName, ID, body, _callback); - - } - - /** - * Update Record - * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param body (required) - * @return V1UpdateRecordResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1UpdateRecordResponse recordServiceUpdateRecord(String vaultID, String objectName, String ID, RecordServiceUpdateRecordBody body) throws ApiException { - ApiResponse localVarResp = recordServiceUpdateRecordWithHttpInfo(vaultID, objectName, ID, body); - return localVarResp.getData(); - } - - /** - * Update Record - * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param body (required) - * @return ApiResponse<V1UpdateRecordResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceUpdateRecordWithHttpInfo(String vaultID, String objectName, String ID, RecordServiceUpdateRecordBody body) throws ApiException { - okhttp3.Call localVarCall = recordServiceUpdateRecordValidateBeforeCall(vaultID, objectName, ID, body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Update Record (asynchronously) - * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. - * @param vaultID ID of the vault. (required) - * @param objectName Name of the table. (required) - * @param ID `skyflow_id` of the record. (required) - * @param body (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceUpdateRecordAsync(String vaultID, String objectName, String ID, RecordServiceUpdateRecordBody body, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceUpdateRecordValidateBeforeCall(vaultID, objectName, ID, body, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/api/TokensApi.java b/src/main/java/com/skyflow/generated/rest/api/TokensApi.java deleted file mode 100644 index f2ec51a3..00000000 --- a/src/main/java/com/skyflow/generated/rest/api/TokensApi.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.api; - -import com.skyflow.generated.rest.ApiCallback; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.ApiResponse; -import com.skyflow.generated.rest.Configuration; -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ProgressRequestBody; -import com.skyflow.generated.rest.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import com.skyflow.generated.rest.models.GooglerpcStatus; -import com.skyflow.generated.rest.models.V1DetokenizePayload; -import com.skyflow.generated.rest.models.V1DetokenizeResponse; -import com.skyflow.generated.rest.models.V1TokenizePayload; -import com.skyflow.generated.rest.models.V1TokenizeResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class TokensApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public TokensApi() { - this(Configuration.getDefaultApiClient()); - } - - public TokensApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for recordServiceDetokenize - * @param vaultID ID of the vault. (required) - * @param detokenizePayload (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details -
- - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceDetokenizeCall(String vaultID, V1DetokenizePayload detokenizePayload, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = detokenizePayload; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/detokenize" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceDetokenizeValidateBeforeCall(String vaultID, V1DetokenizePayload detokenizePayload, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceDetokenize(Async)"); - } - - // verify the required parameter 'detokenizePayload' is set - if (detokenizePayload == null) { - throw new ApiException("Missing the required parameter 'detokenizePayload' when calling recordServiceDetokenize(Async)"); - } - - return recordServiceDetokenizeCall(vaultID, detokenizePayload, _callback); - - } - - /** - * Detokenize - * Returns records that correspond to the specified tokens. - * @param vaultID ID of the vault. (required) - * @param detokenizePayload (required) - * @return V1DetokenizeResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1DetokenizeResponse recordServiceDetokenize(String vaultID, V1DetokenizePayload detokenizePayload) throws ApiException { - ApiResponse localVarResp = recordServiceDetokenizeWithHttpInfo(vaultID, detokenizePayload); - return localVarResp.getData(); - } - - /** - * Detokenize - * Returns records that correspond to the specified tokens. - * @param vaultID ID of the vault. (required) - * @param detokenizePayload (required) - * @return ApiResponse<V1DetokenizeResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceDetokenizeWithHttpInfo(String vaultID, V1DetokenizePayload detokenizePayload) throws ApiException { - okhttp3.Call localVarCall = recordServiceDetokenizeValidateBeforeCall(vaultID, detokenizePayload, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Detokenize (asynchronously) - * Returns records that correspond to the specified tokens. - * @param vaultID ID of the vault. (required) - * @param detokenizePayload (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceDetokenizeAsync(String vaultID, V1DetokenizePayload detokenizePayload, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceDetokenizeValidateBeforeCall(vaultID, detokenizePayload, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for recordServiceTokenize - * @param vaultID ID of the vault. (required) - * @param tokenizePayload (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceTokenizeCall(String vaultID, V1TokenizePayload tokenizePayload, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = tokenizePayload; - - // create path and map variables - String localVarPath = "/v1/vaults/{vaultID}/tokenize" - .replace("{" + "vaultID" + "}", localVarApiClient.escapeString(vaultID.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "Bearer" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call recordServiceTokenizeValidateBeforeCall(String vaultID, V1TokenizePayload tokenizePayload, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'vaultID' is set - if (vaultID == null) { - throw new ApiException("Missing the required parameter 'vaultID' when calling recordServiceTokenize(Async)"); - } - - // verify the required parameter 'tokenizePayload' is set - if (tokenizePayload == null) { - throw new ApiException("Missing the required parameter 'tokenizePayload' when calling recordServiceTokenize(Async)"); - } - - return recordServiceTokenizeCall(vaultID, tokenizePayload, _callback); - - } - - /** - * Tokenize - * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. - * @param vaultID ID of the vault. (required) - * @param tokenizePayload (required) - * @return V1TokenizeResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public V1TokenizeResponse recordServiceTokenize(String vaultID, V1TokenizePayload tokenizePayload) throws ApiException { - ApiResponse localVarResp = recordServiceTokenizeWithHttpInfo(vaultID, tokenizePayload); - return localVarResp.getData(); - } - - /** - * Tokenize - * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. - * @param vaultID ID of the vault. (required) - * @param tokenizePayload (required) - * @return ApiResponse<V1TokenizeResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public ApiResponse recordServiceTokenizeWithHttpInfo(String vaultID, V1TokenizePayload tokenizePayload) throws ApiException { - okhttp3.Call localVarCall = recordServiceTokenizeValidateBeforeCall(vaultID, tokenizePayload, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Tokenize (asynchronously) - * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. - * @param vaultID ID of the vault. (required) - * @param tokenizePayload (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Status Code Description Response Headers
200 A successful response. -
404 Returned when the resource does not exist. -
0 An unexpected error response. -
- */ - public okhttp3.Call recordServiceTokenizeAsync(String vaultID, V1TokenizePayload tokenizePayload, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = recordServiceTokenizeValidateBeforeCall(vaultID, tokenizePayload, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/auth/ApiKeyAuth.java b/src/main/java/com/skyflow/generated/rest/auth/ApiKeyAuth.java deleted file mode 100644 index 79949c2b..00000000 --- a/src/main/java/com/skyflow/generated/rest/auth/ApiKeyAuth.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.auth; - -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.Pair; - -import java.net.URI; -import java.util.Map; -import java.util.List; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } else if ("cookie".equals(location)) { - cookieParams.put(paramName, value); - } - } -} diff --git a/src/main/java/com/skyflow/generated/rest/auth/Authentication.java b/src/main/java/com/skyflow/generated/rest/auth/Authentication.java deleted file mode 100644 index 219caa17..00000000 --- a/src/main/java/com/skyflow/generated/rest/auth/Authentication.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.auth; - -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ApiException; - -import java.net.URI; -import java.util.Map; -import java.util.List; - -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - * @param payload HTTP request body - * @param method HTTP method - * @param uri URI - * @throws ApiException if failed to update the parameters - */ - void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; -} diff --git a/src/main/java/com/skyflow/generated/rest/auth/HttpBasicAuth.java b/src/main/java/com/skyflow/generated/rest/auth/HttpBasicAuth.java deleted file mode 100644 index 5bf3124a..00000000 --- a/src/main/java/com/skyflow/generated/rest/auth/HttpBasicAuth.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.auth; - -import com.skyflow.generated.rest.Pair; -import com.skyflow.generated.rest.ApiException; - -import okhttp3.Credentials; - -import java.net.URI; -import java.util.Map; -import java.util.List; - -public class HttpBasicAuth implements Authentication { - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - if (username == null && password == null) { - return; - } - headerParams.put("Authorization", Credentials.basic( - username == null ? "" : username, - password == null ? "" : password)); - } -} diff --git a/src/main/java/com/skyflow/generated/rest/auth/HttpBearerAuth.java b/src/main/java/com/skyflow/generated/rest/auth/HttpBearerAuth.java deleted file mode 100644 index e8797964..00000000 --- a/src/main/java/com/skyflow/generated/rest/auth/HttpBearerAuth.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.auth; - -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.Pair; - -import java.net.URI; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Supplier; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class HttpBearerAuth implements Authentication { - private final String scheme; - private Supplier tokenSupplier; - - public HttpBearerAuth(String scheme) { - this.scheme = scheme; - } - - /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @return The bearer token - */ - public String getBearerToken() { - return tokenSupplier.get(); - } - - /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @param bearerToken The bearer token to send in the Authorization header - */ - public void setBearerToken(String bearerToken) { - this.tokenSupplier = () -> bearerToken; - } - - /** - * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. - * - * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header - */ - public void setBearerToken(Supplier tokenSupplier) { - this.tokenSupplier = tokenSupplier; - } - - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); - if (bearerToken == null) { - return; - } - - headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); - } - - private static String upperCaseBearer(String scheme) { - return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; - } -} diff --git a/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java b/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java new file mode 100644 index 00000000..a4487b1e --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java b/src/main/java/com/skyflow/generated/rest/core/ApiClientException.java new file mode 100644 index 00000000..7987eba6 --- /dev/null +++ b/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/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java b/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java new file mode 100644 index 00000000..9c81f1f5 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/ApiClientHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java b/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java new file mode 100644 index 00000000..badaddd3 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/ClientOptions.java @@ -0,0 +1,170 @@ +/** + * 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; +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.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.219"); + } + }); + 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/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java b/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java new file mode 100644 index 00000000..6be10979 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * 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/src/main/java/com/skyflow/generated/rest/core/Environment.java b/src/main/java/com/skyflow/generated/rest/core/Environment.java new file mode 100644 index 00000000..c0adb233 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/Environment.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +public final class Environment { + public static final Environment PRODUCTION = new Environment("https://identifier.vault.skyflowapis.com"); + + public static final Environment SANDBOX = new Environment("https://identifier.vault.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/src/main/java/com/skyflow/generated/rest/core/FileStream.java b/src/main/java/com/skyflow/generated/rest/core/FileStream.java new file mode 100644 index 00000000..6b459431 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java b/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java new file mode 100644 index 00000000..545f6088 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java b/src/main/java/com/skyflow/generated/rest/core/MediaTypes.java new file mode 100644 index 00000000..11714cb8 --- /dev/null +++ b/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/src/main/java/com/skyflow/generated/rest/core/Nullable.java b/src/main/java/com/skyflow/generated/rest/core/Nullable.java new file mode 100644 index 00000000..5929c12d --- /dev/null +++ b/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/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java b/src/main/java/com/skyflow/generated/rest/core/NullableNonemptyFilter.java new file mode 100644 index 00000000..98c33be4 --- /dev/null +++ b/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/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java b/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java new file mode 100644 index 00000000..3b7894e0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * 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/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java b/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java new file mode 100644 index 00000000..e9e18fb9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * 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 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/src/main/java/com/skyflow/generated/rest/core/QueryStringMapperTest.java b/src/main/java/com/skyflow/generated/rest/core/QueryStringMapperTest.java new file mode 100644 index 00000000..c5728721 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/QueryStringMapperTest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.core; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class QueryStringMapperTest { + @Test + public void testObjectWithQuotedString_indexedArrays() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithQuotedString_arraysAsRepeats() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_indexedArrays() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_arraysAsRepeats() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_indexedArrays() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_arraysAsRepeats() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_indexedArrays() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_arraysAsRepeats() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_indexedArrays() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = "objects%5B0%5D%5Bvalue%5D=world&objects%5B0%5D%5Bkey%5D=hello&objects%5B1%5D" + + "%5Bvalue%5D=bar&objects%5B1%5D%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_arraysAsRepeats() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = + "objects%5Bvalue%5D=world&objects%5Bkey%5D=hello&objects%5Bvalue" + "%5D=bar&objects%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_indexedArrays() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = + "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds%5D%5B0%5D=id1&objectwitharray" + + "%5BcontactIds%5D%5B1%5D=id2&objectwitharray%5BcontactIds%5D%5B2%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_arraysAsRepeats() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds" + + "%5D=id1&objectwitharray%5BcontactIds%5D=id2&objectwitharray%5BcontactIds%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + private static String queryString(Map params, boolean arraysAsRepeats) { + HttpUrl.Builder httpUrl = HttpUrl.parse("http://www.fakewebsite.com/").newBuilder(); + params.forEach((paramName, paramValue) -> + QueryStringMapper.addQueryParameter(httpUrl, paramName, paramValue, arraysAsRepeats)); + return httpUrl.build().encodedQuery(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java b/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java new file mode 100644 index 00000000..edc6d0ae --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/RequestOptions.java @@ -0,0 +1,101 @@ +/** + * 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 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/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java b/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java new file mode 100644 index 00000000..d8df7715 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java b/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java new file mode 100644 index 00000000..ed894407 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java b/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java new file mode 100644 index 00000000..eda7d265 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/core/Stream.java b/src/main/java/com/skyflow/generated/rest/core/Stream.java new file mode 100644 index 00000000..f037712a --- /dev/null +++ b/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/src/main/java/com/skyflow/generated/rest/core/Suppliers.java b/src/main/java/com/skyflow/generated/rest/core/Suppliers.java new file mode 100644 index 00000000..307d5852 --- /dev/null +++ b/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/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java b/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java new file mode 100644 index 00000000..c8d4bb99 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/errors/BadRequestError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.errors; + +import com.skyflow.generated.rest.core.ApiClientApiException; +import okhttp3.Response; + +public final class BadRequestError extends ApiClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public BadRequestError(Object body) { + super("BadRequestError", 400, body); + this.body = body; + } + + public BadRequestError(Object body, Response rawResponse) { + super("BadRequestError", 400, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java b/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java new file mode 100644 index 00000000..d29f2b82 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/errors/InternalServerError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.errors; + +import com.skyflow.generated.rest.core.ApiClientApiException; +import com.skyflow.generated.rest.types.ErrorResponse; +import okhttp3.Response; + +public final class InternalServerError extends ApiClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final ErrorResponse body; + + public InternalServerError(ErrorResponse body) { + super("InternalServerError", 500, body); + this.body = body; + } + + public InternalServerError(ErrorResponse body, Response rawResponse) { + super("InternalServerError", 500, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public ErrorResponse body() { + return this.body; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java b/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java new file mode 100644 index 00000000..efa94aad --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/errors/NotFoundError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.errors; + +import com.skyflow.generated.rest.core.ApiClientApiException; +import okhttp3.Response; + +public final class NotFoundError extends ApiClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public NotFoundError(Object body) { + super("NotFoundError", 404, body); + this.body = body; + } + + public NotFoundError(Object body, Response rawResponse) { + super("NotFoundError", 404, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java b/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java new file mode 100644 index 00000000..3b6d6ae1 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/errors/UnauthorizedError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.errors; + +import com.skyflow.generated.rest.core.ApiClientApiException; +import okhttp3.Response; + +public final class UnauthorizedError extends ApiClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public UnauthorizedError(Object body) { + super("UnauthorizedError", 401, body); + this.body = body; + } + + public UnauthorizedError(Object body, Response rawResponse) { + super("UnauthorizedError", 401, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/models/AbstractOpenApiSchema.java b/src/main/java/com/skyflow/generated/rest/models/AbstractOpenApiSchema.java deleted file mode 100644 index c506e085..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/AbstractOpenApiSchema.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.

  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import com.skyflow.generated.rest.ApiException; -import java.util.Objects; -import java.lang.reflect.Type; -import java.util.Map; - -/** - * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public abstract class AbstractOpenApiSchema { - - // store the actual instance of the schema/object - private Object instance; - - // is nullable - private Boolean isNullable; - - // schema type (e.g. oneOf, anyOf) - private final String schemaType; - - public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { - this.schemaType = schemaType; - this.isNullable = isNullable; - } - - /** - * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object - * - * @return an instance of the actual schema/object - */ - public abstract Map> getSchemas(); - - /** - * Get the actual instance - * - * @return an instance of the actual schema/object - */ - //@JsonValue - public Object getActualInstance() {return instance;} - - /** - * Set the actual instance - * - * @param instance the actual instance of the schema/object - */ - public void setActualInstance(Object instance) {this.instance = instance;} - - /** - * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well - * - * @return an instance of the actual schema/object - */ - public Object getActualInstanceRecursively() { - return getActualInstanceRecursively(this); - } - - private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { - if (object.getActualInstance() == null) { - return null; - } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { - return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); - } else { - return object.getActualInstance(); - } - } - - /** - * Get the schema type (e.g. anyOf, oneOf) - * - * @return the schema type - */ - public String getSchemaType() { - return schemaType; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ").append(getClass()).append(" {\n"); - sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); - sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); - sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; - return Objects.equals(this.instance, a.instance) && - Objects.equals(this.isNullable, a.isNullable) && - Objects.equals(this.schemaType, a.schemaType); - } - - @Override - public int hashCode() { - return Objects.hash(instance, isNullable, schemaType); - } - - /** - * Is nullable - * - * @return true if it's nullable - */ - public Boolean isNullable() { - if (Boolean.TRUE.equals(isNullable)) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } - - - -} diff --git a/src/main/java/com/skyflow/generated/rest/models/AuditEventAuditResourceType.java b/src/main/java/com/skyflow/generated/rest/models/AuditEventAuditResourceType.java deleted file mode 100644 index ee029542..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/AuditEventAuditResourceType.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Type of the resource. - */ -@JsonAdapter(AuditEventAuditResourceType.Adapter.class) -public enum AuditEventAuditResourceType { - - NONE_API("NONE_API"), - - ACCOUNT("ACCOUNT"), - - AUDIT("AUDIT"), - - BASE_DATA_TYPE("BASE_DATA_TYPE"), - - FIELD_TEMPLATE("FIELD_TEMPLATE"), - - FILE("FILE"), - - KEY("KEY"), - - POLICY("POLICY"), - - PROTO_PARSE("PROTO_PARSE"), - - RECORD("RECORD"), - - ROLE("ROLE"), - - RULE("RULE"), - - SECRET("SECRET"), - - SERVICE_ACCOUNT("SERVICE_ACCOUNT"), - - TOKEN("TOKEN"), - - USER("USER"), - - VAULT("VAULT"), - - VAULT_TEMPLATE("VAULT_TEMPLATE"), - - WORKSPACE("WORKSPACE"), - - TABLE("TABLE"), - - POLICY_TEMPLATE("POLICY_TEMPLATE"), - - MEMBER("MEMBER"), - - TAG("TAG"), - - CONNECTION("CONNECTION"), - - MIGRATION("MIGRATION"), - - SCHEDULED_JOB("SCHEDULED_JOB"), - - JOB("JOB"), - - COLUMN_NAME("COLUMN_NAME"), - - NETWORK_TOKEN("NETWORK_TOKEN"), - - SUBSCRIPTION("SUBSCRIPTION"); - - private String value; - - AuditEventAuditResourceType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static AuditEventAuditResourceType fromValue(String value) { - for (AuditEventAuditResourceType b : AuditEventAuditResourceType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final AuditEventAuditResourceType enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AuditEventAuditResourceType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return AuditEventAuditResourceType.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - AuditEventAuditResourceType.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/AuditEventContext.java b/src/main/java/com/skyflow/generated/rest/models/AuditEventContext.java deleted file mode 100644 index 5732e155..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/AuditEventContext.java +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.ContextAccessType; -import com.skyflow.generated.rest.models.ContextAuthMode; -import com.skyflow.generated.rest.models.V1MemberType; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Context for an audit event. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class AuditEventContext { - public static final String SERIALIZED_NAME_CHANGE_I_D = "changeID"; - @SerializedName(SERIALIZED_NAME_CHANGE_I_D) - private String changeID; - - public static final String SERIALIZED_NAME_REQUEST_I_D = "requestID"; - @SerializedName(SERIALIZED_NAME_REQUEST_I_D) - private String requestID; - - public static final String SERIALIZED_NAME_TRACE_I_D = "traceID"; - @SerializedName(SERIALIZED_NAME_TRACE_I_D) - private String traceID; - - public static final String SERIALIZED_NAME_SESSION_I_D = "sessionID"; - @SerializedName(SERIALIZED_NAME_SESSION_I_D) - private String sessionID; - - public static final String SERIALIZED_NAME_ACTOR = "actor"; - @SerializedName(SERIALIZED_NAME_ACTOR) - private String actor; - - public static final String SERIALIZED_NAME_ACTOR_TYPE = "actorType"; - @SerializedName(SERIALIZED_NAME_ACTOR_TYPE) - private V1MemberType actorType = V1MemberType.NONE; - - public static final String SERIALIZED_NAME_ACCESS_TYPE = "accessType"; - @SerializedName(SERIALIZED_NAME_ACCESS_TYPE) - private ContextAccessType accessType = ContextAccessType.ACCESS_NONE; - - public static final String SERIALIZED_NAME_IP_ADDRESS = "ipAddress"; - @SerializedName(SERIALIZED_NAME_IP_ADDRESS) - private String ipAddress; - - public static final String SERIALIZED_NAME_ORIGIN = "origin"; - @SerializedName(SERIALIZED_NAME_ORIGIN) - private String origin; - - public static final String SERIALIZED_NAME_AUTH_MODE = "authMode"; - @SerializedName(SERIALIZED_NAME_AUTH_MODE) - private ContextAuthMode authMode = ContextAuthMode.AUTH_NONE; - - public static final String SERIALIZED_NAME_JWT_I_D = "jwtID"; - @SerializedName(SERIALIZED_NAME_JWT_I_D) - private String jwtID; - - public static final String SERIALIZED_NAME_BEARER_TOKEN_CONTEXT_I_D = "bearerTokenContextID"; - @SerializedName(SERIALIZED_NAME_BEARER_TOKEN_CONTEXT_I_D) - private String bearerTokenContextID; - - public AuditEventContext() { - } - - public AuditEventContext changeID(String changeID) { - this.changeID = changeID; - return this; - } - - /** - * ID for the audit event. - * @return changeID - */ - @javax.annotation.Nullable - public String getChangeID() { - return changeID; - } - - public void setChangeID(String changeID) { - this.changeID = changeID; - } - - - public AuditEventContext requestID(String requestID) { - this.requestID = requestID; - return this; - } - - /** - * ID for the request that caused the event. - * @return requestID - */ - @javax.annotation.Nullable - public String getRequestID() { - return requestID; - } - - public void setRequestID(String requestID) { - this.requestID = requestID; - } - - - public AuditEventContext traceID(String traceID) { - this.traceID = traceID; - return this; - } - - /** - * ID for the request set by the service that received the request. - * @return traceID - */ - @javax.annotation.Nullable - public String getTraceID() { - return traceID; - } - - public void setTraceID(String traceID) { - this.traceID = traceID; - } - - - public AuditEventContext sessionID(String sessionID) { - this.sessionID = sessionID; - return this; - } - - /** - * ID for the session in which the request was sent. - * @return sessionID - */ - @javax.annotation.Nullable - public String getSessionID() { - return sessionID; - } - - public void setSessionID(String sessionID) { - this.sessionID = sessionID; - } - - - public AuditEventContext actor(String actor) { - this.actor = actor; - return this; - } - - /** - * Member who sent the request. Depending on `actorType`, this may be a user ID or a service account ID. - * @return actor - */ - @javax.annotation.Nullable - public String getActor() { - return actor; - } - - public void setActor(String actor) { - this.actor = actor; - } - - - public AuditEventContext actorType(V1MemberType actorType) { - this.actorType = actorType; - return this; - } - - /** - * Get actorType - * @return actorType - */ - @javax.annotation.Nullable - public V1MemberType getActorType() { - return actorType; - } - - public void setActorType(V1MemberType actorType) { - this.actorType = actorType; - } - - - public AuditEventContext accessType(ContextAccessType accessType) { - this.accessType = accessType; - return this; - } - - /** - * Get accessType - * @return accessType - */ - @javax.annotation.Nullable - public ContextAccessType getAccessType() { - return accessType; - } - - public void setAccessType(ContextAccessType accessType) { - this.accessType = accessType; - } - - - public AuditEventContext ipAddress(String ipAddress) { - this.ipAddress = ipAddress; - return this; - } - - /** - * IP Address of the client that made the request. - * @return ipAddress - */ - @javax.annotation.Nullable - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - - public AuditEventContext origin(String origin) { - this.origin = origin; - return this; - } - - /** - * HTTP Origin request header (including scheme, hostname, and port) of the request. - * @return origin - */ - @javax.annotation.Nullable - public String getOrigin() { - return origin; - } - - public void setOrigin(String origin) { - this.origin = origin; - } - - - public AuditEventContext authMode(ContextAuthMode authMode) { - this.authMode = authMode; - return this; - } - - /** - * Get authMode - * @return authMode - */ - @javax.annotation.Nullable - public ContextAuthMode getAuthMode() { - return authMode; - } - - public void setAuthMode(ContextAuthMode authMode) { - this.authMode = authMode; - } - - - public AuditEventContext jwtID(String jwtID) { - this.jwtID = jwtID; - return this; - } - - /** - * ID of the JWT token. - * @return jwtID - */ - @javax.annotation.Nullable - public String getJwtID() { - return jwtID; - } - - public void setJwtID(String jwtID) { - this.jwtID = jwtID; - } - - - public AuditEventContext bearerTokenContextID(String bearerTokenContextID) { - this.bearerTokenContextID = bearerTokenContextID; - return this; - } - - /** - * Embedded User Context. - * @return bearerTokenContextID - */ - @javax.annotation.Nullable - public String getBearerTokenContextID() { - return bearerTokenContextID; - } - - public void setBearerTokenContextID(String bearerTokenContextID) { - this.bearerTokenContextID = bearerTokenContextID; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuditEventContext auditEventContext = (AuditEventContext) o; - return Objects.equals(this.changeID, auditEventContext.changeID) && - Objects.equals(this.requestID, auditEventContext.requestID) && - Objects.equals(this.traceID, auditEventContext.traceID) && - Objects.equals(this.sessionID, auditEventContext.sessionID) && - Objects.equals(this.actor, auditEventContext.actor) && - Objects.equals(this.actorType, auditEventContext.actorType) && - Objects.equals(this.accessType, auditEventContext.accessType) && - Objects.equals(this.ipAddress, auditEventContext.ipAddress) && - Objects.equals(this.origin, auditEventContext.origin) && - Objects.equals(this.authMode, auditEventContext.authMode) && - Objects.equals(this.jwtID, auditEventContext.jwtID) && - Objects.equals(this.bearerTokenContextID, auditEventContext.bearerTokenContextID); - } - - @Override - public int hashCode() { - return Objects.hash(changeID, requestID, traceID, sessionID, actor, actorType, accessType, ipAddress, origin, authMode, jwtID, bearerTokenContextID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuditEventContext {\n"); - sb.append(" changeID: ").append(toIndentedString(changeID)).append("\n"); - sb.append(" requestID: ").append(toIndentedString(requestID)).append("\n"); - sb.append(" traceID: ").append(toIndentedString(traceID)).append("\n"); - sb.append(" sessionID: ").append(toIndentedString(sessionID)).append("\n"); - sb.append(" actor: ").append(toIndentedString(actor)).append("\n"); - sb.append(" actorType: ").append(toIndentedString(actorType)).append("\n"); - sb.append(" accessType: ").append(toIndentedString(accessType)).append("\n"); - sb.append(" ipAddress: ").append(toIndentedString(ipAddress)).append("\n"); - sb.append(" origin: ").append(toIndentedString(origin)).append("\n"); - sb.append(" authMode: ").append(toIndentedString(authMode)).append("\n"); - sb.append(" jwtID: ").append(toIndentedString(jwtID)).append("\n"); - sb.append(" bearerTokenContextID: ").append(toIndentedString(bearerTokenContextID)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("changeID"); - openapiFields.add("requestID"); - openapiFields.add("traceID"); - openapiFields.add("sessionID"); - openapiFields.add("actor"); - openapiFields.add("actorType"); - openapiFields.add("accessType"); - openapiFields.add("ipAddress"); - openapiFields.add("origin"); - openapiFields.add("authMode"); - openapiFields.add("jwtID"); - openapiFields.add("bearerTokenContextID"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to AuditEventContext - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!AuditEventContext.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AuditEventContext is not found in the empty JSON string", AuditEventContext.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AuditEventContext.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuditEventContext` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("changeID") != null && !jsonObj.get("changeID").isJsonNull()) && !jsonObj.get("changeID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `changeID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("changeID").toString())); - } - if ((jsonObj.get("requestID") != null && !jsonObj.get("requestID").isJsonNull()) && !jsonObj.get("requestID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `requestID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestID").toString())); - } - if ((jsonObj.get("traceID") != null && !jsonObj.get("traceID").isJsonNull()) && !jsonObj.get("traceID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `traceID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("traceID").toString())); - } - if ((jsonObj.get("sessionID") != null && !jsonObj.get("sessionID").isJsonNull()) && !jsonObj.get("sessionID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sessionID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sessionID").toString())); - } - if ((jsonObj.get("actor") != null && !jsonObj.get("actor").isJsonNull()) && !jsonObj.get("actor").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actor").toString())); - } - // validate the optional field `actorType` - if (jsonObj.get("actorType") != null && !jsonObj.get("actorType").isJsonNull()) { - V1MemberType.validateJsonElement(jsonObj.get("actorType")); - } - // validate the optional field `accessType` - if (jsonObj.get("accessType") != null && !jsonObj.get("accessType").isJsonNull()) { - ContextAccessType.validateJsonElement(jsonObj.get("accessType")); - } - if ((jsonObj.get("ipAddress") != null && !jsonObj.get("ipAddress").isJsonNull()) && !jsonObj.get("ipAddress").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `ipAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ipAddress").toString())); - } - if ((jsonObj.get("origin") != null && !jsonObj.get("origin").isJsonNull()) && !jsonObj.get("origin").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `origin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("origin").toString())); - } - // validate the optional field `authMode` - if (jsonObj.get("authMode") != null && !jsonObj.get("authMode").isJsonNull()) { - ContextAuthMode.validateJsonElement(jsonObj.get("authMode")); - } - if ((jsonObj.get("jwtID") != null && !jsonObj.get("jwtID").isJsonNull()) && !jsonObj.get("jwtID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `jwtID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtID").toString())); - } - if ((jsonObj.get("bearerTokenContextID") != null && !jsonObj.get("bearerTokenContextID").isJsonNull()) && !jsonObj.get("bearerTokenContextID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `bearerTokenContextID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bearerTokenContextID").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AuditEventContext.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AuditEventContext' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AuditEventContext.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AuditEventContext value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AuditEventContext read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of AuditEventContext given an JSON string - * - * @param jsonString JSON string - * @return An instance of AuditEventContext - * @throws IOException if the JSON string is invalid with respect to AuditEventContext - */ - public static AuditEventContext fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AuditEventContext.class); - } - - /** - * Convert an instance of AuditEventContext to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/AuditEventData.java b/src/main/java/com/skyflow/generated/rest/models/AuditEventData.java deleted file mode 100644 index 4631467b..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/AuditEventData.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Any Sensitive data that needs to be wrapped. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class AuditEventData { - public static final String SERIALIZED_NAME_CONTENT = "content"; - @SerializedName(SERIALIZED_NAME_CONTENT) - private String content; - - public AuditEventData() { - } - - public AuditEventData content(String content) { - this.content = content; - return this; - } - - /** - * The entire body of the data requested or the query fired. - * @return content - */ - @javax.annotation.Nullable - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuditEventData auditEventData = (AuditEventData) o; - return Objects.equals(this.content, auditEventData.content); - } - - @Override - public int hashCode() { - return Objects.hash(content); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuditEventData {\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("content"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to AuditEventData - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!AuditEventData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AuditEventData is not found in the empty JSON string", AuditEventData.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AuditEventData.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuditEventData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) && !jsonObj.get("content").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `content` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AuditEventData.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AuditEventData' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AuditEventData.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AuditEventData value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AuditEventData read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of AuditEventData given an JSON string - * - * @param jsonString JSON string - * @return An instance of AuditEventData - * @throws IOException if the JSON string is invalid with respect to AuditEventData - */ - public static AuditEventData fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AuditEventData.class); - } - - /** - * Convert an instance of AuditEventData to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/AuditEventHTTPInfo.java b/src/main/java/com/skyflow/generated/rest/models/AuditEventHTTPInfo.java deleted file mode 100644 index 8d35595f..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/AuditEventHTTPInfo.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * AuditEventHTTPInfo - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class AuditEventHTTPInfo { - public static final String SERIALIZED_NAME_U_R_I = "URI"; - @SerializedName(SERIALIZED_NAME_U_R_I) - private String URI; - - public static final String SERIALIZED_NAME_METHOD = "method"; - @SerializedName(SERIALIZED_NAME_METHOD) - private String method; - - public AuditEventHTTPInfo() { - } - - public AuditEventHTTPInfo URI(String URI) { - this.URI = URI; - return this; - } - - /** - * The http URI that is used. - * @return URI - */ - @javax.annotation.Nullable - public String getURI() { - return URI; - } - - public void setURI(String URI) { - this.URI = URI; - } - - - public AuditEventHTTPInfo method(String method) { - this.method = method; - return this; - } - - /** - * http method used. - * @return method - */ - @javax.annotation.Nullable - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuditEventHTTPInfo auditEventHTTPInfo = (AuditEventHTTPInfo) o; - return Objects.equals(this.URI, auditEventHTTPInfo.URI) && - Objects.equals(this.method, auditEventHTTPInfo.method); - } - - @Override - public int hashCode() { - return Objects.hash(URI, method); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuditEventHTTPInfo {\n"); - sb.append(" URI: ").append(toIndentedString(URI)).append("\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("URI"); - openapiFields.add("method"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to AuditEventHTTPInfo - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!AuditEventHTTPInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AuditEventHTTPInfo is not found in the empty JSON string", AuditEventHTTPInfo.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AuditEventHTTPInfo.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuditEventHTTPInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("URI") != null && !jsonObj.get("URI").isJsonNull()) && !jsonObj.get("URI").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `URI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("URI").toString())); - } - if ((jsonObj.get("method") != null && !jsonObj.get("method").isJsonNull()) && !jsonObj.get("method").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AuditEventHTTPInfo.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AuditEventHTTPInfo' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AuditEventHTTPInfo.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AuditEventHTTPInfo value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AuditEventHTTPInfo read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of AuditEventHTTPInfo given an JSON string - * - * @param jsonString JSON string - * @return An instance of AuditEventHTTPInfo - * @throws IOException if the JSON string is invalid with respect to AuditEventHTTPInfo - */ - public static AuditEventHTTPInfo fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AuditEventHTTPInfo.class); - } - - /** - * Convert an instance of AuditEventHTTPInfo to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/BatchRecordMethod.java b/src/main/java/com/skyflow/generated/rest/models/BatchRecordMethod.java deleted file mode 100644 index 4ef6d0f4..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/BatchRecordMethod.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Method of the operation. - */ -@JsonAdapter(BatchRecordMethod.Adapter.class) -public enum BatchRecordMethod { - - NONE("NONE"), - - POST("POST"), - - PUT("PUT"), - - GET("GET"), - - DELETE("DELETE"); - - private String value; - - BatchRecordMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static BatchRecordMethod fromValue(String value) { - for (BatchRecordMethod b : BatchRecordMethod.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final BatchRecordMethod enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public BatchRecordMethod read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return BatchRecordMethod.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - BatchRecordMethod.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/ContextAccessType.java b/src/main/java/com/skyflow/generated/rest/models/ContextAccessType.java deleted file mode 100644 index 92075e20..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/ContextAccessType.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Type of access for the request. - */ -@JsonAdapter(ContextAccessType.Adapter.class) -public enum ContextAccessType { - - ACCESS_NONE("ACCESS_NONE"), - - API("API"), - - SQL("SQL"); - - private String value; - - ContextAccessType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ContextAccessType fromValue(String value) { - for (ContextAccessType b : ContextAccessType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ContextAccessType enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ContextAccessType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ContextAccessType.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - ContextAccessType.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/ContextAuthMode.java b/src/main/java/com/skyflow/generated/rest/models/ContextAuthMode.java deleted file mode 100644 index d0fc0afc..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/ContextAuthMode.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Authentication mode the `actor` used. - */ -@JsonAdapter(ContextAuthMode.Adapter.class) -public enum ContextAuthMode { - - AUTH_NONE("AUTH_NONE"), - - OKTA_JWT("OKTA_JWT"), - - SERVICE_ACCOUNT_JWT("SERVICE_ACCOUNT_JWT"), - - PAT_JWT("PAT_JWT"); - - private String value; - - ContextAuthMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ContextAuthMode fromValue(String value) { - for (ContextAuthMode b : ContextAuthMode.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ContextAuthMode enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ContextAuthMode read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ContextAuthMode.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - ContextAuthMode.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/DetokenizeRecordResponseValueType.java b/src/main/java/com/skyflow/generated/rest/models/DetokenizeRecordResponseValueType.java deleted file mode 100644 index 346833e6..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/DetokenizeRecordResponseValueType.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Gets or Sets DetokenizeRecordResponseValueType - */ -@JsonAdapter(DetokenizeRecordResponseValueType.Adapter.class) -public enum DetokenizeRecordResponseValueType { - - NONE("NONE"), - - STRING("STRING"), - - INTEGER("INTEGER"), - - FLOAT("FLOAT"), - - BOOL("BOOL"), - - DATETIME("DATETIME"), - - JSON("JSON"), - - ARRAY("ARRAY"), - - DATE("DATE"); - - private String value; - - DetokenizeRecordResponseValueType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static DetokenizeRecordResponseValueType fromValue(String value) { - for (DetokenizeRecordResponseValueType b : DetokenizeRecordResponseValueType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final DetokenizeRecordResponseValueType enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public DetokenizeRecordResponseValueType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return DetokenizeRecordResponseValueType.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - DetokenizeRecordResponseValueType.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/GooglerpcStatus.java b/src/main/java/com/skyflow/generated/rest/models/GooglerpcStatus.java deleted file mode 100644 index 44ca3e7f..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/GooglerpcStatus.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.ProtobufAny; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * GooglerpcStatus - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class GooglerpcStatus { - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private Integer code; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message; - - public static final String SERIALIZED_NAME_DETAILS = "details"; - @SerializedName(SERIALIZED_NAME_DETAILS) - private List details = new ArrayList<>(); - - public GooglerpcStatus() { - } - - public GooglerpcStatus code(Integer code) { - this.code = code; - return this; - } - - /** - * Get code - * @return code - */ - @javax.annotation.Nullable - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - - public GooglerpcStatus message(String message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - public GooglerpcStatus details(List details) { - this.details = details; - return this; - } - - public GooglerpcStatus addDetailsItem(ProtobufAny detailsItem) { - if (this.details == null) { - this.details = new ArrayList<>(); - } - this.details.add(detailsItem); - return this; - } - - /** - * Get details - * @return details - */ - @javax.annotation.Nullable - public List getDetails() { - return details; - } - - public void setDetails(List details) { - this.details = details; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GooglerpcStatus googlerpcStatus = (GooglerpcStatus) o; - return Objects.equals(this.code, googlerpcStatus.code) && - Objects.equals(this.message, googlerpcStatus.message) && - Objects.equals(this.details, googlerpcStatus.details); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, details); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GooglerpcStatus {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" details: ").append(toIndentedString(details)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("code"); - openapiFields.add("message"); - openapiFields.add("details"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to GooglerpcStatus - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GooglerpcStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GooglerpcStatus is not found in the empty JSON string", GooglerpcStatus.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!GooglerpcStatus.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GooglerpcStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull() && !jsonObj.get("details").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `details` to be an array in the JSON string but got `%s`", jsonObj.get("details").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GooglerpcStatus.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GooglerpcStatus' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GooglerpcStatus.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GooglerpcStatus value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GooglerpcStatus read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of GooglerpcStatus given an JSON string - * - * @param jsonString JSON string - * @return An instance of GooglerpcStatus - * @throws IOException if the JSON string is invalid with respect to GooglerpcStatus - */ - public static GooglerpcStatus fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GooglerpcStatus.class); - } - - /** - * Convert an instance of GooglerpcStatus to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/ProtobufAny.java b/src/main/java/com/skyflow/generated/rest/models/ProtobufAny.java deleted file mode 100644 index 658d341e..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/ProtobufAny.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * ProtobufAny - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class ProtobufAny { - public static final String SERIALIZED_NAME_AT_TYPE = "@type"; - @SerializedName(SERIALIZED_NAME_AT_TYPE) - private String atType; - - public ProtobufAny() { - } - - public ProtobufAny atType(String atType) { - this.atType = atType; - return this; - } - - /** - * Get atType - * @return atType - */ - @javax.annotation.Nullable - public String getAtType() { - return atType; - } - - public void setAtType(String atType) { - this.atType = atType; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the ProtobufAny instance itself - */ - public ProtobufAny putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ProtobufAny protobufAny = (ProtobufAny) o; - return Objects.equals(this.atType, protobufAny.atType)&& - Objects.equals(this.additionalProperties, protobufAny.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(atType, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ProtobufAny {\n"); - sb.append(" atType: ").append(toIndentedString(atType)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("@type"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ProtobufAny - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ProtobufAny.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in ProtobufAny is not found in the empty JSON string", ProtobufAny.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("@type") != null && !jsonObj.get("@type").isJsonNull()) && !jsonObj.get("@type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `@type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("@type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ProtobufAny.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ProtobufAny' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ProtobufAny.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, ProtobufAny value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public ProtobufAny read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - ProtobufAny instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of ProtobufAny given an JSON string - * - * @param jsonString JSON string - * @return An instance of ProtobufAny - * @throws IOException if the JSON string is invalid with respect to ProtobufAny - */ - public static ProtobufAny fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ProtobufAny.class); - } - - /** - * Convert an instance of ProtobufAny to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/QueryServiceExecuteQueryBody.java b/src/main/java/com/skyflow/generated/rest/models/QueryServiceExecuteQueryBody.java deleted file mode 100644 index 3a7790a0..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/QueryServiceExecuteQueryBody.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * QueryServiceExecuteQueryBody - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class QueryServiceExecuteQueryBody { - public static final String SERIALIZED_NAME_QUERY = "query"; - @SerializedName(SERIALIZED_NAME_QUERY) - private String query; - - public QueryServiceExecuteQueryBody() { - } - - public QueryServiceExecuteQueryBody query(String query) { - this.query = query; - return this; - } - - /** - * The SQL query to execute.<br><br><b>Supported commands:</b> <ul> <li><code>SELECT</code></li> </ul> <b>Supported operators:</b> <ul> <li><code>&gt;</code></li> <li><code>&lt;</code></li> <li><code>=</code></li> <li><code>AND</code></li> <li><code>OR</code></li> <li><code>NOT</code></li> <li><code>LIKE</code></li> <li><code>ILIKE</code></li> <li><code>NULL</code></li> <li><code>NOT NULL</code></li> </ul> <b>Supported keywords:</b> <ul> <li><code>FROM</code></li> <li><code>JOIN</code></li> <li><code>INNER JOIN</code></li> <li><code>LEFT OUTER JOIN</code></li> <li><code>LEFT JOIN</code></li> <li><code>RIGHT OUTER JOIN</code></li> <li><code>RIGHT JOIN</code></li> <li><code>FULL OUTER JOIN</code></li> <li><code>FULL JOIN</code></li> <li><code>OFFSET</code></li> <li><code>LIMIT</code></li> <li><code>WHERE</code></li> </ul> <b>Supported functions:</b> <ul> <li><code>AVG()</code></li> <li><code>SUM()</code></li> <li><code>COUNT()</code></li> <li><code>MIN()</code></li> <li><code>MAX()</code></li> <li><code>REDACTION()</code></li> </ul> - * @return query - */ - @javax.annotation.Nullable - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - QueryServiceExecuteQueryBody queryServiceExecuteQueryBody = (QueryServiceExecuteQueryBody) o; - return Objects.equals(this.query, queryServiceExecuteQueryBody.query); - } - - @Override - public int hashCode() { - return Objects.hash(query); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class QueryServiceExecuteQueryBody {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("query"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to QueryServiceExecuteQueryBody - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!QueryServiceExecuteQueryBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in QueryServiceExecuteQueryBody is not found in the empty JSON string", QueryServiceExecuteQueryBody.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!QueryServiceExecuteQueryBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryServiceExecuteQueryBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!QueryServiceExecuteQueryBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'QueryServiceExecuteQueryBody' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(QueryServiceExecuteQueryBody.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, QueryServiceExecuteQueryBody value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public QueryServiceExecuteQueryBody read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of QueryServiceExecuteQueryBody given an JSON string - * - * @param jsonString JSON string - * @return An instance of QueryServiceExecuteQueryBody - * @throws IOException if the JSON string is invalid with respect to QueryServiceExecuteQueryBody - */ - public static QueryServiceExecuteQueryBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, QueryServiceExecuteQueryBody.class); - } - - /** - * Convert an instance of QueryServiceExecuteQueryBody to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/RecordServiceBatchOperationBody.java b/src/main/java/com/skyflow/generated/rest/models/RecordServiceBatchOperationBody.java deleted file mode 100644 index ec0c3f95..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/RecordServiceBatchOperationBody.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1BYOT; -import com.skyflow.generated.rest.models.V1BatchRecord; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * RecordServiceBatchOperationBody - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class RecordServiceBatchOperationBody { - public static final String SERIALIZED_NAME_RECORDS = "records"; - @SerializedName(SERIALIZED_NAME_RECORDS) - private List records = new ArrayList<>(); - - public static final String SERIALIZED_NAME_CONTINUE_ON_ERROR = "continueOnError"; - @SerializedName(SERIALIZED_NAME_CONTINUE_ON_ERROR) - private Boolean continueOnError; - - public static final String SERIALIZED_NAME_BYOT = "byot"; - @SerializedName(SERIALIZED_NAME_BYOT) - private V1BYOT byot = V1BYOT.DISABLE; - - public RecordServiceBatchOperationBody() { - } - - public RecordServiceBatchOperationBody records(List records) { - this.records = records; - return this; - } - - public RecordServiceBatchOperationBody addRecordsItem(V1BatchRecord recordsItem) { - if (this.records == null) { - this.records = new ArrayList<>(); - } - this.records.add(recordsItem); - return this; - } - - /** - * Record operations to perform. - * @return records - */ - @javax.annotation.Nullable - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - - public RecordServiceBatchOperationBody continueOnError(Boolean continueOnError) { - this.continueOnError = continueOnError; - return this; - } - - /** - * Continue performing operations on partial errors. - * @return continueOnError - */ - @javax.annotation.Nullable - public Boolean getContinueOnError() { - return continueOnError; - } - - public void setContinueOnError(Boolean continueOnError) { - this.continueOnError = continueOnError; - } - - - public RecordServiceBatchOperationBody byot(V1BYOT byot) { - this.byot = byot; - return this; - } - - /** - * Get byot - * @return byot - */ - @javax.annotation.Nullable - public V1BYOT getByot() { - return byot; - } - - public void setByot(V1BYOT byot) { - this.byot = byot; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RecordServiceBatchOperationBody recordServiceBatchOperationBody = (RecordServiceBatchOperationBody) o; - return Objects.equals(this.records, recordServiceBatchOperationBody.records) && - Objects.equals(this.continueOnError, recordServiceBatchOperationBody.continueOnError) && - Objects.equals(this.byot, recordServiceBatchOperationBody.byot); - } - - @Override - public int hashCode() { - return Objects.hash(records, continueOnError, byot); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RecordServiceBatchOperationBody {\n"); - sb.append(" records: ").append(toIndentedString(records)).append("\n"); - sb.append(" continueOnError: ").append(toIndentedString(continueOnError)).append("\n"); - sb.append(" byot: ").append(toIndentedString(byot)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("records"); - openapiFields.add("continueOnError"); - openapiFields.add("byot"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to RecordServiceBatchOperationBody - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!RecordServiceBatchOperationBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in RecordServiceBatchOperationBody is not found in the empty JSON string", RecordServiceBatchOperationBody.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RecordServiceBatchOperationBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecordServiceBatchOperationBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("records") != null && !jsonObj.get("records").isJsonNull()) { - JsonArray jsonArrayrecords = jsonObj.getAsJsonArray("records"); - if (jsonArrayrecords != null) { - // ensure the json data is an array - if (!jsonObj.get("records").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `records` to be an array in the JSON string but got `%s`", jsonObj.get("records").toString())); - } - - // validate the optional field `records` (array) - for (int i = 0; i < jsonArrayrecords.size(); i++) { - V1BatchRecord.validateJsonElement(jsonArrayrecords.get(i)); - }; - } - } - // validate the optional field `byot` - if (jsonObj.get("byot") != null && !jsonObj.get("byot").isJsonNull()) { - V1BYOT.validateJsonElement(jsonObj.get("byot")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!RecordServiceBatchOperationBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RecordServiceBatchOperationBody' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(RecordServiceBatchOperationBody.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, RecordServiceBatchOperationBody value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RecordServiceBatchOperationBody read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of RecordServiceBatchOperationBody given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordServiceBatchOperationBody - * @throws IOException if the JSON string is invalid with respect to RecordServiceBatchOperationBody - */ - public static RecordServiceBatchOperationBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RecordServiceBatchOperationBody.class); - } - - /** - * Convert an instance of RecordServiceBatchOperationBody to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/RecordServiceBulkDeleteRecordBody.java b/src/main/java/com/skyflow/generated/rest/models/RecordServiceBulkDeleteRecordBody.java deleted file mode 100644 index b7358e49..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/RecordServiceBulkDeleteRecordBody.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * RecordServiceBulkDeleteRecordBody - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class RecordServiceBulkDeleteRecordBody { - public static final String SERIALIZED_NAME_SKYFLOW_IDS = "skyflow_ids"; - @SerializedName(SERIALIZED_NAME_SKYFLOW_IDS) - private List skyflowIds = new ArrayList<>(); - - public RecordServiceBulkDeleteRecordBody() { - } - - public RecordServiceBulkDeleteRecordBody skyflowIds(List skyflowIds) { - this.skyflowIds = skyflowIds; - return this; - } - - public RecordServiceBulkDeleteRecordBody addSkyflowIdsItem(String skyflowIdsItem) { - if (this.skyflowIds == null) { - this.skyflowIds = new ArrayList<>(); - } - this.skyflowIds.add(skyflowIdsItem); - return this; - } - - /** - * `skyflow_id` values of the records to delete. If `*` is specified, this operation deletes all records in the table. - * @return skyflowIds - */ - @javax.annotation.Nullable - public List getSkyflowIds() { - return skyflowIds; - } - - public void setSkyflowIds(List skyflowIds) { - this.skyflowIds = skyflowIds; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RecordServiceBulkDeleteRecordBody recordServiceBulkDeleteRecordBody = (RecordServiceBulkDeleteRecordBody) o; - return Objects.equals(this.skyflowIds, recordServiceBulkDeleteRecordBody.skyflowIds); - } - - @Override - public int hashCode() { - return Objects.hash(skyflowIds); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RecordServiceBulkDeleteRecordBody {\n"); - sb.append(" skyflowIds: ").append(toIndentedString(skyflowIds)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("skyflow_ids"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to RecordServiceBulkDeleteRecordBody - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!RecordServiceBulkDeleteRecordBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in RecordServiceBulkDeleteRecordBody is not found in the empty JSON string", RecordServiceBulkDeleteRecordBody.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RecordServiceBulkDeleteRecordBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecordServiceBulkDeleteRecordBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // ensure the optional json data is an array if present - if (jsonObj.get("skyflow_ids") != null && !jsonObj.get("skyflow_ids").isJsonNull() && !jsonObj.get("skyflow_ids").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `skyflow_ids` to be an array in the JSON string but got `%s`", jsonObj.get("skyflow_ids").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!RecordServiceBulkDeleteRecordBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RecordServiceBulkDeleteRecordBody' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(RecordServiceBulkDeleteRecordBody.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, RecordServiceBulkDeleteRecordBody value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RecordServiceBulkDeleteRecordBody read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of RecordServiceBulkDeleteRecordBody given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordServiceBulkDeleteRecordBody - * @throws IOException if the JSON string is invalid with respect to RecordServiceBulkDeleteRecordBody - */ - public static RecordServiceBulkDeleteRecordBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RecordServiceBulkDeleteRecordBody.class); - } - - /** - * Convert an instance of RecordServiceBulkDeleteRecordBody to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/RecordServiceInsertRecordBody.java b/src/main/java/com/skyflow/generated/rest/models/RecordServiceInsertRecordBody.java deleted file mode 100644 index 0ffe7ce8..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/RecordServiceInsertRecordBody.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1BYOT; -import com.skyflow.generated.rest.models.V1FieldRecords; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * RecordServiceInsertRecordBody - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class RecordServiceInsertRecordBody { - public static final String SERIALIZED_NAME_RECORDS = "records"; - @SerializedName(SERIALIZED_NAME_RECORDS) - private List records = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TOKENIZATION = "tokenization"; - @SerializedName(SERIALIZED_NAME_TOKENIZATION) - private Boolean tokenization; - - public static final String SERIALIZED_NAME_UPSERT = "upsert"; - @SerializedName(SERIALIZED_NAME_UPSERT) - private String upsert; - - public static final String SERIALIZED_NAME_HOMOGENEOUS = "homogeneous"; - @SerializedName(SERIALIZED_NAME_HOMOGENEOUS) - private Boolean homogeneous = false; - - public static final String SERIALIZED_NAME_BYOT = "byot"; - @SerializedName(SERIALIZED_NAME_BYOT) - private V1BYOT byot = V1BYOT.DISABLE; - - public RecordServiceInsertRecordBody() { - } - - public RecordServiceInsertRecordBody records(List records) { - this.records = records; - return this; - } - - public RecordServiceInsertRecordBody addRecordsItem(V1FieldRecords recordsItem) { - if (this.records == null) { - this.records = new ArrayList<>(); - } - this.records.add(recordsItem); - return this; - } - - /** - * Record values and tokens. - * @return records - */ - @javax.annotation.Nullable - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - - public RecordServiceInsertRecordBody tokenization(Boolean tokenization) { - this.tokenization = tokenization; - return this; - } - - /** - * If `true`, this operation returns tokens for fields with tokenization enabled. - * @return tokenization - */ - @javax.annotation.Nullable - public Boolean getTokenization() { - return tokenization; - } - - public void setTokenization(Boolean tokenization) { - this.tokenization = tokenization; - } - - - public RecordServiceInsertRecordBody upsert(String upsert) { - this.upsert = upsert; - return this; - } - - /** - * Name of a unique column 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.<br /><br />When you upsert a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed. - * @return upsert - */ - @javax.annotation.Nullable - public String getUpsert() { - return upsert; - } - - public void setUpsert(String upsert) { - this.upsert = upsert; - } - - - public RecordServiceInsertRecordBody homogeneous(Boolean homogeneous) { - this.homogeneous = homogeneous; - return this; - } - - /** - * If `true`, this operation mandates that all the records have the same fields. This parameter does not work with upsert. - * @return homogeneous - */ - @javax.annotation.Nullable - public Boolean getHomogeneous() { - return homogeneous; - } - - public void setHomogeneous(Boolean homogeneous) { - this.homogeneous = homogeneous; - } - - - public RecordServiceInsertRecordBody byot(V1BYOT byot) { - this.byot = byot; - return this; - } - - /** - * Get byot - * @return byot - */ - @javax.annotation.Nullable - public V1BYOT getByot() { - return byot; - } - - public void setByot(V1BYOT byot) { - this.byot = byot; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RecordServiceInsertRecordBody recordServiceInsertRecordBody = (RecordServiceInsertRecordBody) o; - return Objects.equals(this.records, recordServiceInsertRecordBody.records) && - Objects.equals(this.tokenization, recordServiceInsertRecordBody.tokenization) && - Objects.equals(this.upsert, recordServiceInsertRecordBody.upsert) && - Objects.equals(this.homogeneous, recordServiceInsertRecordBody.homogeneous) && - Objects.equals(this.byot, recordServiceInsertRecordBody.byot); - } - - @Override - public int hashCode() { - return Objects.hash(records, tokenization, upsert, homogeneous, byot); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RecordServiceInsertRecordBody {\n"); - sb.append(" records: ").append(toIndentedString(records)).append("\n"); - sb.append(" tokenization: ").append(toIndentedString(tokenization)).append("\n"); - sb.append(" upsert: ").append(toIndentedString(upsert)).append("\n"); - sb.append(" homogeneous: ").append(toIndentedString(homogeneous)).append("\n"); - sb.append(" byot: ").append(toIndentedString(byot)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("records"); - openapiFields.add("tokenization"); - openapiFields.add("upsert"); - openapiFields.add("homogeneous"); - openapiFields.add("byot"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to RecordServiceInsertRecordBody - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!RecordServiceInsertRecordBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in RecordServiceInsertRecordBody is not found in the empty JSON string", RecordServiceInsertRecordBody.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RecordServiceInsertRecordBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecordServiceInsertRecordBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("records") != null && !jsonObj.get("records").isJsonNull()) { - JsonArray jsonArrayrecords = jsonObj.getAsJsonArray("records"); - if (jsonArrayrecords != null) { - // ensure the json data is an array - if (!jsonObj.get("records").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `records` to be an array in the JSON string but got `%s`", jsonObj.get("records").toString())); - } - - // validate the optional field `records` (array) - for (int i = 0; i < jsonArrayrecords.size(); i++) { - V1FieldRecords.validateJsonElement(jsonArrayrecords.get(i)); - }; - } - } - if ((jsonObj.get("upsert") != null && !jsonObj.get("upsert").isJsonNull()) && !jsonObj.get("upsert").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `upsert` to be a primitive type in the JSON string but got `%s`", jsonObj.get("upsert").toString())); - } - // validate the optional field `byot` - if (jsonObj.get("byot") != null && !jsonObj.get("byot").isJsonNull()) { - V1BYOT.validateJsonElement(jsonObj.get("byot")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!RecordServiceInsertRecordBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RecordServiceInsertRecordBody' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(RecordServiceInsertRecordBody.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, RecordServiceInsertRecordBody value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RecordServiceInsertRecordBody read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of RecordServiceInsertRecordBody given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordServiceInsertRecordBody - * @throws IOException if the JSON string is invalid with respect to RecordServiceInsertRecordBody - */ - public static RecordServiceInsertRecordBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RecordServiceInsertRecordBody.class); - } - - /** - * Convert an instance of RecordServiceInsertRecordBody to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/RecordServiceUpdateRecordBody.java b/src/main/java/com/skyflow/generated/rest/models/RecordServiceUpdateRecordBody.java deleted file mode 100644 index 27e8f48a..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/RecordServiceUpdateRecordBody.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1BYOT; -import com.skyflow.generated.rest.models.V1FieldRecords; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * RecordServiceUpdateRecordBody - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class RecordServiceUpdateRecordBody { - public static final String SERIALIZED_NAME_RECORD = "record"; - @SerializedName(SERIALIZED_NAME_RECORD) - private V1FieldRecords record; - - public static final String SERIALIZED_NAME_TOKENIZATION = "tokenization"; - @SerializedName(SERIALIZED_NAME_TOKENIZATION) - private Boolean tokenization; - - public static final String SERIALIZED_NAME_BYOT = "byot"; - @SerializedName(SERIALIZED_NAME_BYOT) - private V1BYOT byot = V1BYOT.DISABLE; - - public RecordServiceUpdateRecordBody() { - } - - public RecordServiceUpdateRecordBody record(V1FieldRecords record) { - this.record = record; - return this; - } - - /** - * Get record - * @return record - */ - @javax.annotation.Nullable - public V1FieldRecords getRecord() { - return record; - } - - public void setRecord(V1FieldRecords record) { - this.record = record; - } - - - public RecordServiceUpdateRecordBody tokenization(Boolean tokenization) { - this.tokenization = tokenization; - return this; - } - - /** - * If `true`, this operation returns tokens for fields with tokenization enabled. - * @return tokenization - */ - @javax.annotation.Nullable - public Boolean getTokenization() { - return tokenization; - } - - public void setTokenization(Boolean tokenization) { - this.tokenization = tokenization; - } - - - public RecordServiceUpdateRecordBody byot(V1BYOT byot) { - this.byot = byot; - return this; - } - - /** - * Get byot - * @return byot - */ - @javax.annotation.Nullable - public V1BYOT getByot() { - return byot; - } - - public void setByot(V1BYOT byot) { - this.byot = byot; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RecordServiceUpdateRecordBody recordServiceUpdateRecordBody = (RecordServiceUpdateRecordBody) o; - return Objects.equals(this.record, recordServiceUpdateRecordBody.record) && - Objects.equals(this.tokenization, recordServiceUpdateRecordBody.tokenization) && - Objects.equals(this.byot, recordServiceUpdateRecordBody.byot); - } - - @Override - public int hashCode() { - return Objects.hash(record, tokenization, byot); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RecordServiceUpdateRecordBody {\n"); - sb.append(" record: ").append(toIndentedString(record)).append("\n"); - sb.append(" tokenization: ").append(toIndentedString(tokenization)).append("\n"); - sb.append(" byot: ").append(toIndentedString(byot)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("record"); - openapiFields.add("tokenization"); - openapiFields.add("byot"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to RecordServiceUpdateRecordBody - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!RecordServiceUpdateRecordBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in RecordServiceUpdateRecordBody is not found in the empty JSON string", RecordServiceUpdateRecordBody.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RecordServiceUpdateRecordBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecordServiceUpdateRecordBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `record` - if (jsonObj.get("record") != null && !jsonObj.get("record").isJsonNull()) { - V1FieldRecords.validateJsonElement(jsonObj.get("record")); - } - // validate the optional field `byot` - if (jsonObj.get("byot") != null && !jsonObj.get("byot").isJsonNull()) { - V1BYOT.validateJsonElement(jsonObj.get("byot")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!RecordServiceUpdateRecordBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RecordServiceUpdateRecordBody' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(RecordServiceUpdateRecordBody.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, RecordServiceUpdateRecordBody value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RecordServiceUpdateRecordBody read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of RecordServiceUpdateRecordBody given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordServiceUpdateRecordBody - * @throws IOException if the JSON string is invalid with respect to RecordServiceUpdateRecordBody - */ - public static RecordServiceUpdateRecordBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RecordServiceUpdateRecordBody.class); - } - - /** - * Convert an instance of RecordServiceUpdateRecordBody to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/RedactionEnumREDACTION.java b/src/main/java/com/skyflow/generated/rest/models/RedactionEnumREDACTION.java deleted file mode 100644 index e0c8ea98..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/RedactionEnumREDACTION.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Redaction type. Subject to policies assigned to the API caller. When used for detokenization, only supported for vaults that support [column groups](/tokenization-column-groups/). - */ -@JsonAdapter(RedactionEnumREDACTION.Adapter.class) -public enum RedactionEnumREDACTION { - - DEFAULT("DEFAULT"), - - REDACTED("REDACTED"), - - MASKED("MASKED"), - - PLAIN_TEXT("PLAIN_TEXT"); - - private String value; - - RedactionEnumREDACTION(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static RedactionEnumREDACTION fromValue(String value) { - for (RedactionEnumREDACTION b : RedactionEnumREDACTION.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final RedactionEnumREDACTION enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RedactionEnumREDACTION read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return RedactionEnumREDACTION.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - RedactionEnumREDACTION.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/RequestActionType.java b/src/main/java/com/skyflow/generated/rest/models/RequestActionType.java deleted file mode 100644 index d5e979d8..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/RequestActionType.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Gets or Sets RequestActionType - */ -@JsonAdapter(RequestActionType.Adapter.class) -public enum RequestActionType { - - NONE("NONE"), - - ASSIGN("ASSIGN"), - - CREATE("CREATE"), - - DELETE("DELETE"), - - EXECUTE("EXECUTE"), - - LIST("LIST"), - - READ("READ"), - - UNASSIGN("UNASSIGN"), - - UPDATE("UPDATE"), - - VALIDATE("VALIDATE"), - - LOGIN("LOGIN"), - - ROTATE("ROTATE"), - - SCHEDULEROTATION("SCHEDULEROTATION"), - - SCHEDULEROTATIONALERT("SCHEDULEROTATIONALERT"), - - IMPORT("IMPORT"), - - GETIMPORTPARAMETERS("GETIMPORTPARAMETERS"), - - PING("PING"), - - GETCLOUDPROVIDER("GETCLOUDPROVIDER"); - - private String value; - - RequestActionType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static RequestActionType fromValue(String value) { - for (RequestActionType b : RequestActionType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final RequestActionType enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RequestActionType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return RequestActionType.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - RequestActionType.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1AuditAfterOptions.java b/src/main/java/com/skyflow/generated/rest/models/V1AuditAfterOptions.java deleted file mode 100644 index faf2c5b3..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1AuditAfterOptions.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1AuditAfterOptions - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1AuditAfterOptions { - public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - @SerializedName(SERIALIZED_NAME_TIMESTAMP) - private String timestamp; - - public static final String SERIALIZED_NAME_CHANGE_I_D = "changeID"; - @SerializedName(SERIALIZED_NAME_CHANGE_I_D) - private String changeID; - - public V1AuditAfterOptions() { - } - - public V1AuditAfterOptions timestamp(String timestamp) { - this.timestamp = timestamp; - return this; - } - - /** - * 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 timestamp - */ - @javax.annotation.Nullable - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - - public V1AuditAfterOptions changeID(String changeID) { - this.changeID = changeID; - return this; - } - - /** - * 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 changeID - */ - @javax.annotation.Nullable - public String getChangeID() { - return changeID; - } - - public void setChangeID(String changeID) { - this.changeID = changeID; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1AuditAfterOptions v1AuditAfterOptions = (V1AuditAfterOptions) o; - return Objects.equals(this.timestamp, v1AuditAfterOptions.timestamp) && - Objects.equals(this.changeID, v1AuditAfterOptions.changeID); - } - - @Override - public int hashCode() { - return Objects.hash(timestamp, changeID); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1AuditAfterOptions {\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" changeID: ").append(toIndentedString(changeID)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("timestamp"); - openapiFields.add("changeID"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1AuditAfterOptions - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1AuditAfterOptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1AuditAfterOptions is not found in the empty JSON string", V1AuditAfterOptions.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1AuditAfterOptions.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1AuditAfterOptions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("timestamp") != null && !jsonObj.get("timestamp").isJsonNull()) && !jsonObj.get("timestamp").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); - } - if ((jsonObj.get("changeID") != null && !jsonObj.get("changeID").isJsonNull()) && !jsonObj.get("changeID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `changeID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("changeID").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1AuditAfterOptions.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1AuditAfterOptions' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1AuditAfterOptions.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1AuditAfterOptions value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1AuditAfterOptions read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1AuditAfterOptions given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1AuditAfterOptions - * @throws IOException if the JSON string is invalid with respect to V1AuditAfterOptions - */ - public static V1AuditAfterOptions fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1AuditAfterOptions.class); - } - - /** - * Convert an instance of V1AuditAfterOptions to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1AuditEventResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1AuditEventResponse.java deleted file mode 100644 index 97134351..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1AuditEventResponse.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.AuditEventData; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Contains fields for defining Response Properties. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1AuditEventResponse { - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private Integer code; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AuditEventData data; - - public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - @SerializedName(SERIALIZED_NAME_TIMESTAMP) - private String timestamp; - - public V1AuditEventResponse() { - } - - public V1AuditEventResponse code(Integer code) { - this.code = code; - return this; - } - - /** - * The status of the overall operation. - * @return code - */ - @javax.annotation.Nullable - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - - public V1AuditEventResponse message(String message) { - this.message = message; - return this; - } - - /** - * The status message for the overall operation. - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - public V1AuditEventResponse data(AuditEventData data) { - this.data = data; - return this; - } - - /** - * Get data - * @return data - */ - @javax.annotation.Nullable - public AuditEventData getData() { - return data; - } - - public void setData(AuditEventData data) { - this.data = data; - } - - - public V1AuditEventResponse timestamp(String timestamp) { - this.timestamp = timestamp; - return this; - } - - /** - * time when this response is generated, use extention method to set it. - * @return timestamp - */ - @javax.annotation.Nullable - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1AuditEventResponse v1AuditEventResponse = (V1AuditEventResponse) o; - return Objects.equals(this.code, v1AuditEventResponse.code) && - Objects.equals(this.message, v1AuditEventResponse.message) && - Objects.equals(this.data, v1AuditEventResponse.data) && - Objects.equals(this.timestamp, v1AuditEventResponse.timestamp); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, data, timestamp); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1AuditEventResponse {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("code"); - openapiFields.add("message"); - openapiFields.add("data"); - openapiFields.add("timestamp"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1AuditEventResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1AuditEventResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1AuditEventResponse is not found in the empty JSON string", V1AuditEventResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1AuditEventResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1AuditEventResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); - } - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - AuditEventData.validateJsonElement(jsonObj.get("data")); - } - if ((jsonObj.get("timestamp") != null && !jsonObj.get("timestamp").isJsonNull()) && !jsonObj.get("timestamp").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1AuditEventResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1AuditEventResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1AuditEventResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1AuditEventResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1AuditEventResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1AuditEventResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1AuditEventResponse - * @throws IOException if the JSON string is invalid with respect to V1AuditEventResponse - */ - public static V1AuditEventResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1AuditEventResponse.class); - } - - /** - * Convert an instance of V1AuditEventResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1AuditResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1AuditResponse.java deleted file mode 100644 index 1d0268b4..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1AuditResponse.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1AuditAfterOptions; -import com.skyflow.generated.rest.models.V1AuditResponseEvent; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1AuditResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1AuditResponse { - public static final String SERIALIZED_NAME_EVENT = "event"; - @SerializedName(SERIALIZED_NAME_EVENT) - private List event = new ArrayList<>(); - - public static final String SERIALIZED_NAME_NEXT_OPS = "nextOps"; - @SerializedName(SERIALIZED_NAME_NEXT_OPS) - private V1AuditAfterOptions nextOps; - - public V1AuditResponse() { - } - - public V1AuditResponse event(List event) { - this.event = event; - return this; - } - - public V1AuditResponse addEventItem(V1AuditResponseEvent eventItem) { - if (this.event == null) { - this.event = new ArrayList<>(); - } - this.event.add(eventItem); - return this; - } - - /** - * Events matching the query. - * @return event - */ - @javax.annotation.Nullable - public List getEvent() { - return event; - } - - public void setEvent(List event) { - this.event = event; - } - - - public V1AuditResponse nextOps(V1AuditAfterOptions nextOps) { - this.nextOps = nextOps; - return this; - } - - /** - * Get nextOps - * @return nextOps - */ - @javax.annotation.Nullable - public V1AuditAfterOptions getNextOps() { - return nextOps; - } - - public void setNextOps(V1AuditAfterOptions nextOps) { - this.nextOps = nextOps; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1AuditResponse v1AuditResponse = (V1AuditResponse) o; - return Objects.equals(this.event, v1AuditResponse.event) && - Objects.equals(this.nextOps, v1AuditResponse.nextOps); - } - - @Override - public int hashCode() { - return Objects.hash(event, nextOps); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1AuditResponse {\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" nextOps: ").append(toIndentedString(nextOps)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("event"); - openapiFields.add("nextOps"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1AuditResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1AuditResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1AuditResponse is not found in the empty JSON string", V1AuditResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1AuditResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1AuditResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("event") != null && !jsonObj.get("event").isJsonNull()) { - JsonArray jsonArrayevent = jsonObj.getAsJsonArray("event"); - if (jsonArrayevent != null) { - // ensure the json data is an array - if (!jsonObj.get("event").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `event` to be an array in the JSON string but got `%s`", jsonObj.get("event").toString())); - } - - // validate the optional field `event` (array) - for (int i = 0; i < jsonArrayevent.size(); i++) { - V1AuditResponseEvent.validateJsonElement(jsonArrayevent.get(i)); - }; - } - } - // validate the optional field `nextOps` - if (jsonObj.get("nextOps") != null && !jsonObj.get("nextOps").isJsonNull()) { - V1AuditAfterOptions.validateJsonElement(jsonObj.get("nextOps")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1AuditResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1AuditResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1AuditResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1AuditResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1AuditResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1AuditResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1AuditResponse - * @throws IOException if the JSON string is invalid with respect to V1AuditResponse - */ - public static V1AuditResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1AuditResponse.class); - } - - /** - * Convert an instance of V1AuditResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1AuditResponseEvent.java b/src/main/java/com/skyflow/generated/rest/models/V1AuditResponseEvent.java deleted file mode 100644 index 0e2070ae..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1AuditResponseEvent.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.AuditEventContext; -import com.skyflow.generated.rest.models.V1AuditEventResponse; -import com.skyflow.generated.rest.models.V1AuditResponseEventRequest; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Audit event details. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1AuditResponseEvent { - public static final String SERIALIZED_NAME_CONTEXT = "context"; - @SerializedName(SERIALIZED_NAME_CONTEXT) - private AuditEventContext context; - - public static final String SERIALIZED_NAME_REQUEST = "request"; - @SerializedName(SERIALIZED_NAME_REQUEST) - private V1AuditResponseEventRequest request; - - public static final String SERIALIZED_NAME_RESPONSE = "response"; - @SerializedName(SERIALIZED_NAME_RESPONSE) - private V1AuditEventResponse response; - - public static final String SERIALIZED_NAME_PARENT_ACCOUNT_I_D = "parentAccountID"; - @SerializedName(SERIALIZED_NAME_PARENT_ACCOUNT_I_D) - private String parentAccountID; - - public static final String SERIALIZED_NAME_ACCOUNT_I_D = "accountID"; - @SerializedName(SERIALIZED_NAME_ACCOUNT_I_D) - private String accountID; - - public static final String SERIALIZED_NAME_RESOURCE_I_DS = "resourceIDs"; - @SerializedName(SERIALIZED_NAME_RESOURCE_I_DS) - private List resourceIDs = new ArrayList<>(); - - public V1AuditResponseEvent() { - } - - public V1AuditResponseEvent context(AuditEventContext context) { - this.context = context; - return this; - } - - /** - * Get context - * @return context - */ - @javax.annotation.Nullable - public AuditEventContext getContext() { - return context; - } - - public void setContext(AuditEventContext context) { - this.context = context; - } - - - public V1AuditResponseEvent request(V1AuditResponseEventRequest request) { - this.request = request; - return this; - } - - /** - * Get request - * @return request - */ - @javax.annotation.Nullable - public V1AuditResponseEventRequest getRequest() { - return request; - } - - public void setRequest(V1AuditResponseEventRequest request) { - this.request = request; - } - - - public V1AuditResponseEvent response(V1AuditEventResponse response) { - this.response = response; - return this; - } - - /** - * Get response - * @return response - */ - @javax.annotation.Nullable - public V1AuditEventResponse getResponse() { - return response; - } - - public void setResponse(V1AuditEventResponse response) { - this.response = response; - } - - - public V1AuditResponseEvent parentAccountID(String parentAccountID) { - this.parentAccountID = parentAccountID; - return this; - } - - /** - * Parent account ID of the account that made the request, if any. - * @return parentAccountID - */ - @javax.annotation.Nullable - public String getParentAccountID() { - return parentAccountID; - } - - public void setParentAccountID(String parentAccountID) { - this.parentAccountID = parentAccountID; - } - - - public V1AuditResponseEvent accountID(String accountID) { - this.accountID = accountID; - return this; - } - - /** - * ID of the account that made the request. - * @return accountID - */ - @javax.annotation.Nullable - public String getAccountID() { - return accountID; - } - - public void setAccountID(String accountID) { - this.accountID = accountID; - } - - - public V1AuditResponseEvent resourceIDs(List resourceIDs) { - this.resourceIDs = resourceIDs; - return this; - } - - public V1AuditResponseEvent addResourceIDsItem(String resourceIDsItem) { - if (this.resourceIDs == null) { - this.resourceIDs = new ArrayList<>(); - } - this.resourceIDs.add(resourceIDsItem); - return this; - } - - /** - * IDs for resources involved in the event. Presented in `{resourceType}/{resourceID}` format. For example, `VAULT/cd1d815aa09b4cbfbb803bd20349f202`. - * @return resourceIDs - */ - @javax.annotation.Nullable - public List getResourceIDs() { - return resourceIDs; - } - - public void setResourceIDs(List resourceIDs) { - this.resourceIDs = resourceIDs; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1AuditResponseEvent v1AuditResponseEvent = (V1AuditResponseEvent) o; - return Objects.equals(this.context, v1AuditResponseEvent.context) && - Objects.equals(this.request, v1AuditResponseEvent.request) && - Objects.equals(this.response, v1AuditResponseEvent.response) && - Objects.equals(this.parentAccountID, v1AuditResponseEvent.parentAccountID) && - Objects.equals(this.accountID, v1AuditResponseEvent.accountID) && - Objects.equals(this.resourceIDs, v1AuditResponseEvent.resourceIDs); - } - - @Override - public int hashCode() { - return Objects.hash(context, request, response, parentAccountID, accountID, resourceIDs); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1AuditResponseEvent {\n"); - sb.append(" context: ").append(toIndentedString(context)).append("\n"); - sb.append(" request: ").append(toIndentedString(request)).append("\n"); - sb.append(" response: ").append(toIndentedString(response)).append("\n"); - sb.append(" parentAccountID: ").append(toIndentedString(parentAccountID)).append("\n"); - sb.append(" accountID: ").append(toIndentedString(accountID)).append("\n"); - sb.append(" resourceIDs: ").append(toIndentedString(resourceIDs)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("context"); - openapiFields.add("request"); - openapiFields.add("response"); - openapiFields.add("parentAccountID"); - openapiFields.add("accountID"); - openapiFields.add("resourceIDs"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1AuditResponseEvent - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1AuditResponseEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1AuditResponseEvent is not found in the empty JSON string", V1AuditResponseEvent.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1AuditResponseEvent.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1AuditResponseEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `context` - if (jsonObj.get("context") != null && !jsonObj.get("context").isJsonNull()) { - AuditEventContext.validateJsonElement(jsonObj.get("context")); - } - // validate the optional field `request` - if (jsonObj.get("request") != null && !jsonObj.get("request").isJsonNull()) { - V1AuditResponseEventRequest.validateJsonElement(jsonObj.get("request")); - } - // validate the optional field `response` - if (jsonObj.get("response") != null && !jsonObj.get("response").isJsonNull()) { - V1AuditEventResponse.validateJsonElement(jsonObj.get("response")); - } - if ((jsonObj.get("parentAccountID") != null && !jsonObj.get("parentAccountID").isJsonNull()) && !jsonObj.get("parentAccountID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `parentAccountID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentAccountID").toString())); - } - if ((jsonObj.get("accountID") != null && !jsonObj.get("accountID").isJsonNull()) && !jsonObj.get("accountID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `accountID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountID").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("resourceIDs") != null && !jsonObj.get("resourceIDs").isJsonNull() && !jsonObj.get("resourceIDs").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceIDs` to be an array in the JSON string but got `%s`", jsonObj.get("resourceIDs").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1AuditResponseEvent.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1AuditResponseEvent' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1AuditResponseEvent.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1AuditResponseEvent value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1AuditResponseEvent read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1AuditResponseEvent given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1AuditResponseEvent - * @throws IOException if the JSON string is invalid with respect to V1AuditResponseEvent - */ - public static V1AuditResponseEvent fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1AuditResponseEvent.class); - } - - /** - * Convert an instance of V1AuditResponseEvent to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1AuditResponseEventRequest.java b/src/main/java/com/skyflow/generated/rest/models/V1AuditResponseEventRequest.java deleted file mode 100644 index d4b69f55..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1AuditResponseEventRequest.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.AuditEventAuditResourceType; -import com.skyflow.generated.rest.models.AuditEventData; -import com.skyflow.generated.rest.models.AuditEventHTTPInfo; -import com.skyflow.generated.rest.models.RequestActionType; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Contains fields for defining Request Properties. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1AuditResponseEventRequest { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AuditEventData data; - - public static final String SERIALIZED_NAME_API_NAME = "apiName"; - @SerializedName(SERIALIZED_NAME_API_NAME) - private String apiName; - - public static final String SERIALIZED_NAME_WORKSPACE_I_D = "workspaceID"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_I_D) - private String workspaceID; - - public static final String SERIALIZED_NAME_VAULT_I_D = "vaultID"; - @SerializedName(SERIALIZED_NAME_VAULT_I_D) - private String vaultID; - - public static final String SERIALIZED_NAME_TAGS = "tags"; - @SerializedName(SERIALIZED_NAME_TAGS) - private List tags = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - @SerializedName(SERIALIZED_NAME_TIMESTAMP) - private String timestamp; - - public static final String SERIALIZED_NAME_ACTION_TYPE = "actionType"; - @SerializedName(SERIALIZED_NAME_ACTION_TYPE) - private RequestActionType actionType = RequestActionType.NONE; - - public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) - private AuditEventAuditResourceType resourceType = AuditEventAuditResourceType.NONE_API; - - public static final String SERIALIZED_NAME_HTTP_INFO = "httpInfo"; - @SerializedName(SERIALIZED_NAME_HTTP_INFO) - private AuditEventHTTPInfo httpInfo; - - public V1AuditResponseEventRequest() { - } - - public V1AuditResponseEventRequest data(AuditEventData data) { - this.data = data; - return this; - } - - /** - * Get data - * @return data - */ - @javax.annotation.Nullable - public AuditEventData getData() { - return data; - } - - public void setData(AuditEventData data) { - this.data = data; - } - - - public V1AuditResponseEventRequest apiName(String apiName) { - this.apiName = apiName; - return this; - } - - /** - * API name. - * @return apiName - */ - @javax.annotation.Nullable - public String getApiName() { - return apiName; - } - - public void setApiName(String apiName) { - this.apiName = apiName; - } - - - public V1AuditResponseEventRequest workspaceID(String workspaceID) { - this.workspaceID = workspaceID; - return this; - } - - /** - * The workspaceID (if any) of the request. - * @return workspaceID - */ - @javax.annotation.Nullable - public String getWorkspaceID() { - return workspaceID; - } - - public void setWorkspaceID(String workspaceID) { - this.workspaceID = workspaceID; - } - - - public V1AuditResponseEventRequest vaultID(String vaultID) { - this.vaultID = vaultID; - return this; - } - - /** - * The vaultID (if any) of the request. - * @return vaultID - */ - @javax.annotation.Nullable - public String getVaultID() { - return vaultID; - } - - public void setVaultID(String vaultID) { - this.vaultID = vaultID; - } - - - public V1AuditResponseEventRequest tags(List tags) { - this.tags = tags; - return this; - } - - public V1AuditResponseEventRequest addTagsItem(String tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList<>(); - } - this.tags.add(tagsItem); - return this; - } - - /** - * Tags associated with the event. To provide better search capabilities. Like login. - * @return tags - */ - @javax.annotation.Nullable - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - - public V1AuditResponseEventRequest timestamp(String timestamp) { - this.timestamp = timestamp; - return this; - } - - /** - * time when this request is generated, use extention method to set it. - * @return timestamp - */ - @javax.annotation.Nullable - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - - public V1AuditResponseEventRequest actionType(RequestActionType actionType) { - this.actionType = actionType; - return this; - } - - /** - * Get actionType - * @return actionType - */ - @javax.annotation.Nullable - public RequestActionType getActionType() { - return actionType; - } - - public void setActionType(RequestActionType actionType) { - this.actionType = actionType; - } - - - public V1AuditResponseEventRequest resourceType(AuditEventAuditResourceType resourceType) { - this.resourceType = resourceType; - return this; - } - - /** - * Get resourceType - * @return resourceType - */ - @javax.annotation.Nullable - public AuditEventAuditResourceType getResourceType() { - return resourceType; - } - - public void setResourceType(AuditEventAuditResourceType resourceType) { - this.resourceType = resourceType; - } - - - public V1AuditResponseEventRequest httpInfo(AuditEventHTTPInfo httpInfo) { - this.httpInfo = httpInfo; - return this; - } - - /** - * Get httpInfo - * @return httpInfo - */ - @javax.annotation.Nullable - public AuditEventHTTPInfo getHttpInfo() { - return httpInfo; - } - - public void setHttpInfo(AuditEventHTTPInfo httpInfo) { - this.httpInfo = httpInfo; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1AuditResponseEventRequest v1AuditResponseEventRequest = (V1AuditResponseEventRequest) o; - return Objects.equals(this.data, v1AuditResponseEventRequest.data) && - Objects.equals(this.apiName, v1AuditResponseEventRequest.apiName) && - Objects.equals(this.workspaceID, v1AuditResponseEventRequest.workspaceID) && - Objects.equals(this.vaultID, v1AuditResponseEventRequest.vaultID) && - Objects.equals(this.tags, v1AuditResponseEventRequest.tags) && - Objects.equals(this.timestamp, v1AuditResponseEventRequest.timestamp) && - Objects.equals(this.actionType, v1AuditResponseEventRequest.actionType) && - Objects.equals(this.resourceType, v1AuditResponseEventRequest.resourceType) && - Objects.equals(this.httpInfo, v1AuditResponseEventRequest.httpInfo); - } - - @Override - public int hashCode() { - return Objects.hash(data, apiName, workspaceID, vaultID, tags, timestamp, actionType, resourceType, httpInfo); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1AuditResponseEventRequest {\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" apiName: ").append(toIndentedString(apiName)).append("\n"); - sb.append(" workspaceID: ").append(toIndentedString(workspaceID)).append("\n"); - sb.append(" vaultID: ").append(toIndentedString(vaultID)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" actionType: ").append(toIndentedString(actionType)).append("\n"); - sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); - sb.append(" httpInfo: ").append(toIndentedString(httpInfo)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("data"); - openapiFields.add("apiName"); - openapiFields.add("workspaceID"); - openapiFields.add("vaultID"); - openapiFields.add("tags"); - openapiFields.add("timestamp"); - openapiFields.add("actionType"); - openapiFields.add("resourceType"); - openapiFields.add("httpInfo"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1AuditResponseEventRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1AuditResponseEventRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1AuditResponseEventRequest is not found in the empty JSON string", V1AuditResponseEventRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1AuditResponseEventRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1AuditResponseEventRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - AuditEventData.validateJsonElement(jsonObj.get("data")); - } - if ((jsonObj.get("apiName") != null && !jsonObj.get("apiName").isJsonNull()) && !jsonObj.get("apiName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `apiName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("apiName").toString())); - } - if ((jsonObj.get("workspaceID") != null && !jsonObj.get("workspaceID").isJsonNull()) && !jsonObj.get("workspaceID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceID").toString())); - } - if ((jsonObj.get("vaultID") != null && !jsonObj.get("vaultID").isJsonNull()) && !jsonObj.get("vaultID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `vaultID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vaultID").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); - } - if ((jsonObj.get("timestamp") != null && !jsonObj.get("timestamp").isJsonNull()) && !jsonObj.get("timestamp").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); - } - // validate the optional field `actionType` - if (jsonObj.get("actionType") != null && !jsonObj.get("actionType").isJsonNull()) { - RequestActionType.validateJsonElement(jsonObj.get("actionType")); - } - // validate the optional field `resourceType` - if (jsonObj.get("resourceType") != null && !jsonObj.get("resourceType").isJsonNull()) { - AuditEventAuditResourceType.validateJsonElement(jsonObj.get("resourceType")); - } - // validate the optional field `httpInfo` - if (jsonObj.get("httpInfo") != null && !jsonObj.get("httpInfo").isJsonNull()) { - AuditEventHTTPInfo.validateJsonElement(jsonObj.get("httpInfo")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1AuditResponseEventRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1AuditResponseEventRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1AuditResponseEventRequest.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1AuditResponseEventRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1AuditResponseEventRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1AuditResponseEventRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1AuditResponseEventRequest - * @throws IOException if the JSON string is invalid with respect to V1AuditResponseEventRequest - */ - public static V1AuditResponseEventRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1AuditResponseEventRequest.class); - } - - /** - * Convert an instance of V1AuditResponseEventRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1BINListRequest.java b/src/main/java/com/skyflow/generated/rest/models/V1BINListRequest.java deleted file mode 100644 index 292bd674..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1BINListRequest.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1VaultSchemaConfig; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Request to return specific card metadata. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1BINListRequest { - public static final String SERIALIZED_NAME_FIELDS = "fields"; - @SerializedName(SERIALIZED_NAME_FIELDS) - private List fields = new ArrayList<>(); - - public static final String SERIALIZED_NAME_B_I_N = "BIN"; - @SerializedName(SERIALIZED_NAME_B_I_N) - private String BIN; - - public static final String SERIALIZED_NAME_VAULT_SCHEMA_CONFIG = "vault_schema_config"; - @SerializedName(SERIALIZED_NAME_VAULT_SCHEMA_CONFIG) - private V1VaultSchemaConfig vaultSchemaConfig; - - public static final String SERIALIZED_NAME_SKYFLOW_ID = "skyflow_id"; - @SerializedName(SERIALIZED_NAME_SKYFLOW_ID) - private String skyflowId; - - public V1BINListRequest() { - } - - public V1BINListRequest fields(List fields) { - this.fields = fields; - return this; - } - - public V1BINListRequest addFieldsItem(String fieldsItem) { - if (this.fields == null) { - this.fields = new ArrayList<>(); - } - this.fields.add(fieldsItem); - return this; - } - - /** - * Fields to return. If not specified, all fields are returned. - * @return fields - */ - @javax.annotation.Nullable - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } - - - public V1BINListRequest BIN(String BIN) { - this.BIN = BIN; - return this; - } - - /** - * BIN of the card. - * @return BIN - */ - @javax.annotation.Nullable - public String getBIN() { - return BIN; - } - - public void setBIN(String BIN) { - this.BIN = BIN; - } - - - public V1BINListRequest vaultSchemaConfig(V1VaultSchemaConfig vaultSchemaConfig) { - this.vaultSchemaConfig = vaultSchemaConfig; - return this; - } - - /** - * Get vaultSchemaConfig - * @return vaultSchemaConfig - */ - @javax.annotation.Nullable - public V1VaultSchemaConfig getVaultSchemaConfig() { - return vaultSchemaConfig; - } - - public void setVaultSchemaConfig(V1VaultSchemaConfig vaultSchemaConfig) { - this.vaultSchemaConfig = vaultSchemaConfig; - } - - - public V1BINListRequest skyflowId(String skyflowId) { - this.skyflowId = skyflowId; - return this; - } - - /** - * <code>skyflow_id</code> of the record. - * @return skyflowId - */ - @javax.annotation.Nullable - public String getSkyflowId() { - return skyflowId; - } - - public void setSkyflowId(String skyflowId) { - this.skyflowId = skyflowId; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1BINListRequest v1BINListRequest = (V1BINListRequest) o; - return Objects.equals(this.fields, v1BINListRequest.fields) && - Objects.equals(this.BIN, v1BINListRequest.BIN) && - Objects.equals(this.vaultSchemaConfig, v1BINListRequest.vaultSchemaConfig) && - Objects.equals(this.skyflowId, v1BINListRequest.skyflowId); - } - - @Override - public int hashCode() { - return Objects.hash(fields, BIN, vaultSchemaConfig, skyflowId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1BINListRequest {\n"); - sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); - sb.append(" BIN: ").append(toIndentedString(BIN)).append("\n"); - sb.append(" vaultSchemaConfig: ").append(toIndentedString(vaultSchemaConfig)).append("\n"); - sb.append(" skyflowId: ").append(toIndentedString(skyflowId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("fields"); - openapiFields.add("BIN"); - openapiFields.add("vault_schema_config"); - openapiFields.add("skyflow_id"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1BINListRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1BINListRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1BINListRequest is not found in the empty JSON string", V1BINListRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1BINListRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1BINListRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // ensure the optional json data is an array if present - if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull() && !jsonObj.get("fields").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); - } - if ((jsonObj.get("BIN") != null && !jsonObj.get("BIN").isJsonNull()) && !jsonObj.get("BIN").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `BIN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("BIN").toString())); - } - // validate the optional field `vault_schema_config` - if (jsonObj.get("vault_schema_config") != null && !jsonObj.get("vault_schema_config").isJsonNull()) { - V1VaultSchemaConfig.validateJsonElement(jsonObj.get("vault_schema_config")); - } - if ((jsonObj.get("skyflow_id") != null && !jsonObj.get("skyflow_id").isJsonNull()) && !jsonObj.get("skyflow_id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `skyflow_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("skyflow_id").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1BINListRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1BINListRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1BINListRequest.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1BINListRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1BINListRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1BINListRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1BINListRequest - * @throws IOException if the JSON string is invalid with respect to V1BINListRequest - */ - public static V1BINListRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1BINListRequest.class); - } - - /** - * Convert an instance of V1BINListRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1BINListResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1BINListResponse.java deleted file mode 100644 index 47f30610..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1BINListResponse.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1Card; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Response to the Get BIN request. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1BINListResponse { - public static final String SERIALIZED_NAME_CARDS_DATA = "cards_data"; - @SerializedName(SERIALIZED_NAME_CARDS_DATA) - private List cardsData = new ArrayList<>(); - - public V1BINListResponse() { - } - - public V1BINListResponse cardsData(List cardsData) { - this.cardsData = cardsData; - return this; - } - - public V1BINListResponse addCardsDataItem(V1Card cardsDataItem) { - if (this.cardsData == null) { - this.cardsData = new ArrayList<>(); - } - this.cardsData.add(cardsDataItem); - return this; - } - - /** - * Card metadata associated with the specified BIN. - * @return cardsData - */ - @javax.annotation.Nullable - public List getCardsData() { - return cardsData; - } - - public void setCardsData(List cardsData) { - this.cardsData = cardsData; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1BINListResponse v1BINListResponse = (V1BINListResponse) o; - return Objects.equals(this.cardsData, v1BINListResponse.cardsData); - } - - @Override - public int hashCode() { - return Objects.hash(cardsData); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1BINListResponse {\n"); - sb.append(" cardsData: ").append(toIndentedString(cardsData)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("cards_data"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1BINListResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1BINListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1BINListResponse is not found in the empty JSON string", V1BINListResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1BINListResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1BINListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("cards_data") != null && !jsonObj.get("cards_data").isJsonNull()) { - JsonArray jsonArraycardsData = jsonObj.getAsJsonArray("cards_data"); - if (jsonArraycardsData != null) { - // ensure the json data is an array - if (!jsonObj.get("cards_data").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `cards_data` to be an array in the JSON string but got `%s`", jsonObj.get("cards_data").toString())); - } - - // validate the optional field `cards_data` (array) - for (int i = 0; i < jsonArraycardsData.size(); i++) { - V1Card.validateJsonElement(jsonArraycardsData.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1BINListResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1BINListResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1BINListResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1BINListResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1BINListResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1BINListResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1BINListResponse - * @throws IOException if the JSON string is invalid with respect to V1BINListResponse - */ - public static V1BINListResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1BINListResponse.class); - } - - /** - * Convert an instance of V1BINListResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1BYOT.java b/src/main/java/com/skyflow/generated/rest/models/V1BYOT.java deleted file mode 100644 index 28bd87e9..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1BYOT.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Token insertion behavior. - DISABLE: Tokens aren't allowed for any fields. If tokens are specified, the request fails. - ENABLE: Tokens are allowed—but not required—for all fields. If tokens are specified, they're inserted. - ENABLE_STRICT: Tokens are required for all fields. If tokens are specified, they're inserted. If not, the request fails. - */ -@JsonAdapter(V1BYOT.Adapter.class) -public enum V1BYOT { - - DISABLE("DISABLE"), - - ENABLE("ENABLE"), - - ENABLE_STRICT("ENABLE_STRICT"); - - private String value; - - V1BYOT(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static V1BYOT fromValue(String value) { - for (V1BYOT b : V1BYOT.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final V1BYOT enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public V1BYOT read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return V1BYOT.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - V1BYOT.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1BatchOperationResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1BatchOperationResponse.java deleted file mode 100644 index 2d98e66e..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1BatchOperationResponse.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1BatchOperationResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1BatchOperationResponse { - public static final String SERIALIZED_NAME_VAULT_I_D = "vaultID"; - @SerializedName(SERIALIZED_NAME_VAULT_I_D) - private String vaultID; - - public static final String SERIALIZED_NAME_RESPONSES = "responses"; - @SerializedName(SERIALIZED_NAME_RESPONSES) - private List responses = new ArrayList<>(); - - public V1BatchOperationResponse() { - } - - public V1BatchOperationResponse vaultID(String vaultID) { - this.vaultID = vaultID; - return this; - } - - /** - * ID of the vault. - * @return vaultID - */ - @javax.annotation.Nullable - public String getVaultID() { - return vaultID; - } - - public void setVaultID(String vaultID) { - this.vaultID = vaultID; - } - - - public V1BatchOperationResponse responses(List responses) { - this.responses = responses; - return this; - } - - public V1BatchOperationResponse addResponsesItem(Object responsesItem) { - if (this.responses == null) { - this.responses = new ArrayList<>(); - } - this.responses.add(responsesItem); - return this; - } - - /** - * Responses in the same order as in the request. Responses have the same payload structure as their corresponding APIs: <br/><ul><li>`POST` returns an Insert Records response.</li><li>`PUT` returns an Update Record response.</li><li>`GET` returns a Get Record response.</li><li>`DELETE` returns a Delete Record response.</li></ul> - * @return responses - */ - @javax.annotation.Nullable - public List getResponses() { - return responses; - } - - public void setResponses(List responses) { - this.responses = responses; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1BatchOperationResponse v1BatchOperationResponse = (V1BatchOperationResponse) o; - return Objects.equals(this.vaultID, v1BatchOperationResponse.vaultID) && - Objects.equals(this.responses, v1BatchOperationResponse.responses); - } - - @Override - public int hashCode() { - return Objects.hash(vaultID, responses); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1BatchOperationResponse {\n"); - sb.append(" vaultID: ").append(toIndentedString(vaultID)).append("\n"); - sb.append(" responses: ").append(toIndentedString(responses)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("vaultID"); - openapiFields.add("responses"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1BatchOperationResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1BatchOperationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1BatchOperationResponse is not found in the empty JSON string", V1BatchOperationResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1BatchOperationResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1BatchOperationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("vaultID") != null && !jsonObj.get("vaultID").isJsonNull()) && !jsonObj.get("vaultID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `vaultID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vaultID").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("responses") != null && !jsonObj.get("responses").isJsonNull() && !jsonObj.get("responses").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `responses` to be an array in the JSON string but got `%s`", jsonObj.get("responses").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1BatchOperationResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1BatchOperationResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1BatchOperationResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1BatchOperationResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1BatchOperationResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1BatchOperationResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1BatchOperationResponse - * @throws IOException if the JSON string is invalid with respect to V1BatchOperationResponse - */ - public static V1BatchOperationResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1BatchOperationResponse.class); - } - - /** - * Convert an instance of V1BatchOperationResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1BatchRecord.java b/src/main/java/com/skyflow/generated/rest/models/V1BatchRecord.java deleted file mode 100644 index 21ab2cf9..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1BatchRecord.java +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.BatchRecordMethod; -import com.skyflow.generated.rest.models.RedactionEnumREDACTION; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1BatchRecord - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1BatchRecord { - public static final String SERIALIZED_NAME_FIELDS = "fields"; - @SerializedName(SERIALIZED_NAME_FIELDS) - private Object fields; - - public static final String SERIALIZED_NAME_TABLE_NAME = "tableName"; - @SerializedName(SERIALIZED_NAME_TABLE_NAME) - private String tableName; - - public static final String SERIALIZED_NAME_METHOD = "method"; - @SerializedName(SERIALIZED_NAME_METHOD) - private BatchRecordMethod method = BatchRecordMethod.NONE; - - public static final String SERIALIZED_NAME_BATCH_I_D = "batchID"; - @SerializedName(SERIALIZED_NAME_BATCH_I_D) - private String batchID; - - public static final String SERIALIZED_NAME_REDACTION = "redaction"; - @SerializedName(SERIALIZED_NAME_REDACTION) - private RedactionEnumREDACTION redaction = RedactionEnumREDACTION.DEFAULT; - - public static final String SERIALIZED_NAME_TOKENIZATION = "tokenization"; - @SerializedName(SERIALIZED_NAME_TOKENIZATION) - private Boolean tokenization; - - public static final String SERIALIZED_NAME_I_D = "ID"; - @SerializedName(SERIALIZED_NAME_I_D) - private String ID; - - public static final String SERIALIZED_NAME_DOWNLOAD_U_R_L = "downloadURL"; - @SerializedName(SERIALIZED_NAME_DOWNLOAD_U_R_L) - private Boolean downloadURL; - - public static final String SERIALIZED_NAME_UPSERT = "upsert"; - @SerializedName(SERIALIZED_NAME_UPSERT) - private String upsert; - - public static final String SERIALIZED_NAME_TOKENS = "tokens"; - @SerializedName(SERIALIZED_NAME_TOKENS) - private Object tokens; - - public V1BatchRecord() { - } - - public V1BatchRecord fields(Object fields) { - this.fields = fields; - return this; - } - - /** - * Field and value key pairs. For example, `{'field_1':'value_1', 'field_2':'value_2'}`. Only valid when `method` is `POST` or `PUT`. - * @return fields - */ - @javax.annotation.Nullable - public Object getFields() { - return fields; - } - - public void setFields(Object fields) { - this.fields = fields; - } - - - public V1BatchRecord tableName(String tableName) { - this.tableName = tableName; - return this; - } - - /** - * Name of the table to perform the operation on. - * @return tableName - */ - @javax.annotation.Nullable - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - - public V1BatchRecord method(BatchRecordMethod method) { - this.method = method; - return this; - } - - /** - * Get method - * @return method - */ - @javax.annotation.Nullable - public BatchRecordMethod getMethod() { - return method; - } - - public void setMethod(BatchRecordMethod method) { - this.method = method; - } - - - public V1BatchRecord batchID(String batchID) { - this.batchID = batchID; - return this; - } - - /** - * ID to group operations by. Operations in the same group are executed sequentially. - * @return batchID - */ - @javax.annotation.Nullable - public String getBatchID() { - return batchID; - } - - public void setBatchID(String batchID) { - this.batchID = batchID; - } - - - public V1BatchRecord redaction(RedactionEnumREDACTION redaction) { - this.redaction = redaction; - return this; - } - - /** - * Get redaction - * @return redaction - */ - @javax.annotation.Nullable - public RedactionEnumREDACTION getRedaction() { - return redaction; - } - - public void setRedaction(RedactionEnumREDACTION redaction) { - this.redaction = redaction; - } - - - public V1BatchRecord tokenization(Boolean tokenization) { - this.tokenization = tokenization; - return this; - } - - /** - * If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified. - * @return tokenization - */ - @javax.annotation.Nullable - public Boolean getTokenization() { - return tokenization; - } - - public void setTokenization(Boolean tokenization) { - this.tokenization = tokenization; - } - - - public V1BatchRecord ID(String ID) { - this.ID = ID; - return this; - } - - /** - * `skyflow_id` for the record. Only valid when `method` is `GET`, `DELETE`, or `PUT`. - * @return ID - */ - @javax.annotation.Nullable - public String getID() { - return ID; - } - - public void setID(String ID) { - this.ID = ID; - } - - - public V1BatchRecord downloadURL(Boolean downloadURL) { - this.downloadURL = downloadURL; - return this; - } - - /** - * If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. - * @return downloadURL - */ - @javax.annotation.Nullable - public Boolean getDownloadURL() { - return downloadURL; - } - - public void setDownloadURL(Boolean downloadURL) { - this.downloadURL = downloadURL; - } - - - public V1BatchRecord upsert(String upsert) { - this.upsert = upsert; - return this; - } - - /** - * Column that stores primary keys for upsert operations. The column must be marked as unique in the vault schema. Only valid when `method` is `POST`. - * @return upsert - */ - @javax.annotation.Nullable - public String getUpsert() { - return upsert; - } - - public void setUpsert(String upsert) { - this.upsert = upsert; - } - - - public V1BatchRecord tokens(Object tokens) { - this.tokens = tokens; - return this; - } - - /** - * Fields and tokens for the record. For example, `{'field_1':'token_1', 'field_2':'token_2'}`. - * @return tokens - */ - @javax.annotation.Nullable - public Object getTokens() { - return tokens; - } - - public void setTokens(Object tokens) { - this.tokens = tokens; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1BatchRecord v1BatchRecord = (V1BatchRecord) o; - return Objects.equals(this.fields, v1BatchRecord.fields) && - Objects.equals(this.tableName, v1BatchRecord.tableName) && - Objects.equals(this.method, v1BatchRecord.method) && - Objects.equals(this.batchID, v1BatchRecord.batchID) && - Objects.equals(this.redaction, v1BatchRecord.redaction) && - Objects.equals(this.tokenization, v1BatchRecord.tokenization) && - Objects.equals(this.ID, v1BatchRecord.ID) && - Objects.equals(this.downloadURL, v1BatchRecord.downloadURL) && - Objects.equals(this.upsert, v1BatchRecord.upsert) && - Objects.equals(this.tokens, v1BatchRecord.tokens); - } - - @Override - public int hashCode() { - return Objects.hash(fields, tableName, method, batchID, redaction, tokenization, ID, downloadURL, upsert, tokens); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1BatchRecord {\n"); - sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); - sb.append(" tableName: ").append(toIndentedString(tableName)).append("\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append(" batchID: ").append(toIndentedString(batchID)).append("\n"); - sb.append(" redaction: ").append(toIndentedString(redaction)).append("\n"); - sb.append(" tokenization: ").append(toIndentedString(tokenization)).append("\n"); - sb.append(" ID: ").append(toIndentedString(ID)).append("\n"); - sb.append(" downloadURL: ").append(toIndentedString(downloadURL)).append("\n"); - sb.append(" upsert: ").append(toIndentedString(upsert)).append("\n"); - sb.append(" tokens: ").append(toIndentedString(tokens)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("fields"); - openapiFields.add("tableName"); - openapiFields.add("method"); - openapiFields.add("batchID"); - openapiFields.add("redaction"); - openapiFields.add("tokenization"); - openapiFields.add("ID"); - openapiFields.add("downloadURL"); - openapiFields.add("upsert"); - openapiFields.add("tokens"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1BatchRecord - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1BatchRecord.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1BatchRecord is not found in the empty JSON string", V1BatchRecord.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1BatchRecord.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1BatchRecord` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("tableName") != null && !jsonObj.get("tableName").isJsonNull()) && !jsonObj.get("tableName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `tableName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tableName").toString())); - } - // validate the optional field `method` - if (jsonObj.get("method") != null && !jsonObj.get("method").isJsonNull()) { - BatchRecordMethod.validateJsonElement(jsonObj.get("method")); - } - if ((jsonObj.get("batchID") != null && !jsonObj.get("batchID").isJsonNull()) && !jsonObj.get("batchID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `batchID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("batchID").toString())); - } - // validate the optional field `redaction` - if (jsonObj.get("redaction") != null && !jsonObj.get("redaction").isJsonNull()) { - RedactionEnumREDACTION.validateJsonElement(jsonObj.get("redaction")); - } - if ((jsonObj.get("ID") != null && !jsonObj.get("ID").isJsonNull()) && !jsonObj.get("ID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `ID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ID").toString())); - } - if ((jsonObj.get("upsert") != null && !jsonObj.get("upsert").isJsonNull()) && !jsonObj.get("upsert").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `upsert` to be a primitive type in the JSON string but got `%s`", jsonObj.get("upsert").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1BatchRecord.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1BatchRecord' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1BatchRecord.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1BatchRecord value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1BatchRecord read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1BatchRecord given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1BatchRecord - * @throws IOException if the JSON string is invalid with respect to V1BatchRecord - */ - public static V1BatchRecord fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1BatchRecord.class); - } - - /** - * Convert an instance of V1BatchRecord to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1BulkDeleteRecordResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1BulkDeleteRecordResponse.java deleted file mode 100644 index 6a89ed40..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1BulkDeleteRecordResponse.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1BulkDeleteRecordResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1BulkDeleteRecordResponse { - public static final String SERIALIZED_NAME_RECORD_I_D_RESPONSE = "RecordIDResponse"; - @SerializedName(SERIALIZED_NAME_RECORD_I_D_RESPONSE) - private List recordIDResponse = new ArrayList<>(); - - public V1BulkDeleteRecordResponse() { - } - - public V1BulkDeleteRecordResponse recordIDResponse(List recordIDResponse) { - this.recordIDResponse = recordIDResponse; - return this; - } - - public V1BulkDeleteRecordResponse addRecordIDResponseItem(String recordIDResponseItem) { - if (this.recordIDResponse == null) { - this.recordIDResponse = new ArrayList<>(); - } - this.recordIDResponse.add(recordIDResponseItem); - return this; - } - - /** - * IDs for the deleted records, or `*` if all records were deleted. - * @return recordIDResponse - */ - @javax.annotation.Nullable - public List getRecordIDResponse() { - return recordIDResponse; - } - - public void setRecordIDResponse(List recordIDResponse) { - this.recordIDResponse = recordIDResponse; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1BulkDeleteRecordResponse v1BulkDeleteRecordResponse = (V1BulkDeleteRecordResponse) o; - return Objects.equals(this.recordIDResponse, v1BulkDeleteRecordResponse.recordIDResponse); - } - - @Override - public int hashCode() { - return Objects.hash(recordIDResponse); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1BulkDeleteRecordResponse {\n"); - sb.append(" recordIDResponse: ").append(toIndentedString(recordIDResponse)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("RecordIDResponse"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1BulkDeleteRecordResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1BulkDeleteRecordResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1BulkDeleteRecordResponse is not found in the empty JSON string", V1BulkDeleteRecordResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1BulkDeleteRecordResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1BulkDeleteRecordResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // ensure the optional json data is an array if present - if (jsonObj.get("RecordIDResponse") != null && !jsonObj.get("RecordIDResponse").isJsonNull() && !jsonObj.get("RecordIDResponse").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `RecordIDResponse` to be an array in the JSON string but got `%s`", jsonObj.get("RecordIDResponse").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1BulkDeleteRecordResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1BulkDeleteRecordResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1BulkDeleteRecordResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1BulkDeleteRecordResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1BulkDeleteRecordResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1BulkDeleteRecordResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1BulkDeleteRecordResponse - * @throws IOException if the JSON string is invalid with respect to V1BulkDeleteRecordResponse - */ - public static V1BulkDeleteRecordResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1BulkDeleteRecordResponse.class); - } - - /** - * Convert an instance of V1BulkDeleteRecordResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1BulkGetRecordResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1BulkGetRecordResponse.java deleted file mode 100644 index 2a935fe9..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1BulkGetRecordResponse.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1FieldRecords; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1BulkGetRecordResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1BulkGetRecordResponse { - public static final String SERIALIZED_NAME_RECORDS = "records"; - @SerializedName(SERIALIZED_NAME_RECORDS) - private List records = new ArrayList<>(); - - public V1BulkGetRecordResponse() { - } - - public V1BulkGetRecordResponse records(List records) { - this.records = records; - return this; - } - - public V1BulkGetRecordResponse addRecordsItem(V1FieldRecords recordsItem) { - if (this.records == null) { - this.records = new ArrayList<>(); - } - this.records.add(recordsItem); - return this; - } - - /** - * The specified records. - * @return records - */ - @javax.annotation.Nullable - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1BulkGetRecordResponse v1BulkGetRecordResponse = (V1BulkGetRecordResponse) o; - return Objects.equals(this.records, v1BulkGetRecordResponse.records); - } - - @Override - public int hashCode() { - return Objects.hash(records); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1BulkGetRecordResponse {\n"); - sb.append(" records: ").append(toIndentedString(records)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("records"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1BulkGetRecordResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1BulkGetRecordResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1BulkGetRecordResponse is not found in the empty JSON string", V1BulkGetRecordResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1BulkGetRecordResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1BulkGetRecordResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("records") != null && !jsonObj.get("records").isJsonNull()) { - JsonArray jsonArrayrecords = jsonObj.getAsJsonArray("records"); - if (jsonArrayrecords != null) { - // ensure the json data is an array - if (!jsonObj.get("records").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `records` to be an array in the JSON string but got `%s`", jsonObj.get("records").toString())); - } - - // validate the optional field `records` (array) - for (int i = 0; i < jsonArrayrecords.size(); i++) { - V1FieldRecords.validateJsonElement(jsonArrayrecords.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1BulkGetRecordResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1BulkGetRecordResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1BulkGetRecordResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1BulkGetRecordResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1BulkGetRecordResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1BulkGetRecordResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1BulkGetRecordResponse - * @throws IOException if the JSON string is invalid with respect to V1BulkGetRecordResponse - */ - public static V1BulkGetRecordResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1BulkGetRecordResponse.class); - } - - /** - * Convert an instance of V1BulkGetRecordResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1Card.java b/src/main/java/com/skyflow/generated/rest/models/V1Card.java deleted file mode 100644 index 5c8fb3cc..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1Card.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Card metadata of the requested BIN. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1Card { - public static final String SERIALIZED_NAME_B_I_N = "BIN"; - @SerializedName(SERIALIZED_NAME_B_I_N) - private String BIN; - - public static final String SERIALIZED_NAME_ISSUER_NAME = "issuer_name"; - @SerializedName(SERIALIZED_NAME_ISSUER_NAME) - private String issuerName; - - public static final String SERIALIZED_NAME_COUNTRY_CODE = "country_code"; - @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) - private String countryCode; - - public static final String SERIALIZED_NAME_CURRENCY = "currency"; - @SerializedName(SERIALIZED_NAME_CURRENCY) - private String currency; - - public static final String SERIALIZED_NAME_CARD_TYPE = "card_type"; - @SerializedName(SERIALIZED_NAME_CARD_TYPE) - private String cardType; - - public static final String SERIALIZED_NAME_CARD_CATEGORY = "card_category"; - @SerializedName(SERIALIZED_NAME_CARD_CATEGORY) - private String cardCategory; - - public static final String SERIALIZED_NAME_CARD_SCHEME = "card_scheme"; - @SerializedName(SERIALIZED_NAME_CARD_SCHEME) - private String cardScheme; - - public static final String SERIALIZED_NAME_CARD_LAST_FOUR_DIGITS = "card_last_four_digits"; - @SerializedName(SERIALIZED_NAME_CARD_LAST_FOUR_DIGITS) - private String cardLastFourDigits; - - public static final String SERIALIZED_NAME_CARD_EXPIRY = "card_expiry"; - @SerializedName(SERIALIZED_NAME_CARD_EXPIRY) - private String cardExpiry; - - public V1Card() { - } - - public V1Card BIN(String BIN) { - this.BIN = BIN; - return this; - } - - /** - * BIN of the card. - * @return BIN - */ - @javax.annotation.Nullable - public String getBIN() { - return BIN; - } - - public void setBIN(String BIN) { - this.BIN = BIN; - } - - - public V1Card issuerName(String issuerName) { - this.issuerName = issuerName; - return this; - } - - /** - * Name of the card issuer bank. - * @return issuerName - */ - @javax.annotation.Nullable - public String getIssuerName() { - return issuerName; - } - - public void setIssuerName(String issuerName) { - this.issuerName = issuerName; - } - - - public V1Card countryCode(String countryCode) { - this.countryCode = countryCode; - return this; - } - - /** - * Country code of the card. - * @return countryCode - */ - @javax.annotation.Nullable - public String getCountryCode() { - return countryCode; - } - - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - - - public V1Card currency(String currency) { - this.currency = currency; - return this; - } - - /** - * Currency of the card. - * @return currency - */ - @javax.annotation.Nullable - public String getCurrency() { - return currency; - } - - public void setCurrency(String currency) { - this.currency = currency; - } - - - public V1Card cardType(String cardType) { - this.cardType = cardType; - return this; - } - - /** - * Type of the card. - * @return cardType - */ - @javax.annotation.Nullable - public String getCardType() { - return cardType; - } - - public void setCardType(String cardType) { - this.cardType = cardType; - } - - - public V1Card cardCategory(String cardCategory) { - this.cardCategory = cardCategory; - return this; - } - - /** - * Category of the card. - * @return cardCategory - */ - @javax.annotation.Nullable - public String getCardCategory() { - return cardCategory; - } - - public void setCardCategory(String cardCategory) { - this.cardCategory = cardCategory; - } - - - public V1Card cardScheme(String cardScheme) { - this.cardScheme = cardScheme; - return this; - } - - /** - * Scheme of the card. - * @return cardScheme - */ - @javax.annotation.Nullable - public String getCardScheme() { - return cardScheme; - } - - public void setCardScheme(String cardScheme) { - this.cardScheme = cardScheme; - } - - - public V1Card cardLastFourDigits(String cardLastFourDigits) { - this.cardLastFourDigits = cardLastFourDigits; - return this; - } - - /** - * Last four digits of the card number. - * @return cardLastFourDigits - */ - @javax.annotation.Nullable - public String getCardLastFourDigits() { - return cardLastFourDigits; - } - - public void setCardLastFourDigits(String cardLastFourDigits) { - this.cardLastFourDigits = cardLastFourDigits; - } - - - public V1Card cardExpiry(String cardExpiry) { - this.cardExpiry = cardExpiry; - return this; - } - - /** - * Expiry date of the card. - * @return cardExpiry - */ - @javax.annotation.Nullable - public String getCardExpiry() { - return cardExpiry; - } - - public void setCardExpiry(String cardExpiry) { - this.cardExpiry = cardExpiry; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1Card v1Card = (V1Card) o; - return Objects.equals(this.BIN, v1Card.BIN) && - Objects.equals(this.issuerName, v1Card.issuerName) && - Objects.equals(this.countryCode, v1Card.countryCode) && - Objects.equals(this.currency, v1Card.currency) && - Objects.equals(this.cardType, v1Card.cardType) && - Objects.equals(this.cardCategory, v1Card.cardCategory) && - Objects.equals(this.cardScheme, v1Card.cardScheme) && - Objects.equals(this.cardLastFourDigits, v1Card.cardLastFourDigits) && - Objects.equals(this.cardExpiry, v1Card.cardExpiry); - } - - @Override - public int hashCode() { - return Objects.hash(BIN, issuerName, countryCode, currency, cardType, cardCategory, cardScheme, cardLastFourDigits, cardExpiry); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1Card {\n"); - sb.append(" BIN: ").append(toIndentedString(BIN)).append("\n"); - sb.append(" issuerName: ").append(toIndentedString(issuerName)).append("\n"); - sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); - sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); - sb.append(" cardType: ").append(toIndentedString(cardType)).append("\n"); - sb.append(" cardCategory: ").append(toIndentedString(cardCategory)).append("\n"); - sb.append(" cardScheme: ").append(toIndentedString(cardScheme)).append("\n"); - sb.append(" cardLastFourDigits: ").append(toIndentedString(cardLastFourDigits)).append("\n"); - sb.append(" cardExpiry: ").append(toIndentedString(cardExpiry)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("BIN"); - openapiFields.add("issuer_name"); - openapiFields.add("country_code"); - openapiFields.add("currency"); - openapiFields.add("card_type"); - openapiFields.add("card_category"); - openapiFields.add("card_scheme"); - openapiFields.add("card_last_four_digits"); - openapiFields.add("card_expiry"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1Card - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1Card.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1Card is not found in the empty JSON string", V1Card.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1Card.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1Card` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("BIN") != null && !jsonObj.get("BIN").isJsonNull()) && !jsonObj.get("BIN").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `BIN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("BIN").toString())); - } - if ((jsonObj.get("issuer_name") != null && !jsonObj.get("issuer_name").isJsonNull()) && !jsonObj.get("issuer_name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `issuer_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("issuer_name").toString())); - } - if ((jsonObj.get("country_code") != null && !jsonObj.get("country_code").isJsonNull()) && !jsonObj.get("country_code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `country_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("country_code").toString())); - } - if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); - } - if ((jsonObj.get("card_type") != null && !jsonObj.get("card_type").isJsonNull()) && !jsonObj.get("card_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_type").toString())); - } - if ((jsonObj.get("card_category") != null && !jsonObj.get("card_category").isJsonNull()) && !jsonObj.get("card_category").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_category` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_category").toString())); - } - if ((jsonObj.get("card_scheme") != null && !jsonObj.get("card_scheme").isJsonNull()) && !jsonObj.get("card_scheme").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_scheme` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_scheme").toString())); - } - if ((jsonObj.get("card_last_four_digits") != null && !jsonObj.get("card_last_four_digits").isJsonNull()) && !jsonObj.get("card_last_four_digits").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_last_four_digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_last_four_digits").toString())); - } - if ((jsonObj.get("card_expiry") != null && !jsonObj.get("card_expiry").isJsonNull()) && !jsonObj.get("card_expiry").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_expiry` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_expiry").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1Card.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1Card' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1Card.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1Card value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1Card read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1Card given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1Card - * @throws IOException if the JSON string is invalid with respect to V1Card - */ - public static V1Card fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1Card.class); - } - - /** - * Convert an instance of V1Card to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1DeleteFileResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1DeleteFileResponse.java deleted file mode 100644 index 9a3c2cb4..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1DeleteFileResponse.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1DeleteFileResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1DeleteFileResponse { - public static final String SERIALIZED_NAME_SKYFLOW_ID = "skyflow_id"; - @SerializedName(SERIALIZED_NAME_SKYFLOW_ID) - private String skyflowId; - - public static final String SERIALIZED_NAME_DELETED = "deleted"; - @SerializedName(SERIALIZED_NAME_DELETED) - private Boolean deleted; - - public V1DeleteFileResponse() { - } - - public V1DeleteFileResponse skyflowId(String skyflowId) { - this.skyflowId = skyflowId; - return this; - } - - /** - * ID of the record. - * @return skyflowId - */ - @javax.annotation.Nullable - public String getSkyflowId() { - return skyflowId; - } - - public void setSkyflowId(String skyflowId) { - this.skyflowId = skyflowId; - } - - - public V1DeleteFileResponse deleted(Boolean deleted) { - this.deleted = deleted; - return this; - } - - /** - * If `true`, the file was deleted. - * @return deleted - */ - @javax.annotation.Nullable - public Boolean getDeleted() { - return deleted; - } - - public void setDeleted(Boolean deleted) { - this.deleted = deleted; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1DeleteFileResponse v1DeleteFileResponse = (V1DeleteFileResponse) o; - return Objects.equals(this.skyflowId, v1DeleteFileResponse.skyflowId) && - Objects.equals(this.deleted, v1DeleteFileResponse.deleted); - } - - @Override - public int hashCode() { - return Objects.hash(skyflowId, deleted); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1DeleteFileResponse {\n"); - sb.append(" skyflowId: ").append(toIndentedString(skyflowId)).append("\n"); - sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("skyflow_id"); - openapiFields.add("deleted"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1DeleteFileResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1DeleteFileResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1DeleteFileResponse is not found in the empty JSON string", V1DeleteFileResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1DeleteFileResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1DeleteFileResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("skyflow_id") != null && !jsonObj.get("skyflow_id").isJsonNull()) && !jsonObj.get("skyflow_id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `skyflow_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("skyflow_id").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1DeleteFileResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1DeleteFileResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1DeleteFileResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1DeleteFileResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1DeleteFileResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1DeleteFileResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1DeleteFileResponse - * @throws IOException if the JSON string is invalid with respect to V1DeleteFileResponse - */ - public static V1DeleteFileResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1DeleteFileResponse.class); - } - - /** - * Convert an instance of V1DeleteFileResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1DeleteRecordResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1DeleteRecordResponse.java deleted file mode 100644 index 8ebf5c35..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1DeleteRecordResponse.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1DeleteRecordResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1DeleteRecordResponse { - public static final String SERIALIZED_NAME_SKYFLOW_ID = "skyflow_id"; - @SerializedName(SERIALIZED_NAME_SKYFLOW_ID) - private String skyflowId; - - public static final String SERIALIZED_NAME_DELETED = "deleted"; - @SerializedName(SERIALIZED_NAME_DELETED) - private Boolean deleted; - - public V1DeleteRecordResponse() { - } - - public V1DeleteRecordResponse skyflowId(String skyflowId) { - this.skyflowId = skyflowId; - return this; - } - - /** - * ID of the deleted record. - * @return skyflowId - */ - @javax.annotation.Nullable - public String getSkyflowId() { - return skyflowId; - } - - public void setSkyflowId(String skyflowId) { - this.skyflowId = skyflowId; - } - - - public V1DeleteRecordResponse deleted(Boolean deleted) { - this.deleted = deleted; - return this; - } - - /** - * If `true`, the record was deleted. - * @return deleted - */ - @javax.annotation.Nullable - public Boolean getDeleted() { - return deleted; - } - - public void setDeleted(Boolean deleted) { - this.deleted = deleted; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1DeleteRecordResponse v1DeleteRecordResponse = (V1DeleteRecordResponse) o; - return Objects.equals(this.skyflowId, v1DeleteRecordResponse.skyflowId) && - Objects.equals(this.deleted, v1DeleteRecordResponse.deleted); - } - - @Override - public int hashCode() { - return Objects.hash(skyflowId, deleted); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1DeleteRecordResponse {\n"); - sb.append(" skyflowId: ").append(toIndentedString(skyflowId)).append("\n"); - sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("skyflow_id"); - openapiFields.add("deleted"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1DeleteRecordResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1DeleteRecordResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1DeleteRecordResponse is not found in the empty JSON string", V1DeleteRecordResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1DeleteRecordResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1DeleteRecordResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("skyflow_id") != null && !jsonObj.get("skyflow_id").isJsonNull()) && !jsonObj.get("skyflow_id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `skyflow_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("skyflow_id").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1DeleteRecordResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1DeleteRecordResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1DeleteRecordResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1DeleteRecordResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1DeleteRecordResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1DeleteRecordResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1DeleteRecordResponse - * @throws IOException if the JSON string is invalid with respect to V1DeleteRecordResponse - */ - public static V1DeleteRecordResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1DeleteRecordResponse.class); - } - - /** - * Convert an instance of V1DeleteRecordResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizePayload.java b/src/main/java/com/skyflow/generated/rest/models/V1DetokenizePayload.java deleted file mode 100644 index fdc5c52e..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizePayload.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1DetokenizeRecordRequest; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1DetokenizePayload - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1DetokenizePayload { - public static final String SERIALIZED_NAME_DETOKENIZATION_PARAMETERS = "detokenizationParameters"; - @SerializedName(SERIALIZED_NAME_DETOKENIZATION_PARAMETERS) - private List detokenizationParameters = new ArrayList<>(); - - public static final String SERIALIZED_NAME_DOWNLOAD_U_R_L = "downloadURL"; - @SerializedName(SERIALIZED_NAME_DOWNLOAD_U_R_L) - private Boolean downloadURL; - - public static final String SERIALIZED_NAME_CONTINUE_ON_ERROR = "continueOnError"; - @SerializedName(SERIALIZED_NAME_CONTINUE_ON_ERROR) - private Boolean continueOnError = false; - - public V1DetokenizePayload() { - } - - public V1DetokenizePayload detokenizationParameters(List detokenizationParameters) { - this.detokenizationParameters = detokenizationParameters; - return this; - } - - public V1DetokenizePayload addDetokenizationParametersItem(V1DetokenizeRecordRequest detokenizationParametersItem) { - if (this.detokenizationParameters == null) { - this.detokenizationParameters = new ArrayList<>(); - } - this.detokenizationParameters.add(detokenizationParametersItem); - return this; - } - - /** - * Detokenization details. - * @return detokenizationParameters - */ - @javax.annotation.Nullable - public List getDetokenizationParameters() { - return detokenizationParameters; - } - - public void setDetokenizationParameters(List detokenizationParameters) { - this.detokenizationParameters = detokenizationParameters; - } - - - public V1DetokenizePayload downloadURL(Boolean downloadURL) { - this.downloadURL = downloadURL; - return this; - } - - /** - * If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. - * @return downloadURL - */ - @javax.annotation.Nullable - public Boolean getDownloadURL() { - return downloadURL; - } - - public void setDownloadURL(Boolean downloadURL) { - this.downloadURL = downloadURL; - } - - - public V1DetokenizePayload continueOnError(Boolean continueOnError) { - this.continueOnError = continueOnError; - return this; - } - - /** - * If `true`, the detokenization request continues even if an error occurs. - * @return continueOnError - */ - @javax.annotation.Nullable - public Boolean getContinueOnError() { - return continueOnError; - } - - public void setContinueOnError(Boolean continueOnError) { - this.continueOnError = continueOnError; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1DetokenizePayload v1DetokenizePayload = (V1DetokenizePayload) o; - return Objects.equals(this.detokenizationParameters, v1DetokenizePayload.detokenizationParameters) && - Objects.equals(this.downloadURL, v1DetokenizePayload.downloadURL) && - Objects.equals(this.continueOnError, v1DetokenizePayload.continueOnError); - } - - @Override - public int hashCode() { - return Objects.hash(detokenizationParameters, downloadURL, continueOnError); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1DetokenizePayload {\n"); - sb.append(" detokenizationParameters: ").append(toIndentedString(detokenizationParameters)).append("\n"); - sb.append(" downloadURL: ").append(toIndentedString(downloadURL)).append("\n"); - sb.append(" continueOnError: ").append(toIndentedString(continueOnError)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("detokenizationParameters"); - openapiFields.add("downloadURL"); - openapiFields.add("continueOnError"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1DetokenizePayload - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1DetokenizePayload.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1DetokenizePayload is not found in the empty JSON string", V1DetokenizePayload.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1DetokenizePayload.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1DetokenizePayload` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("detokenizationParameters") != null && !jsonObj.get("detokenizationParameters").isJsonNull()) { - JsonArray jsonArraydetokenizationParameters = jsonObj.getAsJsonArray("detokenizationParameters"); - if (jsonArraydetokenizationParameters != null) { - // ensure the json data is an array - if (!jsonObj.get("detokenizationParameters").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `detokenizationParameters` to be an array in the JSON string but got `%s`", jsonObj.get("detokenizationParameters").toString())); - } - - // validate the optional field `detokenizationParameters` (array) - for (int i = 0; i < jsonArraydetokenizationParameters.size(); i++) { - V1DetokenizeRecordRequest.validateJsonElement(jsonArraydetokenizationParameters.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1DetokenizePayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1DetokenizePayload' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1DetokenizePayload.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1DetokenizePayload value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1DetokenizePayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1DetokenizePayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1DetokenizePayload - * @throws IOException if the JSON string is invalid with respect to V1DetokenizePayload - */ - public static V1DetokenizePayload fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1DetokenizePayload.class); - } - - /** - * Convert an instance of V1DetokenizePayload to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeRecordRequest.java b/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeRecordRequest.java deleted file mode 100644 index 391fa2fc..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeRecordRequest.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.RedactionEnumREDACTION; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1DetokenizeRecordRequest - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1DetokenizeRecordRequest { - public static final String SERIALIZED_NAME_TOKEN = "token"; - @SerializedName(SERIALIZED_NAME_TOKEN) - private String token; - - public static final String SERIALIZED_NAME_REDACTION = "redaction"; - @SerializedName(SERIALIZED_NAME_REDACTION) - private RedactionEnumREDACTION redaction = RedactionEnumREDACTION.DEFAULT; - - public V1DetokenizeRecordRequest() { - } - - public V1DetokenizeRecordRequest token(String token) { - this.token = token; - return this; - } - - /** - * Token that identifies the record to detokenize. - * @return token - */ - @javax.annotation.Nullable - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - - public V1DetokenizeRecordRequest redaction(RedactionEnumREDACTION redaction) { - this.redaction = redaction; - return this; - } - - /** - * Get redaction - * @return redaction - */ - @javax.annotation.Nullable - public RedactionEnumREDACTION getRedaction() { - return redaction; - } - - public void setRedaction(RedactionEnumREDACTION redaction) { - this.redaction = redaction; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1DetokenizeRecordRequest v1DetokenizeRecordRequest = (V1DetokenizeRecordRequest) o; - return Objects.equals(this.token, v1DetokenizeRecordRequest.token) && - Objects.equals(this.redaction, v1DetokenizeRecordRequest.redaction); - } - - @Override - public int hashCode() { - return Objects.hash(token, redaction); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1DetokenizeRecordRequest {\n"); - sb.append(" token: ").append(toIndentedString(token)).append("\n"); - sb.append(" redaction: ").append(toIndentedString(redaction)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("token"); - openapiFields.add("redaction"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1DetokenizeRecordRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1DetokenizeRecordRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1DetokenizeRecordRequest is not found in the empty JSON string", V1DetokenizeRecordRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1DetokenizeRecordRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1DetokenizeRecordRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); - } - // validate the optional field `redaction` - if (jsonObj.get("redaction") != null && !jsonObj.get("redaction").isJsonNull()) { - RedactionEnumREDACTION.validateJsonElement(jsonObj.get("redaction")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1DetokenizeRecordRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1DetokenizeRecordRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1DetokenizeRecordRequest.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1DetokenizeRecordRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1DetokenizeRecordRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1DetokenizeRecordRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1DetokenizeRecordRequest - * @throws IOException if the JSON string is invalid with respect to V1DetokenizeRecordRequest - */ - public static V1DetokenizeRecordRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1DetokenizeRecordRequest.class); - } - - /** - * Convert an instance of V1DetokenizeRecordRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeRecordResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeRecordResponse.java deleted file mode 100644 index 5c223793..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeRecordResponse.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.DetokenizeRecordResponseValueType; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1DetokenizeRecordResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1DetokenizeRecordResponse { - public static final String SERIALIZED_NAME_TOKEN = "token"; - @SerializedName(SERIALIZED_NAME_TOKEN) - private String token; - - public static final String SERIALIZED_NAME_VALUE_TYPE = "valueType"; - @SerializedName(SERIALIZED_NAME_VALUE_TYPE) - private DetokenizeRecordResponseValueType valueType = DetokenizeRecordResponseValueType.NONE; - - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; - - public static final String SERIALIZED_NAME_ERROR = "error"; - @SerializedName(SERIALIZED_NAME_ERROR) - private String error; - - public V1DetokenizeRecordResponse() { - } - - public V1DetokenizeRecordResponse token(String token) { - this.token = token; - return this; - } - - /** - * Token of the record. - * @return token - */ - @javax.annotation.Nullable - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - - public V1DetokenizeRecordResponse valueType(DetokenizeRecordResponseValueType valueType) { - this.valueType = valueType; - return this; - } - - /** - * Get valueType - * @return valueType - */ - @javax.annotation.Nullable - public DetokenizeRecordResponseValueType getValueType() { - return valueType; - } - - public void setValueType(DetokenizeRecordResponseValueType valueType) { - this.valueType = valueType; - } - - - public V1DetokenizeRecordResponse value(String value) { - this.value = value; - return this; - } - - /** - * Data corresponding to the token. - * @return value - */ - @javax.annotation.Nullable - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - - public V1DetokenizeRecordResponse error(String error) { - this.error = error; - return this; - } - - /** - * Error if token isn't found. - * @return error - */ - @javax.annotation.Nullable - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1DetokenizeRecordResponse v1DetokenizeRecordResponse = (V1DetokenizeRecordResponse) o; - return Objects.equals(this.token, v1DetokenizeRecordResponse.token) && - Objects.equals(this.valueType, v1DetokenizeRecordResponse.valueType) && - Objects.equals(this.value, v1DetokenizeRecordResponse.value) && - Objects.equals(this.error, v1DetokenizeRecordResponse.error); - } - - @Override - public int hashCode() { - return Objects.hash(token, valueType, value, error); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1DetokenizeRecordResponse {\n"); - sb.append(" token: ").append(toIndentedString(token)).append("\n"); - sb.append(" valueType: ").append(toIndentedString(valueType)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" error: ").append(toIndentedString(error)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("token"); - openapiFields.add("valueType"); - openapiFields.add("value"); - openapiFields.add("error"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1DetokenizeRecordResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1DetokenizeRecordResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1DetokenizeRecordResponse is not found in the empty JSON string", V1DetokenizeRecordResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1DetokenizeRecordResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1DetokenizeRecordResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); - } - // validate the optional field `valueType` - if (jsonObj.get("valueType") != null && !jsonObj.get("valueType").isJsonNull()) { - DetokenizeRecordResponseValueType.validateJsonElement(jsonObj.get("valueType")); - } - if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); - } - if ((jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) && !jsonObj.get("error").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1DetokenizeRecordResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1DetokenizeRecordResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1DetokenizeRecordResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1DetokenizeRecordResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1DetokenizeRecordResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1DetokenizeRecordResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1DetokenizeRecordResponse - * @throws IOException if the JSON string is invalid with respect to V1DetokenizeRecordResponse - */ - public static V1DetokenizeRecordResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1DetokenizeRecordResponse.class); - } - - /** - * Convert an instance of V1DetokenizeRecordResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeResponse.java deleted file mode 100644 index ed996183..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1DetokenizeResponse.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1DetokenizeRecordResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1DetokenizeResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1DetokenizeResponse { - public static final String SERIALIZED_NAME_RECORDS = "records"; - @SerializedName(SERIALIZED_NAME_RECORDS) - private List records = new ArrayList<>(); - - public V1DetokenizeResponse() { - } - - public V1DetokenizeResponse records(List records) { - this.records = records; - return this; - } - - public V1DetokenizeResponse addRecordsItem(V1DetokenizeRecordResponse recordsItem) { - if (this.records == null) { - this.records = new ArrayList<>(); - } - this.records.add(recordsItem); - return this; - } - - /** - * Records corresponding to the specified tokens. - * @return records - */ - @javax.annotation.Nullable - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1DetokenizeResponse v1DetokenizeResponse = (V1DetokenizeResponse) o; - return Objects.equals(this.records, v1DetokenizeResponse.records); - } - - @Override - public int hashCode() { - return Objects.hash(records); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1DetokenizeResponse {\n"); - sb.append(" records: ").append(toIndentedString(records)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("records"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1DetokenizeResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1DetokenizeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1DetokenizeResponse is not found in the empty JSON string", V1DetokenizeResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1DetokenizeResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1DetokenizeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("records") != null && !jsonObj.get("records").isJsonNull()) { - JsonArray jsonArrayrecords = jsonObj.getAsJsonArray("records"); - if (jsonArrayrecords != null) { - // ensure the json data is an array - if (!jsonObj.get("records").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `records` to be an array in the JSON string but got `%s`", jsonObj.get("records").toString())); - } - - // validate the optional field `records` (array) - for (int i = 0; i < jsonArrayrecords.size(); i++) { - V1DetokenizeRecordResponse.validateJsonElement(jsonArrayrecords.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1DetokenizeResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1DetokenizeResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1DetokenizeResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1DetokenizeResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1DetokenizeResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1DetokenizeResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1DetokenizeResponse - * @throws IOException if the JSON string is invalid with respect to V1DetokenizeResponse - */ - public static V1DetokenizeResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1DetokenizeResponse.class); - } - - /** - * Convert an instance of V1DetokenizeResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1FieldRecords.java b/src/main/java/com/skyflow/generated/rest/models/V1FieldRecords.java deleted file mode 100644 index 9efada66..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1FieldRecords.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Record values and tokens. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1FieldRecords { - public static final String SERIALIZED_NAME_FIELDS = "fields"; - @SerializedName(SERIALIZED_NAME_FIELDS) - private Object fields; - - public static final String SERIALIZED_NAME_TOKENS = "tokens"; - @SerializedName(SERIALIZED_NAME_TOKENS) - private Object tokens; - - public V1FieldRecords() { - } - - public V1FieldRecords fields(Object fields) { - this.fields = fields; - return this; - } - - /** - * Fields and values for the record. For example, `{'field_1':'value_1', 'field_2':'value_2'}`. - * @return fields - */ - @javax.annotation.Nullable - public Object getFields() { - return fields; - } - - public void setFields(Object fields) { - this.fields = fields; - } - - - public V1FieldRecords tokens(Object tokens) { - this.tokens = tokens; - return this; - } - - /** - * Fields and tokens for the record. For example, `{'field_1':'token_1', 'field_2':'token_2'}`. - * @return tokens - */ - @javax.annotation.Nullable - public Object getTokens() { - return tokens; - } - - public void setTokens(Object tokens) { - this.tokens = tokens; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1FieldRecords v1FieldRecords = (V1FieldRecords) o; - return Objects.equals(this.fields, v1FieldRecords.fields) && - Objects.equals(this.tokens, v1FieldRecords.tokens); - } - - @Override - public int hashCode() { - return Objects.hash(fields, tokens); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1FieldRecords {\n"); - sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); - sb.append(" tokens: ").append(toIndentedString(tokens)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("fields"); - openapiFields.add("tokens"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1FieldRecords - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1FieldRecords.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1FieldRecords is not found in the empty JSON string", V1FieldRecords.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1FieldRecords.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1FieldRecords` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1FieldRecords.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1FieldRecords' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1FieldRecords.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1FieldRecords value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1FieldRecords read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1FieldRecords given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1FieldRecords - * @throws IOException if the JSON string is invalid with respect to V1FieldRecords - */ - public static V1FieldRecords fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1FieldRecords.class); - } - - /** - * Convert an instance of V1FieldRecords to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1FileAVScanStatus.java b/src/main/java/com/skyflow/generated/rest/models/V1FileAVScanStatus.java deleted file mode 100644 index af3f490f..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1FileAVScanStatus.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Anti-virus scan status of the file. - */ -@JsonAdapter(V1FileAVScanStatus.Adapter.class) -public enum V1FileAVScanStatus { - - NONE("SCAN_NONE"), - - CLEAN("SCAN_CLEAN"), - - INFECTED("SCAN_INFECTED"), - - DELETED("SCAN_DELETED"), - - ERROR("SCAN_ERROR"), - - PENDING("SCAN_PENDING"), - - UNSCANNABLE("SCAN_UNSCANNABLE"), - - FILE_NOT_FOUND("SCAN_FILE_NOT_FOUND"), - - INVALID("SCAN_INVALID"); - - private String value; - - V1FileAVScanStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static V1FileAVScanStatus fromValue(String value) { - for (V1FileAVScanStatus b : V1FileAVScanStatus.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final V1FileAVScanStatus enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public V1FileAVScanStatus read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return V1FileAVScanStatus.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - V1FileAVScanStatus.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1GetAuthTokenRequest.java b/src/main/java/com/skyflow/generated/rest/models/V1GetAuthTokenRequest.java deleted file mode 100644 index c2d6bf1d..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1GetAuthTokenRequest.java +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Skyflow Management API - * # Management API This API controls aspects of your account and schema, including workspaces, vaults, keys, users, permissions, and more. The Management API is available from two base URIs:
  • Sandbox: https://manage.skyflowapis-preview.com
  • Production: https://manage.skyflowapis.com
When you make an API call, you need to add two headers:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
X-SKYFLOW-ACCOUNT-IDYour Skyflow account ID.X-SKYFLOW-ACCOUNT-ID: h451b763713e4424a7jke1bbkbbc84ef
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1GetAuthTokenRequest - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-03T10:28:16.037563+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1GetAuthTokenRequest { - public static final String SERIALIZED_NAME_GRANT_TYPE = "grant_type"; - @SerializedName(SERIALIZED_NAME_GRANT_TYPE) - private String grantType; - - public static final String SERIALIZED_NAME_ASSERTION = "assertion"; - @SerializedName(SERIALIZED_NAME_ASSERTION) - private String assertion; - - public static final String SERIALIZED_NAME_SUBJECT_TOKEN = "subject_token"; - @SerializedName(SERIALIZED_NAME_SUBJECT_TOKEN) - private String subjectToken; - - public static final String SERIALIZED_NAME_SUBJECT_TOKEN_TYPE = "subject_token_type"; - @SerializedName(SERIALIZED_NAME_SUBJECT_TOKEN_TYPE) - private String subjectTokenType; - - public static final String SERIALIZED_NAME_REQUESTED_TOKEN_USE = "requested_token_use"; - @SerializedName(SERIALIZED_NAME_REQUESTED_TOKEN_USE) - private String requestedTokenUse; - - public static final String SERIALIZED_NAME_SCOPE = "scope"; - @SerializedName(SERIALIZED_NAME_SCOPE) - private String scope; - - public V1GetAuthTokenRequest() { - } - - public V1GetAuthTokenRequest grantType(String grantType) { - this.grantType = grantType; - return this; - } - - /** - * Grant type of the request. Set this to `urn:ietf:params:oauth:grant-type:jwt-bearer`. - * @return grantType - */ - @javax.annotation.Nonnull - public String getGrantType() { - return grantType; - } - - public void setGrantType(String grantType) { - this.grantType = grantType; - } - - - public V1GetAuthTokenRequest assertion(String assertion) { - this.assertion = assertion; - return this; - } - - /** - * 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 assertion - */ - @javax.annotation.Nonnull - public String getAssertion() { - return assertion; - } - - public void setAssertion(String assertion) { - this.assertion = assertion; - } - - - public V1GetAuthTokenRequest subjectToken(String subjectToken) { - this.subjectToken = subjectToken; - return this; - } - - /** - * Subject token. - * @return subjectToken - */ - @javax.annotation.Nullable - public String getSubjectToken() { - return subjectToken; - } - - public void setSubjectToken(String subjectToken) { - this.subjectToken = subjectToken; - } - - - public V1GetAuthTokenRequest subjectTokenType(String subjectTokenType) { - this.subjectTokenType = subjectTokenType; - return this; - } - - /** - * Subject token type. - * @return subjectTokenType - */ - @javax.annotation.Nullable - public String getSubjectTokenType() { - return subjectTokenType; - } - - public void setSubjectTokenType(String subjectTokenType) { - this.subjectTokenType = subjectTokenType; - } - - - public V1GetAuthTokenRequest requestedTokenUse(String requestedTokenUse) { - this.requestedTokenUse = requestedTokenUse; - return this; - } - - /** - * Token use type. Either `delegation` or `impersonation`. - * @return requestedTokenUse - */ - @javax.annotation.Nullable - public String getRequestedTokenUse() { - return requestedTokenUse; - } - - public void setRequestedTokenUse(String requestedTokenUse) { - this.requestedTokenUse = requestedTokenUse; - } - - - public V1GetAuthTokenRequest scope(String scope) { - this.scope = scope; - return this; - } - - /** - * Subset of available <a href='#Roles'>roles</a> to associate with the requested token. Uses the format \"role:\\<roleID1\\> role:\\<roleID2\\>\". - * @return scope - */ - @javax.annotation.Nullable - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1GetAuthTokenRequest v1GetAuthTokenRequest = (V1GetAuthTokenRequest) o; - return Objects.equals(this.grantType, v1GetAuthTokenRequest.grantType) && - Objects.equals(this.assertion, v1GetAuthTokenRequest.assertion) && - Objects.equals(this.subjectToken, v1GetAuthTokenRequest.subjectToken) && - Objects.equals(this.subjectTokenType, v1GetAuthTokenRequest.subjectTokenType) && - Objects.equals(this.requestedTokenUse, v1GetAuthTokenRequest.requestedTokenUse) && - Objects.equals(this.scope, v1GetAuthTokenRequest.scope); - } - - @Override - public int hashCode() { - return Objects.hash(grantType, assertion, subjectToken, subjectTokenType, requestedTokenUse, scope); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1GetAuthTokenRequest {\n"); - sb.append(" grantType: ").append(toIndentedString(grantType)).append("\n"); - sb.append(" assertion: ").append(toIndentedString(assertion)).append("\n"); - sb.append(" subjectToken: ").append(toIndentedString(subjectToken)).append("\n"); - sb.append(" subjectTokenType: ").append(toIndentedString(subjectTokenType)).append("\n"); - sb.append(" requestedTokenUse: ").append(toIndentedString(requestedTokenUse)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("grant_type"); - openapiFields.add("assertion"); - openapiFields.add("subject_token"); - openapiFields.add("subject_token_type"); - openapiFields.add("requested_token_use"); - openapiFields.add("scope"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("grant_type"); - openapiRequiredFields.add("assertion"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1GetAuthTokenRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1GetAuthTokenRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1GetAuthTokenRequest is not found in the empty JSON string", V1GetAuthTokenRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1GetAuthTokenRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1GetAuthTokenRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : V1GetAuthTokenRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("grant_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `grant_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("grant_type").toString())); - } - if (!jsonObj.get("assertion").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `assertion` to be a primitive type in the JSON string but got `%s`", jsonObj.get("assertion").toString())); - } - if ((jsonObj.get("subject_token") != null && !jsonObj.get("subject_token").isJsonNull()) && !jsonObj.get("subject_token").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `subject_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subject_token").toString())); - } - if ((jsonObj.get("subject_token_type") != null && !jsonObj.get("subject_token_type").isJsonNull()) && !jsonObj.get("subject_token_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `subject_token_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subject_token_type").toString())); - } - if ((jsonObj.get("requested_token_use") != null && !jsonObj.get("requested_token_use").isJsonNull()) && !jsonObj.get("requested_token_use").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `requested_token_use` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requested_token_use").toString())); - } - if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1GetAuthTokenRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1GetAuthTokenRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1GetAuthTokenRequest.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1GetAuthTokenRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1GetAuthTokenRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1GetAuthTokenRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1GetAuthTokenRequest - * @throws IOException if the JSON string is invalid with respect to V1GetAuthTokenRequest - */ - public static V1GetAuthTokenRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1GetAuthTokenRequest.class); - } - - /** - * Convert an instance of V1GetAuthTokenRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1GetAuthTokenResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1GetAuthTokenResponse.java deleted file mode 100644 index d6c0f61f..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1GetAuthTokenResponse.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Skyflow Management API - * # Management API This API controls aspects of your account and schema, including workspaces, vaults, keys, users, permissions, and more. The Management API is available from two base URIs:
  • Sandbox: https://manage.skyflowapis-preview.com
  • Production: https://manage.skyflowapis.com
When you make an API call, you need to add two headers:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
X-SKYFLOW-ACCOUNT-IDYour Skyflow account ID.X-SKYFLOW-ACCOUNT-ID: h451b763713e4424a7jke1bbkbbc84ef
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1GetAuthTokenResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-03T10:28:16.037563+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1GetAuthTokenResponse { - public static final String SERIALIZED_NAME_ACCESS_TOKEN = "accessToken"; - @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) - private String accessToken; - - public static final String SERIALIZED_NAME_TOKEN_TYPE = "tokenType"; - @SerializedName(SERIALIZED_NAME_TOKEN_TYPE) - private String tokenType; - - public V1GetAuthTokenResponse() { - } - - public V1GetAuthTokenResponse accessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * AccessToken. - * @return accessToken - */ - @javax.annotation.Nullable - public String getAccessToken() { - return accessToken; - } - - public void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } - - - public V1GetAuthTokenResponse tokenType(String tokenType) { - this.tokenType = tokenType; - return this; - } - - /** - * TokenType : Bearer. - * @return tokenType - */ - @javax.annotation.Nullable - public String getTokenType() { - return tokenType; - } - - public void setTokenType(String tokenType) { - this.tokenType = tokenType; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1GetAuthTokenResponse v1GetAuthTokenResponse = (V1GetAuthTokenResponse) o; - return Objects.equals(this.accessToken, v1GetAuthTokenResponse.accessToken) && - Objects.equals(this.tokenType, v1GetAuthTokenResponse.tokenType); - } - - @Override - public int hashCode() { - return Objects.hash(accessToken, tokenType); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1GetAuthTokenResponse {\n"); - sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); - sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("accessToken"); - openapiFields.add("tokenType"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1GetAuthTokenResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1GetAuthTokenResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1GetAuthTokenResponse is not found in the empty JSON string", V1GetAuthTokenResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1GetAuthTokenResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1GetAuthTokenResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("accessToken") != null && !jsonObj.get("accessToken").isJsonNull()) && !jsonObj.get("accessToken").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `accessToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accessToken").toString())); - } - if ((jsonObj.get("tokenType") != null && !jsonObj.get("tokenType").isJsonNull()) && !jsonObj.get("tokenType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `tokenType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tokenType").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1GetAuthTokenResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1GetAuthTokenResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1GetAuthTokenResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1GetAuthTokenResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1GetAuthTokenResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1GetAuthTokenResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1GetAuthTokenResponse - * @throws IOException if the JSON string is invalid with respect to V1GetAuthTokenResponse - */ - public static V1GetAuthTokenResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1GetAuthTokenResponse.class); - } - - /** - * Convert an instance of V1GetAuthTokenResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1GetFileScanStatusResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1GetFileScanStatusResponse.java deleted file mode 100644 index 4bce5d74..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1GetFileScanStatusResponse.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1FileAVScanStatus; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1GetFileScanStatusResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1GetFileScanStatusResponse { - public static final String SERIALIZED_NAME_AV_SCAN_STATUS = "av_scan_status"; - @SerializedName(SERIALIZED_NAME_AV_SCAN_STATUS) - private V1FileAVScanStatus avScanStatus = V1FileAVScanStatus.NONE; - - public V1GetFileScanStatusResponse() { - } - - public V1GetFileScanStatusResponse avScanStatus(V1FileAVScanStatus avScanStatus) { - this.avScanStatus = avScanStatus; - return this; - } - - /** - * Get avScanStatus - * @return avScanStatus - */ - @javax.annotation.Nullable - public V1FileAVScanStatus getAvScanStatus() { - return avScanStatus; - } - - public void setAvScanStatus(V1FileAVScanStatus avScanStatus) { - this.avScanStatus = avScanStatus; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1GetFileScanStatusResponse v1GetFileScanStatusResponse = (V1GetFileScanStatusResponse) o; - return Objects.equals(this.avScanStatus, v1GetFileScanStatusResponse.avScanStatus); - } - - @Override - public int hashCode() { - return Objects.hash(avScanStatus); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1GetFileScanStatusResponse {\n"); - sb.append(" avScanStatus: ").append(toIndentedString(avScanStatus)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("av_scan_status"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1GetFileScanStatusResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1GetFileScanStatusResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1GetFileScanStatusResponse is not found in the empty JSON string", V1GetFileScanStatusResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1GetFileScanStatusResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1GetFileScanStatusResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `av_scan_status` - if (jsonObj.get("av_scan_status") != null && !jsonObj.get("av_scan_status").isJsonNull()) { - V1FileAVScanStatus.validateJsonElement(jsonObj.get("av_scan_status")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1GetFileScanStatusResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1GetFileScanStatusResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1GetFileScanStatusResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1GetFileScanStatusResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1GetFileScanStatusResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1GetFileScanStatusResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1GetFileScanStatusResponse - * @throws IOException if the JSON string is invalid with respect to V1GetFileScanStatusResponse - */ - public static V1GetFileScanStatusResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1GetFileScanStatusResponse.class); - } - - /** - * Convert an instance of V1GetFileScanStatusResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1GetQueryResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1GetQueryResponse.java deleted file mode 100644 index 2ff57e57..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1GetQueryResponse.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1FieldRecords; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1GetQueryResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1GetQueryResponse { - public static final String SERIALIZED_NAME_RECORDS = "records"; - @SerializedName(SERIALIZED_NAME_RECORDS) - private List records = new ArrayList<>(); - - public V1GetQueryResponse() { - } - - public V1GetQueryResponse records(List records) { - this.records = records; - return this; - } - - public V1GetQueryResponse addRecordsItem(V1FieldRecords recordsItem) { - if (this.records == null) { - this.records = new ArrayList<>(); - } - this.records.add(recordsItem); - return this; - } - - /** - * Records returned by the query. - * @return records - */ - @javax.annotation.Nullable - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1GetQueryResponse v1GetQueryResponse = (V1GetQueryResponse) o; - return Objects.equals(this.records, v1GetQueryResponse.records); - } - - @Override - public int hashCode() { - return Objects.hash(records); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1GetQueryResponse {\n"); - sb.append(" records: ").append(toIndentedString(records)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("records"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1GetQueryResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1GetQueryResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1GetQueryResponse is not found in the empty JSON string", V1GetQueryResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1GetQueryResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1GetQueryResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("records") != null && !jsonObj.get("records").isJsonNull()) { - JsonArray jsonArrayrecords = jsonObj.getAsJsonArray("records"); - if (jsonArrayrecords != null) { - // ensure the json data is an array - if (!jsonObj.get("records").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `records` to be an array in the JSON string but got `%s`", jsonObj.get("records").toString())); - } - - // validate the optional field `records` (array) - for (int i = 0; i < jsonArrayrecords.size(); i++) { - V1FieldRecords.validateJsonElement(jsonArrayrecords.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1GetQueryResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1GetQueryResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1GetQueryResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1GetQueryResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1GetQueryResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1GetQueryResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1GetQueryResponse - * @throws IOException if the JSON string is invalid with respect to V1GetQueryResponse - */ - public static V1GetQueryResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1GetQueryResponse.class); - } - - /** - * Convert an instance of V1GetQueryResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1InsertRecordResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1InsertRecordResponse.java deleted file mode 100644 index f4f432b3..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1InsertRecordResponse.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1RecordMetaProperties; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1InsertRecordResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1InsertRecordResponse { - public static final String SERIALIZED_NAME_RECORDS = "records"; - @SerializedName(SERIALIZED_NAME_RECORDS) - private List records = new ArrayList<>(); - - public V1InsertRecordResponse() { - } - - public V1InsertRecordResponse records(List records) { - this.records = records; - return this; - } - - public V1InsertRecordResponse addRecordsItem(V1RecordMetaProperties recordsItem) { - if (this.records == null) { - this.records = new ArrayList<>(); - } - this.records.add(recordsItem); - return this; - } - - /** - * Identifiers for the inserted records. - * @return records - */ - @javax.annotation.Nullable - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1InsertRecordResponse v1InsertRecordResponse = (V1InsertRecordResponse) o; - return Objects.equals(this.records, v1InsertRecordResponse.records); - } - - @Override - public int hashCode() { - return Objects.hash(records); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1InsertRecordResponse {\n"); - sb.append(" records: ").append(toIndentedString(records)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("records"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1InsertRecordResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1InsertRecordResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1InsertRecordResponse is not found in the empty JSON string", V1InsertRecordResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1InsertRecordResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1InsertRecordResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("records") != null && !jsonObj.get("records").isJsonNull()) { - JsonArray jsonArrayrecords = jsonObj.getAsJsonArray("records"); - if (jsonArrayrecords != null) { - // ensure the json data is an array - if (!jsonObj.get("records").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `records` to be an array in the JSON string but got `%s`", jsonObj.get("records").toString())); - } - - // validate the optional field `records` (array) - for (int i = 0; i < jsonArrayrecords.size(); i++) { - V1RecordMetaProperties.validateJsonElement(jsonArrayrecords.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1InsertRecordResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1InsertRecordResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1InsertRecordResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1InsertRecordResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1InsertRecordResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1InsertRecordResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1InsertRecordResponse - * @throws IOException if the JSON string is invalid with respect to V1InsertRecordResponse - */ - public static V1InsertRecordResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1InsertRecordResponse.class); - } - - /** - * Convert an instance of V1InsertRecordResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1MemberType.java b/src/main/java/com/skyflow/generated/rest/models/V1MemberType.java deleted file mode 100644 index 5cb1ce8b..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1MemberType.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; -import com.google.gson.TypeAdapter; -import com.google.gson.JsonElement; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Type of the member. - */ -@JsonAdapter(V1MemberType.Adapter.class) -public enum V1MemberType { - - NONE("NONE"), - - USER("USER"), - - SERVICE_ACCOUNT("SERVICE_ACCOUNT"); - - private String value; - - V1MemberType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static V1MemberType fromValue(String value) { - for (V1MemberType b : V1MemberType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final V1MemberType enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public V1MemberType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return V1MemberType.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - V1MemberType.fromValue(value); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1RecordMetaProperties.java b/src/main/java/com/skyflow/generated/rest/models/V1RecordMetaProperties.java deleted file mode 100644 index e0aaf47e..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1RecordMetaProperties.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1RecordMetaProperties - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1RecordMetaProperties { - public static final String SERIALIZED_NAME_SKYFLOW_ID = "skyflow_id"; - @SerializedName(SERIALIZED_NAME_SKYFLOW_ID) - private String skyflowId; - - public static final String SERIALIZED_NAME_TOKENS = "tokens"; - @SerializedName(SERIALIZED_NAME_TOKENS) - private Object tokens; - - public V1RecordMetaProperties() { - } - - public V1RecordMetaProperties skyflowId(String skyflowId) { - this.skyflowId = skyflowId; - return this; - } - - /** - * ID of the inserted record. - * @return skyflowId - */ - @javax.annotation.Nullable - public String getSkyflowId() { - return skyflowId; - } - - public void setSkyflowId(String skyflowId) { - this.skyflowId = skyflowId; - } - - - public V1RecordMetaProperties tokens(Object tokens) { - this.tokens = tokens; - return this; - } - - /** - * Tokens for the record. - * @return tokens - */ - @javax.annotation.Nullable - public Object getTokens() { - return tokens; - } - - public void setTokens(Object tokens) { - this.tokens = tokens; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1RecordMetaProperties v1RecordMetaProperties = (V1RecordMetaProperties) o; - return Objects.equals(this.skyflowId, v1RecordMetaProperties.skyflowId) && - Objects.equals(this.tokens, v1RecordMetaProperties.tokens); - } - - @Override - public int hashCode() { - return Objects.hash(skyflowId, tokens); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1RecordMetaProperties {\n"); - sb.append(" skyflowId: ").append(toIndentedString(skyflowId)).append("\n"); - sb.append(" tokens: ").append(toIndentedString(tokens)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("skyflow_id"); - openapiFields.add("tokens"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1RecordMetaProperties - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1RecordMetaProperties.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1RecordMetaProperties is not found in the empty JSON string", V1RecordMetaProperties.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1RecordMetaProperties.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1RecordMetaProperties` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("skyflow_id") != null && !jsonObj.get("skyflow_id").isJsonNull()) && !jsonObj.get("skyflow_id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `skyflow_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("skyflow_id").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1RecordMetaProperties.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1RecordMetaProperties' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1RecordMetaProperties.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1RecordMetaProperties value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1RecordMetaProperties read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1RecordMetaProperties given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1RecordMetaProperties - * @throws IOException if the JSON string is invalid with respect to V1RecordMetaProperties - */ - public static V1RecordMetaProperties fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1RecordMetaProperties.class); - } - - /** - * Convert an instance of V1RecordMetaProperties to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1TokenizePayload.java b/src/main/java/com/skyflow/generated/rest/models/V1TokenizePayload.java deleted file mode 100644 index 74936451..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1TokenizePayload.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1TokenizeRecordRequest; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1TokenizePayload - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1TokenizePayload { - public static final String SERIALIZED_NAME_TOKENIZATION_PARAMETERS = "tokenizationParameters"; - @SerializedName(SERIALIZED_NAME_TOKENIZATION_PARAMETERS) - private List tokenizationParameters = new ArrayList<>(); - - public V1TokenizePayload() { - } - - public V1TokenizePayload tokenizationParameters(List tokenizationParameters) { - this.tokenizationParameters = tokenizationParameters; - return this; - } - - public V1TokenizePayload addTokenizationParametersItem(V1TokenizeRecordRequest tokenizationParametersItem) { - if (this.tokenizationParameters == null) { - this.tokenizationParameters = new ArrayList<>(); - } - this.tokenizationParameters.add(tokenizationParametersItem); - return this; - } - - /** - * Tokenization details. - * @return tokenizationParameters - */ - @javax.annotation.Nullable - public List getTokenizationParameters() { - return tokenizationParameters; - } - - public void setTokenizationParameters(List tokenizationParameters) { - this.tokenizationParameters = tokenizationParameters; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1TokenizePayload v1TokenizePayload = (V1TokenizePayload) o; - return Objects.equals(this.tokenizationParameters, v1TokenizePayload.tokenizationParameters); - } - - @Override - public int hashCode() { - return Objects.hash(tokenizationParameters); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1TokenizePayload {\n"); - sb.append(" tokenizationParameters: ").append(toIndentedString(tokenizationParameters)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("tokenizationParameters"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1TokenizePayload - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1TokenizePayload.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1TokenizePayload is not found in the empty JSON string", V1TokenizePayload.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1TokenizePayload.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1TokenizePayload` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("tokenizationParameters") != null && !jsonObj.get("tokenizationParameters").isJsonNull()) { - JsonArray jsonArraytokenizationParameters = jsonObj.getAsJsonArray("tokenizationParameters"); - if (jsonArraytokenizationParameters != null) { - // ensure the json data is an array - if (!jsonObj.get("tokenizationParameters").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `tokenizationParameters` to be an array in the JSON string but got `%s`", jsonObj.get("tokenizationParameters").toString())); - } - - // validate the optional field `tokenizationParameters` (array) - for (int i = 0; i < jsonArraytokenizationParameters.size(); i++) { - V1TokenizeRecordRequest.validateJsonElement(jsonArraytokenizationParameters.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1TokenizePayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1TokenizePayload' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1TokenizePayload.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1TokenizePayload value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1TokenizePayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1TokenizePayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1TokenizePayload - * @throws IOException if the JSON string is invalid with respect to V1TokenizePayload - */ - public static V1TokenizePayload fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1TokenizePayload.class); - } - - /** - * Convert an instance of V1TokenizePayload to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1TokenizeRecordRequest.java b/src/main/java/com/skyflow/generated/rest/models/V1TokenizeRecordRequest.java deleted file mode 100644 index 1de790c5..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1TokenizeRecordRequest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1TokenizeRecordRequest - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1TokenizeRecordRequest { - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; - - public static final String SERIALIZED_NAME_COLUMN_GROUP = "columnGroup"; - @SerializedName(SERIALIZED_NAME_COLUMN_GROUP) - private String columnGroup; - - public V1TokenizeRecordRequest() { - } - - public V1TokenizeRecordRequest value(String value) { - this.value = value; - return this; - } - - /** - * Existing value to return a token for. - * @return value - */ - @javax.annotation.Nullable - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - - public V1TokenizeRecordRequest columnGroup(String columnGroup) { - this.columnGroup = columnGroup; - return this; - } - - /** - * Name of the column group that the value belongs to. - * @return columnGroup - */ - @javax.annotation.Nullable - public String getColumnGroup() { - return columnGroup; - } - - public void setColumnGroup(String columnGroup) { - this.columnGroup = columnGroup; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1TokenizeRecordRequest v1TokenizeRecordRequest = (V1TokenizeRecordRequest) o; - return Objects.equals(this.value, v1TokenizeRecordRequest.value) && - Objects.equals(this.columnGroup, v1TokenizeRecordRequest.columnGroup); - } - - @Override - public int hashCode() { - return Objects.hash(value, columnGroup); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1TokenizeRecordRequest {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" columnGroup: ").append(toIndentedString(columnGroup)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("value"); - openapiFields.add("columnGroup"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1TokenizeRecordRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1TokenizeRecordRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1TokenizeRecordRequest is not found in the empty JSON string", V1TokenizeRecordRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1TokenizeRecordRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1TokenizeRecordRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); - } - if ((jsonObj.get("columnGroup") != null && !jsonObj.get("columnGroup").isJsonNull()) && !jsonObj.get("columnGroup").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `columnGroup` to be a primitive type in the JSON string but got `%s`", jsonObj.get("columnGroup").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1TokenizeRecordRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1TokenizeRecordRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1TokenizeRecordRequest.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1TokenizeRecordRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1TokenizeRecordRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1TokenizeRecordRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1TokenizeRecordRequest - * @throws IOException if the JSON string is invalid with respect to V1TokenizeRecordRequest - */ - public static V1TokenizeRecordRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1TokenizeRecordRequest.class); - } - - /** - * Convert an instance of V1TokenizeRecordRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1TokenizeRecordResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1TokenizeRecordResponse.java deleted file mode 100644 index 290d7403..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1TokenizeRecordResponse.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1TokenizeRecordResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1TokenizeRecordResponse { - public static final String SERIALIZED_NAME_TOKEN = "token"; - @SerializedName(SERIALIZED_NAME_TOKEN) - private String token; - - public V1TokenizeRecordResponse() { - } - - public V1TokenizeRecordResponse token(String token) { - this.token = token; - return this; - } - - /** - * Token corresponding to a value. - * @return token - */ - @javax.annotation.Nullable - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1TokenizeRecordResponse v1TokenizeRecordResponse = (V1TokenizeRecordResponse) o; - return Objects.equals(this.token, v1TokenizeRecordResponse.token); - } - - @Override - public int hashCode() { - return Objects.hash(token); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1TokenizeRecordResponse {\n"); - sb.append(" token: ").append(toIndentedString(token)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("token"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1TokenizeRecordResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1TokenizeRecordResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1TokenizeRecordResponse is not found in the empty JSON string", V1TokenizeRecordResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1TokenizeRecordResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1TokenizeRecordResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1TokenizeRecordResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1TokenizeRecordResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1TokenizeRecordResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1TokenizeRecordResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1TokenizeRecordResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1TokenizeRecordResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1TokenizeRecordResponse - * @throws IOException if the JSON string is invalid with respect to V1TokenizeRecordResponse - */ - public static V1TokenizeRecordResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1TokenizeRecordResponse.class); - } - - /** - * Convert an instance of V1TokenizeRecordResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1TokenizeResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1TokenizeResponse.java deleted file mode 100644 index 3885c9a5..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1TokenizeResponse.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1TokenizeRecordResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1TokenizeResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1TokenizeResponse { - public static final String SERIALIZED_NAME_RECORDS = "records"; - @SerializedName(SERIALIZED_NAME_RECORDS) - private List records = new ArrayList<>(); - - public V1TokenizeResponse() { - } - - public V1TokenizeResponse records(List records) { - this.records = records; - return this; - } - - public V1TokenizeResponse addRecordsItem(V1TokenizeRecordResponse recordsItem) { - if (this.records == null) { - this.records = new ArrayList<>(); - } - this.records.add(recordsItem); - return this; - } - - /** - * Tokens corresponding to the specified values. - * @return records - */ - @javax.annotation.Nullable - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1TokenizeResponse v1TokenizeResponse = (V1TokenizeResponse) o; - return Objects.equals(this.records, v1TokenizeResponse.records); - } - - @Override - public int hashCode() { - return Objects.hash(records); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1TokenizeResponse {\n"); - sb.append(" records: ").append(toIndentedString(records)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("records"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1TokenizeResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1TokenizeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1TokenizeResponse is not found in the empty JSON string", V1TokenizeResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1TokenizeResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1TokenizeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("records") != null && !jsonObj.get("records").isJsonNull()) { - JsonArray jsonArrayrecords = jsonObj.getAsJsonArray("records"); - if (jsonArrayrecords != null) { - // ensure the json data is an array - if (!jsonObj.get("records").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `records` to be an array in the JSON string but got `%s`", jsonObj.get("records").toString())); - } - - // validate the optional field `records` (array) - for (int i = 0; i < jsonArrayrecords.size(); i++) { - V1TokenizeRecordResponse.validateJsonElement(jsonArrayrecords.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1TokenizeResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1TokenizeResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1TokenizeResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1TokenizeResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1TokenizeResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1TokenizeResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1TokenizeResponse - * @throws IOException if the JSON string is invalid with respect to V1TokenizeResponse - */ - public static V1TokenizeResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1TokenizeResponse.class); - } - - /** - * Convert an instance of V1TokenizeResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1UpdateRecordResponse.java b/src/main/java/com/skyflow/generated/rest/models/V1UpdateRecordResponse.java deleted file mode 100644 index b731dd12..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1UpdateRecordResponse.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * V1UpdateRecordResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1UpdateRecordResponse { - public static final String SERIALIZED_NAME_SKYFLOW_ID = "skyflow_id"; - @SerializedName(SERIALIZED_NAME_SKYFLOW_ID) - private String skyflowId; - - public static final String SERIALIZED_NAME_TOKENS = "tokens"; - @SerializedName(SERIALIZED_NAME_TOKENS) - private Object tokens; - - public V1UpdateRecordResponse() { - } - - public V1UpdateRecordResponse skyflowId(String skyflowId) { - this.skyflowId = skyflowId; - return this; - } - - /** - * ID of the updated record. - * @return skyflowId - */ - @javax.annotation.Nullable - public String getSkyflowId() { - return skyflowId; - } - - public void setSkyflowId(String skyflowId) { - this.skyflowId = skyflowId; - } - - - public V1UpdateRecordResponse tokens(Object tokens) { - this.tokens = tokens; - return this; - } - - /** - * Tokens for the record. - * @return tokens - */ - @javax.annotation.Nullable - public Object getTokens() { - return tokens; - } - - public void setTokens(Object tokens) { - this.tokens = tokens; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1UpdateRecordResponse v1UpdateRecordResponse = (V1UpdateRecordResponse) o; - return Objects.equals(this.skyflowId, v1UpdateRecordResponse.skyflowId) && - Objects.equals(this.tokens, v1UpdateRecordResponse.tokens); - } - - @Override - public int hashCode() { - return Objects.hash(skyflowId, tokens); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1UpdateRecordResponse {\n"); - sb.append(" skyflowId: ").append(toIndentedString(skyflowId)).append("\n"); - sb.append(" tokens: ").append(toIndentedString(tokens)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("skyflow_id"); - openapiFields.add("tokens"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1UpdateRecordResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1UpdateRecordResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1UpdateRecordResponse is not found in the empty JSON string", V1UpdateRecordResponse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1UpdateRecordResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1UpdateRecordResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("skyflow_id") != null && !jsonObj.get("skyflow_id").isJsonNull()) && !jsonObj.get("skyflow_id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `skyflow_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("skyflow_id").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1UpdateRecordResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1UpdateRecordResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1UpdateRecordResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1UpdateRecordResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1UpdateRecordResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1UpdateRecordResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1UpdateRecordResponse - * @throws IOException if the JSON string is invalid with respect to V1UpdateRecordResponse - */ - public static V1UpdateRecordResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1UpdateRecordResponse.class); - } - - /** - * Convert an instance of V1UpdateRecordResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1VaultFieldMapping.java b/src/main/java/com/skyflow/generated/rest/models/V1VaultFieldMapping.java deleted file mode 100644 index 582a53fd..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1VaultFieldMapping.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Mapping of the fields in the vault to the fields to use for the lookup. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1VaultFieldMapping { - public static final String SERIALIZED_NAME_CARD_NUMBER = "card_number"; - @SerializedName(SERIALIZED_NAME_CARD_NUMBER) - private String cardNumber; - - public static final String SERIALIZED_NAME_CARD_LAST_FOUR_DIGITS = "card_last_four_digits"; - @SerializedName(SERIALIZED_NAME_CARD_LAST_FOUR_DIGITS) - private String cardLastFourDigits; - - public static final String SERIALIZED_NAME_CARD_EXPIRY = "card_expiry"; - @SerializedName(SERIALIZED_NAME_CARD_EXPIRY) - private String cardExpiry; - - public V1VaultFieldMapping() { - } - - public V1VaultFieldMapping cardNumber(String cardNumber) { - this.cardNumber = cardNumber; - return this; - } - - /** - * Name of the column that stores the card number. - * @return cardNumber - */ - @javax.annotation.Nullable - public String getCardNumber() { - return cardNumber; - } - - public void setCardNumber(String cardNumber) { - this.cardNumber = cardNumber; - } - - - public V1VaultFieldMapping cardLastFourDigits(String cardLastFourDigits) { - this.cardLastFourDigits = cardLastFourDigits; - return this; - } - - /** - * Name of the column that stores the card number suffix. - * @return cardLastFourDigits - */ - @javax.annotation.Nullable - public String getCardLastFourDigits() { - return cardLastFourDigits; - } - - public void setCardLastFourDigits(String cardLastFourDigits) { - this.cardLastFourDigits = cardLastFourDigits; - } - - - public V1VaultFieldMapping cardExpiry(String cardExpiry) { - this.cardExpiry = cardExpiry; - return this; - } - - /** - * Name of the column that stores the expiry date. - * @return cardExpiry - */ - @javax.annotation.Nullable - public String getCardExpiry() { - return cardExpiry; - } - - public void setCardExpiry(String cardExpiry) { - this.cardExpiry = cardExpiry; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1VaultFieldMapping v1VaultFieldMapping = (V1VaultFieldMapping) o; - return Objects.equals(this.cardNumber, v1VaultFieldMapping.cardNumber) && - Objects.equals(this.cardLastFourDigits, v1VaultFieldMapping.cardLastFourDigits) && - Objects.equals(this.cardExpiry, v1VaultFieldMapping.cardExpiry); - } - - @Override - public int hashCode() { - return Objects.hash(cardNumber, cardLastFourDigits, cardExpiry); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1VaultFieldMapping {\n"); - sb.append(" cardNumber: ").append(toIndentedString(cardNumber)).append("\n"); - sb.append(" cardLastFourDigits: ").append(toIndentedString(cardLastFourDigits)).append("\n"); - sb.append(" cardExpiry: ").append(toIndentedString(cardExpiry)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("card_number"); - openapiFields.add("card_last_four_digits"); - openapiFields.add("card_expiry"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1VaultFieldMapping - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1VaultFieldMapping.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1VaultFieldMapping is not found in the empty JSON string", V1VaultFieldMapping.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1VaultFieldMapping.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1VaultFieldMapping` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("card_number") != null && !jsonObj.get("card_number").isJsonNull()) && !jsonObj.get("card_number").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_number").toString())); - } - if ((jsonObj.get("card_last_four_digits") != null && !jsonObj.get("card_last_four_digits").isJsonNull()) && !jsonObj.get("card_last_four_digits").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_last_four_digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_last_four_digits").toString())); - } - if ((jsonObj.get("card_expiry") != null && !jsonObj.get("card_expiry").isJsonNull()) && !jsonObj.get("card_expiry").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `card_expiry` to be a primitive type in the JSON string but got `%s`", jsonObj.get("card_expiry").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1VaultFieldMapping.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1VaultFieldMapping' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1VaultFieldMapping.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1VaultFieldMapping value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1VaultFieldMapping read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1VaultFieldMapping given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1VaultFieldMapping - * @throws IOException if the JSON string is invalid with respect to V1VaultFieldMapping - */ - public static V1VaultFieldMapping fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1VaultFieldMapping.class); - } - - /** - * Convert an instance of V1VaultFieldMapping to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/models/V1VaultSchemaConfig.java b/src/main/java/com/skyflow/generated/rest/models/V1VaultSchemaConfig.java deleted file mode 100644 index 58ac97ef..00000000 --- a/src/main/java/com/skyflow/generated/rest/models/V1VaultSchemaConfig.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Skyflow Data API - * # Data API This API inserts, retrieves, and otherwise manages data in a vault. The Data API is available from two base URIs. *identifier* is the identifier in your vault's URL.
  • Sandbox: https://_*identifier*.vault.skyflowapis-preview.com
  • Production: https://_*identifier*.vault.skyflowapis.com
When you make an API call, you need to add a header:
HeaderValueExample
AuthorizationA Bearer Token. See API Authentication.Authorization: Bearer eyJhbGciOiJSUzI...1NiIsJdfPA
- * - * The version of the OpenAPI document: v1 - * Contact: support@skyflow.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.skyflow.generated.rest.models; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.skyflow.generated.rest.models.V1VaultFieldMapping; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.skyflow.generated.rest.JSON; - -/** - * Details of the vault that stores additional card details. - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-25T11:34:22.684345+05:30[Asia/Kolkata]", comments = "Generator version: 7.8.0") -public class V1VaultSchemaConfig { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_TABLE_NAME = "table_name"; - @SerializedName(SERIALIZED_NAME_TABLE_NAME) - private String tableName; - - public static final String SERIALIZED_NAME_MAPPING = "mapping"; - @SerializedName(SERIALIZED_NAME_MAPPING) - private V1VaultFieldMapping mapping; - - public V1VaultSchemaConfig() { - } - - public V1VaultSchemaConfig id(String id) { - this.id = id; - return this; - } - - /** - * ID of the vault that stores card details. - * @return id - */ - @javax.annotation.Nullable - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - - public V1VaultSchemaConfig tableName(String tableName) { - this.tableName = tableName; - return this; - } - - /** - * Name of the table that stores card details. - * @return tableName - */ - @javax.annotation.Nullable - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - - public V1VaultSchemaConfig mapping(V1VaultFieldMapping mapping) { - this.mapping = mapping; - return this; - } - - /** - * Get mapping - * @return mapping - */ - @javax.annotation.Nullable - public V1VaultFieldMapping getMapping() { - return mapping; - } - - public void setMapping(V1VaultFieldMapping mapping) { - this.mapping = mapping; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - V1VaultSchemaConfig v1VaultSchemaConfig = (V1VaultSchemaConfig) o; - return Objects.equals(this.id, v1VaultSchemaConfig.id) && - Objects.equals(this.tableName, v1VaultSchemaConfig.tableName) && - Objects.equals(this.mapping, v1VaultSchemaConfig.mapping); - } - - @Override - public int hashCode() { - return Objects.hash(id, tableName, mapping); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V1VaultSchemaConfig {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" tableName: ").append(toIndentedString(tableName)).append("\n"); - sb.append(" mapping: ").append(toIndentedString(mapping)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("id"); - openapiFields.add("table_name"); - openapiFields.add("mapping"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V1VaultSchemaConfig - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V1VaultSchemaConfig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in V1VaultSchemaConfig is not found in the empty JSON string", V1VaultSchemaConfig.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!V1VaultSchemaConfig.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `V1VaultSchemaConfig` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); - } - if ((jsonObj.get("table_name") != null && !jsonObj.get("table_name").isJsonNull()) && !jsonObj.get("table_name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `table_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("table_name").toString())); - } - // validate the optional field `mapping` - if (jsonObj.get("mapping") != null && !jsonObj.get("mapping").isJsonNull()) { - V1VaultFieldMapping.validateJsonElement(jsonObj.get("mapping")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V1VaultSchemaConfig.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V1VaultSchemaConfig' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V1VaultSchemaConfig.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V1VaultSchemaConfig value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public V1VaultSchemaConfig read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of V1VaultSchemaConfig given an JSON string - * - * @param jsonString JSON string - * @return An instance of V1VaultSchemaConfig - * @throws IOException if the JSON string is invalid with respect to V1VaultSchemaConfig - */ - public static V1VaultSchemaConfig fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V1VaultSchemaConfig.class); - } - - /** - * Convert an instance of V1VaultSchemaConfig to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncAuditClient.java b/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncAuditClient.java new file mode 100644 index 00000000..0064558d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncAuditClient.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.audit.requests.AuditServiceListAuditEventsRequest; +import com.skyflow.generated.rest.types.V1AuditResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncAuditClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAuditClient rawClient; + + public AsyncAuditClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAuditClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAuditClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists audit events that match query parameters. + */ + public CompletableFuture auditServiceListAuditEvents(AuditServiceListAuditEventsRequest request) { + return this.rawClient.auditServiceListAuditEvents(request).thenApply(response -> response.body()); + } + + /** + * Lists audit events that match query parameters. + */ + public CompletableFuture auditServiceListAuditEvents( + AuditServiceListAuditEventsRequest request, RequestOptions requestOptions) { + return this.rawClient + .auditServiceListAuditEvents(request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java b/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java new file mode 100644 index 00000000..875ca259 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/AsyncRawAuditClient.java @@ -0,0 +1,296 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +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.errors.NotFoundError; +import com.skyflow.generated.rest.resources.audit.requests.AuditServiceListAuditEventsRequest; +import com.skyflow.generated.rest.types.V1AuditResponse; +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; + + public AsyncRawAuditClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists audit events that match query parameters. + */ + public CompletableFuture> auditServiceListAuditEvents( + AuditServiceListAuditEventsRequest request) { + return auditServiceListAuditEvents(request, null); + } + + /** + * Lists audit events that match query parameters. + */ + public CompletableFuture> auditServiceListAuditEvents( + AuditServiceListAuditEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/audit/events"); + if (request.getFilterOpsContextChangeId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.changeID", + request.getFilterOpsContextChangeId().get(), + false); + } + if (request.getFilterOpsContextRequestId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.requestID", + request.getFilterOpsContextRequestId().get(), + false); + } + if (request.getFilterOpsContextTraceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.traceID", + request.getFilterOpsContextTraceId().get(), + false); + } + if (request.getFilterOpsContextSessionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.sessionID", + request.getFilterOpsContextSessionId().get(), + false); + } + if (request.getFilterOpsContextActor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.actor", + request.getFilterOpsContextActor().get(), + false); + } + if (request.getFilterOpsContextActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.actorType", + request.getFilterOpsContextActorType().get(), + false); + } + if (request.getFilterOpsContextAccessType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.accessType", + request.getFilterOpsContextAccessType().get(), + false); + } + if (request.getFilterOpsContextIpAddress().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.ipAddress", + request.getFilterOpsContextIpAddress().get(), + false); + } + if (request.getFilterOpsContextOrigin().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.origin", + request.getFilterOpsContextOrigin().get(), + false); + } + if (request.getFilterOpsContextAuthMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.authMode", + request.getFilterOpsContextAuthMode().get(), + false); + } + if (request.getFilterOpsContextJwtId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.jwtID", + request.getFilterOpsContextJwtId().get(), + false); + } + if (request.getFilterOpsContextBearerTokenContextId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.bearerTokenContextID", + request.getFilterOpsContextBearerTokenContextId().get(), + false); + } + if (request.getFilterOpsParentAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.parentAccountID", + request.getFilterOpsParentAccountId().get(), + false); + } + QueryStringMapper.addQueryParameter(httpUrl, "filterOps.accountID", request.getFilterOpsAccountId(), false); + if (request.getFilterOpsWorkspaceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.workspaceID", + request.getFilterOpsWorkspaceId().get(), + false); + } + if (request.getFilterOpsVaultId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.vaultID", request.getFilterOpsVaultId().get(), false); + } + if (request.getFilterOpsResourceIDs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.resourceIDs", + request.getFilterOpsResourceIDs().get(), + false); + } + if (request.getFilterOpsActionType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.actionType", + request.getFilterOpsActionType().get(), + false); + } + if (request.getFilterOpsResourceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.resourceType", + request.getFilterOpsResourceType().get(), + false); + } + if (request.getFilterOpsTags().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.tags", request.getFilterOpsTags().get(), false); + } + if (request.getFilterOpsResponseCode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.responseCode", + request.getFilterOpsResponseCode().get(), + false); + } + if (request.getFilterOpsStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.startTime", + request.getFilterOpsStartTime().get(), + false); + } + if (request.getFilterOpsEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.endTime", request.getFilterOpsEndTime().get(), false); + } + if (request.getFilterOpsApiName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.apiName", request.getFilterOpsApiName().get(), false); + } + if (request.getFilterOpsResponseMessage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.responseMessage", + request.getFilterOpsResponseMessage().get(), + false); + } + if (request.getFilterOpsHttpMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.httpMethod", + request.getFilterOpsHttpMethod().get(), + false); + } + if (request.getFilterOpsHttpUri().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.httpURI", request.getFilterOpsHttpUri().get(), false); + } + if (request.getSortOpsSortBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sortOps.sortBy", request.getSortOpsSortBy().get(), false); + } + if (request.getSortOpsOrderBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sortOps.orderBy", request.getSortOpsOrderBy().get(), false); + } + if (request.getAfterOpsTimestamp().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "afterOps.timestamp", + request.getAfterOpsTimestamp().get(), + false); + } + if (request.getAfterOpsChangeId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "afterOps.changeID", request.getAfterOpsChangeId().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1AuditResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/AuditClient.java b/src/main/java/com/skyflow/generated/rest/resources/audit/AuditClient.java new file mode 100644 index 00000000..bac81431 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/AuditClient.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.audit.requests.AuditServiceListAuditEventsRequest; +import com.skyflow.generated.rest.types.V1AuditResponse; + +public class AuditClient { + protected final ClientOptions clientOptions; + + private final RawAuditClient rawClient; + + public AuditClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAuditClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAuditClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists audit events that match query parameters. + */ + public V1AuditResponse auditServiceListAuditEvents(AuditServiceListAuditEventsRequest request) { + return this.rawClient.auditServiceListAuditEvents(request).body(); + } + + /** + * Lists audit events that match query parameters. + */ + public V1AuditResponse auditServiceListAuditEvents( + AuditServiceListAuditEventsRequest request, RequestOptions requestOptions) { + return this.rawClient + .auditServiceListAuditEvents(request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/RawAuditClient.java b/src/main/java/com/skyflow/generated/rest/resources/audit/RawAuditClient.java new file mode 100644 index 00000000..bfec3bf2 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/RawAuditClient.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +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.errors.NotFoundError; +import com.skyflow.generated.rest.resources.audit.requests.AuditServiceListAuditEventsRequest; +import com.skyflow.generated.rest.types.V1AuditResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAuditClient { + protected final ClientOptions clientOptions; + + public RawAuditClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists audit events that match query parameters. + */ + public ApiClientHttpResponse auditServiceListAuditEvents( + AuditServiceListAuditEventsRequest request) { + return auditServiceListAuditEvents(request, null); + } + + /** + * Lists audit events that match query parameters. + */ + public ApiClientHttpResponse auditServiceListAuditEvents( + AuditServiceListAuditEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/audit/events"); + if (request.getFilterOpsContextChangeId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.changeID", + request.getFilterOpsContextChangeId().get(), + false); + } + if (request.getFilterOpsContextRequestId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.requestID", + request.getFilterOpsContextRequestId().get(), + false); + } + if (request.getFilterOpsContextTraceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.traceID", + request.getFilterOpsContextTraceId().get(), + false); + } + if (request.getFilterOpsContextSessionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.sessionID", + request.getFilterOpsContextSessionId().get(), + false); + } + if (request.getFilterOpsContextActor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.actor", + request.getFilterOpsContextActor().get(), + false); + } + if (request.getFilterOpsContextActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.actorType", + request.getFilterOpsContextActorType().get(), + false); + } + if (request.getFilterOpsContextAccessType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.accessType", + request.getFilterOpsContextAccessType().get(), + false); + } + if (request.getFilterOpsContextIpAddress().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.ipAddress", + request.getFilterOpsContextIpAddress().get(), + false); + } + if (request.getFilterOpsContextOrigin().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.origin", + request.getFilterOpsContextOrigin().get(), + false); + } + if (request.getFilterOpsContextAuthMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.authMode", + request.getFilterOpsContextAuthMode().get(), + false); + } + if (request.getFilterOpsContextJwtId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.jwtID", + request.getFilterOpsContextJwtId().get(), + false); + } + if (request.getFilterOpsContextBearerTokenContextId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.context.bearerTokenContextID", + request.getFilterOpsContextBearerTokenContextId().get(), + false); + } + if (request.getFilterOpsParentAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.parentAccountID", + request.getFilterOpsParentAccountId().get(), + false); + } + QueryStringMapper.addQueryParameter(httpUrl, "filterOps.accountID", request.getFilterOpsAccountId(), false); + if (request.getFilterOpsWorkspaceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.workspaceID", + request.getFilterOpsWorkspaceId().get(), + false); + } + if (request.getFilterOpsVaultId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.vaultID", request.getFilterOpsVaultId().get(), false); + } + if (request.getFilterOpsResourceIDs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.resourceIDs", + request.getFilterOpsResourceIDs().get(), + false); + } + if (request.getFilterOpsActionType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.actionType", + request.getFilterOpsActionType().get(), + false); + } + if (request.getFilterOpsResourceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.resourceType", + request.getFilterOpsResourceType().get(), + false); + } + if (request.getFilterOpsTags().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.tags", request.getFilterOpsTags().get(), false); + } + if (request.getFilterOpsResponseCode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.responseCode", + request.getFilterOpsResponseCode().get(), + false); + } + if (request.getFilterOpsStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.startTime", + request.getFilterOpsStartTime().get(), + false); + } + if (request.getFilterOpsEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.endTime", request.getFilterOpsEndTime().get(), false); + } + if (request.getFilterOpsApiName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.apiName", request.getFilterOpsApiName().get(), false); + } + if (request.getFilterOpsResponseMessage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.responseMessage", + request.getFilterOpsResponseMessage().get(), + false); + } + if (request.getFilterOpsHttpMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "filterOps.httpMethod", + request.getFilterOpsHttpMethod().get(), + false); + } + if (request.getFilterOpsHttpUri().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filterOps.httpURI", request.getFilterOpsHttpUri().get(), false); + } + if (request.getSortOpsSortBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sortOps.sortBy", request.getSortOpsSortBy().get(), false); + } + if (request.getSortOpsOrderBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sortOps.orderBy", request.getSortOpsOrderBy().get(), false); + } + if (request.getAfterOpsTimestamp().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "afterOps.timestamp", + request.getAfterOpsTimestamp().get(), + false); + } + if (request.getAfterOpsChangeId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "afterOps.changeID", request.getAfterOpsChangeId().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1AuditResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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/audit/requests/AuditServiceListAuditEventsRequest.java b/src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java new file mode 100644 index 00000000..3da04589 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/requests/AuditServiceListAuditEventsRequest.java @@ -0,0 +1,1589 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.audit.types.AuditServiceListAuditEventsRequestFilterOpsActionType; +import com.skyflow.generated.rest.resources.audit.types.AuditServiceListAuditEventsRequestFilterOpsContextAccessType; +import com.skyflow.generated.rest.resources.audit.types.AuditServiceListAuditEventsRequestFilterOpsContextActorType; +import com.skyflow.generated.rest.resources.audit.types.AuditServiceListAuditEventsRequestFilterOpsContextAuthMode; +import com.skyflow.generated.rest.resources.audit.types.AuditServiceListAuditEventsRequestFilterOpsResourceType; +import com.skyflow.generated.rest.resources.audit.types.AuditServiceListAuditEventsRequestSortOpsOrderBy; +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 = AuditServiceListAuditEventsRequest.Builder.class) +public final class AuditServiceListAuditEventsRequest { + private final Optional filterOpsContextChangeId; + + private final Optional filterOpsContextRequestId; + + private final Optional filterOpsContextTraceId; + + private final Optional filterOpsContextSessionId; + + private final Optional filterOpsContextActor; + + private final Optional filterOpsContextActorType; + + private final Optional filterOpsContextAccessType; + + private final Optional filterOpsContextIpAddress; + + private final Optional filterOpsContextOrigin; + + private final Optional filterOpsContextAuthMode; + + private final Optional filterOpsContextJwtId; + + private final Optional filterOpsContextBearerTokenContextId; + + private final Optional filterOpsParentAccountId; + + private final String filterOpsAccountId; + + private final Optional filterOpsWorkspaceId; + + private final Optional filterOpsVaultId; + + private final Optional filterOpsResourceIDs; + + private final Optional filterOpsActionType; + + private final Optional filterOpsResourceType; + + private final Optional filterOpsTags; + + private final Optional filterOpsResponseCode; + + private final Optional filterOpsStartTime; + + private final Optional filterOpsEndTime; + + private final Optional filterOpsApiName; + + private final Optional filterOpsResponseMessage; + + private final Optional filterOpsHttpMethod; + + private final Optional filterOpsHttpUri; + + private final Optional sortOpsSortBy; + + private final Optional sortOpsOrderBy; + + private final Optional afterOpsTimestamp; + + private final Optional afterOpsChangeId; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private AuditServiceListAuditEventsRequest( + Optional filterOpsContextChangeId, + Optional filterOpsContextRequestId, + Optional filterOpsContextTraceId, + Optional filterOpsContextSessionId, + Optional filterOpsContextActor, + Optional filterOpsContextActorType, + Optional filterOpsContextAccessType, + Optional filterOpsContextIpAddress, + Optional filterOpsContextOrigin, + Optional filterOpsContextAuthMode, + Optional filterOpsContextJwtId, + Optional filterOpsContextBearerTokenContextId, + Optional filterOpsParentAccountId, + String filterOpsAccountId, + Optional filterOpsWorkspaceId, + Optional filterOpsVaultId, + Optional filterOpsResourceIDs, + Optional filterOpsActionType, + Optional filterOpsResourceType, + Optional filterOpsTags, + Optional filterOpsResponseCode, + Optional filterOpsStartTime, + Optional filterOpsEndTime, + Optional filterOpsApiName, + Optional filterOpsResponseMessage, + Optional filterOpsHttpMethod, + Optional filterOpsHttpUri, + Optional sortOpsSortBy, + Optional sortOpsOrderBy, + Optional afterOpsTimestamp, + Optional afterOpsChangeId, + Optional limit, + Optional offset, + Map additionalProperties) { + this.filterOpsContextChangeId = filterOpsContextChangeId; + this.filterOpsContextRequestId = filterOpsContextRequestId; + this.filterOpsContextTraceId = filterOpsContextTraceId; + this.filterOpsContextSessionId = filterOpsContextSessionId; + this.filterOpsContextActor = filterOpsContextActor; + this.filterOpsContextActorType = filterOpsContextActorType; + this.filterOpsContextAccessType = filterOpsContextAccessType; + this.filterOpsContextIpAddress = filterOpsContextIpAddress; + this.filterOpsContextOrigin = filterOpsContextOrigin; + this.filterOpsContextAuthMode = filterOpsContextAuthMode; + this.filterOpsContextJwtId = filterOpsContextJwtId; + this.filterOpsContextBearerTokenContextId = filterOpsContextBearerTokenContextId; + this.filterOpsParentAccountId = filterOpsParentAccountId; + this.filterOpsAccountId = filterOpsAccountId; + this.filterOpsWorkspaceId = filterOpsWorkspaceId; + this.filterOpsVaultId = filterOpsVaultId; + this.filterOpsResourceIDs = filterOpsResourceIDs; + this.filterOpsActionType = filterOpsActionType; + this.filterOpsResourceType = filterOpsResourceType; + this.filterOpsTags = filterOpsTags; + this.filterOpsResponseCode = filterOpsResponseCode; + this.filterOpsStartTime = filterOpsStartTime; + this.filterOpsEndTime = filterOpsEndTime; + this.filterOpsApiName = filterOpsApiName; + this.filterOpsResponseMessage = filterOpsResponseMessage; + this.filterOpsHttpMethod = filterOpsHttpMethod; + this.filterOpsHttpUri = filterOpsHttpUri; + this.sortOpsSortBy = sortOpsSortBy; + this.sortOpsOrderBy = sortOpsOrderBy; + this.afterOpsTimestamp = afterOpsTimestamp; + this.afterOpsChangeId = afterOpsChangeId; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID for the audit event. + */ + @JsonProperty("filterOps.context.changeID") + public Optional getFilterOpsContextChangeId() { + return filterOpsContextChangeId; + } + + /** + * @return ID for the request that caused the event. + */ + @JsonProperty("filterOps.context.requestID") + public Optional getFilterOpsContextRequestId() { + return filterOpsContextRequestId; + } + + /** + * @return ID for the request set by the service that received the request. + */ + @JsonProperty("filterOps.context.traceID") + public Optional getFilterOpsContextTraceId() { + return filterOpsContextTraceId; + } + + /** + * @return ID for the session in which the request was sent. + */ + @JsonProperty("filterOps.context.sessionID") + public Optional getFilterOpsContextSessionId() { + return filterOpsContextSessionId; + } + + /** + * @return Member who sent the request. Depending on actorType, this may be a user ID or a service account ID. + */ + @JsonProperty("filterOps.context.actor") + public Optional getFilterOpsContextActor() { + return filterOpsContextActor; + } + + /** + * @return Type of member who sent the request. + */ + @JsonProperty("filterOps.context.actorType") + public Optional getFilterOpsContextActorType() { + return filterOpsContextActorType; + } + + /** + * @return Type of access for the request. + */ + @JsonProperty("filterOps.context.accessType") + public Optional getFilterOpsContextAccessType() { + return filterOpsContextAccessType; + } + + /** + * @return IP Address of the client that made the request. + */ + @JsonProperty("filterOps.context.ipAddress") + public Optional getFilterOpsContextIpAddress() { + return filterOpsContextIpAddress; + } + + /** + * @return HTTP Origin request header (including scheme, hostname, and port) of the request. + */ + @JsonProperty("filterOps.context.origin") + public Optional getFilterOpsContextOrigin() { + return filterOpsContextOrigin; + } + + /** + * @return Authentication mode the actor used. + */ + @JsonProperty("filterOps.context.authMode") + public Optional getFilterOpsContextAuthMode() { + return filterOpsContextAuthMode; + } + + /** + * @return ID of the JWT token. + */ + @JsonProperty("filterOps.context.jwtID") + public Optional getFilterOpsContextJwtId() { + return filterOpsContextJwtId; + } + + /** + * @return Embedded User Context. + */ + @JsonProperty("filterOps.context.bearerTokenContextID") + public Optional getFilterOpsContextBearerTokenContextId() { + return filterOpsContextBearerTokenContextId; + } + + /** + * @return Resources with the specified parent account ID. + */ + @JsonProperty("filterOps.parentAccountID") + public Optional getFilterOpsParentAccountId() { + return filterOpsParentAccountId; + } + + /** + * @return Resources with the specified account ID. + */ + @JsonProperty("filterOps.accountID") + public String getFilterOpsAccountId() { + return filterOpsAccountId; + } + + /** + * @return Resources with the specified workspace ID. + */ + @JsonProperty("filterOps.workspaceID") + public Optional getFilterOpsWorkspaceId() { + return filterOpsWorkspaceId; + } + + /** + * @return Resources with the specified vault ID. + */ + @JsonProperty("filterOps.vaultID") + public Optional getFilterOpsVaultId() { + return filterOpsVaultId; + } + + /** + * @return 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". + */ + @JsonProperty("filterOps.resourceIDs") + public Optional getFilterOpsResourceIDs() { + return filterOpsResourceIDs; + } + + /** + * @return Events with the specified action type. + */ + @JsonProperty("filterOps.actionType") + public Optional getFilterOpsActionType() { + return filterOpsActionType; + } + + /** + * @return Resources with the specified type. + */ + @JsonProperty("filterOps.resourceType") + public Optional getFilterOpsResourceType() { + return filterOpsResourceType; + } + + /** + * @return Events with associated tags. If an event matches at least one tag, the event is returned. Comma-separated list. For example, "login, get". + */ + @JsonProperty("filterOps.tags") + public Optional getFilterOpsTags() { + return filterOpsTags; + } + + /** + * @return HTTP response code of the request. + */ + @JsonProperty("filterOps.responseCode") + public Optional getFilterOpsResponseCode() { + return filterOpsResponseCode; + } + + /** + * @return Start timestamp for the query, in SQL format. + */ + @JsonProperty("filterOps.startTime") + public Optional getFilterOpsStartTime() { + return filterOpsStartTime; + } + + /** + * @return End timestamp for the query, in SQL format. + */ + @JsonProperty("filterOps.endTime") + public Optional getFilterOpsEndTime() { + return filterOpsEndTime; + } + + /** + * @return Name of the API called in the request. + */ + @JsonProperty("filterOps.apiName") + public Optional getFilterOpsApiName() { + return filterOpsApiName; + } + + /** + * @return Response message of the request. + */ + @JsonProperty("filterOps.responseMessage") + public Optional getFilterOpsResponseMessage() { + return filterOpsResponseMessage; + } + + /** + * @return HTTP method of the request. + */ + @JsonProperty("filterOps.httpMethod") + public Optional getFilterOpsHttpMethod() { + return filterOpsHttpMethod; + } + + /** + * @return HTTP URI of the request. + */ + @JsonProperty("filterOps.httpURI") + public Optional getFilterOpsHttpUri() { + return filterOpsHttpUri; + } + + /** + * @return Fully-qualified field by which to sort results. Field names should be in camel case (for example, "capitalization.camelCase"). + */ + @JsonProperty("sortOps.sortBy") + public Optional getSortOpsSortBy() { + return sortOpsSortBy; + } + + /** + * @return Ascending or descending ordering of results. + */ + @JsonProperty("sortOps.orderBy") + public Optional getSortOpsOrderBy() { + return sortOpsOrderBy; + } + + /** + * @return 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. + */ + @JsonProperty("afterOps.timestamp") + public Optional getAfterOpsTimestamp() { + return afterOpsTimestamp; + } + + /** + * @return 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. + */ + @JsonProperty("afterOps.changeID") + public Optional getAfterOpsChangeId() { + return afterOpsChangeId; + } + + /** + * @return Number of results to return. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Record position at which to start returning results. + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditServiceListAuditEventsRequest + && equalTo((AuditServiceListAuditEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuditServiceListAuditEventsRequest other) { + return filterOpsContextChangeId.equals(other.filterOpsContextChangeId) + && filterOpsContextRequestId.equals(other.filterOpsContextRequestId) + && filterOpsContextTraceId.equals(other.filterOpsContextTraceId) + && filterOpsContextSessionId.equals(other.filterOpsContextSessionId) + && filterOpsContextActor.equals(other.filterOpsContextActor) + && filterOpsContextActorType.equals(other.filterOpsContextActorType) + && filterOpsContextAccessType.equals(other.filterOpsContextAccessType) + && filterOpsContextIpAddress.equals(other.filterOpsContextIpAddress) + && filterOpsContextOrigin.equals(other.filterOpsContextOrigin) + && filterOpsContextAuthMode.equals(other.filterOpsContextAuthMode) + && filterOpsContextJwtId.equals(other.filterOpsContextJwtId) + && filterOpsContextBearerTokenContextId.equals(other.filterOpsContextBearerTokenContextId) + && filterOpsParentAccountId.equals(other.filterOpsParentAccountId) + && filterOpsAccountId.equals(other.filterOpsAccountId) + && filterOpsWorkspaceId.equals(other.filterOpsWorkspaceId) + && filterOpsVaultId.equals(other.filterOpsVaultId) + && filterOpsResourceIDs.equals(other.filterOpsResourceIDs) + && filterOpsActionType.equals(other.filterOpsActionType) + && filterOpsResourceType.equals(other.filterOpsResourceType) + && filterOpsTags.equals(other.filterOpsTags) + && filterOpsResponseCode.equals(other.filterOpsResponseCode) + && filterOpsStartTime.equals(other.filterOpsStartTime) + && filterOpsEndTime.equals(other.filterOpsEndTime) + && filterOpsApiName.equals(other.filterOpsApiName) + && filterOpsResponseMessage.equals(other.filterOpsResponseMessage) + && filterOpsHttpMethod.equals(other.filterOpsHttpMethod) + && filterOpsHttpUri.equals(other.filterOpsHttpUri) + && sortOpsSortBy.equals(other.sortOpsSortBy) + && sortOpsOrderBy.equals(other.sortOpsOrderBy) + && afterOpsTimestamp.equals(other.afterOpsTimestamp) + && afterOpsChangeId.equals(other.afterOpsChangeId) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.filterOpsContextChangeId, + this.filterOpsContextRequestId, + this.filterOpsContextTraceId, + this.filterOpsContextSessionId, + this.filterOpsContextActor, + this.filterOpsContextActorType, + this.filterOpsContextAccessType, + this.filterOpsContextIpAddress, + this.filterOpsContextOrigin, + this.filterOpsContextAuthMode, + this.filterOpsContextJwtId, + this.filterOpsContextBearerTokenContextId, + this.filterOpsParentAccountId, + this.filterOpsAccountId, + this.filterOpsWorkspaceId, + this.filterOpsVaultId, + this.filterOpsResourceIDs, + this.filterOpsActionType, + this.filterOpsResourceType, + this.filterOpsTags, + this.filterOpsResponseCode, + this.filterOpsStartTime, + this.filterOpsEndTime, + this.filterOpsApiName, + this.filterOpsResponseMessage, + this.filterOpsHttpMethod, + this.filterOpsHttpUri, + this.sortOpsSortBy, + this.sortOpsOrderBy, + this.afterOpsTimestamp, + this.afterOpsChangeId, + this.limit, + this.offset); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FilterOpsAccountIdStage builder() { + return new Builder(); + } + + public interface FilterOpsAccountIdStage { + /** + * Resources with the specified account ID. + */ + _FinalStage filterOpsAccountId(@NotNull String filterOpsAccountId); + + Builder from(AuditServiceListAuditEventsRequest other); + } + + public interface _FinalStage { + AuditServiceListAuditEventsRequest build(); + + /** + *

ID for the audit event.

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

ID for the request that caused the event.

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

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

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

ID for the session in which the request was sent.

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

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

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

Type of member who sent the request.

+ */ + _FinalStage filterOpsContextActorType( + Optional filterOpsContextActorType); + + _FinalStage filterOpsContextActorType( + AuditServiceListAuditEventsRequestFilterOpsContextActorType filterOpsContextActorType); + + /** + *

Type of access for the request.

+ */ + _FinalStage filterOpsContextAccessType( + Optional filterOpsContextAccessType); + + _FinalStage filterOpsContextAccessType( + AuditServiceListAuditEventsRequestFilterOpsContextAccessType filterOpsContextAccessType); + + /** + *

IP Address of the client that made the request.

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

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

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

Authentication mode the actor used.

+ */ + _FinalStage filterOpsContextAuthMode( + Optional filterOpsContextAuthMode); + + _FinalStage filterOpsContextAuthMode( + AuditServiceListAuditEventsRequestFilterOpsContextAuthMode filterOpsContextAuthMode); + + /** + *

ID of the JWT token.

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

Embedded User Context.

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

Resources with the specified parent account ID.

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

Resources with the specified workspace ID.

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

Resources with the specified vault ID.

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

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".

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

Events with the specified action type.

+ */ + _FinalStage filterOpsActionType( + Optional filterOpsActionType); + + _FinalStage filterOpsActionType(AuditServiceListAuditEventsRequestFilterOpsActionType filterOpsActionType); + + /** + *

Resources with the specified type.

+ */ + _FinalStage filterOpsResourceType( + Optional filterOpsResourceType); + + _FinalStage filterOpsResourceType( + AuditServiceListAuditEventsRequestFilterOpsResourceType filterOpsResourceType); + + /** + *

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

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

HTTP response code of the request.

+ */ + _FinalStage filterOpsResponseCode(Optional filterOpsResponseCode); + + _FinalStage filterOpsResponseCode(Integer filterOpsResponseCode); + + /** + *

Start timestamp for the query, in SQL format.

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

End timestamp for the query, in SQL format.

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

Name of the API called in the request.

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

Response message of the request.

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

HTTP method of the request.

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

HTTP URI of the request.

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

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

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

Ascending or descending ordering of results.

+ */ + _FinalStage sortOpsOrderBy(Optional sortOpsOrderBy); + + _FinalStage sortOpsOrderBy(AuditServiceListAuditEventsRequestSortOpsOrderBy sortOpsOrderBy); + + /** + *

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.

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

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.

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

Number of results to return.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Record position at which to start returning results.

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FilterOpsAccountIdStage, _FinalStage { + private String filterOpsAccountId; + + private Optional offset = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional afterOpsChangeId = Optional.empty(); + + private Optional afterOpsTimestamp = Optional.empty(); + + private Optional sortOpsOrderBy = Optional.empty(); + + private Optional sortOpsSortBy = Optional.empty(); + + private Optional filterOpsHttpUri = Optional.empty(); + + private Optional filterOpsHttpMethod = Optional.empty(); + + private Optional filterOpsResponseMessage = Optional.empty(); + + private Optional filterOpsApiName = Optional.empty(); + + private Optional filterOpsEndTime = Optional.empty(); + + private Optional filterOpsStartTime = Optional.empty(); + + private Optional filterOpsResponseCode = Optional.empty(); + + private Optional filterOpsTags = Optional.empty(); + + private Optional filterOpsResourceType = + Optional.empty(); + + private Optional filterOpsActionType = Optional.empty(); + + private Optional filterOpsResourceIDs = Optional.empty(); + + private Optional filterOpsVaultId = Optional.empty(); + + private Optional filterOpsWorkspaceId = Optional.empty(); + + private Optional filterOpsParentAccountId = Optional.empty(); + + private Optional filterOpsContextBearerTokenContextId = Optional.empty(); + + private Optional filterOpsContextJwtId = Optional.empty(); + + private Optional filterOpsContextAuthMode = + Optional.empty(); + + private Optional filterOpsContextOrigin = Optional.empty(); + + private Optional filterOpsContextIpAddress = Optional.empty(); + + private Optional filterOpsContextAccessType = + Optional.empty(); + + private Optional filterOpsContextActorType = + Optional.empty(); + + private Optional filterOpsContextActor = Optional.empty(); + + private Optional filterOpsContextSessionId = Optional.empty(); + + private Optional filterOpsContextTraceId = Optional.empty(); + + private Optional filterOpsContextRequestId = Optional.empty(); + + private Optional filterOpsContextChangeId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuditServiceListAuditEventsRequest other) { + filterOpsContextChangeId(other.getFilterOpsContextChangeId()); + filterOpsContextRequestId(other.getFilterOpsContextRequestId()); + filterOpsContextTraceId(other.getFilterOpsContextTraceId()); + filterOpsContextSessionId(other.getFilterOpsContextSessionId()); + filterOpsContextActor(other.getFilterOpsContextActor()); + filterOpsContextActorType(other.getFilterOpsContextActorType()); + filterOpsContextAccessType(other.getFilterOpsContextAccessType()); + filterOpsContextIpAddress(other.getFilterOpsContextIpAddress()); + filterOpsContextOrigin(other.getFilterOpsContextOrigin()); + filterOpsContextAuthMode(other.getFilterOpsContextAuthMode()); + filterOpsContextJwtId(other.getFilterOpsContextJwtId()); + filterOpsContextBearerTokenContextId(other.getFilterOpsContextBearerTokenContextId()); + filterOpsParentAccountId(other.getFilterOpsParentAccountId()); + filterOpsAccountId(other.getFilterOpsAccountId()); + filterOpsWorkspaceId(other.getFilterOpsWorkspaceId()); + filterOpsVaultId(other.getFilterOpsVaultId()); + filterOpsResourceIDs(other.getFilterOpsResourceIDs()); + filterOpsActionType(other.getFilterOpsActionType()); + filterOpsResourceType(other.getFilterOpsResourceType()); + filterOpsTags(other.getFilterOpsTags()); + filterOpsResponseCode(other.getFilterOpsResponseCode()); + filterOpsStartTime(other.getFilterOpsStartTime()); + filterOpsEndTime(other.getFilterOpsEndTime()); + filterOpsApiName(other.getFilterOpsApiName()); + filterOpsResponseMessage(other.getFilterOpsResponseMessage()); + filterOpsHttpMethod(other.getFilterOpsHttpMethod()); + filterOpsHttpUri(other.getFilterOpsHttpUri()); + sortOpsSortBy(other.getSortOpsSortBy()); + sortOpsOrderBy(other.getSortOpsOrderBy()); + afterOpsTimestamp(other.getAfterOpsTimestamp()); + afterOpsChangeId(other.getAfterOpsChangeId()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + /** + * 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 + @JsonSetter("filterOps.accountID") + public _FinalStage filterOpsAccountId(@NotNull String filterOpsAccountId) { + this.filterOpsAccountId = Objects.requireNonNull(filterOpsAccountId, "filterOpsAccountId must not be null"); + return this; + } + + /** + *

Record position at which to start returning results.

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

Record position at which to start returning results.

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

Number of results to return.

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

Number of results to return.

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

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 + public _FinalStage afterOpsChangeId(String afterOpsChangeId) { + this.afterOpsChangeId = Optional.ofNullable(afterOpsChangeId); + return this; + } + + /** + *

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 + @JsonSetter(value = "afterOps.changeID", nulls = Nulls.SKIP) + public _FinalStage afterOpsChangeId(Optional afterOpsChangeId) { + this.afterOpsChangeId = afterOpsChangeId; + return this; + } + + /** + *

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 + public _FinalStage afterOpsTimestamp(String afterOpsTimestamp) { + this.afterOpsTimestamp = Optional.ofNullable(afterOpsTimestamp); + return this; + } + + /** + *

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 + @JsonSetter(value = "afterOps.timestamp", nulls = Nulls.SKIP) + public _FinalStage afterOpsTimestamp(Optional afterOpsTimestamp) { + this.afterOpsTimestamp = afterOpsTimestamp; + return this; + } + + /** + *

Ascending or descending ordering of results.

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

Ascending or descending ordering of results.

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

Fully-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 + public _FinalStage sortOpsSortBy(String sortOpsSortBy) { + this.sortOpsSortBy = Optional.ofNullable(sortOpsSortBy); + return this; + } + + /** + *

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

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

HTTP URI of the request.

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

HTTP URI of the request.

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

HTTP method of the request.

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

HTTP method of the request.

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

Response message of the request.

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

Response message of the request.

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

Name of the API called in the request.

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

Name of the API called in the request.

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

End timestamp for the query, in SQL format.

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

End timestamp for the query, in SQL format.

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

Start timestamp for the query, in SQL format.

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

Start timestamp for the query, in SQL format.

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

HTTP response code of the request.

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

HTTP response code of the request.

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

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 + public _FinalStage filterOpsTags(String filterOpsTags) { + this.filterOpsTags = Optional.ofNullable(filterOpsTags); + return this; + } + + /** + *

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 + @JsonSetter(value = "filterOps.tags", nulls = Nulls.SKIP) + public _FinalStage filterOpsTags(Optional filterOpsTags) { + this.filterOpsTags = filterOpsTags; + return this; + } + + /** + *

Resources with the specified type.

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

Resources with the specified type.

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

Events with the specified action type.

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

Events with the specified action type.

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

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 + public _FinalStage filterOpsResourceIDs(String filterOpsResourceIDs) { + this.filterOpsResourceIDs = Optional.ofNullable(filterOpsResourceIDs); + return this; + } + + /** + *

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 + @JsonSetter(value = "filterOps.resourceIDs", nulls = Nulls.SKIP) + public _FinalStage filterOpsResourceIDs(Optional filterOpsResourceIDs) { + this.filterOpsResourceIDs = filterOpsResourceIDs; + return this; + } + + /** + *

Resources with the specified vault ID.

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

Resources with the specified vault ID.

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

Resources with the specified workspace ID.

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

Resources with the specified workspace ID.

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

Resources with the specified parent account ID.

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

Resources with the specified parent account ID.

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

Embedded User Context.

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

Embedded User Context.

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

ID of the JWT token.

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

ID of the JWT token.

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

Authentication mode the actor used.

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

Authentication mode the actor used.

+ */ + @java.lang.Override + @JsonSetter(value = "filterOps.context.authMode", nulls = Nulls.SKIP) + public _FinalStage filterOpsContextAuthMode( + Optional filterOpsContextAuthMode) { + this.filterOpsContextAuthMode = filterOpsContextAuthMode; + return this; + } + + /** + *

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 + public _FinalStage filterOpsContextOrigin(String filterOpsContextOrigin) { + this.filterOpsContextOrigin = Optional.ofNullable(filterOpsContextOrigin); + return this; + } + + /** + *

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

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

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 + public _FinalStage filterOpsContextIpAddress(String filterOpsContextIpAddress) { + this.filterOpsContextIpAddress = Optional.ofNullable(filterOpsContextIpAddress); + return this; + } + + /** + *

IP Address of the client that made the request.

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

Type of access for the request.

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

Type of access for the request.

+ */ + @java.lang.Override + @JsonSetter(value = "filterOps.context.accessType", nulls = Nulls.SKIP) + public _FinalStage filterOpsContextAccessType( + Optional filterOpsContextAccessType) { + this.filterOpsContextAccessType = filterOpsContextAccessType; + return this; + } + + /** + *

Type of member who sent the request.

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

Type of member who sent the request.

+ */ + @java.lang.Override + @JsonSetter(value = "filterOps.context.actorType", nulls = Nulls.SKIP) + public _FinalStage filterOpsContextActorType( + Optional filterOpsContextActorType) { + this.filterOpsContextActorType = filterOpsContextActorType; + return this; + } + + /** + *

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 + public _FinalStage filterOpsContextActor(String filterOpsContextActor) { + this.filterOpsContextActor = Optional.ofNullable(filterOpsContextActor); + return this; + } + + /** + *

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

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

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 + public _FinalStage filterOpsContextSessionId(String filterOpsContextSessionId) { + this.filterOpsContextSessionId = Optional.ofNullable(filterOpsContextSessionId); + return this; + } + + /** + *

ID for the session in which the request was sent.

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

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 + public _FinalStage filterOpsContextTraceId(String filterOpsContextTraceId) { + this.filterOpsContextTraceId = Optional.ofNullable(filterOpsContextTraceId); + return this; + } + + /** + *

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

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

ID for the request that caused the event.

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

ID for the request that caused the event.

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

ID for the audit event.

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

ID for the audit event.

+ */ + @java.lang.Override + @JsonSetter(value = "filterOps.context.changeID", nulls = Nulls.SKIP) + public _FinalStage filterOpsContextChangeId(Optional filterOpsContextChangeId) { + this.filterOpsContextChangeId = filterOpsContextChangeId; + return this; + } + + @java.lang.Override + public AuditServiceListAuditEventsRequest build() { + return new AuditServiceListAuditEventsRequest( + filterOpsContextChangeId, + filterOpsContextRequestId, + filterOpsContextTraceId, + filterOpsContextSessionId, + filterOpsContextActor, + filterOpsContextActorType, + filterOpsContextAccessType, + filterOpsContextIpAddress, + filterOpsContextOrigin, + filterOpsContextAuthMode, + filterOpsContextJwtId, + filterOpsContextBearerTokenContextId, + filterOpsParentAccountId, + filterOpsAccountId, + filterOpsWorkspaceId, + filterOpsVaultId, + filterOpsResourceIDs, + filterOpsActionType, + filterOpsResourceType, + filterOpsTags, + filterOpsResponseCode, + filterOpsStartTime, + filterOpsEndTime, + filterOpsApiName, + filterOpsResponseMessage, + filterOpsHttpMethod, + filterOpsHttpUri, + sortOpsSortBy, + sortOpsOrderBy, + afterOpsTimestamp, + afterOpsChangeId, + limit, + offset, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java new file mode 100644 index 00000000..a9fb6d44 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsActionType.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AuditServiceListAuditEventsRequestFilterOpsActionType { + NONE("NONE"), + + ASSIGN("ASSIGN"), + + CREATE("CREATE"), + + DELETE("DELETE"), + + EXECUTE("EXECUTE"), + + LIST("LIST"), + + READ("READ"), + + UNASSIGN("UNASSIGN"), + + UPDATE("UPDATE"), + + VALIDATE("VALIDATE"), + + LOGIN("LOGIN"), + + ROTATE("ROTATE"), + + SCHEDULEROTATION("SCHEDULEROTATION"), + + SCHEDULEROTATIONALERT("SCHEDULEROTATIONALERT"), + + IMPORT("IMPORT"), + + GETIMPORTPARAMETERS("GETIMPORTPARAMETERS"), + + PING("PING"), + + GETCLOUDPROVIDER("GETCLOUDPROVIDER"); + + private final String value; + + AuditServiceListAuditEventsRequestFilterOpsActionType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java new file mode 100644 index 00000000..0b082305 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAccessType.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AuditServiceListAuditEventsRequestFilterOpsContextAccessType { + ACCESS_NONE("ACCESS_NONE"), + + API("API"), + + SQL("SQL"), + + OKTA_LOGIN("OKTA_LOGIN"); + + private final String value; + + AuditServiceListAuditEventsRequestFilterOpsContextAccessType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java new file mode 100644 index 00000000..76a357f4 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextActorType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AuditServiceListAuditEventsRequestFilterOpsContextActorType { + NONE("NONE"), + + USER("USER"), + + SERVICE_ACCOUNT("SERVICE_ACCOUNT"); + + private final String value; + + AuditServiceListAuditEventsRequestFilterOpsContextActorType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java new file mode 100644 index 00000000..cfca2e35 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsContextAuthMode.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AuditServiceListAuditEventsRequestFilterOpsContextAuthMode { + AUTH_NONE("AUTH_NONE"), + + OKTA_JWT("OKTA_JWT"), + + SERVICE_ACCOUNT_JWT("SERVICE_ACCOUNT_JWT"), + + PAT_JWT("PAT_JWT"); + + private final String value; + + AuditServiceListAuditEventsRequestFilterOpsContextAuthMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java new file mode 100644 index 00000000..f5d2eafe --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestFilterOpsResourceType.java @@ -0,0 +1,80 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AuditServiceListAuditEventsRequestFilterOpsResourceType { + NONE_API("NONE_API"), + + ACCOUNT("ACCOUNT"), + + AUDIT("AUDIT"), + + BASE_DATA_TYPE("BASE_DATA_TYPE"), + + FIELD_TEMPLATE("FIELD_TEMPLATE"), + + FILE("FILE"), + + KEY("KEY"), + + POLICY("POLICY"), + + PROTO_PARSE("PROTO_PARSE"), + + RECORD("RECORD"), + + ROLE("ROLE"), + + RULE("RULE"), + + SECRET("SECRET"), + + SERVICE_ACCOUNT("SERVICE_ACCOUNT"), + + TOKEN("TOKEN"), + + USER("USER"), + + VAULT("VAULT"), + + VAULT_TEMPLATE("VAULT_TEMPLATE"), + + WORKSPACE("WORKSPACE"), + + TABLE("TABLE"), + + POLICY_TEMPLATE("POLICY_TEMPLATE"), + + MEMBER("MEMBER"), + + TAG("TAG"), + + CONNECTION("CONNECTION"), + + MIGRATION("MIGRATION"), + + SCHEDULED_JOB("SCHEDULED_JOB"), + + JOB("JOB"), + + COLUMN_NAME("COLUMN_NAME"), + + NETWORK_TOKEN("NETWORK_TOKEN"), + + SUBSCRIPTION("SUBSCRIPTION"); + + private final String value; + + AuditServiceListAuditEventsRequestFilterOpsResourceType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java new file mode 100644 index 00000000..51fc2715 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/audit/types/AuditServiceListAuditEventsRequestSortOpsOrderBy.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.audit.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AuditServiceListAuditEventsRequestSortOpsOrderBy { + ASCENDING("ASCENDING"), + + DESCENDING("DESCENDING"); + + private final String value; + + AuditServiceListAuditEventsRequestSortOpsOrderBy(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java b/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java new file mode 100644 index 00000000..43ffab73 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.authentication; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.authentication.requests.V1GetAuthTokenRequest; +import com.skyflow.generated.rest.types.V1GetAuthTokenResponse; +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/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java b/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java new file mode 100644 index 00000000..eca4ab90 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.authentication; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.BadRequestError; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.errors.UnauthorizedError; +import com.skyflow.generated.rest.resources.authentication.requests.V1GetAuthTokenRequest; +import com.skyflow.generated.rest.types.V1GetAuthTokenResponse; +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.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, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/AuthenticationClient.java b/src/main/java/com/skyflow/generated/rest/resources/authentication/AuthenticationClient.java new file mode 100644 index 00000000..662bfb3d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/authentication/AuthenticationClient.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.authentication; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.authentication.requests.V1GetAuthTokenRequest; +import com.skyflow.generated.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/src/main/java/com/skyflow/generated/rest/resources/authentication/RawAuthenticationClient.java b/src/main/java/com/skyflow/generated/rest/resources/authentication/RawAuthenticationClient.java new file mode 100644 index 00000000..3d242eff --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/authentication/RawAuthenticationClient.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.authentication; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.BadRequestError; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.errors.UnauthorizedError; +import com.skyflow.generated.rest.resources.authentication.requests.V1GetAuthTokenRequest; +import com.skyflow.generated.rest.types.V1GetAuthTokenResponse; +import java.io.IOException; +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, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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/src/main/java/com/skyflow/generated/rest/resources/authentication/requests/V1GetAuthTokenRequest.java new file mode 100644 index 00000000..8c4961b1 --- /dev/null +++ b/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; + } + + @java.lang.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); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.grantType, + this.assertion, + this.subjectToken, + this.subjectTokenType, + this.requestedTokenUse, + this.scope); + } + + @java.lang.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() {} + + @java.lang.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. + */ + @java.lang.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. + */ + @java.lang.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. + */ + @java.lang.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>".

+ */ + @java.lang.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. + */ + @java.lang.Override + public _FinalStage requestedTokenUse(String requestedTokenUse) { + this.requestedTokenUse = Optional.ofNullable(requestedTokenUse); + return this; + } + + /** + *

Token use type. Either delegation or impersonation.

+ */ + @java.lang.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. + */ + @java.lang.Override + public _FinalStage subjectTokenType(String subjectTokenType) { + this.subjectTokenType = Optional.ofNullable(subjectTokenType); + return this; + } + + /** + *

Subject token type.

+ */ + @java.lang.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. + */ + @java.lang.Override + public _FinalStage subjectToken(String subjectToken) { + this.subjectToken = Optional.ofNullable(subjectToken); + return this; + } + + /** + *

Subject token.

+ */ + @java.lang.Override + @JsonSetter(value = "subject_token", nulls = Nulls.SKIP) + public _FinalStage subjectToken(Optional subjectToken) { + this.subjectToken = subjectToken; + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncBinLookupClient.java new file mode 100644 index 00000000..f10ed979 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncBinLookupClient.java @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.binlookup; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.binlookup.requests.V1BinListRequest; +import com.skyflow.generated.rest.types.V1BinListResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncBinLookupClient { + protected final ClientOptions clientOptions; + + private final AsyncRawBinLookupClient rawClient; + + public AsyncBinLookupClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawBinLookupClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawBinLookupClient withRawResponse() { + return this.rawClient; + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public CompletableFuture binListServiceListCardsOfBin() { + return this.rawClient.binListServiceListCardsOfBin().thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public CompletableFuture binListServiceListCardsOfBin(V1BinListRequest request) { + return this.rawClient.binListServiceListCardsOfBin(request).thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public CompletableFuture binListServiceListCardsOfBin( + V1BinListRequest request, RequestOptions requestOptions) { + return this.rawClient + .binListServiceListCardsOfBin(request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncRawBinLookupClient.java b/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncRawBinLookupClient.java new file mode 100644 index 00000000..2a3f5f4f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/binlookup/AsyncRawBinLookupClient.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.binlookup; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.resources.binlookup.requests.V1BinListRequest; +import com.skyflow.generated.rest.types.V1BinListResponse; +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.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawBinLookupClient { + protected final ClientOptions clientOptions; + + public AsyncRawBinLookupClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public CompletableFuture> binListServiceListCardsOfBin() { + return binListServiceListCardsOfBin(V1BinListRequest.builder().build()); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public CompletableFuture> binListServiceListCardsOfBin( + V1BinListRequest request) { + return binListServiceListCardsOfBin(request, null); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public CompletableFuture> binListServiceListCardsOfBin( + V1BinListRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/card_lookup") + .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(), V1BinListResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/BinLookupClient.java b/src/main/java/com/skyflow/generated/rest/resources/binlookup/BinLookupClient.java new file mode 100644 index 00000000..a7822986 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/binlookup/BinLookupClient.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.binlookup; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.binlookup.requests.V1BinListRequest; +import com.skyflow.generated.rest.types.V1BinListResponse; + +public class BinLookupClient { + protected final ClientOptions clientOptions; + + private final RawBinLookupClient rawClient; + + public BinLookupClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawBinLookupClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawBinLookupClient withRawResponse() { + return this.rawClient; + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public V1BinListResponse binListServiceListCardsOfBin() { + return this.rawClient.binListServiceListCardsOfBin().body(); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public V1BinListResponse binListServiceListCardsOfBin(V1BinListRequest request) { + return this.rawClient.binListServiceListCardsOfBin(request).body(); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public V1BinListResponse binListServiceListCardsOfBin(V1BinListRequest request, RequestOptions requestOptions) { + return this.rawClient + .binListServiceListCardsOfBin(request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/binlookup/RawBinLookupClient.java b/src/main/java/com/skyflow/generated/rest/resources/binlookup/RawBinLookupClient.java new file mode 100644 index 00000000..bb08039b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/binlookup/RawBinLookupClient.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.binlookup; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.resources.binlookup.requests.V1BinListRequest; +import com.skyflow.generated.rest.types.V1BinListResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawBinLookupClient { + protected final ClientOptions clientOptions; + + public RawBinLookupClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public ApiClientHttpResponse binListServiceListCardsOfBin() { + return binListServiceListCardsOfBin(V1BinListRequest.builder().build()); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public ApiClientHttpResponse binListServiceListCardsOfBin(V1BinListRequest request) { + return binListServiceListCardsOfBin(request, null); + } + + /** + * <b>Note</b>: This endpoint is in beta and subject to change. <br><br> Returns the specified card metadata. + */ + public ApiClientHttpResponse binListServiceListCardsOfBin( + V1BinListRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/card_lookup") + .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(), V1BinListResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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/binlookup/requests/V1BinListRequest.java b/src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java new file mode 100644 index 00000000..d4a1c21b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/binlookup/requests/V1BinListRequest.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.binlookup.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.V1VaultSchemaConfig; +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 = V1BinListRequest.Builder.class) +public final class V1BinListRequest { + private final Optional> fields; + + private final Optional bin; + + private final Optional vaultSchemaConfig; + + private final Optional skyflowId; + + private final Map additionalProperties; + + private V1BinListRequest( + Optional> fields, + Optional bin, + Optional vaultSchemaConfig, + Optional skyflowId, + Map additionalProperties) { + this.fields = fields; + this.bin = bin; + this.vaultSchemaConfig = vaultSchemaConfig; + this.skyflowId = skyflowId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Fields to return. If not specified, all fields are returned. + */ + @JsonProperty("fields") + public Optional> getFields() { + return fields; + } + + /** + * @return BIN of the card. + */ + @JsonProperty("BIN") + public Optional getBin() { + return bin; + } + + @JsonProperty("vault_schema_config") + public Optional getVaultSchemaConfig() { + return vaultSchemaConfig; + } + + /** + * @return <code>skyflow_id</code> of the record. + */ + @JsonProperty("skyflow_id") + public Optional getSkyflowId() { + return skyflowId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1BinListRequest && equalTo((V1BinListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1BinListRequest other) { + return fields.equals(other.fields) + && bin.equals(other.bin) + && vaultSchemaConfig.equals(other.vaultSchemaConfig) + && skyflowId.equals(other.skyflowId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fields, this.bin, this.vaultSchemaConfig, this.skyflowId); + } + + @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> fields = Optional.empty(); + + private Optional bin = Optional.empty(); + + private Optional vaultSchemaConfig = Optional.empty(); + + private Optional skyflowId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1BinListRequest other) { + fields(other.getFields()); + bin(other.getBin()); + vaultSchemaConfig(other.getVaultSchemaConfig()); + skyflowId(other.getSkyflowId()); + return this; + } + + /** + *

Fields to return. If not specified, all fields are returned.

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

BIN of the card.

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

<code>skyflow_id</code> of the record.

+ */ + @JsonSetter(value = "skyflow_id", 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; + } + + public V1BinListRequest build() { + return new V1BinListRequest(fields, bin, vaultSchemaConfig, skyflowId, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncDeprecatedClient.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncDeprecatedClient.java new file mode 100644 index 00000000..c1709f7f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncDeprecatedClient.java @@ -0,0 +1,89 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.deprecated; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectStatusRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectTextRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.V1DetectFileRequest; +import com.skyflow.generated.rest.types.V1DetectFileResponse; +import com.skyflow.generated.rest.types.V1DetectStatusResponse; +import com.skyflow.generated.rest.types.V1DetectTextResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncDeprecatedClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDeprecatedClient rawClient; + + public AsyncDeprecatedClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDeprecatedClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDeprecatedClient withRawResponse() { + return this.rawClient; + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public CompletableFuture detectServiceDetectFileInput(V1DetectFileRequest request) { + return this.rawClient.detectServiceDetectFileInput(request).thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public CompletableFuture detectServiceDetectFileInput( + V1DetectFileRequest request, RequestOptions requestOptions) { + return this.rawClient + .detectServiceDetectFileInput(request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public CompletableFuture detectServiceDetectStatus(String id) { + return this.rawClient.detectServiceDetectStatus(id).thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public CompletableFuture detectServiceDetectStatus( + String id, DetectServiceDetectStatusRequest request) { + return this.rawClient.detectServiceDetectStatus(id, request).thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public CompletableFuture detectServiceDetectStatus( + String id, DetectServiceDetectStatusRequest request, RequestOptions requestOptions) { + return this.rawClient + .detectServiceDetectStatus(id, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public CompletableFuture detectServiceDetectText(DetectServiceDetectTextRequest request) { + return this.rawClient.detectServiceDetectText(request).thenApply(response -> response.body()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public CompletableFuture detectServiceDetectText( + DetectServiceDetectTextRequest request, RequestOptions requestOptions) { + return this.rawClient.detectServiceDetectText(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncRawDeprecatedClient.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncRawDeprecatedClient.java new file mode 100644 index 00000000..9c9ec79a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/deprecated/AsyncRawDeprecatedClient.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.deprecated; + +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.MediaTypes; +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.errors.NotFoundError; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectStatusRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectTextRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.V1DetectFileRequest; +import com.skyflow.generated.rest.types.V1DetectFileResponse; +import com.skyflow.generated.rest.types.V1DetectStatusResponse; +import com.skyflow.generated.rest.types.V1DetectTextResponse; +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.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDeprecatedClient { + protected final ClientOptions clientOptions; + + public AsyncRawDeprecatedClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public CompletableFuture> detectServiceDetectFileInput( + V1DetectFileRequest request) { + return detectServiceDetectFileInput(request, null); + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public CompletableFuture> detectServiceDetectFileInput( + V1DetectFileRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/file") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ApiClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), V1DetectFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public CompletableFuture> detectServiceDetectStatus(String id) { + return detectServiceDetectStatus( + id, DetectServiceDetectStatusRequest.builder().build()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public CompletableFuture> detectServiceDetectStatus( + String id, DetectServiceDetectStatusRequest request) { + return detectServiceDetectStatus(id, request, null); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public CompletableFuture> detectServiceDetectStatus( + String id, DetectServiceDetectStatusRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/status") + .addPathSegment(id); + if (request.getVaultId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "vault_id", request.getVaultId().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1DetectStatusResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public CompletableFuture> detectServiceDetectText( + DetectServiceDetectTextRequest request) { + return detectServiceDetectText(request, null); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public CompletableFuture> detectServiceDetectText( + DetectServiceDetectTextRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/text") + .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(), V1DetectTextResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/DeprecatedClient.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/DeprecatedClient.java new file mode 100644 index 00000000..820a349b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/deprecated/DeprecatedClient.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.deprecated; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectStatusRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectTextRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.V1DetectFileRequest; +import com.skyflow.generated.rest.types.V1DetectFileResponse; +import com.skyflow.generated.rest.types.V1DetectStatusResponse; +import com.skyflow.generated.rest.types.V1DetectTextResponse; + +public class DeprecatedClient { + protected final ClientOptions clientOptions; + + private final RawDeprecatedClient rawClient; + + public DeprecatedClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDeprecatedClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDeprecatedClient withRawResponse() { + return this.rawClient; + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public V1DetectFileResponse detectServiceDetectFileInput(V1DetectFileRequest request) { + return this.rawClient.detectServiceDetectFileInput(request).body(); + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public V1DetectFileResponse detectServiceDetectFileInput( + V1DetectFileRequest request, RequestOptions requestOptions) { + return this.rawClient + .detectServiceDetectFileInput(request, requestOptions) + .body(); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public V1DetectStatusResponse detectServiceDetectStatus(String id) { + return this.rawClient.detectServiceDetectStatus(id).body(); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public V1DetectStatusResponse detectServiceDetectStatus(String id, DetectServiceDetectStatusRequest request) { + return this.rawClient.detectServiceDetectStatus(id, request).body(); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public V1DetectStatusResponse detectServiceDetectStatus( + String id, DetectServiceDetectStatusRequest request, RequestOptions requestOptions) { + return this.rawClient + .detectServiceDetectStatus(id, request, requestOptions) + .body(); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public V1DetectTextResponse detectServiceDetectText(DetectServiceDetectTextRequest request) { + return this.rawClient.detectServiceDetectText(request).body(); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public V1DetectTextResponse detectServiceDetectText( + DetectServiceDetectTextRequest request, RequestOptions requestOptions) { + return this.rawClient.detectServiceDetectText(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/RawDeprecatedClient.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/RawDeprecatedClient.java new file mode 100644 index 00000000..4472487f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/deprecated/RawDeprecatedClient.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.deprecated; + +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.MediaTypes; +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.errors.NotFoundError; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectStatusRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.DetectServiceDetectTextRequest; +import com.skyflow.generated.rest.resources.deprecated.requests.V1DetectFileRequest; +import com.skyflow.generated.rest.types.V1DetectFileResponse; +import com.skyflow.generated.rest.types.V1DetectStatusResponse; +import com.skyflow.generated.rest.types.V1DetectTextResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDeprecatedClient { + protected final ClientOptions clientOptions; + + public RawDeprecatedClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public ApiClientHttpResponse detectServiceDetectFileInput(V1DetectFileRequest request) { + return detectServiceDetectFileInput(request, null); + } + + /** + * <b>Note</b>: This operation is deprecated. Use one of the <a href=#De-identify%20File>De-identify File</a> operations.<br/><br/>Detects and deidentifies sensitive data from image, audio, and video files. + */ + public ApiClientHttpResponse detectServiceDetectFileInput( + V1DetectFileRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/file") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ApiClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), V1DetectFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public ApiClientHttpResponse detectServiceDetectStatus(String id) { + return detectServiceDetectStatus( + id, DetectServiceDetectStatusRequest.builder().build()); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public ApiClientHttpResponse detectServiceDetectStatus( + String id, DetectServiceDetectStatusRequest request) { + return detectServiceDetectStatus(id, request, null); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#get_detect_run>Get Detect Run</a>.<br/><br/>Returns the status of a file deidentification request. + */ + public ApiClientHttpResponse detectServiceDetectStatus( + String id, DetectServiceDetectStatusRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/status") + .addPathSegment(id); + if (request.getVaultId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "vault_id", request.getVaultId().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1DetectStatusResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public ApiClientHttpResponse detectServiceDetectText(DetectServiceDetectTextRequest request) { + return detectServiceDetectText(request, null); + } + + /** + * <b>Note</b>: This operation is deprecated. Use <a href=#deidentify_string>De-identify String</a>.<br/><br/>Detects and deidentifies sensitive data from text. + */ + public ApiClientHttpResponse detectServiceDetectText( + DetectServiceDetectTextRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/text") + .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(), V1DetectTextResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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/deprecated/requests/DetectServiceDetectStatusRequest.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java new file mode 100644 index 00000000..45997db3 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectStatusRequest.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.deprecated.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DetectServiceDetectStatusRequest.Builder.class) +public final class DetectServiceDetectStatusRequest { + private final Optional vaultId; + + private final Map additionalProperties; + + private DetectServiceDetectStatusRequest(Optional vaultId, Map additionalProperties) { + this.vaultId = vaultId; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault. + */ + @JsonProperty("vault_id") + public Optional getVaultId() { + return vaultId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetectServiceDetectStatusRequest && equalTo((DetectServiceDetectStatusRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetectServiceDetectStatusRequest other) { + return vaultId.equals(other.vaultId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.vaultId); + } + + @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 vaultId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DetectServiceDetectStatusRequest other) { + vaultId(other.getVaultId()); + return this; + } + + /** + *

ID of the vault.

+ */ + @JsonSetter(value = "vault_id", 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; + } + + public DetectServiceDetectStatusRequest build() { + return new DetectServiceDetectStatusRequest(vaultId, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java new file mode 100644 index 00000000..3c4b4ea2 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/DetectServiceDetectTextRequest.java @@ -0,0 +1,526 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.deprecated.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.DetectDataAccuracy; +import com.skyflow.generated.rest.types.DetectDataEntities; +import com.skyflow.generated.rest.types.DetectRequestDeidentifyOption; +import com.skyflow.generated.rest.types.V1AdvancedOptions; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DetectServiceDetectTextRequest.Builder.class) +public final class DetectServiceDetectTextRequest { + private final String text; + + private final String vaultId; + + private final Optional sessionId; + + private final Optional> restrictEntityTypes; + + private final Optional deidentifyTokenFormat; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional returnEntities; + + private final Optional accuracy; + + private final Optional advancedOptions; + + private final Optional storeEntities; + + private final Map additionalProperties; + + private DetectServiceDetectTextRequest( + String text, + String vaultId, + Optional sessionId, + Optional> restrictEntityTypes, + Optional deidentifyTokenFormat, + Optional> allowRegex, + Optional> restrictRegex, + Optional returnEntities, + Optional accuracy, + Optional advancedOptions, + Optional storeEntities, + Map additionalProperties) { + this.text = text; + this.vaultId = vaultId; + this.sessionId = sessionId; + this.restrictEntityTypes = restrictEntityTypes; + this.deidentifyTokenFormat = deidentifyTokenFormat; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.returnEntities = returnEntities; + this.accuracy = accuracy; + this.advancedOptions = advancedOptions; + this.storeEntities = storeEntities; + this.additionalProperties = additionalProperties; + } + + /** + * @return Data to deidentify. + */ + @JsonProperty("text") + public String getText() { + return text; + } + + /** + * @return ID of the vault. + */ + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return Will give a handle to delete the tokens generated during a specific interaction. + */ + @JsonProperty("session_id") + public Optional getSessionId() { + return sessionId; + } + + /** + * @return Entities to detect and deidentify. + */ + @JsonProperty("restrict_entity_types") + public Optional> getRestrictEntityTypes() { + return restrictEntityTypes; + } + + @JsonProperty("deidentify_token_format") + public Optional getDeidentifyTokenFormat() { + return deidentifyTokenFormat; + } + + /** + * @return Regular expressions to ignore when detecting entities. + */ + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + /** + * @return Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'. + */ + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + /** + * @return If true, returns the details for the detected entities. + */ + @JsonProperty("return_entities") + public Optional getReturnEntities() { + return returnEntities; + } + + @JsonProperty("accuracy") + public Optional getAccuracy() { + return accuracy; + } + + @JsonProperty("advanced_options") + public Optional getAdvancedOptions() { + return advancedOptions; + } + + /** + * @return Indicates whether entities should be stored in the vault. + */ + @JsonProperty("store_entities") + public Optional getStoreEntities() { + return storeEntities; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetectServiceDetectTextRequest && equalTo((DetectServiceDetectTextRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetectServiceDetectTextRequest other) { + return text.equals(other.text) + && vaultId.equals(other.vaultId) + && sessionId.equals(other.sessionId) + && restrictEntityTypes.equals(other.restrictEntityTypes) + && deidentifyTokenFormat.equals(other.deidentifyTokenFormat) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && returnEntities.equals(other.returnEntities) + && accuracy.equals(other.accuracy) + && advancedOptions.equals(other.advancedOptions) + && storeEntities.equals(other.storeEntities); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.text, + this.vaultId, + this.sessionId, + this.restrictEntityTypes, + this.deidentifyTokenFormat, + this.allowRegex, + this.restrictRegex, + this.returnEntities, + this.accuracy, + this.advancedOptions, + this.storeEntities); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + * Data to deidentify. + */ + VaultIdStage text(@NotNull String text); + + Builder from(DetectServiceDetectTextRequest other); + } + + public interface VaultIdStage { + /** + * ID of the vault. + */ + _FinalStage vaultId(@NotNull String vaultId); + } + + public interface _FinalStage { + DetectServiceDetectTextRequest build(); + + /** + *

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

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

Entities to detect and deidentify.

+ */ + _FinalStage restrictEntityTypes(Optional> restrictEntityTypes); + + _FinalStage restrictEntityTypes(List restrictEntityTypes); + + _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat); + + _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat); + + /** + *

Regular expressions to ignore when detecting entities.

+ */ + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + /** + *

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

+ */ + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + /** + *

If true, returns the details for the detected entities.

+ */ + _FinalStage returnEntities(Optional returnEntities); + + _FinalStage returnEntities(Boolean returnEntities); + + _FinalStage accuracy(Optional accuracy); + + _FinalStage accuracy(DetectDataAccuracy accuracy); + + _FinalStage advancedOptions(Optional advancedOptions); + + _FinalStage advancedOptions(V1AdvancedOptions advancedOptions); + + /** + *

Indicates whether entities should be stored in the vault.

+ */ + _FinalStage storeEntities(Optional storeEntities); + + _FinalStage storeEntities(Boolean storeEntities); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, VaultIdStage, _FinalStage { + private String text; + + private String vaultId; + + private Optional storeEntities = Optional.empty(); + + private Optional advancedOptions = Optional.empty(); + + private Optional accuracy = Optional.empty(); + + private Optional returnEntities = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional deidentifyTokenFormat = Optional.empty(); + + private Optional> restrictEntityTypes = Optional.empty(); + + private Optional sessionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DetectServiceDetectTextRequest other) { + text(other.getText()); + vaultId(other.getVaultId()); + sessionId(other.getSessionId()); + restrictEntityTypes(other.getRestrictEntityTypes()); + deidentifyTokenFormat(other.getDeidentifyTokenFormat()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + returnEntities(other.getReturnEntities()); + accuracy(other.getAccuracy()); + advancedOptions(other.getAdvancedOptions()); + storeEntities(other.getStoreEntities()); + return this; + } + + /** + * Data to deidentify.

Data to deidentify.

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

ID of the vault.

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

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 + public _FinalStage storeEntities(Boolean storeEntities) { + this.storeEntities = Optional.ofNullable(storeEntities); + return this; + } + + /** + *

Indicates whether entities should be stored in the vault.

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

If true, returns the details for the detected entities.

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

If true, returns the details for the detected entities.

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

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

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

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

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

Regular expressions to ignore when detecting entities.

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

Regular expressions to ignore when detecting entities.

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

Entities to detect and deidentify.

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

Entities to detect and deidentify.

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

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

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

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

+ */ + @java.lang.Override + @JsonSetter(value = "session_id", nulls = Nulls.SKIP) + public _FinalStage sessionId(Optional sessionId) { + this.sessionId = sessionId; + return this; + } + + @java.lang.Override + public DetectServiceDetectTextRequest build() { + return new DetectServiceDetectTextRequest( + text, + vaultId, + sessionId, + restrictEntityTypes, + deidentifyTokenFormat, + allowRegex, + restrictRegex, + returnEntities, + accuracy, + advancedOptions, + storeEntities, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java b/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java new file mode 100644 index 00000000..8bdee935 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/deprecated/requests/V1DetectFileRequest.java @@ -0,0 +1,634 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.deprecated.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.DetectDataAccuracy; +import com.skyflow.generated.rest.types.DetectDataEntities; +import com.skyflow.generated.rest.types.DetectFileRequestDataType; +import com.skyflow.generated.rest.types.DetectRequestDeidentifyOption; +import com.skyflow.generated.rest.types.V1AdvancedOptions; +import com.skyflow.generated.rest.types.V1AudioConfig; +import com.skyflow.generated.rest.types.V1FileDataFormat; +import com.skyflow.generated.rest.types.V1ImageOptions; +import com.skyflow.generated.rest.types.V1PdfConfig; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1DetectFileRequest.Builder.class) +public final class V1DetectFileRequest { + private final String file; + + private final V1FileDataFormat dataFormat; + + private final DetectFileRequestDataType inputType; + + private final String vaultId; + + private final Optional sessionId; + + private final Optional> restrictEntityTypes; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional returnEntities; + + private final Optional accuracy; + + private final Optional audio; + + private final Optional image; + + private final Optional pdf; + + private final Optional advancedOptions; + + private final Optional deidentifyTokenFormat; + + private final Map additionalProperties; + + private V1DetectFileRequest( + String file, + V1FileDataFormat dataFormat, + DetectFileRequestDataType inputType, + String vaultId, + Optional sessionId, + Optional> restrictEntityTypes, + Optional> allowRegex, + Optional> restrictRegex, + Optional returnEntities, + Optional accuracy, + Optional audio, + Optional image, + Optional pdf, + Optional advancedOptions, + Optional deidentifyTokenFormat, + Map additionalProperties) { + this.file = file; + this.dataFormat = dataFormat; + this.inputType = inputType; + this.vaultId = vaultId; + this.sessionId = sessionId; + this.restrictEntityTypes = restrictEntityTypes; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.returnEntities = returnEntities; + this.accuracy = accuracy; + this.audio = audio; + this.image = image; + this.pdf = pdf; + this.advancedOptions = advancedOptions; + this.deidentifyTokenFormat = deidentifyTokenFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Path of the file or base64-encoded data that has to be processed. + */ + @JsonProperty("file") + public String getFile() { + return file; + } + + @JsonProperty("data_format") + public V1FileDataFormat getDataFormat() { + return dataFormat; + } + + @JsonProperty("input_type") + public DetectFileRequestDataType getInputType() { + return inputType; + } + + /** + * @return ID of the vault. + */ + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return Will give a handle to delete the tokens generated during a specific interaction. + */ + @JsonProperty("session_id") + public Optional getSessionId() { + return sessionId; + } + + /** + * @return Entities to detect and deidentify. + */ + @JsonProperty("restrict_entity_types") + public Optional> getRestrictEntityTypes() { + return restrictEntityTypes; + } + + /** + * @return Regular expressions to ignore when detecting entities. + */ + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + /** + * @return Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'. + */ + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + /** + * @return If true, returns the details for the detected entities. + */ + @JsonProperty("return_entities") + public Optional getReturnEntities() { + return returnEntities; + } + + @JsonProperty("accuracy") + public Optional getAccuracy() { + return accuracy; + } + + @JsonProperty("audio") + public Optional getAudio() { + return audio; + } + + @JsonProperty("image") + public Optional getImage() { + return image; + } + + @JsonProperty("pdf") + public Optional getPdf() { + return pdf; + } + + @JsonProperty("advanced_options") + public Optional getAdvancedOptions() { + return advancedOptions; + } + + @JsonProperty("deidentify_token_format") + public Optional getDeidentifyTokenFormat() { + return deidentifyTokenFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetectFileRequest && equalTo((V1DetectFileRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetectFileRequest other) { + return file.equals(other.file) + && dataFormat.equals(other.dataFormat) + && inputType.equals(other.inputType) + && vaultId.equals(other.vaultId) + && sessionId.equals(other.sessionId) + && restrictEntityTypes.equals(other.restrictEntityTypes) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && returnEntities.equals(other.returnEntities) + && accuracy.equals(other.accuracy) + && audio.equals(other.audio) + && image.equals(other.image) + && pdf.equals(other.pdf) + && advancedOptions.equals(other.advancedOptions) + && deidentifyTokenFormat.equals(other.deidentifyTokenFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.file, + this.dataFormat, + this.inputType, + this.vaultId, + this.sessionId, + this.restrictEntityTypes, + this.allowRegex, + this.restrictRegex, + this.returnEntities, + this.accuracy, + this.audio, + this.image, + this.pdf, + this.advancedOptions, + this.deidentifyTokenFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FileStage builder() { + return new Builder(); + } + + public interface FileStage { + /** + * Path of the file or base64-encoded data that has to be processed. + */ + DataFormatStage file(@NotNull String file); + + Builder from(V1DetectFileRequest other); + } + + public interface DataFormatStage { + InputTypeStage dataFormat(@NotNull V1FileDataFormat dataFormat); + } + + public interface InputTypeStage { + VaultIdStage inputType(@NotNull DetectFileRequestDataType inputType); + } + + public interface VaultIdStage { + /** + * ID of the vault. + */ + _FinalStage vaultId(@NotNull String vaultId); + } + + public interface _FinalStage { + V1DetectFileRequest build(); + + /** + *

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

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

Entities to detect and deidentify.

+ */ + _FinalStage restrictEntityTypes(Optional> restrictEntityTypes); + + _FinalStage restrictEntityTypes(List restrictEntityTypes); + + /** + *

Regular expressions to ignore when detecting entities.

+ */ + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + /** + *

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

+ */ + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + /** + *

If true, returns the details for the detected entities.

+ */ + _FinalStage returnEntities(Optional returnEntities); + + _FinalStage returnEntities(Boolean returnEntities); + + _FinalStage accuracy(Optional accuracy); + + _FinalStage accuracy(DetectDataAccuracy accuracy); + + _FinalStage audio(Optional audio); + + _FinalStage audio(V1AudioConfig audio); + + _FinalStage image(Optional image); + + _FinalStage image(V1ImageOptions image); + + _FinalStage pdf(Optional pdf); + + _FinalStage pdf(V1PdfConfig pdf); + + _FinalStage advancedOptions(Optional advancedOptions); + + _FinalStage advancedOptions(V1AdvancedOptions advancedOptions); + + _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat); + + _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FileStage, DataFormatStage, InputTypeStage, VaultIdStage, _FinalStage { + private String file; + + private V1FileDataFormat dataFormat; + + private DetectFileRequestDataType inputType; + + private String vaultId; + + private Optional deidentifyTokenFormat = Optional.empty(); + + private Optional advancedOptions = Optional.empty(); + + private Optional pdf = Optional.empty(); + + private Optional image = Optional.empty(); + + private Optional audio = Optional.empty(); + + private Optional accuracy = Optional.empty(); + + private Optional returnEntities = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional> restrictEntityTypes = Optional.empty(); + + private Optional sessionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(V1DetectFileRequest other) { + file(other.getFile()); + dataFormat(other.getDataFormat()); + inputType(other.getInputType()); + vaultId(other.getVaultId()); + sessionId(other.getSessionId()); + restrictEntityTypes(other.getRestrictEntityTypes()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + returnEntities(other.getReturnEntities()); + accuracy(other.getAccuracy()); + audio(other.getAudio()); + image(other.getImage()); + pdf(other.getPdf()); + advancedOptions(other.getAdvancedOptions()); + deidentifyTokenFormat(other.getDeidentifyTokenFormat()); + return this; + } + + /** + * Path of the file or base64-encoded data that has to be processed.

Path of the file or base64-encoded data that has to be processed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("file") + public DataFormatStage file(@NotNull String file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data_format") + public InputTypeStage dataFormat(@NotNull V1FileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("input_type") + public VaultIdStage inputType(@NotNull DetectFileRequestDataType inputType) { + this.inputType = Objects.requireNonNull(inputType, "inputType must not be null"); + return this; + } + + /** + * ID of the vault.

ID of the vault.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("vault_id") + public _FinalStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat) { + this.deidentifyTokenFormat = Optional.ofNullable(deidentifyTokenFormat); + return this; + } + + @java.lang.Override + @JsonSetter(value = "deidentify_token_format", nulls = Nulls.SKIP) + public _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat) { + this.deidentifyTokenFormat = deidentifyTokenFormat; + return this; + } + + @java.lang.Override + public _FinalStage advancedOptions(V1AdvancedOptions advancedOptions) { + this.advancedOptions = Optional.ofNullable(advancedOptions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "advanced_options", nulls = Nulls.SKIP) + public _FinalStage advancedOptions(Optional advancedOptions) { + this.advancedOptions = advancedOptions; + return this; + } + + @java.lang.Override + public _FinalStage pdf(V1PdfConfig pdf) { + this.pdf = Optional.ofNullable(pdf); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pdf", nulls = Nulls.SKIP) + public _FinalStage pdf(Optional pdf) { + this.pdf = pdf; + return this; + } + + @java.lang.Override + public _FinalStage image(V1ImageOptions image) { + this.image = Optional.ofNullable(image); + return this; + } + + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional image) { + this.image = image; + return this; + } + + @java.lang.Override + public _FinalStage audio(V1AudioConfig audio) { + this.audio = Optional.ofNullable(audio); + return this; + } + + @java.lang.Override + @JsonSetter(value = "audio", nulls = Nulls.SKIP) + public _FinalStage audio(Optional audio) { + this.audio = audio; + return this; + } + + @java.lang.Override + public _FinalStage accuracy(DetectDataAccuracy accuracy) { + this.accuracy = Optional.ofNullable(accuracy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "accuracy", nulls = Nulls.SKIP) + public _FinalStage accuracy(Optional accuracy) { + this.accuracy = accuracy; + return this; + } + + /** + *

If true, returns the details for the detected entities.

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

If true, returns the details for the detected entities.

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

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

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

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

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

Regular expressions to ignore when detecting entities.

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

Regular expressions to ignore when detecting entities.

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

Entities to detect and deidentify.

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

Entities to detect and deidentify.

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

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

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

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

+ */ + @java.lang.Override + @JsonSetter(value = "session_id", nulls = Nulls.SKIP) + public _FinalStage sessionId(Optional sessionId) { + this.sessionId = sessionId; + return this; + } + + @java.lang.Override + public V1DetectFileRequest build() { + return new V1DetectFileRequest( + file, + dataFormat, + inputType, + vaultId, + sessionId, + restrictEntityTypes, + allowRegex, + restrictRegex, + returnEntities, + accuracy, + audio, + image, + pdf, + advancedOptions, + deidentifyTokenFormat, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java new file mode 100644 index 00000000..48692d9f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncFilesClient.java @@ -0,0 +1,188 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyAudioRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyDocumentRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyImageRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPdfRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPresentationRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifySpreadsheetRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest; +import com.skyflow.generated.rest.resources.files.requests.GetRunRequest; +import com.skyflow.generated.rest.types.DeidentifyFileResponse; +import com.skyflow.generated.rest.types.DeidentifyStatusResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncFilesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFilesClient rawClient; + + public AsyncFilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFilesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFilesClient withRawResponse() { + return this.rawClient; + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public CompletableFuture deidentifyFile(DeidentifyFileRequest request) { + return this.rawClient.deidentifyFile(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public CompletableFuture deidentifyFile( + DeidentifyFileRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyFile(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyDocument(DeidentifyDocumentRequest request) { + return this.rawClient.deidentifyDocument(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyDocument( + DeidentifyDocumentRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyDocument(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyPdf(DeidentifyPdfRequest request) { + return this.rawClient.deidentifyPdf(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyPdf( + DeidentifyPdfRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyPdf(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyImage(DeidentifyImageRequest request) { + return this.rawClient.deidentifyImage(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyImage( + DeidentifyImageRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyImage(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyText(DeidentifyTextRequest request) { + return this.rawClient.deidentifyText(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyText( + DeidentifyTextRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyText(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyStructuredText(DeidentifyStructuredTextRequest request) { + return this.rawClient.deidentifyStructuredText(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyStructuredText( + DeidentifyStructuredTextRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyStructuredText(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifySpreadsheet(DeidentifySpreadsheetRequest request) { + return this.rawClient.deidentifySpreadsheet(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifySpreadsheet( + DeidentifySpreadsheetRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifySpreadsheet(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyPresentation(DeidentifyPresentationRequest request) { + return this.rawClient.deidentifyPresentation(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyPresentation( + DeidentifyPresentationRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyPresentation(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyAudio(DeidentifyAudioRequest request) { + return this.rawClient.deidentifyAudio(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture deidentifyAudio( + DeidentifyAudioRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyAudio(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns the status of the detect run. + */ + public CompletableFuture getRun(String runId, GetRunRequest request) { + return this.rawClient.getRun(runId, request).thenApply(response -> response.body()); + } + + /** + * Returns the status of the detect run. + */ + public CompletableFuture getRun( + String runId, GetRunRequest request, RequestOptions requestOptions) { + return this.rawClient.getRun(runId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java new file mode 100644 index 00000000..f400bb2a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/AsyncRawFilesClient.java @@ -0,0 +1,929 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files; + +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.MediaTypes; +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.errors.BadRequestError; +import com.skyflow.generated.rest.errors.InternalServerError; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.errors.UnauthorizedError; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyAudioRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyDocumentRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyImageRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPdfRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPresentationRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifySpreadsheetRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest; +import com.skyflow.generated.rest.resources.files.requests.GetRunRequest; +import com.skyflow.generated.rest.types.DeidentifyFileResponse; +import com.skyflow.generated.rest.types.DeidentifyStatusResponse; +import com.skyflow.generated.rest.types.ErrorResponse; +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.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFilesClient { + protected final ClientOptions clientOptions; + + public AsyncRawFilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public CompletableFuture> deidentifyFile( + DeidentifyFileRequest request) { + return deidentifyFile(request, null); + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public CompletableFuture> deidentifyFile( + DeidentifyFileRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ApiClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyDocument( + DeidentifyDocumentRequest request) { + return deidentifyDocument(request, null); + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyDocument( + DeidentifyDocumentRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/document") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyPdf( + DeidentifyPdfRequest request) { + return deidentifyPdf(request, null); + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyPdf( + DeidentifyPdfRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/document/pdf") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyImage( + DeidentifyImageRequest request) { + return deidentifyImage(request, null); + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyImage( + DeidentifyImageRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/image") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyText( + DeidentifyTextRequest request) { + return deidentifyText(request, null); + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyText( + DeidentifyTextRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/text") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyStructuredText( + DeidentifyStructuredTextRequest request) { + return deidentifyStructuredText(request, null); + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyStructuredText( + DeidentifyStructuredTextRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/structured_text") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifySpreadsheet( + DeidentifySpreadsheetRequest request) { + return deidentifySpreadsheet(request, null); + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifySpreadsheet( + DeidentifySpreadsheetRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/spreadsheet") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyPresentation( + DeidentifyPresentationRequest request) { + return deidentifyPresentation(request, null); + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyPresentation( + DeidentifyPresentationRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/presentation") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyAudio( + DeidentifyAudioRequest request) { + return deidentifyAudio(request, null); + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public CompletableFuture> deidentifyAudio( + DeidentifyAudioRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/audio") + .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(), DeidentifyFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns the status of the detect run. + */ + public CompletableFuture> getRun( + String runId, GetRunRequest request) { + return getRun(runId, request, null); + } + + /** + * Returns the status of the detect run. + */ + public CompletableFuture> getRun( + String runId, GetRunRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/runs") + .addPathSegment(runId); + QueryStringMapper.addQueryParameter(httpUrl, "vault_id", request.getVaultId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), DeidentifyStatusResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java new file mode 100644 index 00000000..89898d41 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/FilesClient.java @@ -0,0 +1,180 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyAudioRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyDocumentRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyImageRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPdfRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPresentationRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifySpreadsheetRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest; +import com.skyflow.generated.rest.resources.files.requests.GetRunRequest; +import com.skyflow.generated.rest.types.DeidentifyFileResponse; +import com.skyflow.generated.rest.types.DeidentifyStatusResponse; + +public class FilesClient { + protected final ClientOptions clientOptions; + + private final RawFilesClient rawClient; + + public FilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFilesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFilesClient withRawResponse() { + return this.rawClient; + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public DeidentifyFileResponse deidentifyFile(DeidentifyFileRequest request) { + return this.rawClient.deidentifyFile(request).body(); + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public DeidentifyFileResponse deidentifyFile(DeidentifyFileRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyFile(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyDocument(DeidentifyDocumentRequest request) { + return this.rawClient.deidentifyDocument(request).body(); + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyDocument(DeidentifyDocumentRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyDocument(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyPdf(DeidentifyPdfRequest request) { + return this.rawClient.deidentifyPdf(request).body(); + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyPdf(DeidentifyPdfRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyPdf(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyImage(DeidentifyImageRequest request) { + return this.rawClient.deidentifyImage(request).body(); + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyImage(DeidentifyImageRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyImage(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyText(DeidentifyTextRequest request) { + return this.rawClient.deidentifyText(request).body(); + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyText(DeidentifyTextRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyText(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyStructuredText(DeidentifyStructuredTextRequest request) { + return this.rawClient.deidentifyStructuredText(request).body(); + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyStructuredText( + DeidentifyStructuredTextRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyStructuredText(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifySpreadsheet(DeidentifySpreadsheetRequest request) { + return this.rawClient.deidentifySpreadsheet(request).body(); + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifySpreadsheet( + DeidentifySpreadsheetRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifySpreadsheet(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyPresentation(DeidentifyPresentationRequest request) { + return this.rawClient.deidentifyPresentation(request).body(); + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyPresentation( + DeidentifyPresentationRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyPresentation(request, requestOptions).body(); + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyAudio(DeidentifyAudioRequest request) { + return this.rawClient.deidentifyAudio(request).body(); + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public DeidentifyFileResponse deidentifyAudio(DeidentifyAudioRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyAudio(request, requestOptions).body(); + } + + /** + * Returns the status of the detect run. + */ + public DeidentifyStatusResponse getRun(String runId, GetRunRequest request) { + return this.rawClient.getRun(runId, request).body(); + } + + /** + * Returns the status of the detect run. + */ + public DeidentifyStatusResponse getRun(String runId, GetRunRequest request, RequestOptions requestOptions) { + return this.rawClient.getRun(runId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java b/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java new file mode 100644 index 00000000..85939625 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/RawFilesClient.java @@ -0,0 +1,714 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files; + +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.MediaTypes; +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.errors.BadRequestError; +import com.skyflow.generated.rest.errors.InternalServerError; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.errors.UnauthorizedError; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyAudioRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyDocumentRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyImageRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPdfRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyPresentationRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifySpreadsheetRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyStructuredTextRequest; +import com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest; +import com.skyflow.generated.rest.resources.files.requests.GetRunRequest; +import com.skyflow.generated.rest.types.DeidentifyFileResponse; +import com.skyflow.generated.rest.types.DeidentifyStatusResponse; +import com.skyflow.generated.rest.types.ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFilesClient { + protected final ClientOptions clientOptions; + + public RawFilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public ApiClientHttpResponse deidentifyFile(DeidentifyFileRequest request) { + return deidentifyFile(request, null); + } + + /** + * De-identifies sensitive data from a file. This operation includes options applicable to all supported file types.<br/><br/>For more specific options, see the category-specific operations (like <a href='#deidentify_document'>De-identify Document</a>) and the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>). + */ + public ApiClientHttpResponse deidentifyFile( + DeidentifyFileRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ApiClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ApiClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyDocument(DeidentifyDocumentRequest request) { + return deidentifyDocument(request, null); + } + + /** + * De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.<br/><br/>For more specific options, see the file type-specific opertions (like <a href='#deidentify_pdf'>De-identify PDF</a>) where they're available. For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyDocument( + DeidentifyDocumentRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/document") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyPdf(DeidentifyPdfRequest request) { + return deidentifyPdf(request, null); + } + + /** + * De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.<br/><br/>For broader file type support, see <a href='#deidentify_document'>De-identify Document</a> and <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyPdf( + DeidentifyPdfRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/document/pdf") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyImage(DeidentifyImageRequest request) { + return deidentifyImage(request, null); + } + + /** + * De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyImage( + DeidentifyImageRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/image") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyText(DeidentifyTextRequest request) { + return deidentifyText(request, null); + } + + /** + * De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyText( + DeidentifyTextRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/text") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyStructuredText( + DeidentifyStructuredTextRequest request) { + return deidentifyStructuredText(request, null); + } + + /** + * De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyStructuredText( + DeidentifyStructuredTextRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/structured_text") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifySpreadsheet(DeidentifySpreadsheetRequest request) { + return deidentifySpreadsheet(request, null); + } + + /** + * De-identifies sensitive data from a spreadsheet file. This operation includes options applicable to all supported spreadsheet file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifySpreadsheet( + DeidentifySpreadsheetRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/spreadsheet") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyPresentation(DeidentifyPresentationRequest request) { + return deidentifyPresentation(request, null); + } + + /** + * De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyPresentation( + DeidentifyPresentationRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/presentation") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyAudio(DeidentifyAudioRequest request) { + return deidentifyAudio(request, null); + } + + /** + * De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.<br/><br/>For broader file type support, see <a href='#deidentify_file'>De-identify File</a>. + */ + public ApiClientHttpResponse deidentifyAudio( + DeidentifyAudioRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/file/audio") + .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(), DeidentifyFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * Returns the status of the detect run. + */ + public ApiClientHttpResponse getRun(String runId, GetRunRequest request) { + return getRun(runId, request, null); + } + + /** + * Returns the status of the detect run. + */ + public ApiClientHttpResponse getRun( + String runId, GetRunRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/runs") + .addPathSegment(runId); + QueryStringMapper.addQueryParameter(httpUrl, "vault_id", request.getVaultId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), DeidentifyStatusResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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/files/requests/DeidentifyAudioRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java new file mode 100644 index 00000000..5f4929aa --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyAudioRequest.java @@ -0,0 +1,582 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyAudioRequestFile; +import com.skyflow.generated.rest.resources.files.types.DeidentifyAudioRequestOutputTranscription; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyAudioRequest.Builder.class) +public final class DeidentifyAudioRequest { + private final String vaultId; + + private final DeidentifyAudioRequestFile file; + + private final Optional outputProcessedAudio; + + private final Optional outputTranscription; + + private final Optional bleepGain; + + private final Optional bleepFrequency; + + private final Optional bleepStartPadding; + + private final Optional bleepStopPadding; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyAudioRequest( + String vaultId, + DeidentifyAudioRequestFile file, + Optional outputProcessedAudio, + Optional outputTranscription, + Optional bleepGain, + Optional bleepFrequency, + Optional bleepStartPadding, + Optional bleepStopPadding, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.outputProcessedAudio = outputProcessedAudio; + this.outputTranscription = outputTranscription; + this.bleepGain = bleepGain; + this.bleepFrequency = bleepFrequency; + this.bleepStartPadding = bleepStartPadding; + this.bleepStopPadding = bleepStopPadding; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyAudioRequestFile getFile() { + return file; + } + + /** + * @return If true, includes processed audio file in the response. + */ + @JsonProperty("output_processed_audio") + public Optional getOutputProcessedAudio() { + return outputProcessedAudio; + } + + /** + * @return Type of transcription to output. + */ + @JsonProperty("output_transcription") + public Optional getOutputTranscription() { + return outputTranscription; + } + + /** + * @return Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. + */ + @JsonProperty("bleep_gain") + public Optional getBleepGain() { + return bleepGain; + } + + /** + * @return The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. + */ + @JsonProperty("bleep_frequency") + public Optional getBleepFrequency() { + return bleepFrequency; + } + + /** + * @return Padding added to the beginning of a bleep, in seconds. + */ + @JsonProperty("bleep_start_padding") + public Optional getBleepStartPadding() { + return bleepStartPadding; + } + + /** + * @return Padding added to the end of a bleep, in seconds. + */ + @JsonProperty("bleep_stop_padding") + public Optional getBleepStopPadding() { + return bleepStopPadding; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyAudioRequest && equalTo((DeidentifyAudioRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyAudioRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && outputProcessedAudio.equals(other.outputProcessedAudio) + && outputTranscription.equals(other.outputTranscription) + && bleepGain.equals(other.bleepGain) + && bleepFrequency.equals(other.bleepFrequency) + && bleepStartPadding.equals(other.bleepStartPadding) + && bleepStopPadding.equals(other.bleepStopPadding) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.outputProcessedAudio, + this.outputTranscription, + this.bleepGain, + this.bleepFrequency, + this.bleepStartPadding, + this.bleepStopPadding, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyAudioRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyAudioRequestFile file); + } + + public interface _FinalStage { + DeidentifyAudioRequest build(); + + /** + *

If true, includes processed audio file in the response.

+ */ + _FinalStage outputProcessedAudio(Optional outputProcessedAudio); + + _FinalStage outputProcessedAudio(Boolean outputProcessedAudio); + + /** + *

Type of transcription to output.

+ */ + _FinalStage outputTranscription(Optional outputTranscription); + + _FinalStage outputTranscription(DeidentifyAudioRequestOutputTranscription outputTranscription); + + /** + *

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

+ */ + _FinalStage bleepGain(Optional bleepGain); + + _FinalStage bleepGain(Double bleepGain); + + /** + *

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

+ */ + _FinalStage bleepFrequency(Optional bleepFrequency); + + _FinalStage bleepFrequency(Double bleepFrequency); + + /** + *

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

+ */ + _FinalStage bleepStartPadding(Optional bleepStartPadding); + + _FinalStage bleepStartPadding(Double bleepStartPadding); + + /** + *

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

+ */ + _FinalStage bleepStopPadding(Optional bleepStopPadding); + + _FinalStage bleepStopPadding(Double bleepStopPadding); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyAudioRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + private Optional bleepStopPadding = Optional.empty(); + + private Optional bleepStartPadding = Optional.empty(); + + private Optional bleepFrequency = Optional.empty(); + + private Optional bleepGain = Optional.empty(); + + private Optional outputTranscription = Optional.empty(); + + private Optional outputProcessedAudio = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyAudioRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + outputProcessedAudio(other.getOutputProcessedAudio()); + outputTranscription(other.getOutputTranscription()); + bleepGain(other.getBleepGain()); + bleepFrequency(other.getBleepFrequency()); + bleepStartPadding(other.getBleepStartPadding()); + bleepStopPadding(other.getBleepStopPadding()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyAudioRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + /** + *

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 + public _FinalStage bleepStopPadding(Double bleepStopPadding) { + this.bleepStopPadding = Optional.ofNullable(bleepStopPadding); + return this; + } + + /** + *

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

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

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 + public _FinalStage bleepStartPadding(Double bleepStartPadding) { + this.bleepStartPadding = Optional.ofNullable(bleepStartPadding); + return this; + } + + /** + *

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

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

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 + public _FinalStage bleepFrequency(Double bleepFrequency) { + this.bleepFrequency = Optional.ofNullable(bleepFrequency); + return this; + } + + /** + *

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

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

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 + public _FinalStage bleepGain(Double bleepGain) { + this.bleepGain = Optional.ofNullable(bleepGain); + return this; + } + + /** + *

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

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

Type of transcription to output.

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

Type of transcription to output.

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

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 + public _FinalStage outputProcessedAudio(Boolean outputProcessedAudio) { + this.outputProcessedAudio = Optional.ofNullable(outputProcessedAudio); + return this; + } + + /** + *

If true, includes processed audio file in the response.

+ */ + @java.lang.Override + @JsonSetter(value = "output_processed_audio", nulls = Nulls.SKIP) + public _FinalStage outputProcessedAudio(Optional outputProcessedAudio) { + this.outputProcessedAudio = outputProcessedAudio; + return this; + } + + @java.lang.Override + public DeidentifyAudioRequest build() { + return new DeidentifyAudioRequest( + vaultId, + file, + outputProcessedAudio, + outputTranscription, + bleepGain, + bleepFrequency, + bleepStartPadding, + bleepStopPadding, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java new file mode 100644 index 00000000..bf6f307e --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyDocumentRequest.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyDocumentRequestFile; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyDocumentRequest.Builder.class) +public final class DeidentifyDocumentRequest { + private final String vaultId; + + private final DeidentifyDocumentRequestFile file; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyDocumentRequest( + String vaultId, + DeidentifyDocumentRequestFile file, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyDocumentRequestFile getFile() { + return file; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyDocumentRequest && equalTo((DeidentifyDocumentRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyDocumentRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyDocumentRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyDocumentRequestFile file); + } + + public interface _FinalStage { + DeidentifyDocumentRequest build(); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyDocumentRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyDocumentRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyDocumentRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + @java.lang.Override + public DeidentifyDocumentRequest build() { + return new DeidentifyDocumentRequest( + vaultId, + file, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java new file mode 100644 index 00000000..1cbcd8f1 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyFileRequest.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyFileRequestFile; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyFileRequest.Builder.class) +public final class DeidentifyFileRequest { + private final String vaultId; + + private final DeidentifyFileRequestFile file; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyFileRequest( + String vaultId, + DeidentifyFileRequestFile file, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyFileRequestFile getFile() { + return file; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyFileRequest && equalTo((DeidentifyFileRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyFileRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyFileRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyFileRequestFile file); + } + + public interface _FinalStage { + DeidentifyFileRequest build(); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyFileRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyFileRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyFileRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + @java.lang.Override + public DeidentifyFileRequest build() { + return new DeidentifyFileRequest( + vaultId, + file, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java new file mode 100644 index 00000000..41de24b2 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyImageRequest.java @@ -0,0 +1,446 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyImageRequestFile; +import com.skyflow.generated.rest.resources.files.types.DeidentifyImageRequestMaskingMethod; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyImageRequest.Builder.class) +public final class DeidentifyImageRequest { + private final String vaultId; + + private final DeidentifyImageRequestFile file; + + private final Optional outputProcessedImage; + + private final Optional outputOcrText; + + private final Optional maskingMethod; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyImageRequest( + String vaultId, + DeidentifyImageRequestFile file, + Optional outputProcessedImage, + Optional outputOcrText, + Optional maskingMethod, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.outputProcessedImage = outputProcessedImage; + this.outputOcrText = outputOcrText; + this.maskingMethod = maskingMethod; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyImageRequestFile getFile() { + return file; + } + + /** + * @return If true, includes processed image in the output. + */ + @JsonProperty("output_processed_image") + public Optional getOutputProcessedImage() { + return outputProcessedImage; + } + + /** + * @return If true, includes OCR text output in the response. + */ + @JsonProperty("output_ocr_text") + public Optional getOutputOcrText() { + return outputOcrText; + } + + /** + * @return Method to mask the entities in the image. + */ + @JsonProperty("masking_method") + public Optional getMaskingMethod() { + return maskingMethod; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyImageRequest && equalTo((DeidentifyImageRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyImageRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && outputProcessedImage.equals(other.outputProcessedImage) + && outputOcrText.equals(other.outputOcrText) + && maskingMethod.equals(other.maskingMethod) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.outputProcessedImage, + this.outputOcrText, + this.maskingMethod, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyImageRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyImageRequestFile file); + } + + public interface _FinalStage { + DeidentifyImageRequest build(); + + /** + *

If true, includes processed image in the output.

+ */ + _FinalStage outputProcessedImage(Optional outputProcessedImage); + + _FinalStage outputProcessedImage(Boolean outputProcessedImage); + + /** + *

If true, includes OCR text output in the response.

+ */ + _FinalStage outputOcrText(Optional outputOcrText); + + _FinalStage outputOcrText(Boolean outputOcrText); + + /** + *

Method to mask the entities in the image.

+ */ + _FinalStage maskingMethod(Optional maskingMethod); + + _FinalStage maskingMethod(DeidentifyImageRequestMaskingMethod maskingMethod); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyImageRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + private Optional maskingMethod = Optional.empty(); + + private Optional outputOcrText = Optional.empty(); + + private Optional outputProcessedImage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyImageRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + outputProcessedImage(other.getOutputProcessedImage()); + outputOcrText(other.getOutputOcrText()); + maskingMethod(other.getMaskingMethod()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyImageRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + /** + *

Method to mask the entities in the image.

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

Method to mask the entities in the image.

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

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 + public _FinalStage outputOcrText(Boolean outputOcrText) { + this.outputOcrText = Optional.ofNullable(outputOcrText); + return this; + } + + /** + *

If true, includes OCR text output in the response.

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

If true, includes processed image in the output.

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

If true, includes processed image in the output.

+ */ + @java.lang.Override + @JsonSetter(value = "output_processed_image", nulls = Nulls.SKIP) + public _FinalStage outputProcessedImage(Optional outputProcessedImage) { + this.outputProcessedImage = outputProcessedImage; + return this; + } + + @java.lang.Override + public DeidentifyImageRequest build() { + return new DeidentifyImageRequest( + vaultId, + file, + outputProcessedImage, + outputOcrText, + maskingMethod, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java new file mode 100644 index 00000000..83fbb14f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPdfRequest.java @@ -0,0 +1,400 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyPdfRequestFile; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyPdfRequest.Builder.class) +public final class DeidentifyPdfRequest { + private final String vaultId; + + private final DeidentifyPdfRequestFile file; + + private final Optional density; + + private final Optional maxResolution; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyPdfRequest( + String vaultId, + DeidentifyPdfRequestFile file, + Optional density, + Optional maxResolution, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.density = density; + this.maxResolution = maxResolution; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyPdfRequestFile getFile() { + return file; + } + + /** + * @return Pixel density at which to process the PDF file. + */ + @JsonProperty("density") + public Optional getDensity() { + return density; + } + + /** + * @return Max resolution at which to process the PDF file. + */ + @JsonProperty("max_resolution") + public Optional getMaxResolution() { + return maxResolution; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyPdfRequest && equalTo((DeidentifyPdfRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyPdfRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && density.equals(other.density) + && maxResolution.equals(other.maxResolution) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.density, + this.maxResolution, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyPdfRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyPdfRequestFile file); + } + + public interface _FinalStage { + DeidentifyPdfRequest build(); + + /** + *

Pixel density at which to process the PDF file.

+ */ + _FinalStage density(Optional density); + + _FinalStage density(Integer density); + + /** + *

Max resolution at which to process the PDF file.

+ */ + _FinalStage maxResolution(Optional maxResolution); + + _FinalStage maxResolution(Integer maxResolution); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyPdfRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + private Optional maxResolution = Optional.empty(); + + private Optional density = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyPdfRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + density(other.getDensity()); + maxResolution(other.getMaxResolution()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyPdfRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + /** + *

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 + public _FinalStage maxResolution(Integer maxResolution) { + this.maxResolution = Optional.ofNullable(maxResolution); + return this; + } + + /** + *

Max resolution at which to process the PDF file.

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

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 + public _FinalStage density(Integer density) { + this.density = Optional.ofNullable(density); + return this; + } + + /** + *

Pixel density at which to process the PDF file.

+ */ + @java.lang.Override + @JsonSetter(value = "density", nulls = Nulls.SKIP) + public _FinalStage density(Optional density) { + this.density = density; + return this; + } + + @java.lang.Override + public DeidentifyPdfRequest build() { + return new DeidentifyPdfRequest( + vaultId, + file, + density, + maxResolution, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java new file mode 100644 index 00000000..47a63a5b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyPresentationRequest.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyPresentationRequestFile; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyPresentationRequest.Builder.class) +public final class DeidentifyPresentationRequest { + private final String vaultId; + + private final DeidentifyPresentationRequestFile file; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyPresentationRequest( + String vaultId, + DeidentifyPresentationRequestFile file, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyPresentationRequestFile getFile() { + return file; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyPresentationRequest && equalTo((DeidentifyPresentationRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyPresentationRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyPresentationRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyPresentationRequestFile file); + } + + public interface _FinalStage { + DeidentifyPresentationRequest build(); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyPresentationRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyPresentationRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyPresentationRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + @java.lang.Override + public DeidentifyPresentationRequest build() { + return new DeidentifyPresentationRequest( + vaultId, + file, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java new file mode 100644 index 00000000..b72b412b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifySpreadsheetRequest.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifySpreadsheetRequestFile; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifySpreadsheetRequest.Builder.class) +public final class DeidentifySpreadsheetRequest { + private final String vaultId; + + private final DeidentifySpreadsheetRequestFile file; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifySpreadsheetRequest( + String vaultId, + DeidentifySpreadsheetRequestFile file, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifySpreadsheetRequestFile getFile() { + return file; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifySpreadsheetRequest && equalTo((DeidentifySpreadsheetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifySpreadsheetRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifySpreadsheetRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifySpreadsheetRequestFile file); + } + + public interface _FinalStage { + DeidentifySpreadsheetRequest build(); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifySpreadsheetRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifySpreadsheetRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifySpreadsheetRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + @java.lang.Override + public DeidentifySpreadsheetRequest build() { + return new DeidentifySpreadsheetRequest( + vaultId, + file, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java new file mode 100644 index 00000000..a61a5ba0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyStructuredTextRequest.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyStructuredTextRequestFile; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyStructuredTextRequest.Builder.class) +public final class DeidentifyStructuredTextRequest { + private final String vaultId; + + private final DeidentifyStructuredTextRequestFile file; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyStructuredTextRequest( + String vaultId, + DeidentifyStructuredTextRequestFile file, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyStructuredTextRequestFile getFile() { + return file; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyStructuredTextRequest && equalTo((DeidentifyStructuredTextRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyStructuredTextRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyStructuredTextRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyStructuredTextRequestFile file); + } + + public interface _FinalStage { + DeidentifyStructuredTextRequest build(); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyStructuredTextRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyStructuredTextRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyStructuredTextRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + @java.lang.Override + public DeidentifyStructuredTextRequest build() { + return new DeidentifyStructuredTextRequest( + vaultId, + file, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java new file mode 100644 index 00000000..4eb0ac6c --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/DeidentifyTextRequest.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.files.types.DeidentifyTextRequestFile; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenTypeWithoutVault; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyTextRequest.Builder.class) +public final class DeidentifyTextRequest { + private final String vaultId; + + private final DeidentifyTextRequestFile file; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyTextRequest( + String vaultId, + DeidentifyTextRequestFile file, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.file = file; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return File to de-identify. Files are specified as Base64-encoded data. + */ + @JsonProperty("file") + public DeidentifyTextRequestFile getFile() { + return file; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyTextRequest && equalTo((DeidentifyTextRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyTextRequest other) { + return vaultId.equals(other.vaultId) + && file.equals(other.file) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.file, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + FileStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyTextRequest other); + } + + public interface FileStage { + /** + * File to de-identify. Files are specified as Base64-encoded data. + */ + _FinalStage file(@NotNull DeidentifyTextRequestFile file); + } + + public interface _FinalStage { + DeidentifyTextRequest build(); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenTypeWithoutVault tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, FileStage, _FinalStage { + private String vaultId; + + private DeidentifyTextRequestFile file; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyTextRequest other) { + vaultId(other.getVaultId()); + file(other.getFile()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public FileStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("file") + public _FinalStage file(@NotNull DeidentifyTextRequestFile file) { + this.file = Objects.requireNonNull(file, "file must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenTypeWithoutVault tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + @java.lang.Override + public DeidentifyTextRequest build() { + return new DeidentifyTextRequest( + vaultId, + file, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java b/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java new file mode 100644 index 00000000..390d2090 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/requests/GetRunRequest.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetRunRequest.Builder.class) +public final class GetRunRequest { + private final String vaultId; + + private final Map additionalProperties; + + private GetRunRequest(String vaultId, Map additionalProperties) { + this.vaultId = vaultId; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault. + */ + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetRunRequest && equalTo((GetRunRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetRunRequest other) { + return vaultId.equals(other.vaultId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.vaultId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + /** + * ID of the vault. + */ + _FinalStage vaultId(@NotNull String vaultId); + + Builder from(GetRunRequest other); + } + + public interface _FinalStage { + GetRunRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, _FinalStage { + private String vaultId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetRunRequest other) { + vaultId(other.getVaultId()); + return this; + } + + /** + * ID of the vault.

ID of the vault.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("vault_id") + public _FinalStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + @java.lang.Override + public GetRunRequest build() { + return new GetRunRequest(vaultId, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java new file mode 100644 index 00000000..ad124de0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFile.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyAudioRequestFile.Builder.class) +public final class DeidentifyAudioRequestFile { + private final String base64; + + private final DeidentifyAudioRequestFileDataFormat dataFormat; + + private final Map additionalProperties; + + private DeidentifyAudioRequestFile( + String base64, DeidentifyAudioRequestFileDataFormat dataFormat, Map additionalProperties) { + this.base64 = base64; + this.dataFormat = dataFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public DeidentifyAudioRequestFileDataFormat getDataFormat() { + return dataFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyAudioRequestFile && equalTo((DeidentifyAudioRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyAudioRequestFile other) { + return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64, this.dataFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + DataFormatStage base64(@NotNull String base64); + + Builder from(DeidentifyAudioRequestFile other); + } + + public interface DataFormatStage { + /** + * Data format of the file. + */ + _FinalStage dataFormat(@NotNull DeidentifyAudioRequestFileDataFormat dataFormat); + } + + public interface _FinalStage { + DeidentifyAudioRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, DataFormatStage, _FinalStage { + private String base64; + + private DeidentifyAudioRequestFileDataFormat dataFormat; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyAudioRequestFile other) { + base64(other.getBase64()); + dataFormat(other.getDataFormat()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public DataFormatStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("data_format") + public _FinalStage dataFormat(@NotNull DeidentifyAudioRequestFileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java new file mode 100644 index 00000000..05203b05 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestFileDataFormat.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyAudioRequestFileDataFormat { + MP_3("mp3"), + + WAV("wav"); + + private final String value; + + DeidentifyAudioRequestFileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java new file mode 100644 index 00000000..bd2d8aac --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyAudioRequestOutputTranscription.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyAudioRequestOutputTranscription { + DIARIZED_TRANSCRIPTION("diarized_transcription"), + + MEDICAL_DIARIZED_TRANSCRIPTION("medical_diarized_transcription"), + + MEDICAL_TRANSCRIPTION("medical_transcription"), + + PLAINTEXT_TRANSCRIPTION("plaintext_transcription"), + + TRANSCRIPTION("transcription"); + + private final String value; + + DeidentifyAudioRequestOutputTranscription(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java new file mode 100644 index 00000000..76c7972c --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFile.java @@ -0,0 +1,147 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyDocumentRequestFile.Builder.class) +public final class DeidentifyDocumentRequestFile { + private final String base64; + + private final DeidentifyDocumentRequestFileDataFormat dataFormat; + + private final Map additionalProperties; + + private DeidentifyDocumentRequestFile( + String base64, + DeidentifyDocumentRequestFileDataFormat dataFormat, + Map additionalProperties) { + this.base64 = base64; + this.dataFormat = dataFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public DeidentifyDocumentRequestFileDataFormat getDataFormat() { + return dataFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyDocumentRequestFile && equalTo((DeidentifyDocumentRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyDocumentRequestFile other) { + return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64, this.dataFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + DataFormatStage base64(@NotNull String base64); + + Builder from(DeidentifyDocumentRequestFile other); + } + + public interface DataFormatStage { + /** + * Data format of the file. + */ + _FinalStage dataFormat(@NotNull DeidentifyDocumentRequestFileDataFormat dataFormat); + } + + public interface _FinalStage { + DeidentifyDocumentRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, DataFormatStage, _FinalStage { + private String base64; + + private DeidentifyDocumentRequestFileDataFormat dataFormat; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyDocumentRequestFile other) { + base64(other.getBase64()); + dataFormat(other.getDataFormat()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public DataFormatStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("data_format") + public _FinalStage dataFormat(@NotNull DeidentifyDocumentRequestFileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java new file mode 100644 index 00000000..6b741b95 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyDocumentRequestFileDataFormat.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyDocumentRequestFileDataFormat { + DOC("doc"), + + DOCX("docx"), + + PDF("pdf"); + + private final String value; + + DeidentifyDocumentRequestFileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java new file mode 100644 index 00000000..f21ddeef --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFile.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyFileRequestFile.Builder.class) +public final class DeidentifyFileRequestFile { + private final String base64; + + private final DeidentifyFileRequestFileDataFormat dataFormat; + + private final Map additionalProperties; + + private DeidentifyFileRequestFile( + String base64, DeidentifyFileRequestFileDataFormat dataFormat, Map additionalProperties) { + this.base64 = base64; + this.dataFormat = dataFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public DeidentifyFileRequestFileDataFormat getDataFormat() { + return dataFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyFileRequestFile && equalTo((DeidentifyFileRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyFileRequestFile other) { + return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64, this.dataFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + DataFormatStage base64(@NotNull String base64); + + Builder from(DeidentifyFileRequestFile other); + } + + public interface DataFormatStage { + /** + * Data format of the file. + */ + _FinalStage dataFormat(@NotNull DeidentifyFileRequestFileDataFormat dataFormat); + } + + public interface _FinalStage { + DeidentifyFileRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, DataFormatStage, _FinalStage { + private String base64; + + private DeidentifyFileRequestFileDataFormat dataFormat; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyFileRequestFile other) { + base64(other.getBase64()); + dataFormat(other.getDataFormat()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public DataFormatStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("data_format") + public _FinalStage dataFormat(@NotNull DeidentifyFileRequestFileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java new file mode 100644 index 00000000..afc90bc3 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyFileRequestFileDataFormat.java @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyFileRequestFileDataFormat { + BMP("bmp"), + + CSV("csv"), + + DOC("doc"), + + DOCX("docx"), + + JPEG("jpeg"), + + JPG("jpg"), + + JSON("json"), + + MP_3("mp3"), + + PDF("pdf"), + + PNG("png"), + + PPT("ppt"), + + PPTX("pptx"), + + TIF("tif"), + + TIFF("tiff"), + + TXT("txt"), + + WAV("wav"), + + XLS("xls"), + + XLSX("xlsx"), + + XML("xml"); + + private final String value; + + DeidentifyFileRequestFileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java new file mode 100644 index 00000000..116fd94d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFile.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyImageRequestFile.Builder.class) +public final class DeidentifyImageRequestFile { + private final String base64; + + private final DeidentifyImageRequestFileDataFormat dataFormat; + + private final Map additionalProperties; + + private DeidentifyImageRequestFile( + String base64, DeidentifyImageRequestFileDataFormat dataFormat, Map additionalProperties) { + this.base64 = base64; + this.dataFormat = dataFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public DeidentifyImageRequestFileDataFormat getDataFormat() { + return dataFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyImageRequestFile && equalTo((DeidentifyImageRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyImageRequestFile other) { + return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64, this.dataFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + DataFormatStage base64(@NotNull String base64); + + Builder from(DeidentifyImageRequestFile other); + } + + public interface DataFormatStage { + /** + * Data format of the file. + */ + _FinalStage dataFormat(@NotNull DeidentifyImageRequestFileDataFormat dataFormat); + } + + public interface _FinalStage { + DeidentifyImageRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, DataFormatStage, _FinalStage { + private String base64; + + private DeidentifyImageRequestFileDataFormat dataFormat; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyImageRequestFile other) { + base64(other.getBase64()); + dataFormat(other.getDataFormat()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public DataFormatStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("data_format") + public _FinalStage dataFormat(@NotNull DeidentifyImageRequestFileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java new file mode 100644 index 00000000..cfb324d9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestFileDataFormat.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyImageRequestFileDataFormat { + BMP("bmp"), + + JPEG("jpeg"), + + JPG("jpg"), + + PNG("png"), + + TIF("tif"), + + TIFF("tiff"); + + private final String value; + + DeidentifyImageRequestFileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java new file mode 100644 index 00000000..8cf5bf3c --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyImageRequestMaskingMethod.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyImageRequestMaskingMethod { + BLACKBOX("blackbox"), + + BLUR("blur"); + + private final String value; + + DeidentifyImageRequestMaskingMethod(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java new file mode 100644 index 00000000..14028aab --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPdfRequestFile.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyPdfRequestFile.Builder.class) +public final class DeidentifyPdfRequestFile { + private final String base64; + + private final Map additionalProperties; + + private DeidentifyPdfRequestFile(String base64, Map additionalProperties) { + this.base64 = base64; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public String getDataFormat() { + return "pdf"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyPdfRequestFile && equalTo((DeidentifyPdfRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyPdfRequestFile other) { + return base64.equals(other.base64); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + _FinalStage base64(@NotNull String base64); + + Builder from(DeidentifyPdfRequestFile other); + } + + public interface _FinalStage { + DeidentifyPdfRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, _FinalStage { + private String base64; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyPdfRequestFile other) { + base64(other.getBase64()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public _FinalStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java new file mode 100644 index 00000000..1b2e247f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFile.java @@ -0,0 +1,147 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyPresentationRequestFile.Builder.class) +public final class DeidentifyPresentationRequestFile { + private final String base64; + + private final DeidentifyPresentationRequestFileDataFormat dataFormat; + + private final Map additionalProperties; + + private DeidentifyPresentationRequestFile( + String base64, + DeidentifyPresentationRequestFileDataFormat dataFormat, + Map additionalProperties) { + this.base64 = base64; + this.dataFormat = dataFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public DeidentifyPresentationRequestFileDataFormat getDataFormat() { + return dataFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyPresentationRequestFile && equalTo((DeidentifyPresentationRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyPresentationRequestFile other) { + return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64, this.dataFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + DataFormatStage base64(@NotNull String base64); + + Builder from(DeidentifyPresentationRequestFile other); + } + + public interface DataFormatStage { + /** + * Data format of the file. + */ + _FinalStage dataFormat(@NotNull DeidentifyPresentationRequestFileDataFormat dataFormat); + } + + public interface _FinalStage { + DeidentifyPresentationRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, DataFormatStage, _FinalStage { + private String base64; + + private DeidentifyPresentationRequestFileDataFormat dataFormat; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyPresentationRequestFile other) { + base64(other.getBase64()); + dataFormat(other.getDataFormat()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public DataFormatStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("data_format") + public _FinalStage dataFormat(@NotNull DeidentifyPresentationRequestFileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java new file mode 100644 index 00000000..e6bcd268 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyPresentationRequestFileDataFormat.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyPresentationRequestFileDataFormat { + PPT("ppt"), + + PPTX("pptx"); + + private final String value; + + DeidentifyPresentationRequestFileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java new file mode 100644 index 00000000..2e291563 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFile.java @@ -0,0 +1,147 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifySpreadsheetRequestFile.Builder.class) +public final class DeidentifySpreadsheetRequestFile { + private final String base64; + + private final DeidentifySpreadsheetRequestFileDataFormat dataFormat; + + private final Map additionalProperties; + + private DeidentifySpreadsheetRequestFile( + String base64, + DeidentifySpreadsheetRequestFileDataFormat dataFormat, + Map additionalProperties) { + this.base64 = base64; + this.dataFormat = dataFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public DeidentifySpreadsheetRequestFileDataFormat getDataFormat() { + return dataFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifySpreadsheetRequestFile && equalTo((DeidentifySpreadsheetRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifySpreadsheetRequestFile other) { + return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64, this.dataFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + DataFormatStage base64(@NotNull String base64); + + Builder from(DeidentifySpreadsheetRequestFile other); + } + + public interface DataFormatStage { + /** + * Data format of the file. + */ + _FinalStage dataFormat(@NotNull DeidentifySpreadsheetRequestFileDataFormat dataFormat); + } + + public interface _FinalStage { + DeidentifySpreadsheetRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, DataFormatStage, _FinalStage { + private String base64; + + private DeidentifySpreadsheetRequestFileDataFormat dataFormat; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifySpreadsheetRequestFile other) { + base64(other.getBase64()); + dataFormat(other.getDataFormat()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public DataFormatStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("data_format") + public _FinalStage dataFormat(@NotNull DeidentifySpreadsheetRequestFileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java new file mode 100644 index 00000000..795a2666 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifySpreadsheetRequestFileDataFormat.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifySpreadsheetRequestFileDataFormat { + CSV("csv"), + + XLS("xls"), + + XLSX("xlsx"); + + private final String value; + + DeidentifySpreadsheetRequestFileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java new file mode 100644 index 00000000..d8d5193a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFile.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyStructuredTextRequestFile.Builder.class) +public final class DeidentifyStructuredTextRequestFile { + private final String base64; + + private final DeidentifyStructuredTextRequestFileDataFormat dataFormat; + + private final Map additionalProperties; + + private DeidentifyStructuredTextRequestFile( + String base64, + DeidentifyStructuredTextRequestFileDataFormat dataFormat, + Map additionalProperties) { + this.base64 = base64; + this.dataFormat = dataFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public DeidentifyStructuredTextRequestFileDataFormat getDataFormat() { + return dataFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyStructuredTextRequestFile + && equalTo((DeidentifyStructuredTextRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyStructuredTextRequestFile other) { + return base64.equals(other.base64) && dataFormat.equals(other.dataFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64, this.dataFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + DataFormatStage base64(@NotNull String base64); + + Builder from(DeidentifyStructuredTextRequestFile other); + } + + public interface DataFormatStage { + /** + * Data format of the file. + */ + _FinalStage dataFormat(@NotNull DeidentifyStructuredTextRequestFileDataFormat dataFormat); + } + + public interface _FinalStage { + DeidentifyStructuredTextRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, DataFormatStage, _FinalStage { + private String base64; + + private DeidentifyStructuredTextRequestFileDataFormat dataFormat; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyStructuredTextRequestFile other) { + base64(other.getBase64()); + dataFormat(other.getDataFormat()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public DataFormatStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("data_format") + public _FinalStage dataFormat(@NotNull DeidentifyStructuredTextRequestFileDataFormat dataFormat) { + this.dataFormat = Objects.requireNonNull(dataFormat, "dataFormat must not be null"); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java new file mode 100644 index 00000000..11b30288 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyStructuredTextRequestFileDataFormat.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeidentifyStructuredTextRequestFileDataFormat { + JSON("json"), + + XML("xml"); + + private final String value; + + DeidentifyStructuredTextRequestFileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java new file mode 100644 index 00000000..c7cbc5b3 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/files/types/DeidentifyTextRequestFile.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.files.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyTextRequestFile.Builder.class) +public final class DeidentifyTextRequestFile { + private final String base64; + + private final Map additionalProperties; + + private DeidentifyTextRequestFile(String base64, Map additionalProperties) { + this.base64 = base64; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded data of the file to de-identify. + */ + @JsonProperty("base64") + public String getBase64() { + return base64; + } + + /** + * @return Data format of the file. + */ + @JsonProperty("data_format") + public String getDataFormat() { + return "txt"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyTextRequestFile && equalTo((DeidentifyTextRequestFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyTextRequestFile other) { + return base64.equals(other.base64); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.base64); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Base64Stage builder() { + return new Builder(); + } + + public interface Base64Stage { + /** + * Base64-encoded data of the file to de-identify. + */ + _FinalStage base64(@NotNull String base64); + + Builder from(DeidentifyTextRequestFile other); + } + + public interface _FinalStage { + DeidentifyTextRequestFile build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Base64Stage, _FinalStage { + private String base64; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyTextRequestFile other) { + base64(other.getBase64()); + return this; + } + + /** + * 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 + @JsonSetter("base64") + public _FinalStage base64(@NotNull String base64) { + this.base64 = Objects.requireNonNull(base64, "base64 must not be null"); + return this; + } + + @java.lang.Override + public DeidentifyTextRequestFile build() { + return new DeidentifyTextRequestFile(base64, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/AsyncQueryClient.java b/src/main/java/com/skyflow/generated/rest/resources/query/AsyncQueryClient.java new file mode 100644 index 00000000..894c97b5 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/query/AsyncQueryClient.java @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.query; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.query.requests.QueryServiceExecuteQueryBody; +import com.skyflow.generated.rest.types.V1GetQueryResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncQueryClient { + protected final ClientOptions clientOptions; + + private final AsyncRawQueryClient rawClient; + + public AsyncQueryClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawQueryClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawQueryClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public CompletableFuture queryServiceExecuteQuery(String vaultId) { + return this.rawClient.queryServiceExecuteQuery(vaultId).thenApply(response -> response.body()); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public CompletableFuture queryServiceExecuteQuery( + String vaultId, QueryServiceExecuteQueryBody request) { + return this.rawClient.queryServiceExecuteQuery(vaultId, request).thenApply(response -> response.body()); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public CompletableFuture queryServiceExecuteQuery( + String vaultId, QueryServiceExecuteQueryBody request, RequestOptions requestOptions) { + return this.rawClient + .queryServiceExecuteQuery(vaultId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/AsyncRawQueryClient.java b/src/main/java/com/skyflow/generated/rest/resources/query/AsyncRawQueryClient.java new file mode 100644 index 00000000..96e2dc0b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/query/AsyncRawQueryClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.query; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.resources.query.requests.QueryServiceExecuteQueryBody; +import com.skyflow.generated.rest.types.V1GetQueryResponse; +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.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawQueryClient { + protected final ClientOptions clientOptions; + + public AsyncRawQueryClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public CompletableFuture> queryServiceExecuteQuery(String vaultId) { + return queryServiceExecuteQuery( + vaultId, QueryServiceExecuteQueryBody.builder().build()); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public CompletableFuture> queryServiceExecuteQuery( + String vaultId, QueryServiceExecuteQueryBody request) { + return queryServiceExecuteQuery(vaultId, request, null); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public CompletableFuture> queryServiceExecuteQuery( + String vaultId, QueryServiceExecuteQueryBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegments("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(), V1GetQueryResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/QueryClient.java b/src/main/java/com/skyflow/generated/rest/resources/query/QueryClient.java new file mode 100644 index 00000000..39bb709d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/query/QueryClient.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.query; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.query.requests.QueryServiceExecuteQueryBody; +import com.skyflow.generated.rest.types.V1GetQueryResponse; + +public class QueryClient { + protected final ClientOptions clientOptions; + + private final RawQueryClient rawClient; + + public QueryClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawQueryClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawQueryClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public V1GetQueryResponse queryServiceExecuteQuery(String vaultId) { + return this.rawClient.queryServiceExecuteQuery(vaultId).body(); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public V1GetQueryResponse queryServiceExecuteQuery(String vaultId, QueryServiceExecuteQueryBody request) { + return this.rawClient.queryServiceExecuteQuery(vaultId, request).body(); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public V1GetQueryResponse queryServiceExecuteQuery( + String vaultId, QueryServiceExecuteQueryBody request, RequestOptions requestOptions) { + return this.rawClient + .queryServiceExecuteQuery(vaultId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/query/RawQueryClient.java b/src/main/java/com/skyflow/generated/rest/resources/query/RawQueryClient.java new file mode 100644 index 00000000..3e5bee51 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/query/RawQueryClient.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.query; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.resources.query.requests.QueryServiceExecuteQueryBody; +import com.skyflow.generated.rest.types.V1GetQueryResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawQueryClient { + protected final ClientOptions clientOptions; + + public RawQueryClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public ApiClientHttpResponse queryServiceExecuteQuery(String vaultId) { + return queryServiceExecuteQuery( + vaultId, QueryServiceExecuteQueryBody.builder().build()); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public ApiClientHttpResponse queryServiceExecuteQuery( + String vaultId, QueryServiceExecuteQueryBody request) { + return queryServiceExecuteQuery(vaultId, request, null); + } + + /** + * Returns records for a valid SQL query. This endpoint <ul><li>Can return redacted record values.</li><li>Supports only the <code>SELECT</code> command.</li><li>Returns a maximum of 25 records. To return additional records, perform another query using the <code>OFFSET</code> keyword.</li><li>Can't modify the vault or perform transactions.</li><li>Can't return tokens.</li><li>Can't return file download or render URLs.</li><li>Doesn't support the <code>WHERE</code> keyword with columns using transient tokenization.</li><li>Doesn't support ? conditional for columns with column-level encryption disabled.</li><ul> + */ + public ApiClientHttpResponse queryServiceExecuteQuery( + String vaultId, QueryServiceExecuteQueryBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegments("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(), V1GetQueryResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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/query/requests/QueryServiceExecuteQueryBody.java b/src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java new file mode 100644 index 00000000..dfa21d15 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/query/requests/QueryServiceExecuteQueryBody.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.query.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; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = QueryServiceExecuteQueryBody.Builder.class) +public final class QueryServiceExecuteQueryBody { + private final Optional query; + + private final Map additionalProperties; + + private QueryServiceExecuteQueryBody(Optional query, Map additionalProperties) { + this.query = query; + this.additionalProperties = additionalProperties; + } + + /** + * @return The SQL query to execute.<br><br><b>Supported commands:</b> <ul> <li><code>SELECT</code></li> </ul> <b>Supported operators:</b> <ul> <li><code>></code></li> <li><code><</code></li> <li><code>=</code></li> <li><code>AND</code></li> <li><code>OR</code></li> <li><code>NOT</code></li> <li><code>LIKE</code></li> <li><code>ILIKE</code></li> <li><code>NULL</code></li> <li><code>NOT NULL</code></li> </ul> <b>Supported keywords:</b> <ul> <li><code>FROM</code></li> <li><code>JOIN</code></li> <li><code>INNER JOIN</code></li> <li><code>LEFT OUTER JOIN</code></li> <li><code>LEFT JOIN</code></li> <li><code>RIGHT OUTER JOIN</code></li> <li><code>RIGHT JOIN</code></li> <li><code>FULL OUTER JOIN</code></li> <li><code>FULL JOIN</code></li> <li><code>OFFSET</code></li> <li><code>LIMIT</code></li> <li><code>WHERE</code></li> </ul> <b>Supported functions:</b> <ul> <li><code>AVG()</code></li> <li><code>SUM()</code></li> <li><code>COUNT()</code></li> <li><code>MIN()</code></li> <li><code>MAX()</code></li> <li><code>REDACTION()</code></li> </ul> + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof QueryServiceExecuteQueryBody && equalTo((QueryServiceExecuteQueryBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(QueryServiceExecuteQueryBody other) { + return query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.query); + } + + @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 query = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(QueryServiceExecuteQueryBody other) { + query(other.getQuery()); + return this; + } + + /** + *

The SQL query to execute.<br><br><b>Supported commands:</b> <ul> <li><code>SELECT</code></li> </ul> <b>Supported operators:</b> <ul> <li><code>></code></li> <li><code><</code></li> <li><code>=</code></li> <li><code>AND</code></li> <li><code>OR</code></li> <li><code>NOT</code></li> <li><code>LIKE</code></li> <li><code>ILIKE</code></li> <li><code>NULL</code></li> <li><code>NOT NULL</code></li> </ul> <b>Supported keywords:</b> <ul> <li><code>FROM</code></li> <li><code>JOIN</code></li> <li><code>INNER JOIN</code></li> <li><code>LEFT OUTER JOIN</code></li> <li><code>LEFT JOIN</code></li> <li><code>RIGHT OUTER JOIN</code></li> <li><code>RIGHT JOIN</code></li> <li><code>FULL OUTER JOIN</code></li> <li><code>FULL JOIN</code></li> <li><code>OFFSET</code></li> <li><code>LIMIT</code></li> <li><code>WHERE</code></li> </ul> <b>Supported functions:</b> <ul> <li><code>AVG()</code></li> <li><code>SUM()</code></li> <li><code>COUNT()</code></li> <li><code>MIN()</code></li> <li><code>MAX()</code></li> <li><code>REDACTION()</code></li> </ul>

+ */ + @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 QueryServiceExecuteQueryBody build() { + return new QueryServiceExecuteQueryBody(query, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRawRecordsClient.java b/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRawRecordsClient.java new file mode 100644 index 00000000..757ee8e4 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRawRecordsClient.java @@ -0,0 +1,956 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records; + +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.MediaTypes; +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.errors.NotFoundError; +import com.skyflow.generated.rest.resources.records.requests.FileServiceUploadFileRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBatchOperationBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkDeleteRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceInsertRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceUpdateRecordBody; +import com.skyflow.generated.rest.types.V1BatchOperationResponse; +import com.skyflow.generated.rest.types.V1BulkDeleteRecordResponse; +import com.skyflow.generated.rest.types.V1BulkGetRecordResponse; +import com.skyflow.generated.rest.types.V1DeleteFileResponse; +import com.skyflow.generated.rest.types.V1DeleteRecordResponse; +import com.skyflow.generated.rest.types.V1FieldRecords; +import com.skyflow.generated.rest.types.V1GetFileScanStatusResponse; +import com.skyflow.generated.rest.types.V1InsertRecordResponse; +import com.skyflow.generated.rest.types.V1UpdateRecordResponse; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.MultipartBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawRecordsClient { + protected final ClientOptions clientOptions; + + public AsyncRawRecordsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Performs multiple record operations in a single transaction. + */ + public CompletableFuture> recordServiceBatchOperation( + String vaultId) { + return recordServiceBatchOperation( + vaultId, RecordServiceBatchOperationBody.builder().build()); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public CompletableFuture> recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request) { + return recordServiceBatchOperation(vaultId, request, null); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public CompletableFuture> recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .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(), V1BatchOperationResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Gets the specified records from a table. + */ + public CompletableFuture> recordServiceBulkGetRecord( + String vaultId, String objectName) { + return recordServiceBulkGetRecord( + vaultId, objectName, RecordServiceBulkGetRecordRequest.builder().build()); + } + + /** + * Gets the specified records from a table. + */ + public CompletableFuture> recordServiceBulkGetRecord( + String vaultId, String objectName, RecordServiceBulkGetRecordRequest request) { + return recordServiceBulkGetRecord(vaultId, objectName, request, null); + } + + /** + * Gets the specified records from a table. + */ + public CompletableFuture> recordServiceBulkGetRecord( + String vaultId, + String objectName, + RecordServiceBulkGetRecordRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName); + if (request.getRedaction().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redaction", request.getRedaction().get(), false); + } + if (request.getTokenization().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "tokenization", request.getTokenization().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getDownloadUrl().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "downloadURL", request.getDownloadUrl().get(), false); + } + if (request.getColumnName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "column_name", request.getColumnName().get(), false); + } + if (request.getOrderBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order_by", request.getOrderBy().get(), false); + } + if (request.getSkyflowIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "skyflow_ids", request.getSkyflowIds().get(), true); + } + if (request.getFields().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "fields", request.getFields().get(), true); + } + if (request.getColumnValues().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "column_values", request.getColumnValues().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1BulkGetRecordResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public CompletableFuture> recordServiceInsertRecord( + String vaultId, String objectName) { + return recordServiceInsertRecord( + vaultId, objectName, RecordServiceInsertRecordBody.builder().build()); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public CompletableFuture> recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request) { + return recordServiceInsertRecord(vaultId, objectName, request, null); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public CompletableFuture> recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .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(), V1InsertRecordResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes the specified records from a table. + */ + public CompletableFuture> recordServiceBulkDeleteRecord( + String vaultId, String objectName) { + return recordServiceBulkDeleteRecord( + vaultId, objectName, RecordServiceBulkDeleteRecordBody.builder().build()); + } + + /** + * Deletes the specified records from a table. + */ + public CompletableFuture> recordServiceBulkDeleteRecord( + String vaultId, String objectName, RecordServiceBulkDeleteRecordBody request) { + return recordServiceBulkDeleteRecord(vaultId, objectName, request, null); + } + + /** + * Deletes the specified records from a table. + */ + public CompletableFuture> recordServiceBulkDeleteRecord( + String vaultId, + String objectName, + RecordServiceBulkDeleteRecordBody request, + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .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("DELETE", 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(), V1BulkDeleteRecordResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns the specified record from a table. + */ + public CompletableFuture> recordServiceGetRecord( + String vaultId, String objectName, String id) { + return recordServiceGetRecord( + vaultId, objectName, id, RecordServiceGetRecordRequest.builder().build()); + } + + /** + * Returns the specified record from a table. + */ + public CompletableFuture> recordServiceGetRecord( + String vaultId, String objectName, String id, RecordServiceGetRecordRequest request) { + return recordServiceGetRecord(vaultId, objectName, id, request, null); + } + + /** + * Returns the specified record from a table. + */ + public CompletableFuture> recordServiceGetRecord( + String vaultId, + String objectName, + String id, + RecordServiceGetRecordRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id); + if (request.getRedaction().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redaction", request.getRedaction().get(), false); + } + if (request.getTokenization().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "tokenization", request.getTokenization().get(), false); + } + if (request.getDownloadUrl().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "downloadURL", request.getDownloadUrl().get(), false); + } + if (request.getFields().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "fields", request.getFields().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1FieldRecords.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public CompletableFuture> recordServiceUpdateRecord( + String vaultId, String objectName, String id) { + return recordServiceUpdateRecord( + vaultId, objectName, id, RecordServiceUpdateRecordBody.builder().build()); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public CompletableFuture> recordServiceUpdateRecord( + String vaultId, String objectName, String id, RecordServiceUpdateRecordBody request) { + return recordServiceUpdateRecord(vaultId, objectName, id, request, null); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public CompletableFuture> recordServiceUpdateRecord( + String vaultId, + String objectName, + String id, + RecordServiceUpdateRecordBody request, + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id) + .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("PUT", 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(), V1UpdateRecordResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public CompletableFuture> recordServiceDeleteRecord( + String vaultId, String objectName, String id) { + return recordServiceDeleteRecord(vaultId, objectName, id, null); + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public CompletableFuture> recordServiceDeleteRecord( + String vaultId, String objectName, String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .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(), V1DeleteRecordResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Uploads a file to the specified record. + */ + public CompletableFuture> fileServiceUploadFile( + String vaultId, String objectName, String id, Optional fileColumnName) { + return fileServiceUploadFile( + vaultId, + objectName, + id, + fileColumnName, + FileServiceUploadFileRequest.builder().build()); + } + + /** + * Uploads a file to the specified record. + */ + public CompletableFuture> fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request) { + return fileServiceUploadFile(vaultId, objectName, id, fileColumnName, request, null); + } + + /** + * Uploads a file to the specified record. + */ + public CompletableFuture> fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request, + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id) + .addPathSegments("files") + .build(); + MultipartBody.Builder body = new MultipartBody.Builder().setType(MultipartBody.FORM); + try { + if (fileColumnName.isPresent()) { + String fileColumnNameMimeType = + Files.probeContentType(fileColumnName.get().toPath()); + MediaType fileColumnNameMimeTypeMediaType = + fileColumnNameMimeType != null ? MediaType.parse(fileColumnNameMimeType) : null; + body.addFormDataPart( + "fileColumnName", + fileColumnName.get().getName(), + RequestBody.create(fileColumnName.get(), fileColumnNameMimeTypeMediaType)); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body.build()) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1UpdateRecordResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes a file from the specified record. + */ + public CompletableFuture> fileServiceDeleteFile( + String vaultId, String tableName, String id, String columnName) { + return fileServiceDeleteFile(vaultId, tableName, id, columnName, null); + } + + /** + * Deletes a file from the specified record. + */ + public CompletableFuture> fileServiceDeleteFile( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(tableName) + .addPathSegment(id) + .addPathSegments("files") + .addPathSegment(columnName) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .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(), V1DeleteFileResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns the anti-virus scan status of a file. + */ + public CompletableFuture> fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName) { + return fileServiceGetFileScanStatus(vaultId, tableName, id, columnName, null); + } + + /** + * Returns the anti-virus scan status of a file. + */ + public CompletableFuture> fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(tableName) + .addPathSegment(id) + .addPathSegments("files") + .addPathSegment(columnName) + .addPathSegments("scan-status") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .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(), V1GetFileScanStatusResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRecordsClient.java b/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRecordsClient.java new file mode 100644 index 00000000..baf98c1d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/AsyncRecordsClient.java @@ -0,0 +1,317 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.records.requests.FileServiceUploadFileRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBatchOperationBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkDeleteRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceInsertRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceUpdateRecordBody; +import com.skyflow.generated.rest.types.V1BatchOperationResponse; +import com.skyflow.generated.rest.types.V1BulkDeleteRecordResponse; +import com.skyflow.generated.rest.types.V1BulkGetRecordResponse; +import com.skyflow.generated.rest.types.V1DeleteFileResponse; +import com.skyflow.generated.rest.types.V1DeleteRecordResponse; +import com.skyflow.generated.rest.types.V1FieldRecords; +import com.skyflow.generated.rest.types.V1GetFileScanStatusResponse; +import com.skyflow.generated.rest.types.V1InsertRecordResponse; +import com.skyflow.generated.rest.types.V1UpdateRecordResponse; +import java.io.File; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +public class AsyncRecordsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawRecordsClient rawClient; + + public AsyncRecordsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawRecordsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawRecordsClient withRawResponse() { + return this.rawClient; + } + + /** + * Performs multiple record operations in a single transaction. + */ + public CompletableFuture recordServiceBatchOperation(String vaultId) { + return this.rawClient.recordServiceBatchOperation(vaultId).thenApply(response -> response.body()); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public CompletableFuture recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request) { + return this.rawClient.recordServiceBatchOperation(vaultId, request).thenApply(response -> response.body()); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public CompletableFuture recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceBatchOperation(vaultId, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Gets the specified records from a table. + */ + public CompletableFuture recordServiceBulkGetRecord(String vaultId, String objectName) { + return this.rawClient.recordServiceBulkGetRecord(vaultId, objectName).thenApply(response -> response.body()); + } + + /** + * Gets the specified records from a table. + */ + public CompletableFuture recordServiceBulkGetRecord( + String vaultId, String objectName, RecordServiceBulkGetRecordRequest request) { + return this.rawClient + .recordServiceBulkGetRecord(vaultId, objectName, request) + .thenApply(response -> response.body()); + } + + /** + * Gets the specified records from a table. + */ + public CompletableFuture recordServiceBulkGetRecord( + String vaultId, + String objectName, + RecordServiceBulkGetRecordRequest request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceBulkGetRecord(vaultId, objectName, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public CompletableFuture recordServiceInsertRecord(String vaultId, String objectName) { + return this.rawClient.recordServiceInsertRecord(vaultId, objectName).thenApply(response -> response.body()); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public CompletableFuture recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request) { + return this.rawClient + .recordServiceInsertRecord(vaultId, objectName, request) + .thenApply(response -> response.body()); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public CompletableFuture recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceInsertRecord(vaultId, objectName, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Deletes the specified records from a table. + */ + public CompletableFuture recordServiceBulkDeleteRecord( + String vaultId, String objectName) { + return this.rawClient.recordServiceBulkDeleteRecord(vaultId, objectName).thenApply(response -> response.body()); + } + + /** + * Deletes the specified records from a table. + */ + public CompletableFuture recordServiceBulkDeleteRecord( + String vaultId, String objectName, RecordServiceBulkDeleteRecordBody request) { + return this.rawClient + .recordServiceBulkDeleteRecord(vaultId, objectName, request) + .thenApply(response -> response.body()); + } + + /** + * Deletes the specified records from a table. + */ + public CompletableFuture recordServiceBulkDeleteRecord( + String vaultId, + String objectName, + RecordServiceBulkDeleteRecordBody request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceBulkDeleteRecord(vaultId, objectName, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Returns the specified record from a table. + */ + public CompletableFuture recordServiceGetRecord(String vaultId, String objectName, String id) { + return this.rawClient.recordServiceGetRecord(vaultId, objectName, id).thenApply(response -> response.body()); + } + + /** + * Returns the specified record from a table. + */ + public CompletableFuture recordServiceGetRecord( + String vaultId, String objectName, String id, RecordServiceGetRecordRequest request) { + return this.rawClient + .recordServiceGetRecord(vaultId, objectName, id, request) + .thenApply(response -> response.body()); + } + + /** + * Returns the specified record from a table. + */ + public CompletableFuture recordServiceGetRecord( + String vaultId, + String objectName, + String id, + RecordServiceGetRecordRequest request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceGetRecord(vaultId, objectName, id, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public CompletableFuture recordServiceUpdateRecord( + String vaultId, String objectName, String id) { + return this.rawClient.recordServiceUpdateRecord(vaultId, objectName, id).thenApply(response -> response.body()); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public CompletableFuture recordServiceUpdateRecord( + String vaultId, String objectName, String id, RecordServiceUpdateRecordBody request) { + return this.rawClient + .recordServiceUpdateRecord(vaultId, objectName, id, request) + .thenApply(response -> response.body()); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public CompletableFuture recordServiceUpdateRecord( + String vaultId, + String objectName, + String id, + RecordServiceUpdateRecordBody request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceUpdateRecord(vaultId, objectName, id, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public CompletableFuture recordServiceDeleteRecord( + String vaultId, String objectName, String id) { + return this.rawClient.recordServiceDeleteRecord(vaultId, objectName, id).thenApply(response -> response.body()); + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public CompletableFuture recordServiceDeleteRecord( + String vaultId, String objectName, String id, RequestOptions requestOptions) { + return this.rawClient + .recordServiceDeleteRecord(vaultId, objectName, id, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Uploads a file to the specified record. + */ + public CompletableFuture fileServiceUploadFile( + String vaultId, String objectName, String id, Optional fileColumnName) { + return this.rawClient + .fileServiceUploadFile(vaultId, objectName, id, fileColumnName) + .thenApply(response -> response.body()); + } + + /** + * Uploads a file to the specified record. + */ + public CompletableFuture fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request) { + return this.rawClient + .fileServiceUploadFile(vaultId, objectName, id, fileColumnName, request) + .thenApply(response -> response.body()); + } + + /** + * Uploads a file to the specified record. + */ + public CompletableFuture fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request, + RequestOptions requestOptions) { + return this.rawClient + .fileServiceUploadFile(vaultId, objectName, id, fileColumnName, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Deletes a file from the specified record. + */ + public CompletableFuture fileServiceDeleteFile( + String vaultId, String tableName, String id, String columnName) { + return this.rawClient + .fileServiceDeleteFile(vaultId, tableName, id, columnName) + .thenApply(response -> response.body()); + } + + /** + * Deletes a file from the specified record. + */ + public CompletableFuture fileServiceDeleteFile( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + return this.rawClient + .fileServiceDeleteFile(vaultId, tableName, id, columnName, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Returns the anti-virus scan status of a file. + */ + public CompletableFuture fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName) { + return this.rawClient + .fileServiceGetFileScanStatus(vaultId, tableName, id, columnName) + .thenApply(response -> response.body()); + } + + /** + * Returns the anti-virus scan status of a file. + */ + public CompletableFuture fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + return this.rawClient + .fileServiceGetFileScanStatus(vaultId, tableName, id, columnName, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/RawRecordsClient.java b/src/main/java/com/skyflow/generated/rest/resources/records/RawRecordsClient.java new file mode 100644 index 00000000..593f5e3d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/RawRecordsClient.java @@ -0,0 +1,800 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records; + +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.MediaTypes; +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.errors.NotFoundError; +import com.skyflow.generated.rest.resources.records.requests.FileServiceUploadFileRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBatchOperationBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkDeleteRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceInsertRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceUpdateRecordBody; +import com.skyflow.generated.rest.types.V1BatchOperationResponse; +import com.skyflow.generated.rest.types.V1BulkDeleteRecordResponse; +import com.skyflow.generated.rest.types.V1BulkGetRecordResponse; +import com.skyflow.generated.rest.types.V1DeleteFileResponse; +import com.skyflow.generated.rest.types.V1DeleteRecordResponse; +import com.skyflow.generated.rest.types.V1FieldRecords; +import com.skyflow.generated.rest.types.V1GetFileScanStatusResponse; +import com.skyflow.generated.rest.types.V1InsertRecordResponse; +import com.skyflow.generated.rest.types.V1UpdateRecordResponse; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.MultipartBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawRecordsClient { + protected final ClientOptions clientOptions; + + public RawRecordsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Performs multiple record operations in a single transaction. + */ + public ApiClientHttpResponse recordServiceBatchOperation(String vaultId) { + return recordServiceBatchOperation( + vaultId, RecordServiceBatchOperationBody.builder().build()); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public ApiClientHttpResponse recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request) { + return recordServiceBatchOperation(vaultId, request, null); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public ApiClientHttpResponse recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .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(), V1BatchOperationResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Gets the specified records from a table. + */ + public ApiClientHttpResponse recordServiceBulkGetRecord( + String vaultId, String objectName) { + return recordServiceBulkGetRecord( + vaultId, objectName, RecordServiceBulkGetRecordRequest.builder().build()); + } + + /** + * Gets the specified records from a table. + */ + public ApiClientHttpResponse recordServiceBulkGetRecord( + String vaultId, String objectName, RecordServiceBulkGetRecordRequest request) { + return recordServiceBulkGetRecord(vaultId, objectName, request, null); + } + + /** + * Gets the specified records from a table. + */ + public ApiClientHttpResponse recordServiceBulkGetRecord( + String vaultId, + String objectName, + RecordServiceBulkGetRecordRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName); + if (request.getRedaction().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redaction", request.getRedaction().get(), false); + } + if (request.getTokenization().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "tokenization", request.getTokenization().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getDownloadUrl().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "downloadURL", request.getDownloadUrl().get(), false); + } + if (request.getColumnName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "column_name", request.getColumnName().get(), false); + } + if (request.getOrderBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order_by", request.getOrderBy().get(), false); + } + if (request.getSkyflowIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "skyflow_ids", request.getSkyflowIds().get(), true); + } + if (request.getFields().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "fields", request.getFields().get(), true); + } + if (request.getColumnValues().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "column_values", request.getColumnValues().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1BulkGetRecordResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public ApiClientHttpResponse recordServiceInsertRecord(String vaultId, String objectName) { + return recordServiceInsertRecord( + vaultId, objectName, RecordServiceInsertRecordBody.builder().build()); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public ApiClientHttpResponse recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request) { + return recordServiceInsertRecord(vaultId, objectName, request, null); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public ApiClientHttpResponse recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .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(), V1InsertRecordResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Deletes the specified records from a table. + */ + public ApiClientHttpResponse recordServiceBulkDeleteRecord( + String vaultId, String objectName) { + return recordServiceBulkDeleteRecord( + vaultId, objectName, RecordServiceBulkDeleteRecordBody.builder().build()); + } + + /** + * Deletes the specified records from a table. + */ + public ApiClientHttpResponse recordServiceBulkDeleteRecord( + String vaultId, String objectName, RecordServiceBulkDeleteRecordBody request) { + return recordServiceBulkDeleteRecord(vaultId, objectName, request, null); + } + + /** + * Deletes the specified records from a table. + */ + public ApiClientHttpResponse recordServiceBulkDeleteRecord( + String vaultId, + String objectName, + RecordServiceBulkDeleteRecordBody request, + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .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("DELETE", 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(), V1BulkDeleteRecordResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Returns the specified record from a table. + */ + public ApiClientHttpResponse recordServiceGetRecord(String vaultId, String objectName, String id) { + return recordServiceGetRecord( + vaultId, objectName, id, RecordServiceGetRecordRequest.builder().build()); + } + + /** + * Returns the specified record from a table. + */ + public ApiClientHttpResponse recordServiceGetRecord( + String vaultId, String objectName, String id, RecordServiceGetRecordRequest request) { + return recordServiceGetRecord(vaultId, objectName, id, request, null); + } + + /** + * Returns the specified record from a table. + */ + public ApiClientHttpResponse recordServiceGetRecord( + String vaultId, + String objectName, + String id, + RecordServiceGetRecordRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id); + if (request.getRedaction().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redaction", request.getRedaction().get(), false); + } + if (request.getTokenization().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "tokenization", request.getTokenization().get(), false); + } + if (request.getDownloadUrl().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "downloadURL", request.getDownloadUrl().get(), false); + } + if (request.getFields().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "fields", request.getFields().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1FieldRecords.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public ApiClientHttpResponse recordServiceUpdateRecord( + String vaultId, String objectName, String id) { + return recordServiceUpdateRecord( + vaultId, objectName, id, RecordServiceUpdateRecordBody.builder().build()); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public ApiClientHttpResponse recordServiceUpdateRecord( + String vaultId, String objectName, String id, RecordServiceUpdateRecordBody request) { + return recordServiceUpdateRecord(vaultId, objectName, id, request, null); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public ApiClientHttpResponse recordServiceUpdateRecord( + String vaultId, + String objectName, + String id, + RecordServiceUpdateRecordBody request, + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id) + .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("PUT", 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(), V1UpdateRecordResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public ApiClientHttpResponse recordServiceDeleteRecord( + String vaultId, String objectName, String id) { + return recordServiceDeleteRecord(vaultId, objectName, id, null); + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public ApiClientHttpResponse recordServiceDeleteRecord( + String vaultId, String objectName, String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .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(), V1DeleteRecordResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Uploads a file to the specified record. + */ + public ApiClientHttpResponse fileServiceUploadFile( + String vaultId, String objectName, String id, Optional fileColumnName) { + return fileServiceUploadFile( + vaultId, + objectName, + id, + fileColumnName, + FileServiceUploadFileRequest.builder().build()); + } + + /** + * Uploads a file to the specified record. + */ + public ApiClientHttpResponse fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request) { + return fileServiceUploadFile(vaultId, objectName, id, fileColumnName, request, null); + } + + /** + * Uploads a file to the specified record. + */ + public ApiClientHttpResponse fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request, + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(objectName) + .addPathSegment(id) + .addPathSegments("files") + .build(); + MultipartBody.Builder body = new MultipartBody.Builder().setType(MultipartBody.FORM); + try { + if (fileColumnName.isPresent()) { + String fileColumnNameMimeType = + Files.probeContentType(fileColumnName.get().toPath()); + MediaType fileColumnNameMimeTypeMediaType = + fileColumnNameMimeType != null ? MediaType.parse(fileColumnNameMimeType) : null; + body.addFormDataPart( + "fileColumnName", + fileColumnName.get().getName(), + RequestBody.create(fileColumnName.get(), fileColumnNameMimeTypeMediaType)); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body.build()) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.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(), V1UpdateRecordResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Deletes a file from the specified record. + */ + public ApiClientHttpResponse fileServiceDeleteFile( + String vaultId, String tableName, String id, String columnName) { + return fileServiceDeleteFile(vaultId, tableName, id, columnName, null); + } + + /** + * Deletes a file from the specified record. + */ + public ApiClientHttpResponse fileServiceDeleteFile( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(tableName) + .addPathSegment(id) + .addPathSegments("files") + .addPathSegment(columnName) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .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(), V1DeleteFileResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Returns the anti-virus scan status of a file. + */ + public ApiClientHttpResponse fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName) { + return fileServiceGetFileScanStatus(vaultId, tableName, id, columnName, null); + } + + /** + * Returns the anti-virus scan status of a file. + */ + public ApiClientHttpResponse fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegment(tableName) + .addPathSegment(id) + .addPathSegments("files") + .addPathSegment(columnName) + .addPathSegments("scan-status") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .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(), V1GetFileScanStatusResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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/records/RecordsClient.java b/src/main/java/com/skyflow/generated/rest/resources/records/RecordsClient.java new file mode 100644 index 00000000..fee9d49b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/RecordsClient.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.records.requests.FileServiceUploadFileRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBatchOperationBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkDeleteRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBulkGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceGetRecordRequest; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceInsertRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceUpdateRecordBody; +import com.skyflow.generated.rest.types.V1BatchOperationResponse; +import com.skyflow.generated.rest.types.V1BulkDeleteRecordResponse; +import com.skyflow.generated.rest.types.V1BulkGetRecordResponse; +import com.skyflow.generated.rest.types.V1DeleteFileResponse; +import com.skyflow.generated.rest.types.V1DeleteRecordResponse; +import com.skyflow.generated.rest.types.V1FieldRecords; +import com.skyflow.generated.rest.types.V1GetFileScanStatusResponse; +import com.skyflow.generated.rest.types.V1InsertRecordResponse; +import com.skyflow.generated.rest.types.V1UpdateRecordResponse; +import java.io.File; +import java.util.Optional; + +public class RecordsClient { + protected final ClientOptions clientOptions; + + private final RawRecordsClient rawClient; + + public RecordsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawRecordsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawRecordsClient withRawResponse() { + return this.rawClient; + } + + /** + * Performs multiple record operations in a single transaction. + */ + public V1BatchOperationResponse recordServiceBatchOperation(String vaultId) { + return this.rawClient.recordServiceBatchOperation(vaultId).body(); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public V1BatchOperationResponse recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request) { + return this.rawClient.recordServiceBatchOperation(vaultId, request).body(); + } + + /** + * Performs multiple record operations in a single transaction. + */ + public V1BatchOperationResponse recordServiceBatchOperation( + String vaultId, RecordServiceBatchOperationBody request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceBatchOperation(vaultId, request, requestOptions) + .body(); + } + + /** + * Gets the specified records from a table. + */ + public V1BulkGetRecordResponse recordServiceBulkGetRecord(String vaultId, String objectName) { + return this.rawClient.recordServiceBulkGetRecord(vaultId, objectName).body(); + } + + /** + * Gets the specified records from a table. + */ + public V1BulkGetRecordResponse recordServiceBulkGetRecord( + String vaultId, String objectName, RecordServiceBulkGetRecordRequest request) { + return this.rawClient + .recordServiceBulkGetRecord(vaultId, objectName, request) + .body(); + } + + /** + * Gets the specified records from a table. + */ + public V1BulkGetRecordResponse recordServiceBulkGetRecord( + String vaultId, + String objectName, + RecordServiceBulkGetRecordRequest request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceBulkGetRecord(vaultId, objectName, request, requestOptions) + .body(); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public V1InsertRecordResponse recordServiceInsertRecord(String vaultId, String objectName) { + return this.rawClient.recordServiceInsertRecord(vaultId, objectName).body(); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public V1InsertRecordResponse recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request) { + return this.rawClient + .recordServiceInsertRecord(vaultId, objectName, request) + .body(); + } + + /** + * Inserts a record in the specified table.<br /><br />The time-to-live (TTL) for a transient field begins when the field value is set during record insertion.<br /><br />Columns that have a string data type and a uniqueness constraint accept strings up to 2500 characters. If an inserted string exceeds 2500 characters, the call returns a token insertion error. + */ + public V1InsertRecordResponse recordServiceInsertRecord( + String vaultId, String objectName, RecordServiceInsertRecordBody request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceInsertRecord(vaultId, objectName, request, requestOptions) + .body(); + } + + /** + * Deletes the specified records from a table. + */ + public V1BulkDeleteRecordResponse recordServiceBulkDeleteRecord(String vaultId, String objectName) { + return this.rawClient.recordServiceBulkDeleteRecord(vaultId, objectName).body(); + } + + /** + * Deletes the specified records from a table. + */ + public V1BulkDeleteRecordResponse recordServiceBulkDeleteRecord( + String vaultId, String objectName, RecordServiceBulkDeleteRecordBody request) { + return this.rawClient + .recordServiceBulkDeleteRecord(vaultId, objectName, request) + .body(); + } + + /** + * Deletes the specified records from a table. + */ + public V1BulkDeleteRecordResponse recordServiceBulkDeleteRecord( + String vaultId, + String objectName, + RecordServiceBulkDeleteRecordBody request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceBulkDeleteRecord(vaultId, objectName, request, requestOptions) + .body(); + } + + /** + * Returns the specified record from a table. + */ + public V1FieldRecords recordServiceGetRecord(String vaultId, String objectName, String id) { + return this.rawClient.recordServiceGetRecord(vaultId, objectName, id).body(); + } + + /** + * Returns the specified record from a table. + */ + public V1FieldRecords recordServiceGetRecord( + String vaultId, String objectName, String id, RecordServiceGetRecordRequest request) { + return this.rawClient + .recordServiceGetRecord(vaultId, objectName, id, request) + .body(); + } + + /** + * Returns the specified record from a table. + */ + public V1FieldRecords recordServiceGetRecord( + String vaultId, + String objectName, + String id, + RecordServiceGetRecordRequest request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceGetRecord(vaultId, objectName, id, request, requestOptions) + .body(); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public V1UpdateRecordResponse recordServiceUpdateRecord(String vaultId, String objectName, String id) { + return this.rawClient.recordServiceUpdateRecord(vaultId, objectName, id).body(); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public V1UpdateRecordResponse recordServiceUpdateRecord( + String vaultId, String objectName, String id, RecordServiceUpdateRecordBody request) { + return this.rawClient + .recordServiceUpdateRecord(vaultId, objectName, id, request) + .body(); + } + + /** + * Updates the specified record in a table.<br /><br />When you update a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.<br /><br />The time-to-live (TTL) for a transient field resets when the field value is updated. + */ + public V1UpdateRecordResponse recordServiceUpdateRecord( + String vaultId, + String objectName, + String id, + RecordServiceUpdateRecordBody request, + RequestOptions requestOptions) { + return this.rawClient + .recordServiceUpdateRecord(vaultId, objectName, id, request, requestOptions) + .body(); + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public V1DeleteRecordResponse recordServiceDeleteRecord(String vaultId, String objectName, String id) { + return this.rawClient.recordServiceDeleteRecord(vaultId, objectName, id).body(); + } + + /** + * Deletes the specified record from a table.<br /><br /><b>Note:</b> This method doesn't delete transient field tokens. Transient field values are available until they expire based on the fields' time-to-live (TTL) setting. + */ + public V1DeleteRecordResponse recordServiceDeleteRecord( + String vaultId, String objectName, String id, RequestOptions requestOptions) { + return this.rawClient + .recordServiceDeleteRecord(vaultId, objectName, id, requestOptions) + .body(); + } + + /** + * Uploads a file to the specified record. + */ + public V1UpdateRecordResponse fileServiceUploadFile( + String vaultId, String objectName, String id, Optional fileColumnName) { + return this.rawClient + .fileServiceUploadFile(vaultId, objectName, id, fileColumnName) + .body(); + } + + /** + * Uploads a file to the specified record. + */ + public V1UpdateRecordResponse fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request) { + return this.rawClient + .fileServiceUploadFile(vaultId, objectName, id, fileColumnName, request) + .body(); + } + + /** + * Uploads a file to the specified record. + */ + public V1UpdateRecordResponse fileServiceUploadFile( + String vaultId, + String objectName, + String id, + Optional fileColumnName, + FileServiceUploadFileRequest request, + RequestOptions requestOptions) { + return this.rawClient + .fileServiceUploadFile(vaultId, objectName, id, fileColumnName, request, requestOptions) + .body(); + } + + /** + * Deletes a file from the specified record. + */ + public V1DeleteFileResponse fileServiceDeleteFile(String vaultId, String tableName, String id, String columnName) { + return this.rawClient + .fileServiceDeleteFile(vaultId, tableName, id, columnName) + .body(); + } + + /** + * Deletes a file from the specified record. + */ + public V1DeleteFileResponse fileServiceDeleteFile( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + return this.rawClient + .fileServiceDeleteFile(vaultId, tableName, id, columnName, requestOptions) + .body(); + } + + /** + * Returns the anti-virus scan status of a file. + */ + public V1GetFileScanStatusResponse fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName) { + return this.rawClient + .fileServiceGetFileScanStatus(vaultId, tableName, id, columnName) + .body(); + } + + /** + * Returns the anti-virus scan status of a file. + */ + public V1GetFileScanStatusResponse fileServiceGetFileScanStatus( + String vaultId, String tableName, String id, String columnName, RequestOptions requestOptions) { + return this.rawClient + .fileServiceGetFileScanStatus(vaultId, tableName, id, columnName, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java b/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java new file mode 100644 index 00000000..d1b64906 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/requests/FileServiceUploadFileRequest.java @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FileServiceUploadFileRequest.Builder.class) +public final class FileServiceUploadFileRequest { + private final Map additionalProperties; + + private FileServiceUploadFileRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FileServiceUploadFileRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @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 { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(FileServiceUploadFileRequest other) { + return this; + } + + public FileServiceUploadFileRequest build() { + return new FileServiceUploadFileRequest(additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java new file mode 100644 index 00000000..33b92483 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBatchOperationBody.java @@ -0,0 +1,160 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.V1BatchRecord; +import com.skyflow.generated.rest.types.V1Byot; +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 = RecordServiceBatchOperationBody.Builder.class) +public final class RecordServiceBatchOperationBody { + private final Optional> records; + + private final Optional continueOnError; + + private final Optional byot; + + private final Map additionalProperties; + + private RecordServiceBatchOperationBody( + Optional> records, + Optional continueOnError, + Optional byot, + Map additionalProperties) { + this.records = records; + this.continueOnError = continueOnError; + this.byot = byot; + this.additionalProperties = additionalProperties; + } + + /** + * @return Record operations to perform. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + /** + * @return Continue performing operations on partial errors. + */ + @JsonProperty("continueOnError") + public Optional getContinueOnError() { + return continueOnError; + } + + @JsonProperty("byot") + public Optional getByot() { + return byot; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecordServiceBatchOperationBody && equalTo((RecordServiceBatchOperationBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecordServiceBatchOperationBody other) { + return records.equals(other.records) + && continueOnError.equals(other.continueOnError) + && byot.equals(other.byot); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.records, this.continueOnError, this.byot); + } + + @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> records = Optional.empty(); + + private Optional continueOnError = Optional.empty(); + + private Optional byot = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecordServiceBatchOperationBody other) { + records(other.getRecords()); + continueOnError(other.getContinueOnError()); + byot(other.getByot()); + return this; + } + + /** + *

Record operations to perform.

+ */ + @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; + } + + /** + *

Continue performing operations on partial errors.

+ */ + @JsonSetter(value = "continueOnError", nulls = Nulls.SKIP) + public Builder continueOnError(Optional continueOnError) { + this.continueOnError = continueOnError; + return this; + } + + public Builder continueOnError(Boolean continueOnError) { + this.continueOnError = Optional.ofNullable(continueOnError); + return this; + } + + @JsonSetter(value = "byot", nulls = Nulls.SKIP) + public Builder byot(Optional byot) { + this.byot = byot; + return this; + } + + public Builder byot(V1Byot byot) { + this.byot = Optional.ofNullable(byot); + return this; + } + + public RecordServiceBatchOperationBody build() { + return new RecordServiceBatchOperationBody(records, continueOnError, byot, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java new file mode 100644 index 00000000..b2c991f9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkDeleteRecordBody.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RecordServiceBulkDeleteRecordBody.Builder.class) +public final class RecordServiceBulkDeleteRecordBody { + private final Optional> skyflowIds; + + private final Map additionalProperties; + + private RecordServiceBulkDeleteRecordBody( + Optional> skyflowIds, Map additionalProperties) { + this.skyflowIds = skyflowIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return skyflow_id values of the records to delete. If * is specified, this operation deletes all records in the table. + */ + @JsonProperty("skyflow_ids") + public Optional> getSkyflowIds() { + return skyflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecordServiceBulkDeleteRecordBody && equalTo((RecordServiceBulkDeleteRecordBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecordServiceBulkDeleteRecordBody other) { + return skyflowIds.equals(other.skyflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.skyflowIds); + } + + @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> skyflowIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecordServiceBulkDeleteRecordBody other) { + skyflowIds(other.getSkyflowIds()); + return this; + } + + /** + *

skyflow_id values of the records to delete. If * is specified, this operation deletes all records in the table.

+ */ + @JsonSetter(value = "skyflow_ids", 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 RecordServiceBulkDeleteRecordBody build() { + return new RecordServiceBulkDeleteRecordBody(skyflowIds, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java new file mode 100644 index 00000000..f8cccf09 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceBulkGetRecordRequest.java @@ -0,0 +1,413 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.records.types.RecordServiceBulkGetRecordRequestOrderBy; +import com.skyflow.generated.rest.resources.records.types.RecordServiceBulkGetRecordRequestRedaction; +import java.util.Collections; +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 = RecordServiceBulkGetRecordRequest.Builder.class) +public final class RecordServiceBulkGetRecordRequest { + private final Optional> skyflowIds; + + private final Optional> fields; + + private final Optional> columnValues; + + private final Optional redaction; + + private final Optional tokenization; + + private final Optional offset; + + private final Optional limit; + + private final Optional downloadUrl; + + private final Optional columnName; + + private final Optional orderBy; + + private final Map additionalProperties; + + private RecordServiceBulkGetRecordRequest( + Optional> skyflowIds, + Optional> fields, + Optional> columnValues, + Optional redaction, + Optional tokenization, + Optional offset, + Optional limit, + Optional downloadUrl, + Optional columnName, + Optional orderBy, + Map additionalProperties) { + this.skyflowIds = skyflowIds; + this.fields = fields; + this.columnValues = columnValues; + this.redaction = redaction; + this.tokenization = tokenization; + this.offset = offset; + this.limit = limit; + this.downloadUrl = downloadUrl; + this.columnName = columnName; + this.orderBy = orderBy; + this.additionalProperties = additionalProperties; + } + + /** + * @return skyflow_id values of the records to return, with one value per skyflow_ids URL parameter. For example, ?skyflow_ids=abc&skyflow_ids=123.<br /><br />If not specified, returns the first 25 records in the table. + */ + @JsonProperty("skyflow_ids") + public Optional> getSkyflowIds() { + return skyflowIds; + } + + /** + * @return Fields to return for the record, with one value per fields URL parameter. For example, ?fields=abc&fields=123.<br /><br />If not specified, returns all fields. + */ + @JsonProperty("fields") + public Optional> getFields() { + return fields; + } + + /** + * @return Column values of the records to return, with one value per column_values URL parameter. For example, ?column_values=abc&column_values=123.<br /><br />column_name is mandatory when providing column_values. If you use column name or column value, you cannot use skyflow_ids. Passing either of these parameters with skyflow_ids returns an error. + */ + @JsonProperty("column_values") + public Optional> getColumnValues() { + return columnValues; + } + + /** + * @return Redaction level to enforce for the returned records. Subject to policies assigned to the API caller. + */ + @JsonProperty("redaction") + public Optional getRedaction() { + return redaction; + } + + /** + * @return If true, this operation returns tokens for fields with tokenization enabled. Only applicable if skyflow_id values are specified. + */ + @JsonProperty("tokenization") + public Optional getTokenization() { + return tokenization; + } + + /** + * @return Record position at which to start receiving data. + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + /** + * @return Number of record to return. Maximum 25. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. + */ + @JsonProperty("downloadURL") + public Optional getDownloadUrl() { + return downloadUrl; + } + + /** + * @return Name of the column. It must be configured as unique in the schema. If you provide both column name or column value, you cannot use skyflow_ids. Passing either of these parameters with skyflow_ids returns an error. + */ + @JsonProperty("column_name") + public Optional getColumnName() { + return columnName; + } + + /** + * @return Order to return records, based on skyflow_id values. To disable, set to NONE. + */ + @JsonProperty("order_by") + public Optional getOrderBy() { + return orderBy; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecordServiceBulkGetRecordRequest && equalTo((RecordServiceBulkGetRecordRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecordServiceBulkGetRecordRequest other) { + return skyflowIds.equals(other.skyflowIds) + && fields.equals(other.fields) + && columnValues.equals(other.columnValues) + && redaction.equals(other.redaction) + && tokenization.equals(other.tokenization) + && offset.equals(other.offset) + && limit.equals(other.limit) + && downloadUrl.equals(other.downloadUrl) + && columnName.equals(other.columnName) + && orderBy.equals(other.orderBy); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.skyflowIds, + this.fields, + this.columnValues, + this.redaction, + this.tokenization, + this.offset, + this.limit, + this.downloadUrl, + this.columnName, + this.orderBy); + } + + @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> skyflowIds = Optional.empty(); + + private Optional> fields = Optional.empty(); + + private Optional> columnValues = Optional.empty(); + + private Optional redaction = Optional.empty(); + + private Optional tokenization = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional downloadUrl = Optional.empty(); + + private Optional columnName = Optional.empty(); + + private Optional orderBy = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecordServiceBulkGetRecordRequest other) { + skyflowIds(other.getSkyflowIds()); + fields(other.getFields()); + columnValues(other.getColumnValues()); + redaction(other.getRedaction()); + tokenization(other.getTokenization()); + offset(other.getOffset()); + limit(other.getLimit()); + downloadUrl(other.getDownloadUrl()); + columnName(other.getColumnName()); + orderBy(other.getOrderBy()); + return this; + } + + /** + *

skyflow_id values of the records to return, with one value per skyflow_ids URL parameter. For example, ?skyflow_ids=abc&skyflow_ids=123.<br /><br />If not specified, returns the first 25 records in the table.

+ */ + @JsonSetter(value = "skyflow_ids", 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 Builder skyflowIds(String skyflowIds) { + this.skyflowIds = Optional.of(Collections.singletonList(skyflowIds)); + return this; + } + + /** + *

Fields to return for the record, with one value per fields URL parameter. For example, ?fields=abc&fields=123.<br /><br />If not specified, returns all fields.

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

Column values of the records to return, with one value per column_values URL parameter. For example, ?column_values=abc&column_values=123.<br /><br />column_name is mandatory when providing column_values. If you use column name or column value, you cannot use skyflow_ids. Passing either of these parameters with skyflow_ids returns an error.

+ */ + @JsonSetter(value = "column_values", nulls = Nulls.SKIP) + public Builder columnValues(Optional> columnValues) { + this.columnValues = columnValues; + return this; + } + + public Builder columnValues(List columnValues) { + this.columnValues = Optional.ofNullable(columnValues); + return this; + } + + public Builder columnValues(String columnValues) { + this.columnValues = Optional.of(Collections.singletonList(columnValues)); + return this; + } + + /** + *

Redaction level to enforce for the returned records. Subject to policies assigned to the API caller.

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

If true, this operation returns tokens for fields with tokenization enabled. Only applicable if skyflow_id values are specified.

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

Record position at which to start receiving data.

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

Number of record to return. Maximum 25.

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

If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean.

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

Name of the column. It must be configured as unique in the schema. If you provide both column name or column value, you cannot use skyflow_ids. Passing either of these parameters with skyflow_ids returns an error.

+ */ + @JsonSetter(value = "column_name", 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; + } + + /** + *

Order to return records, based on skyflow_id values. To disable, set to NONE.

+ */ + @JsonSetter(value = "order_by", nulls = Nulls.SKIP) + public Builder orderBy(Optional orderBy) { + this.orderBy = orderBy; + return this; + } + + public Builder orderBy(RecordServiceBulkGetRecordRequestOrderBy orderBy) { + this.orderBy = Optional.ofNullable(orderBy); + return this; + } + + public RecordServiceBulkGetRecordRequest build() { + return new RecordServiceBulkGetRecordRequest( + skyflowIds, + fields, + columnValues, + redaction, + tokenization, + offset, + limit, + downloadUrl, + columnName, + orderBy, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java new file mode 100644 index 00000000..0fa5319d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceGetRecordRequest.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.records.types.RecordServiceGetRecordRequestRedaction; +import java.util.Collections; +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 = RecordServiceGetRecordRequest.Builder.class) +public final class RecordServiceGetRecordRequest { + private final Optional> fields; + + private final Optional redaction; + + private final Optional tokenization; + + private final Optional downloadUrl; + + private final Map additionalProperties; + + private RecordServiceGetRecordRequest( + Optional> fields, + Optional redaction, + Optional tokenization, + Optional downloadUrl, + Map additionalProperties) { + this.fields = fields; + this.redaction = redaction; + this.tokenization = tokenization; + this.downloadUrl = downloadUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Fields to return for the record, with one value per fields URL parameter. For example, ?fields=abc&fields=123.<br /><br />If not specified, returns all fields. + */ + @JsonProperty("fields") + public Optional> getFields() { + return fields; + } + + /** + * @return Redaction level to enforce for the returned record. Subject to policies assigned to the API caller. + */ + @JsonProperty("redaction") + public Optional getRedaction() { + return redaction; + } + + /** + * @return If true, this operation returns tokens for fields with tokenization enabled. Only applicable if skyflow_id values are specified. + */ + @JsonProperty("tokenization") + public Optional getTokenization() { + return tokenization; + } + + /** + * @return If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. + */ + @JsonProperty("downloadURL") + public Optional getDownloadUrl() { + return downloadUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecordServiceGetRecordRequest && equalTo((RecordServiceGetRecordRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecordServiceGetRecordRequest other) { + return fields.equals(other.fields) + && redaction.equals(other.redaction) + && tokenization.equals(other.tokenization) + && downloadUrl.equals(other.downloadUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fields, this.redaction, this.tokenization, this.downloadUrl); + } + + @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> fields = Optional.empty(); + + private Optional redaction = Optional.empty(); + + private Optional tokenization = Optional.empty(); + + private Optional downloadUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecordServiceGetRecordRequest other) { + fields(other.getFields()); + redaction(other.getRedaction()); + tokenization(other.getTokenization()); + downloadUrl(other.getDownloadUrl()); + return this; + } + + /** + *

Fields to return for the record, with one value per fields URL parameter. For example, ?fields=abc&fields=123.<br /><br />If not specified, returns all fields.

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

Redaction level to enforce for the returned record. Subject to policies assigned to the API caller.

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

If true, this operation returns tokens for fields with tokenization enabled. Only applicable if skyflow_id values are specified.

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

If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean.

+ */ + @JsonSetter(value = "downloadURL", nulls = Nulls.SKIP) + public Builder downloadUrl(Optional downloadUrl) { + this.downloadUrl = downloadUrl; + return this; + } + + public Builder downloadUrl(Boolean downloadUrl) { + this.downloadUrl = Optional.ofNullable(downloadUrl); + return this; + } + + public RecordServiceGetRecordRequest build() { + return new RecordServiceGetRecordRequest( + fields, redaction, tokenization, downloadUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java new file mode 100644 index 00000000..4ac78692 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceInsertRecordBody.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.V1Byot; +import com.skyflow.generated.rest.types.V1FieldRecords; +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 = RecordServiceInsertRecordBody.Builder.class) +public final class RecordServiceInsertRecordBody { + private final Optional> records; + + private final Optional tokenization; + + private final Optional upsert; + + private final Optional homogeneous; + + private final Optional byot; + + private final Map additionalProperties; + + private RecordServiceInsertRecordBody( + Optional> records, + Optional tokenization, + Optional upsert, + Optional homogeneous, + Optional byot, + Map additionalProperties) { + this.records = records; + this.tokenization = tokenization; + this.upsert = upsert; + this.homogeneous = homogeneous; + this.byot = byot; + this.additionalProperties = additionalProperties; + } + + /** + * @return Record values and tokens. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + /** + * @return If true, this operation returns tokens for fields with tokenization enabled. + */ + @JsonProperty("tokenization") + public Optional getTokenization() { + return tokenization; + } + + /** + * @return Name of a unique column 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.<br /><br />When you upsert a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed. + */ + @JsonProperty("upsert") + public Optional getUpsert() { + return upsert; + } + + /** + * @return If true, this operation mandates that all the records have the same fields. This parameter does not work with upsert. + */ + @JsonProperty("homogeneous") + public Optional getHomogeneous() { + return homogeneous; + } + + @JsonProperty("byot") + public Optional getByot() { + return byot; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecordServiceInsertRecordBody && equalTo((RecordServiceInsertRecordBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecordServiceInsertRecordBody other) { + return records.equals(other.records) + && tokenization.equals(other.tokenization) + && upsert.equals(other.upsert) + && homogeneous.equals(other.homogeneous) + && byot.equals(other.byot); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.records, this.tokenization, this.upsert, this.homogeneous, this.byot); + } + + @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> records = Optional.empty(); + + private Optional tokenization = Optional.empty(); + + private Optional upsert = Optional.empty(); + + private Optional homogeneous = Optional.empty(); + + private Optional byot = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecordServiceInsertRecordBody other) { + records(other.getRecords()); + tokenization(other.getTokenization()); + upsert(other.getUpsert()); + homogeneous(other.getHomogeneous()); + byot(other.getByot()); + return this; + } + + /** + *

Record values and tokens.

+ */ + @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; + } + + /** + *

If true, this operation returns tokens for fields with tokenization enabled.

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

Name of a unique column 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.<br /><br />When you upsert a field, include the entire contents you want the field to store. For JSON fields, include all nested fields and values. If a nested field isn't included, it's removed.

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

If true, this operation mandates that all the records have the same fields. This parameter does not work with upsert.

+ */ + @JsonSetter(value = "homogeneous", nulls = Nulls.SKIP) + public Builder homogeneous(Optional homogeneous) { + this.homogeneous = homogeneous; + return this; + } + + public Builder homogeneous(Boolean homogeneous) { + this.homogeneous = Optional.ofNullable(homogeneous); + return this; + } + + @JsonSetter(value = "byot", nulls = Nulls.SKIP) + public Builder byot(Optional byot) { + this.byot = byot; + return this; + } + + public Builder byot(V1Byot byot) { + this.byot = Optional.ofNullable(byot); + return this; + } + + public RecordServiceInsertRecordBody build() { + return new RecordServiceInsertRecordBody( + records, tokenization, upsert, homogeneous, byot, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java new file mode 100644 index 00000000..19e0ae23 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/requests/RecordServiceUpdateRecordBody.java @@ -0,0 +1,151 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.V1Byot; +import com.skyflow.generated.rest.types.V1FieldRecords; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RecordServiceUpdateRecordBody.Builder.class) +public final class RecordServiceUpdateRecordBody { + private final Optional record; + + private final Optional tokenization; + + private final Optional byot; + + private final Map additionalProperties; + + private RecordServiceUpdateRecordBody( + Optional record, + Optional tokenization, + Optional byot, + Map additionalProperties) { + this.record = record; + this.tokenization = tokenization; + this.byot = byot; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("record") + public Optional getRecord() { + return record; + } + + /** + * @return If true, this operation returns tokens for fields with tokenization enabled. + */ + @JsonProperty("tokenization") + public Optional getTokenization() { + return tokenization; + } + + @JsonProperty("byot") + public Optional getByot() { + return byot; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecordServiceUpdateRecordBody && equalTo((RecordServiceUpdateRecordBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecordServiceUpdateRecordBody other) { + return record.equals(other.record) && tokenization.equals(other.tokenization) && byot.equals(other.byot); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.record, this.tokenization, this.byot); + } + + @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 record = Optional.empty(); + + private Optional tokenization = Optional.empty(); + + private Optional byot = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecordServiceUpdateRecordBody other) { + record(other.getRecord()); + tokenization(other.getTokenization()); + byot(other.getByot()); + return this; + } + + @JsonSetter(value = "record", nulls = Nulls.SKIP) + public Builder record(Optional record) { + this.record = record; + return this; + } + + public Builder record(V1FieldRecords record) { + this.record = Optional.ofNullable(record); + return this; + } + + /** + *

If true, this operation returns tokens for fields with tokenization enabled.

+ */ + @JsonSetter(value = "tokenization", nulls = Nulls.SKIP) + public Builder tokenization(Optional tokenization) { + this.tokenization = tokenization; + return this; + } + + public Builder tokenization(Boolean tokenization) { + this.tokenization = Optional.ofNullable(tokenization); + return this; + } + + @JsonSetter(value = "byot", nulls = Nulls.SKIP) + public Builder byot(Optional byot) { + this.byot = byot; + return this; + } + + public Builder byot(V1Byot byot) { + this.byot = Optional.ofNullable(byot); + return this; + } + + public RecordServiceUpdateRecordBody build() { + return new RecordServiceUpdateRecordBody(record, tokenization, byot, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java b/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java new file mode 100644 index 00000000..2563652f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestOrderBy.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RecordServiceBulkGetRecordRequestOrderBy { + ASCENDING("ASCENDING"), + + DESCENDING("DESCENDING"), + + NONE("NONE"); + + private final String value; + + RecordServiceBulkGetRecordRequestOrderBy(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java b/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java new file mode 100644 index 00000000..b20f2541 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceBulkGetRecordRequestRedaction.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RecordServiceBulkGetRecordRequestRedaction { + DEFAULT("DEFAULT"), + + REDACTED("REDACTED"), + + MASKED("MASKED"), + + PLAIN_TEXT("PLAIN_TEXT"); + + private final String value; + + RecordServiceBulkGetRecordRequestRedaction(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java b/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java new file mode 100644 index 00000000..468e3edd --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/records/types/RecordServiceGetRecordRequestRedaction.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.records.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RecordServiceGetRecordRequestRedaction { + DEFAULT("DEFAULT"), + + REDACTED("REDACTED"), + + MASKED("MASKED"), + + PLAIN_TEXT("PLAIN_TEXT"); + + private final String value; + + RecordServiceGetRecordRequestRedaction(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncRawStringsClient.java b/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncRawStringsClient.java new file mode 100644 index 00000000..0dc804b2 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncRawStringsClient.java @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.strings; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.BadRequestError; +import com.skyflow.generated.rest.errors.InternalServerError; +import com.skyflow.generated.rest.errors.UnauthorizedError; +import com.skyflow.generated.rest.resources.strings.requests.DeidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.requests.ReidentifyStringRequest; +import com.skyflow.generated.rest.types.DeidentifyStringResponse; +import com.skyflow.generated.rest.types.ErrorResponse; +import com.skyflow.generated.rest.types.ReidentifyStringResponse; +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.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawStringsClient { + protected final ClientOptions clientOptions; + + public AsyncRawStringsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * De-identifies sensitive data from a string. + */ + public CompletableFuture> deidentifyString( + DeidentifyStringRequest request) { + return deidentifyString(request, null); + } + + /** + * De-identifies sensitive data from a string. + */ + public CompletableFuture> deidentifyString( + DeidentifyStringRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/string") + .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(), DeidentifyStringResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Re-identifies tokens in a string. + */ + public CompletableFuture> reidentifyString( + ReidentifyStringRequest request) { + return reidentifyString(request, null); + } + + /** + * Re-identifies tokens in a string. + */ + public CompletableFuture> reidentifyString( + ReidentifyStringRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/reidentify/string") + .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(), ReidentifyStringResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncStringsClient.java b/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncStringsClient.java new file mode 100644 index 00000000..86e5cd0d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/strings/AsyncStringsClient.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.strings; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.strings.requests.DeidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.requests.ReidentifyStringRequest; +import com.skyflow.generated.rest.types.DeidentifyStringResponse; +import com.skyflow.generated.rest.types.ReidentifyStringResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncStringsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawStringsClient rawClient; + + public AsyncStringsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawStringsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawStringsClient withRawResponse() { + return this.rawClient; + } + + /** + * De-identifies sensitive data from a string. + */ + public CompletableFuture deidentifyString(DeidentifyStringRequest request) { + return this.rawClient.deidentifyString(request).thenApply(response -> response.body()); + } + + /** + * De-identifies sensitive data from a string. + */ + public CompletableFuture deidentifyString( + DeidentifyStringRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyString(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Re-identifies tokens in a string. + */ + public CompletableFuture reidentifyString(ReidentifyStringRequest request) { + return this.rawClient.reidentifyString(request).thenApply(response -> response.body()); + } + + /** + * Re-identifies tokens in a string. + */ + public CompletableFuture reidentifyString( + ReidentifyStringRequest request, RequestOptions requestOptions) { + return this.rawClient.reidentifyString(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/RawStringsClient.java b/src/main/java/com/skyflow/generated/rest/resources/strings/RawStringsClient.java new file mode 100644 index 00000000..0e1fbad0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/strings/RawStringsClient.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.strings; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.BadRequestError; +import com.skyflow.generated.rest.errors.InternalServerError; +import com.skyflow.generated.rest.errors.UnauthorizedError; +import com.skyflow.generated.rest.resources.strings.requests.DeidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.requests.ReidentifyStringRequest; +import com.skyflow.generated.rest.types.DeidentifyStringResponse; +import com.skyflow.generated.rest.types.ErrorResponse; +import com.skyflow.generated.rest.types.ReidentifyStringResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawStringsClient { + protected final ClientOptions clientOptions; + + public RawStringsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * De-identifies sensitive data from a string. + */ + public ApiClientHttpResponse deidentifyString(DeidentifyStringRequest request) { + return deidentifyString(request, null); + } + + /** + * De-identifies sensitive data from a string. + */ + public ApiClientHttpResponse deidentifyString( + DeidentifyStringRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/deidentify/string") + .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(), DeidentifyStringResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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); + } + } + + /** + * Re-identifies tokens in a string. + */ + public ApiClientHttpResponse reidentifyString(ReidentifyStringRequest request) { + return reidentifyString(request, null); + } + + /** + * Re-identifies tokens in a string. + */ + public ApiClientHttpResponse reidentifyString( + ReidentifyStringRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/detect/reidentify/string") + .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(), ReidentifyStringResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), 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/strings/StringsClient.java b/src/main/java/com/skyflow/generated/rest/resources/strings/StringsClient.java new file mode 100644 index 00000000..153efe07 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/strings/StringsClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.strings; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.strings.requests.DeidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.requests.ReidentifyStringRequest; +import com.skyflow.generated.rest.types.DeidentifyStringResponse; +import com.skyflow.generated.rest.types.ReidentifyStringResponse; + +public class StringsClient { + protected final ClientOptions clientOptions; + + private final RawStringsClient rawClient; + + public StringsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawStringsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawStringsClient withRawResponse() { + return this.rawClient; + } + + /** + * De-identifies sensitive data from a string. + */ + public DeidentifyStringResponse deidentifyString(DeidentifyStringRequest request) { + return this.rawClient.deidentifyString(request).body(); + } + + /** + * De-identifies sensitive data from a string. + */ + public DeidentifyStringResponse deidentifyString(DeidentifyStringRequest request, RequestOptions requestOptions) { + return this.rawClient.deidentifyString(request, requestOptions).body(); + } + + /** + * Re-identifies tokens in a string. + */ + public ReidentifyStringResponse reidentifyString(ReidentifyStringRequest request) { + return this.rawClient.reidentifyString(request).body(); + } + + /** + * Re-identifies tokens in a string. + */ + public ReidentifyStringResponse reidentifyString(ReidentifyStringRequest request, RequestOptions requestOptions) { + return this.rawClient.reidentifyString(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java b/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java new file mode 100644 index 00000000..4a74fcba --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/strings/requests/DeidentifyStringRequest.java @@ -0,0 +1,309 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.strings.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.EntityType; +import com.skyflow.generated.rest.types.TokenType; +import com.skyflow.generated.rest.types.Transformations; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyStringRequest.Builder.class) +public final class DeidentifyStringRequest { + private final String vaultId; + + private final String text; + + private final Optional> entityTypes; + + private final Optional tokenType; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional transformations; + + private final Map additionalProperties; + + private DeidentifyStringRequest( + String vaultId, + String text, + Optional> entityTypes, + Optional tokenType, + Optional> allowRegex, + Optional> restrictRegex, + Optional transformations, + Map additionalProperties) { + this.vaultId = vaultId; + this.text = text; + this.entityTypes = entityTypes; + this.tokenType = tokenType; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.transformations = transformations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return String to de-identify. + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @JsonProperty("token_type") + public Optional getTokenType() { + return tokenType; + } + + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + @JsonProperty("transformations") + public Optional getTransformations() { + return transformations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyStringRequest && equalTo((DeidentifyStringRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyStringRequest other) { + return vaultId.equals(other.vaultId) + && text.equals(other.text) + && entityTypes.equals(other.entityTypes) + && tokenType.equals(other.tokenType) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && transformations.equals(other.transformations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vaultId, + this.text, + this.entityTypes, + this.tokenType, + this.allowRegex, + this.restrictRegex, + this.transformations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VaultIdStage builder() { + return new Builder(); + } + + public interface VaultIdStage { + TextStage vaultId(@NotNull String vaultId); + + Builder from(DeidentifyStringRequest other); + } + + public interface TextStage { + /** + * String to de-identify. + */ + _FinalStage text(@NotNull String text); + } + + public interface _FinalStage { + DeidentifyStringRequest build(); + + _FinalStage entityTypes(Optional> entityTypes); + + _FinalStage entityTypes(List entityTypes); + + _FinalStage tokenType(Optional tokenType); + + _FinalStage tokenType(TokenType tokenType); + + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + _FinalStage transformations(Optional transformations); + + _FinalStage transformations(Transformations transformations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VaultIdStage, TextStage, _FinalStage { + private String vaultId; + + private String text; + + private Optional transformations = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional tokenType = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyStringRequest other) { + vaultId(other.getVaultId()); + text(other.getText()); + entityTypes(other.getEntityTypes()); + tokenType(other.getTokenType()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + transformations(other.getTransformations()); + return this; + } + + @java.lang.Override + @JsonSetter("vault_id") + public TextStage vaultId(@NotNull String vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId must not be null"); + return this; + } + + /** + * String to de-identify.

String to de-identify.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transformations(Transformations transformations) { + this.transformations = Optional.ofNullable(transformations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transformations", nulls = Nulls.SKIP) + public _FinalStage transformations(Optional transformations) { + this.transformations = transformations; + return this; + } + + @java.lang.Override + public _FinalStage restrictRegex(List restrictRegex) { + this.restrictRegex = Optional.ofNullable(restrictRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrict_regex", nulls = Nulls.SKIP) + public _FinalStage restrictRegex(Optional> restrictRegex) { + this.restrictRegex = restrictRegex; + return this; + } + + @java.lang.Override + public _FinalStage allowRegex(List allowRegex) { + this.allowRegex = Optional.ofNullable(allowRegex); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_regex", nulls = Nulls.SKIP) + public _FinalStage allowRegex(Optional> allowRegex) { + this.allowRegex = allowRegex; + return this; + } + + @java.lang.Override + public _FinalStage tokenType(TokenType tokenType) { + this.tokenType = Optional.ofNullable(tokenType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "token_type", nulls = Nulls.SKIP) + public _FinalStage tokenType(Optional tokenType) { + this.tokenType = tokenType; + return this; + } + + @java.lang.Override + public _FinalStage entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public _FinalStage entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + @java.lang.Override + public DeidentifyStringRequest build() { + return new DeidentifyStringRequest( + vaultId, + text, + entityTypes, + tokenType, + allowRegex, + restrictRegex, + transformations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java b/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java new file mode 100644 index 00000000..e61cb5a2 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/strings/requests/ReidentifyStringRequest.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.strings.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.resources.strings.types.ReidentifyStringRequestFormat; +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 = ReidentifyStringRequest.Builder.class) +public final class ReidentifyStringRequest { + private final String text; + + private final String vaultId; + + private final Optional format; + + private final Map additionalProperties; + + private ReidentifyStringRequest( + String text, + String vaultId, + Optional format, + Map additionalProperties) { + this.text = text; + this.vaultId = vaultId; + this.format = format; + this.additionalProperties = additionalProperties; + } + + /** + * @return String to re-identify. + */ + @JsonProperty("text") + public String getText() { + return text; + } + + /** + * @return ID of the vault where the entities are stored. + */ + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return 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. + */ + @JsonProperty("format") + public Optional getFormat() { + return format; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReidentifyStringRequest && equalTo((ReidentifyStringRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReidentifyStringRequest other) { + return text.equals(other.text) && vaultId.equals(other.vaultId) && format.equals(other.format); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text, this.vaultId, this.format); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + * String to re-identify. + */ + VaultIdStage text(@NotNull String text); + + Builder from(ReidentifyStringRequest other); + } + + public interface VaultIdStage { + /** + * ID of the vault where the entities are stored. + */ + _FinalStage vaultId(@NotNull String vaultId); + } + + public interface _FinalStage { + ReidentifyStringRequest build(); + + /** + *

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.

+ */ + _FinalStage format(Optional format); + + _FinalStage format(ReidentifyStringRequestFormat format); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, VaultIdStage, _FinalStage { + private String text; + + private String vaultId; + + private Optional format = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReidentifyStringRequest other) { + text(other.getText()); + vaultId(other.getVaultId()); + format(other.getFormat()); + return this; + } + + /** + * String to re-identify.

String to re-identify.

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

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 + public _FinalStage format(ReidentifyStringRequestFormat format) { + this.format = Optional.ofNullable(format); + return this; + } + + /** + *

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 + @JsonSetter(value = "format", nulls = Nulls.SKIP) + public _FinalStage format(Optional format) { + this.format = format; + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java new file mode 100644 index 00000000..68c5209f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/strings/types/ReidentifyStringRequestFormat.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.strings.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.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.EntityType; +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 = ReidentifyStringRequestFormat.Builder.class) +public final class ReidentifyStringRequestFormat { + private final Optional> redacted; + + private final Optional> masked; + + private final Optional> plaintext; + + private final Map additionalProperties; + + private ReidentifyStringRequestFormat( + Optional> redacted, + Optional> masked, + Optional> plaintext, + Map additionalProperties) { + this.redacted = redacted; + this.masked = masked; + this.plaintext = plaintext; + this.additionalProperties = additionalProperties; + } + + /** + * @return Entity types to fully redact. + */ + @JsonProperty("redacted") + public Optional> getRedacted() { + return redacted; + } + + /** + * @return Entity types to mask. + */ + @JsonProperty("masked") + public Optional> getMasked() { + return masked; + } + + /** + * @return Entity types to return in plaintext. + */ + @JsonProperty("plaintext") + public Optional> getPlaintext() { + return plaintext; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReidentifyStringRequestFormat && equalTo((ReidentifyStringRequestFormat) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReidentifyStringRequestFormat other) { + return redacted.equals(other.redacted) && masked.equals(other.masked) && plaintext.equals(other.plaintext); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.redacted, this.masked, this.plaintext); + } + + @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> redacted = Optional.empty(); + + private Optional> masked = Optional.empty(); + + private Optional> plaintext = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReidentifyStringRequestFormat other) { + redacted(other.getRedacted()); + masked(other.getMasked()); + plaintext(other.getPlaintext()); + return this; + } + + /** + *

Entity types to fully redact.

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

Entity types to mask.

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

Entity types to return in plaintext.

+ */ + @JsonSetter(value = "plaintext", nulls = Nulls.SKIP) + public Builder plaintext(Optional> plaintext) { + this.plaintext = plaintext; + return this; + } + + public Builder plaintext(List plaintext) { + this.plaintext = Optional.ofNullable(plaintext); + return this; + } + + public ReidentifyStringRequestFormat build() { + return new ReidentifyStringRequestFormat(redacted, masked, plaintext, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncRawTokensClient.java b/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncRawTokensClient.java new file mode 100644 index 00000000..fbf69580 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncRawTokensClient.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.tokens; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.resources.tokens.requests.V1DetokenizePayload; +import com.skyflow.generated.rest.resources.tokens.requests.V1TokenizePayload; +import com.skyflow.generated.rest.types.V1DetokenizeResponse; +import com.skyflow.generated.rest.types.V1TokenizeResponse; +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.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns records that correspond to the specified tokens. + */ + public CompletableFuture> recordServiceDetokenize(String vaultId) { + return recordServiceDetokenize(vaultId, V1DetokenizePayload.builder().build()); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public CompletableFuture> recordServiceDetokenize( + String vaultId, V1DetokenizePayload request) { + return recordServiceDetokenize(vaultId, request, null); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public CompletableFuture> recordServiceDetokenize( + String vaultId, V1DetokenizePayload request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegments("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(), V1DetokenizeResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public CompletableFuture> recordServiceTokenize(String vaultId) { + return recordServiceTokenize(vaultId, V1TokenizePayload.builder().build()); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public CompletableFuture> recordServiceTokenize( + String vaultId, V1TokenizePayload request) { + return recordServiceTokenize(vaultId, request, null); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public CompletableFuture> recordServiceTokenize( + String vaultId, V1TokenizePayload request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegments("tokenize") + .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(), V1TokenizeResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new ApiClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ApiClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncTokensClient.java b/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncTokensClient.java new file mode 100644 index 00000000..26d5ea05 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/tokens/AsyncTokensClient.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.tokens; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.tokens.requests.V1DetokenizePayload; +import com.skyflow.generated.rest.resources.tokens.requests.V1TokenizePayload; +import com.skyflow.generated.rest.types.V1DetokenizeResponse; +import com.skyflow.generated.rest.types.V1TokenizeResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTokensClient rawClient; + + public AsyncTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTokensClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns records that correspond to the specified tokens. + */ + public CompletableFuture recordServiceDetokenize(String vaultId) { + return this.rawClient.recordServiceDetokenize(vaultId).thenApply(response -> response.body()); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public CompletableFuture recordServiceDetokenize( + String vaultId, V1DetokenizePayload request) { + return this.rawClient.recordServiceDetokenize(vaultId, request).thenApply(response -> response.body()); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public CompletableFuture recordServiceDetokenize( + String vaultId, V1DetokenizePayload request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceDetokenize(vaultId, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public CompletableFuture recordServiceTokenize(String vaultId) { + return this.rawClient.recordServiceTokenize(vaultId).thenApply(response -> response.body()); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public CompletableFuture recordServiceTokenize(String vaultId, V1TokenizePayload request) { + return this.rawClient.recordServiceTokenize(vaultId, request).thenApply(response -> response.body()); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public CompletableFuture recordServiceTokenize( + String vaultId, V1TokenizePayload request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceTokenize(vaultId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/RawTokensClient.java b/src/main/java/com/skyflow/generated/rest/resources/tokens/RawTokensClient.java new file mode 100644 index 00000000..5ed17d28 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/tokens/RawTokensClient.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.tokens; + +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.MediaTypes; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.errors.NotFoundError; +import com.skyflow.generated.rest.resources.tokens.requests.V1DetokenizePayload; +import com.skyflow.generated.rest.resources.tokens.requests.V1TokenizePayload; +import com.skyflow.generated.rest.types.V1DetokenizeResponse; +import com.skyflow.generated.rest.types.V1TokenizeResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTokensClient { + protected final ClientOptions clientOptions; + + public RawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns records that correspond to the specified tokens. + */ + public ApiClientHttpResponse recordServiceDetokenize(String vaultId) { + return recordServiceDetokenize(vaultId, V1DetokenizePayload.builder().build()); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public ApiClientHttpResponse recordServiceDetokenize( + String vaultId, V1DetokenizePayload request) { + return recordServiceDetokenize(vaultId, request, null); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public ApiClientHttpResponse recordServiceDetokenize( + String vaultId, V1DetokenizePayload request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegments("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(), V1DetokenizeResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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); + } + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public ApiClientHttpResponse recordServiceTokenize(String vaultId) { + return recordServiceTokenize(vaultId, V1TokenizePayload.builder().build()); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public ApiClientHttpResponse recordServiceTokenize(String vaultId, V1TokenizePayload request) { + return recordServiceTokenize(vaultId, request, null); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public ApiClientHttpResponse recordServiceTokenize( + String vaultId, V1TokenizePayload request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/vaults") + .addPathSegment(vaultId) + .addPathSegments("tokenize") + .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(), V1TokenizeResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), 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/tokens/TokensClient.java b/src/main/java/com/skyflow/generated/rest/resources/tokens/TokensClient.java new file mode 100644 index 00000000..8b0e7e40 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/tokens/TokensClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.tokens; + +import com.skyflow.generated.rest.core.ClientOptions; +import com.skyflow.generated.rest.core.RequestOptions; +import com.skyflow.generated.rest.resources.tokens.requests.V1DetokenizePayload; +import com.skyflow.generated.rest.resources.tokens.requests.V1TokenizePayload; +import com.skyflow.generated.rest.types.V1DetokenizeResponse; +import com.skyflow.generated.rest.types.V1TokenizeResponse; + +public class TokensClient { + protected final ClientOptions clientOptions; + + private final RawTokensClient rawClient; + + public TokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTokensClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns records that correspond to the specified tokens. + */ + public V1DetokenizeResponse recordServiceDetokenize(String vaultId) { + return this.rawClient.recordServiceDetokenize(vaultId).body(); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public V1DetokenizeResponse recordServiceDetokenize(String vaultId, V1DetokenizePayload request) { + return this.rawClient.recordServiceDetokenize(vaultId, request).body(); + } + + /** + * Returns records that correspond to the specified tokens. + */ + public V1DetokenizeResponse recordServiceDetokenize( + String vaultId, V1DetokenizePayload request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceDetokenize(vaultId, request, requestOptions) + .body(); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public V1TokenizeResponse recordServiceTokenize(String vaultId) { + return this.rawClient.recordServiceTokenize(vaultId).body(); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public V1TokenizeResponse recordServiceTokenize(String vaultId, V1TokenizePayload request) { + return this.rawClient.recordServiceTokenize(vaultId, request).body(); + } + + /** + * Returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization.<br /><br /><b>Note:</b> This endpoint doesn't insert records—it returns tokens for existing values. To insert records and tokenize that new record's values, see <a href='#RecordService_InsertRecord'>Insert Record</a> and the tokenization parameter. + */ + public V1TokenizeResponse recordServiceTokenize( + String vaultId, V1TokenizePayload request, RequestOptions requestOptions) { + return this.rawClient + .recordServiceTokenize(vaultId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java b/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java new file mode 100644 index 00000000..1d3cb407 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1DetokenizePayload.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.tokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.V1DetokenizeRecordRequest; +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 = V1DetokenizePayload.Builder.class) +public final class V1DetokenizePayload { + private final Optional> detokenizationParameters; + + private final Optional downloadUrl; + + private final Optional continueOnError; + + private final Map additionalProperties; + + private V1DetokenizePayload( + Optional> detokenizationParameters, + Optional downloadUrl, + Optional continueOnError, + Map additionalProperties) { + this.detokenizationParameters = detokenizationParameters; + this.downloadUrl = downloadUrl; + this.continueOnError = continueOnError; + this.additionalProperties = additionalProperties; + } + + /** + * @return Detokenization details. + */ + @JsonProperty("detokenizationParameters") + public Optional> getDetokenizationParameters() { + return detokenizationParameters; + } + + /** + * @return If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. + */ + @JsonProperty("downloadURL") + public Optional getDownloadUrl() { + return downloadUrl; + } + + /** + * @return If true, the detokenization request continues even if an error occurs. + */ + @JsonProperty("continueOnError") + public Optional getContinueOnError() { + return continueOnError; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetokenizePayload && equalTo((V1DetokenizePayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetokenizePayload other) { + return detokenizationParameters.equals(other.detokenizationParameters) + && downloadUrl.equals(other.downloadUrl) + && continueOnError.equals(other.continueOnError); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.detokenizationParameters, this.downloadUrl, this.continueOnError); + } + + @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> detokenizationParameters = Optional.empty(); + + private Optional downloadUrl = Optional.empty(); + + private Optional continueOnError = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DetokenizePayload other) { + detokenizationParameters(other.getDetokenizationParameters()); + downloadUrl(other.getDownloadUrl()); + continueOnError(other.getContinueOnError()); + return this; + } + + /** + *

Detokenization details.

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

If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean.

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

If true, the detokenization request continues even if an error occurs.

+ */ + @JsonSetter(value = "continueOnError", nulls = Nulls.SKIP) + public Builder continueOnError(Optional continueOnError) { + this.continueOnError = continueOnError; + return this; + } + + public Builder continueOnError(Boolean continueOnError) { + this.continueOnError = Optional.ofNullable(continueOnError); + return this; + } + + public V1DetokenizePayload build() { + return new V1DetokenizePayload( + detokenizationParameters, downloadUrl, continueOnError, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java b/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java new file mode 100644 index 00000000..30bdde6a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/resources/tokens/requests/V1TokenizePayload.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.rest.resources.tokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import com.skyflow.generated.rest.types.V1TokenizeRecordRequest; +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 = V1TokenizePayload.Builder.class) +public final class V1TokenizePayload { + private final Optional> tokenizationParameters; + + private final Map additionalProperties; + + private V1TokenizePayload( + Optional> tokenizationParameters, Map additionalProperties) { + this.tokenizationParameters = tokenizationParameters; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tokenization details. + */ + @JsonProperty("tokenizationParameters") + public Optional> getTokenizationParameters() { + return tokenizationParameters; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1TokenizePayload && equalTo((V1TokenizePayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1TokenizePayload other) { + return tokenizationParameters.equals(other.tokenizationParameters); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.tokenizationParameters); + } + + @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> tokenizationParameters = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1TokenizePayload other) { + tokenizationParameters(other.getTokenizationParameters()); + return this; + } + + /** + *

Tokenization details.

+ */ + @JsonSetter(value = "tokenizationParameters", nulls = Nulls.SKIP) + public Builder tokenizationParameters(Optional> tokenizationParameters) { + this.tokenizationParameters = tokenizationParameters; + return this; + } + + public Builder tokenizationParameters(List tokenizationParameters) { + this.tokenizationParameters = Optional.ofNullable(tokenizationParameters); + return this; + } + + public V1TokenizePayload build() { + return new V1TokenizePayload(tokenizationParameters, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java b/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java new file mode 100644 index 00000000..0f5d1fc2 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsColumnMapping.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdvancedOptionsColumnMapping.Builder.class) +public final class AdvancedOptionsColumnMapping { + private final String sessionId; + + private final String default_; + + private final Optional> entityColumnMap; + + private final Map additionalProperties; + + private AdvancedOptionsColumnMapping( + String sessionId, + String default_, + Optional> entityColumnMap, + Map additionalProperties) { + this.sessionId = sessionId; + this.default_ = default_; + this.entityColumnMap = entityColumnMap; + this.additionalProperties = additionalProperties; + } + + /** + * @return Table name of the vault. + */ + @JsonProperty("session_id") + public String getSessionId() { + return sessionId; + } + + /** + * @return Name of column to store data in when no explicit mapping exists. + */ + @JsonProperty("default") + public String getDefault() { + return default_; + } + + /** + * @return Column mapping for different entities. + */ + @JsonProperty("entity_column_map") + public Optional> getEntityColumnMap() { + return entityColumnMap; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdvancedOptionsColumnMapping && equalTo((AdvancedOptionsColumnMapping) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdvancedOptionsColumnMapping other) { + return sessionId.equals(other.sessionId) + && default_.equals(other.default_) + && entityColumnMap.equals(other.entityColumnMap); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.sessionId, this.default_, this.entityColumnMap); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SessionIdStage builder() { + return new Builder(); + } + + public interface SessionIdStage { + /** + * Table name of the vault. + */ + DefaultStage sessionId(@NotNull String sessionId); + + Builder from(AdvancedOptionsColumnMapping other); + } + + public interface DefaultStage { + /** + * Name of column to store data in when no explicit mapping exists. + */ + _FinalStage default_(@NotNull String default_); + } + + public interface _FinalStage { + AdvancedOptionsColumnMapping build(); + + /** + *

Column mapping for different entities.

+ */ + _FinalStage entityColumnMap(Optional> entityColumnMap); + + _FinalStage entityColumnMap(List entityColumnMap); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SessionIdStage, DefaultStage, _FinalStage { + private String sessionId; + + private String default_; + + private Optional> entityColumnMap = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdvancedOptionsColumnMapping other) { + sessionId(other.getSessionId()); + default_(other.getDefault()); + entityColumnMap(other.getEntityColumnMap()); + return this; + } + + /** + * 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 + @JsonSetter("session_id") + public DefaultStage sessionId(@NotNull String sessionId) { + this.sessionId = Objects.requireNonNull(sessionId, "sessionId must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("default") + public _FinalStage default_(@NotNull String default_) { + this.default_ = Objects.requireNonNull(default_, "default_ must not be null"); + return this; + } + + /** + *

Column mapping for different entities.

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

Column mapping for different entities.

+ */ + @java.lang.Override + @JsonSetter(value = "entity_column_map", nulls = Nulls.SKIP) + public _FinalStage entityColumnMap(Optional> entityColumnMap) { + this.entityColumnMap = entityColumnMap; + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java new file mode 100644 index 00000000..3df03da3 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsEntityColumnMap.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = AdvancedOptionsEntityColumnMap.Builder.class) +public final class AdvancedOptionsEntityColumnMap { + private final Optional entityType; + + private final Optional columnName; + + private final Map additionalProperties; + + private AdvancedOptionsEntityColumnMap( + Optional entityType, + Optional columnName, + Map additionalProperties) { + this.entityType = entityType; + this.columnName = columnName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("entity_type") + public Optional getEntityType() { + return entityType; + } + + /** + * @return Column name where the entity has to be stored. + */ + @JsonProperty("column_name") + public Optional getColumnName() { + return columnName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdvancedOptionsEntityColumnMap && equalTo((AdvancedOptionsEntityColumnMap) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdvancedOptionsEntityColumnMap other) { + return entityType.equals(other.entityType) && columnName.equals(other.columnName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.entityType, this.columnName); + } + + @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 entityType = Optional.empty(); + + private Optional columnName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdvancedOptionsEntityColumnMap other) { + entityType(other.getEntityType()); + columnName(other.getColumnName()); + return this; + } + + @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) + public Builder entityType(Optional entityType) { + this.entityType = entityType; + return this; + } + + public Builder entityType(DetectDataEntities entityType) { + this.entityType = Optional.ofNullable(entityType); + return this; + } + + /** + *

Column name where the entity has to be stored.

+ */ + @JsonSetter(value = "column_name", 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; + } + + public AdvancedOptionsEntityColumnMap build() { + return new AdvancedOptionsEntityColumnMap(entityType, columnName, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java b/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.java new file mode 100644 index 00000000..dcacb09f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AdvancedOptionsVaultSchema.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.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdvancedOptionsVaultSchema.Builder.class) +public final class AdvancedOptionsVaultSchema { + private final String tableName; + + private final AdvancedOptionsColumnMapping mapping; + + private final Map additionalProperties; + + private AdvancedOptionsVaultSchema( + String tableName, AdvancedOptionsColumnMapping mapping, Map additionalProperties) { + this.tableName = tableName; + this.mapping = mapping; + this.additionalProperties = additionalProperties; + } + + /** + * @return Table name of the vault. + */ + @JsonProperty("table_name") + public String getTableName() { + return tableName; + } + + @JsonProperty("mapping") + public AdvancedOptionsColumnMapping getMapping() { + return mapping; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdvancedOptionsVaultSchema && equalTo((AdvancedOptionsVaultSchema) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdvancedOptionsVaultSchema other) { + return tableName.equals(other.tableName) && mapping.equals(other.mapping); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.tableName, this.mapping); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TableNameStage builder() { + return new Builder(); + } + + public interface TableNameStage { + /** + * Table name of the vault. + */ + MappingStage tableName(@NotNull String tableName); + + Builder from(AdvancedOptionsVaultSchema other); + } + + public interface MappingStage { + _FinalStage mapping(@NotNull AdvancedOptionsColumnMapping mapping); + } + + public interface _FinalStage { + AdvancedOptionsVaultSchema build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TableNameStage, MappingStage, _FinalStage { + private String tableName; + + private AdvancedOptionsColumnMapping mapping; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdvancedOptionsVaultSchema other) { + tableName(other.getTableName()); + mapping(other.getMapping()); + return this; + } + + /** + * 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 + @JsonSetter("table_name") + public MappingStage tableName(@NotNull String tableName) { + this.tableName = Objects.requireNonNull(tableName, "tableName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("mapping") + public _FinalStage mapping(@NotNull AdvancedOptionsColumnMapping mapping) { + this.mapping = Objects.requireNonNull(mapping, "mapping must not be null"); + return this; + } + + @java.lang.Override + public AdvancedOptionsVaultSchema build() { + return new AdvancedOptionsVaultSchema(tableName, mapping, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java b/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java new file mode 100644 index 00000000..e9052d16 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AudioConfigTranscriptionType.java @@ -0,0 +1,40 @@ +/** + * 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 AudioConfigTranscriptionType { + NONE("none"), + + SKYFLOW_TRANSCRIPTION("skyflow_transcription"), + + AWS_TRANSCRIPTION("aws_transcription"), + + AWS_TRANSCRIPTION_DIARIZE("aws_transcription_diarize"), + + AWS_MEDICAL_TRANSCRIPTION("aws_medical_transcription"), + + AWS_MEDICAL_TRANSCRIPTION_DIARIZE("aws_medical_transcription_diarize"), + + AWS_TRANSCRIPTION_DIARIZE_JSON("aws_transcription_diarize_json"), + + DEEPGRAM_TRANSCRIPTION_DIARIZE("deepgram_transcription_diarize"), + + DEEPGRAM_TRANSCRIPTION_JSON("deepgram_transcription_json"), + + DEEPGRAM_WRAPPER("deepgram_wrapper"); + + private final String value; + + AudioConfigTranscriptionType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java b/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java new file mode 100644 index 00000000..4264996a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AuditEventAuditResourceType.java @@ -0,0 +1,80 @@ +/** + * 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 AuditEventAuditResourceType { + NONE_API("NONE_API"), + + ACCOUNT("ACCOUNT"), + + AUDIT("AUDIT"), + + BASE_DATA_TYPE("BASE_DATA_TYPE"), + + FIELD_TEMPLATE("FIELD_TEMPLATE"), + + FILE("FILE"), + + KEY("KEY"), + + POLICY("POLICY"), + + PROTO_PARSE("PROTO_PARSE"), + + RECORD("RECORD"), + + ROLE("ROLE"), + + RULE("RULE"), + + SECRET("SECRET"), + + SERVICE_ACCOUNT("SERVICE_ACCOUNT"), + + TOKEN("TOKEN"), + + USER("USER"), + + VAULT("VAULT"), + + VAULT_TEMPLATE("VAULT_TEMPLATE"), + + WORKSPACE("WORKSPACE"), + + TABLE("TABLE"), + + POLICY_TEMPLATE("POLICY_TEMPLATE"), + + MEMBER("MEMBER"), + + TAG("TAG"), + + CONNECTION("CONNECTION"), + + MIGRATION("MIGRATION"), + + SCHEDULED_JOB("SCHEDULED_JOB"), + + JOB("JOB"), + + COLUMN_NAME("COLUMN_NAME"), + + NETWORK_TOKEN("NETWORK_TOKEN"), + + SUBSCRIPTION("SUBSCRIPTION"); + + private final String value; + + AuditEventAuditResourceType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java b/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java new file mode 100644 index 00000000..2a5c104a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AuditEventContext.java @@ -0,0 +1,440 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = AuditEventContext.Builder.class) +public final class AuditEventContext { + private final Optional changeId; + + private final Optional requestId; + + private final Optional traceId; + + private final Optional sessionId; + + private final Optional actor; + + private final Optional actorType; + + private final Optional accessType; + + private final Optional ipAddress; + + private final Optional origin; + + private final Optional authMode; + + private final Optional jwtId; + + private final Optional bearerTokenContextId; + + private final Map additionalProperties; + + private AuditEventContext( + Optional changeId, + Optional requestId, + Optional traceId, + Optional sessionId, + Optional actor, + Optional actorType, + Optional accessType, + Optional ipAddress, + Optional origin, + Optional authMode, + Optional jwtId, + Optional bearerTokenContextId, + Map additionalProperties) { + this.changeId = changeId; + this.requestId = requestId; + this.traceId = traceId; + this.sessionId = sessionId; + this.actor = actor; + this.actorType = actorType; + this.accessType = accessType; + this.ipAddress = ipAddress; + this.origin = origin; + this.authMode = authMode; + this.jwtId = jwtId; + this.bearerTokenContextId = bearerTokenContextId; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID for the audit event. + */ + @JsonProperty("changeID") + public Optional getChangeId() { + return changeId; + } + + /** + * @return ID for the request that caused the event. + */ + @JsonProperty("requestID") + public Optional getRequestId() { + return requestId; + } + + /** + * @return ID for the request set by the service that received the request. + */ + @JsonProperty("traceID") + public Optional getTraceId() { + return traceId; + } + + /** + * @return ID for the session in which the request was sent. + */ + @JsonProperty("sessionID") + public Optional getSessionId() { + return sessionId; + } + + /** + * @return Member who sent the request. Depending on actorType, this may be a user ID or a service account ID. + */ + @JsonProperty("actor") + public Optional getActor() { + return actor; + } + + @JsonProperty("actorType") + public Optional getActorType() { + return actorType; + } + + @JsonProperty("accessType") + public Optional getAccessType() { + return accessType; + } + + /** + * @return IP Address of the client that made the request. + */ + @JsonProperty("ipAddress") + public Optional getIpAddress() { + return ipAddress; + } + + /** + * @return HTTP Origin request header (including scheme, hostname, and port) of the request. + */ + @JsonProperty("origin") + public Optional getOrigin() { + return origin; + } + + @JsonProperty("authMode") + public Optional getAuthMode() { + return authMode; + } + + /** + * @return ID of the JWT token. + */ + @JsonProperty("jwtID") + public Optional getJwtId() { + return jwtId; + } + + /** + * @return Embedded User Context. + */ + @JsonProperty("bearerTokenContextID") + public Optional getBearerTokenContextId() { + return bearerTokenContextId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditEventContext && equalTo((AuditEventContext) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuditEventContext other) { + return changeId.equals(other.changeId) + && requestId.equals(other.requestId) + && traceId.equals(other.traceId) + && sessionId.equals(other.sessionId) + && actor.equals(other.actor) + && actorType.equals(other.actorType) + && accessType.equals(other.accessType) + && ipAddress.equals(other.ipAddress) + && origin.equals(other.origin) + && authMode.equals(other.authMode) + && jwtId.equals(other.jwtId) + && bearerTokenContextId.equals(other.bearerTokenContextId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.changeId, + this.requestId, + this.traceId, + this.sessionId, + this.actor, + this.actorType, + this.accessType, + this.ipAddress, + this.origin, + this.authMode, + this.jwtId, + this.bearerTokenContextId); + } + + @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 changeId = Optional.empty(); + + private Optional requestId = Optional.empty(); + + private Optional traceId = Optional.empty(); + + private Optional sessionId = Optional.empty(); + + private Optional actor = Optional.empty(); + + private Optional actorType = Optional.empty(); + + private Optional accessType = Optional.empty(); + + private Optional ipAddress = Optional.empty(); + + private Optional origin = Optional.empty(); + + private Optional authMode = Optional.empty(); + + private Optional jwtId = Optional.empty(); + + private Optional bearerTokenContextId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AuditEventContext other) { + changeId(other.getChangeId()); + requestId(other.getRequestId()); + traceId(other.getTraceId()); + sessionId(other.getSessionId()); + actor(other.getActor()); + actorType(other.getActorType()); + accessType(other.getAccessType()); + ipAddress(other.getIpAddress()); + origin(other.getOrigin()); + authMode(other.getAuthMode()); + jwtId(other.getJwtId()); + bearerTokenContextId(other.getBearerTokenContextId()); + return this; + } + + /** + *

ID for the audit event.

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

ID for the request that caused the event.

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

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

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

ID for the session in which the request was sent.

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

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

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

IP Address of the client that made the request.

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

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

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

ID of the JWT token.

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

Embedded User Context.

+ */ + @JsonSetter(value = "bearerTokenContextID", nulls = Nulls.SKIP) + public Builder bearerTokenContextId(Optional bearerTokenContextId) { + this.bearerTokenContextId = bearerTokenContextId; + return this; + } + + public Builder bearerTokenContextId(String bearerTokenContextId) { + this.bearerTokenContextId = Optional.ofNullable(bearerTokenContextId); + return this; + } + + public AuditEventContext build() { + return new AuditEventContext( + changeId, + requestId, + traceId, + sessionId, + actor, + actorType, + accessType, + ipAddress, + origin, + authMode, + jwtId, + bearerTokenContextId, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java b/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java new file mode 100644 index 00000000..45d15be1 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AuditEventData.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = AuditEventData.Builder.class) +public final class AuditEventData { + private final Optional content; + + private final Map additionalProperties; + + private AuditEventData(Optional content, Map additionalProperties) { + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return The entire body of the data requested or the query fired. + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditEventData && equalTo((AuditEventData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuditEventData other) { + return content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.content); + } + + @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 content = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AuditEventData other) { + content(other.getContent()); + return this; + } + + /** + *

The entire body of the data requested or the query fired.

+ */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + public AuditEventData build() { + return new AuditEventData(content, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java b/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java new file mode 100644 index 00000000..91126cc0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/AuditEventHttpInfo.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = AuditEventHttpInfo.Builder.class) +public final class AuditEventHttpInfo { + private final Optional uri; + + private final Optional method; + + private final Map additionalProperties; + + private AuditEventHttpInfo( + Optional uri, Optional method, Map additionalProperties) { + this.uri = uri; + this.method = method; + this.additionalProperties = additionalProperties; + } + + /** + * @return The http URI that is used. + */ + @JsonProperty("URI") + public Optional getUri() { + return uri; + } + + /** + * @return http method used. + */ + @JsonProperty("method") + public Optional getMethod() { + return method; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditEventHttpInfo && equalTo((AuditEventHttpInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuditEventHttpInfo other) { + return uri.equals(other.uri) && method.equals(other.method); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.uri, this.method); + } + + @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 uri = Optional.empty(); + + private Optional method = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AuditEventHttpInfo other) { + uri(other.getUri()); + method(other.getMethod()); + return this; + } + + /** + *

The http URI that is used.

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

http method used.

+ */ + @JsonSetter(value = "method", nulls = Nulls.SKIP) + public Builder method(Optional method) { + this.method = method; + return this; + } + + public Builder method(String method) { + this.method = Optional.ofNullable(method); + return this; + } + + public AuditEventHttpInfo build() { + return new AuditEventHttpInfo(uri, method, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java b/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.java new file mode 100644 index 00000000..c50f618d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/BatchRecordMethod.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 BatchRecordMethod { + NONE("NONE"), + + POST("POST"), + + PUT("PUT"), + + GET("GET"), + + DELETE("DELETE"); + + private final String value; + + BatchRecordMethod(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java b/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java new file mode 100644 index 00000000..b1b6072c --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/ContextAccessType.java @@ -0,0 +1,26 @@ +/** + * 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 ContextAccessType { + ACCESS_NONE("ACCESS_NONE"), + + API("API"), + + SQL("SQL"); + + private final String value; + + ContextAccessType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java b/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java new file mode 100644 index 00000000..349ca23a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/ContextAuthMode.java @@ -0,0 +1,28 @@ +/** + * 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 ContextAuthMode { + AUTH_NONE("AUTH_NONE"), + + OKTA_JWT("OKTA_JWT"), + + SERVICE_ACCOUNT_JWT("SERVICE_ACCOUNT_JWT"), + + PAT_JWT("PAT_JWT"); + + private final String value; + + ContextAuthMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java b/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java new file mode 100644 index 00000000..59839994 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutput.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = DeidentifyFileOutput.Builder.class) +public final class DeidentifyFileOutput { + private final Optional processedFile; + + private final Optional processedFileType; + + private final Optional processedFileExtension; + + private final Map additionalProperties; + + private DeidentifyFileOutput( + Optional processedFile, + Optional processedFileType, + Optional processedFileExtension, + Map additionalProperties) { + this.processedFile = processedFile; + this.processedFileType = processedFileType; + this.processedFileExtension = processedFileExtension; + this.additionalProperties = additionalProperties; + } + + /** + * @return URL or base64-encoded data of the output. + */ + @JsonProperty("processed_file") + public Optional getProcessedFile() { + return processedFile; + } + + /** + * @return Type of the processed file. + */ + @JsonProperty("processed_file_type") + public Optional getProcessedFileType() { + return processedFileType; + } + + /** + * @return Extension of the processed file. + */ + @JsonProperty("processed_file_extension") + public Optional getProcessedFileExtension() { + return processedFileExtension; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyFileOutput && equalTo((DeidentifyFileOutput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyFileOutput other) { + return processedFile.equals(other.processedFile) + && processedFileType.equals(other.processedFileType) + && processedFileExtension.equals(other.processedFileExtension); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.processedFile, this.processedFileType, this.processedFileExtension); + } + + @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 processedFile = Optional.empty(); + + private Optional processedFileType = Optional.empty(); + + private Optional processedFileExtension = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeidentifyFileOutput other) { + processedFile(other.getProcessedFile()); + processedFileType(other.getProcessedFileType()); + processedFileExtension(other.getProcessedFileExtension()); + return this; + } + + /** + *

URL or base64-encoded data of the output.

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

Type of the processed file.

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

Extension of the processed file.

+ */ + @JsonSetter(value = "processed_file_extension", nulls = Nulls.SKIP) + public Builder processedFileExtension(Optional processedFileExtension) { + this.processedFileExtension = processedFileExtension; + return this; + } + + public Builder processedFileExtension(String processedFileExtension) { + this.processedFileExtension = Optional.ofNullable(processedFileExtension); + return this; + } + + public DeidentifyFileOutput build() { + return new DeidentifyFileOutput( + processedFile, processedFileType, processedFileExtension, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java b/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java new file mode 100644 index 00000000..c560dc9e --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileOutputProcessedFileType.java @@ -0,0 +1,40 @@ +/** + * 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 DeidentifyFileOutputProcessedFileType { + ENTITIES("entities"), + + PLAINTEXT_TRANSCRIPTION("plaintext_transcription"), + + REDACTED_AUDIO("redacted_audio"), + + REDACTED_DIARIZED_TRANSCRIPTION("redacted_diarized_transcription"), + + REDACTED_FILE("redacted_file"), + + REDACTED_IMAGE("redacted_image"), + + REDACTED_MEDICAL_DIARIZED_TRANSCRIPTION("redacted_medical_diarized_transcription"), + + REDACTED_MEDICAL_TRANSCRIPTION("redacted_medical_transcription"), + + REDACTED_TEXT("redacted_text"), + + REDACTED_TRANSCRIPTION("redacted_transcription"); + + private final String value; + + DeidentifyFileOutputProcessedFileType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java b/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java new file mode 100644 index 00000000..460058dc --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DeidentifyFileResponse.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyFileResponse.Builder.class) +public final class DeidentifyFileResponse { + private final String runId; + + private final Map additionalProperties; + + private DeidentifyFileResponse(String runId, Map additionalProperties) { + this.runId = runId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Status URL for the detect run. + */ + @JsonProperty("run_id") + public String getRunId() { + return runId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyFileResponse && equalTo((DeidentifyFileResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyFileResponse other) { + return runId.equals(other.runId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.runId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RunIdStage builder() { + return new Builder(); + } + + public interface RunIdStage { + /** + * Status URL for the detect run. + */ + _FinalStage runId(@NotNull String runId); + + Builder from(DeidentifyFileResponse other); + } + + public interface _FinalStage { + DeidentifyFileResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RunIdStage, _FinalStage { + private String runId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyFileResponse other) { + runId(other.getRunId()); + return this; + } + + /** + * 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 + @JsonSetter("run_id") + public _FinalStage runId(@NotNull String runId) { + this.runId = Objects.requireNonNull(runId, "runId must not be null"); + return this; + } + + @java.lang.Override + public DeidentifyFileResponse build() { + return new DeidentifyFileResponse(runId, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java new file mode 100644 index 00000000..9f73e9ad --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponse.java @@ -0,0 +1,521 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.rest.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyStatusResponse.Builder.class) +public final class DeidentifyStatusResponse { + private final DeidentifyStatusResponseStatus status; + + private final List output; + + private final DeidentifyStatusResponseOutputType outputType; + + private final String message; + + private final Optional wordCount; + + private final Optional characterCount; + + private final Optional size; + + private final Optional duration; + + private final Optional pages; + + private final Optional slides; + + private final Map additionalProperties; + + private DeidentifyStatusResponse( + DeidentifyStatusResponseStatus status, + List output, + DeidentifyStatusResponseOutputType outputType, + String message, + Optional wordCount, + Optional characterCount, + Optional size, + Optional duration, + Optional pages, + Optional slides, + Map additionalProperties) { + this.status = status; + this.output = output; + this.outputType = outputType; + this.message = message; + this.wordCount = wordCount; + this.characterCount = characterCount; + this.size = size; + this.duration = duration; + this.pages = pages; + this.slides = slides; + this.additionalProperties = additionalProperties; + } + + /** + * @return Status of the detect run. + */ + @JsonProperty("status") + public DeidentifyStatusResponseStatus getStatus() { + return status; + } + + /** + * @return How the input file was specified. + */ + @JsonProperty("output") + public List getOutput() { + return output; + } + + /** + * @return How the output file is specified. + */ + @JsonProperty("output_type") + public DeidentifyStatusResponseOutputType getOutputType() { + return outputType; + } + + /** + * @return Status details about the detect run. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return Number of words in the processed text. + */ + @JsonProperty("word_count") + public Optional getWordCount() { + return wordCount; + } + + /** + * @return Number of characters in the processed text. + */ + @JsonProperty("character_count") + public Optional getCharacterCount() { + return characterCount; + } + + /** + * @return Size of the processed text in kilobytes (KB). + */ + @JsonProperty("size") + public Optional getSize() { + return size; + } + + /** + * @return Duration of the processed audio in seconds. + */ + @JsonProperty("duration") + public Optional getDuration() { + return duration; + } + + /** + * @return Number of pages in the processed PDF. + */ + @JsonProperty("pages") + public Optional getPages() { + return pages; + } + + /** + * @return Number of slides in the processed presentation. + */ + @JsonProperty("slides") + public Optional getSlides() { + return slides; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyStatusResponse && equalTo((DeidentifyStatusResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyStatusResponse other) { + return status.equals(other.status) + && output.equals(other.output) + && outputType.equals(other.outputType) + && message.equals(other.message) + && wordCount.equals(other.wordCount) + && characterCount.equals(other.characterCount) + && size.equals(other.size) + && duration.equals(other.duration) + && pages.equals(other.pages) + && slides.equals(other.slides); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.status, + this.output, + this.outputType, + this.message, + this.wordCount, + this.characterCount, + this.size, + this.duration, + this.pages, + this.slides); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + * Status of the detect run. + */ + OutputTypeStage status(@NotNull DeidentifyStatusResponseStatus status); + + Builder from(DeidentifyStatusResponse other); + } + + public interface OutputTypeStage { + /** + * How the output file is specified. + */ + MessageStage outputType(@NotNull DeidentifyStatusResponseOutputType outputType); + } + + public interface MessageStage { + /** + * Status details about the detect run. + */ + _FinalStage message(@NotNull String message); + } + + public interface _FinalStage { + DeidentifyStatusResponse build(); + + /** + *

How the input file was specified.

+ */ + _FinalStage output(List output); + + _FinalStage addOutput(DeidentifyFileOutput output); + + _FinalStage addAllOutput(List output); + + /** + *

Number of words in the processed text.

+ */ + _FinalStage wordCount(Optional wordCount); + + _FinalStage wordCount(Integer wordCount); + + /** + *

Number of characters in the processed text.

+ */ + _FinalStage characterCount(Optional characterCount); + + _FinalStage characterCount(Integer characterCount); + + /** + *

Size of the processed text in kilobytes (KB).

+ */ + _FinalStage size(Optional size); + + _FinalStage size(Integer size); + + /** + *

Duration of the processed audio in seconds.

+ */ + _FinalStage duration(Optional duration); + + _FinalStage duration(Integer duration); + + /** + *

Number of pages in the processed PDF.

+ */ + _FinalStage pages(Optional pages); + + _FinalStage pages(Integer pages); + + /** + *

Number of slides in the processed presentation.

+ */ + _FinalStage slides(Optional slides); + + _FinalStage slides(Integer slides); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, OutputTypeStage, MessageStage, _FinalStage { + private DeidentifyStatusResponseStatus status; + + private DeidentifyStatusResponseOutputType outputType; + + private String message; + + private Optional slides = Optional.empty(); + + private Optional pages = Optional.empty(); + + private Optional duration = Optional.empty(); + + private Optional size = Optional.empty(); + + private Optional characterCount = Optional.empty(); + + private Optional wordCount = Optional.empty(); + + private List output = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyStatusResponse other) { + status(other.getStatus()); + output(other.getOutput()); + outputType(other.getOutputType()); + message(other.getMessage()); + wordCount(other.getWordCount()); + characterCount(other.getCharacterCount()); + size(other.getSize()); + duration(other.getDuration()); + pages(other.getPages()); + slides(other.getSlides()); + return this; + } + + /** + * 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 + @JsonSetter("status") + public OutputTypeStage status(@NotNull DeidentifyStatusResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("output_type") + public MessageStage outputType(@NotNull DeidentifyStatusResponseOutputType outputType) { + this.outputType = Objects.requireNonNull(outputType, "outputType must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

Number of slides in the processed presentation.

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

Number of slides in the processed presentation.

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

Number of pages in the processed PDF.

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

Number of pages in the processed PDF.

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

Duration of the processed audio in seconds.

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

Duration of the processed audio in seconds.

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

Size of the processed text in kilobytes (KB).

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

Size of the processed text in kilobytes (KB).

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

Number of characters in the processed text.

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

Number of characters in the processed text.

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

Number of words in the processed text.

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

Number of words in the processed text.

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

How the input file was specified.

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

How the input file was specified.

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

How the input file was specified.

+ */ + @java.lang.Override + @JsonSetter(value = "output", nulls = Nulls.SKIP) + public _FinalStage output(List output) { + this.output.clear(); + this.output.addAll(output); + return this; + } + + @java.lang.Override + public DeidentifyStatusResponse build() { + return new DeidentifyStatusResponse( + status, + output, + outputType, + message, + wordCount, + characterCount, + size, + duration, + pages, + slides, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java new file mode 100644 index 00000000..547bf414 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseOutputType.java @@ -0,0 +1,26 @@ +/** + * 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 DeidentifyStatusResponseOutputType { + BASE_64("BASE64"), + + EFS_PATH("EFS_PATH"), + + UNKNOWN("UNKNOWN"); + + private final String value; + + DeidentifyStatusResponseOutputType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java new file mode 100644 index 00000000..4e51e5cf --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStatusResponseStatus.java @@ -0,0 +1,26 @@ +/** + * 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 DeidentifyStatusResponseStatus { + FAILED("FAILED"), + + IN_PROGRESS("IN_PROGRESS"), + + SUCCESS("SUCCESS"); + + private final String value; + + DeidentifyStatusResponseStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java new file mode 100644 index 00000000..5b768610 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DeidentifyStringResponse.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.rest.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeidentifyStringResponse.Builder.class) +public final class DeidentifyStringResponse { + private final String processedText; + + private final List entities; + + private final int wordCount; + + private final int characterCount; + + private final Map additionalProperties; + + private DeidentifyStringResponse( + String processedText, + List entities, + int wordCount, + int characterCount, + Map additionalProperties) { + this.processedText = processedText; + this.entities = entities; + this.wordCount = wordCount; + this.characterCount = characterCount; + this.additionalProperties = additionalProperties; + } + + /** + * @return De-identified text. + */ + @JsonProperty("processed_text") + public String getProcessedText() { + return processedText; + } + + /** + * @return Detected entities. + */ + @JsonProperty("entities") + public List getEntities() { + return entities; + } + + /** + * @return Number of words from the input text. + */ + @JsonProperty("word_count") + public int getWordCount() { + return wordCount; + } + + /** + * @return Number of characters from the input text. + */ + @JsonProperty("character_count") + public int getCharacterCount() { + return characterCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeidentifyStringResponse && equalTo((DeidentifyStringResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeidentifyStringResponse other) { + return processedText.equals(other.processedText) + && entities.equals(other.entities) + && wordCount == other.wordCount + && characterCount == other.characterCount; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.processedText, this.entities, this.wordCount, this.characterCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProcessedTextStage builder() { + return new Builder(); + } + + public interface ProcessedTextStage { + /** + * De-identified text. + */ + WordCountStage processedText(@NotNull String processedText); + + Builder from(DeidentifyStringResponse other); + } + + public interface WordCountStage { + /** + * Number of words from the input text. + */ + CharacterCountStage wordCount(int wordCount); + } + + public interface CharacterCountStage { + /** + * Number of characters from the input text. + */ + _FinalStage characterCount(int characterCount); + } + + public interface _FinalStage { + DeidentifyStringResponse build(); + + /** + *

Detected entities.

+ */ + _FinalStage entities(List entities); + + _FinalStage addEntities(DetectedEntity entities); + + _FinalStage addAllEntities(List entities); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProcessedTextStage, WordCountStage, CharacterCountStage, _FinalStage { + private String processedText; + + private int wordCount; + + private int characterCount; + + private List entities = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeidentifyStringResponse other) { + processedText(other.getProcessedText()); + entities(other.getEntities()); + wordCount(other.getWordCount()); + characterCount(other.getCharacterCount()); + return this; + } + + /** + * De-identified text.

De-identified text.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("processed_text") + public WordCountStage processedText(@NotNull String processedText) { + this.processedText = Objects.requireNonNull(processedText, "processedText must not be null"); + return this; + } + + /** + * 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 + @JsonSetter("word_count") + public CharacterCountStage wordCount(int wordCount) { + this.wordCount = wordCount; + return this; + } + + /** + * 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 + @JsonSetter("character_count") + public _FinalStage characterCount(int characterCount) { + this.characterCount = characterCount; + return this; + } + + /** + *

Detected entities.

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

Detected entities.

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

Detected entities.

+ */ + @java.lang.Override + @JsonSetter(value = "entities", nulls = Nulls.SKIP) + public _FinalStage entities(List entities) { + this.entities.clear(); + this.entities.addAll(entities); + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java new file mode 100644 index 00000000..64afed64 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DetectDataAccuracy.java @@ -0,0 +1,36 @@ +/** + * 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 DetectDataAccuracy { + UNKNOWN("unknown"), + + STANDARD("standard"), + + STANDARD_PLUS("standard_plus"), + + STANDARD_PLUS_MULTILINGUAL("standard_plus_multilingual"), + + STANDARD_PLUS_AUTOMATIC("standard_plus_automatic"), + + HIGH("high"), + + HIGH_MULTILINGUAL("high_multilingual"), + + HIGH_AUTOMATIC("high_automatic"); + + private final String value; + + DetectDataAccuracy(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java b/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java new file mode 100644 index 00000000..d655bb64 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DetectDataEntities.java @@ -0,0 +1,146 @@ +/** + * 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 DetectDataEntities { + AGE("age"), + + BANK_ACCOUNT("bank_account"), + + CREDIT_CARD("credit_card"), + + CREDIT_CARD_EXPIRATION("credit_card_expiration"), + + CVV("cvv"), + + DATE("date"), + + DATE_INTERVAL("date_interval"), + + DOB("dob"), + + DRIVER_LICENSE("driver_license"), + + EMAIL_ADDRESS("email_address"), + + HEALTHCARE_NUMBER("healthcare_number"), + + IP_ADDRESS("ip_address"), + + LOCATION("location"), + + NAME("name"), + + NUMERICAL_PII("numerical_pii"), + + PHONE_NUMBER("phone_number"), + + SSN("ssn"), + + URL("url"), + + VEHICLE_ID("vehicle_id"), + + MEDICAL_CODE("medical_code"), + + NAME_FAMILY("name_family"), + + NAME_GIVEN("name_given"), + + ACCOUNT_NUMBER("account_number"), + + EVENT("event"), + + FILENAME("filename"), + + GENDER_SEXUALITY("gender_sexuality"), + + LANGUAGE("language"), + + LOCATION_ADDRESS("location_address"), + + LOCATION_CITY("location_city"), + + LOCATION_COORDINATE("location_coordinate"), + + LOCATION_COUNTRY("location_country"), + + LOCATION_STATE("location_state"), + + LOCATION_ZIP("location_zip"), + + MARITAL_STATUS("marital_status"), + + MONEY("money"), + + NAME_MEDICAL_PROFESSIONAL("name_medical_professional"), + + OCCUPATION("occupation"), + + ORGANIZATION("organization"), + + ORGANIZATION_MEDICAL_FACILITY("organization_medical_facility"), + + ORIGIN("origin"), + + PASSPORT_NUMBER("passport_number"), + + PASSWORD("password"), + + PHYSICAL_ATTRIBUTE("physical_attribute"), + + POLITICAL_AFFILIATION("political_affiliation"), + + RELIGION("religion"), + + TIME("time"), + + USERNAME("username"), + + ZODIAC_SIGN("zodiac_sign"), + + BLOOD_TYPE("blood_type"), + + CONDITION("condition"), + + DOSE("dose"), + + DRUG("drug"), + + INJURY("injury"), + + MEDICAL_PROCESS("medical_process"), + + STATISTICS("statistics"), + + ROUTING_NUMBER("routing_number"), + + CORPORATE_ACTION("corporate_action"), + + FINANCIAL_METRIC("financial_metric"), + + PRODUCT("product"), + + TREND("trend"), + + DURATION("duration"), + + LOCATION_ADDRESS_STREET("location_address_street"), + + ALL("all"); + + private final String value; + + DetectDataEntities(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java b/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.java new file mode 100644 index 00000000..e039bc86 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DetectFileRequestDataType.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 DetectFileRequestDataType { + UNKNOWN("UNKNOWN"), + + BASE_64("BASE64"); + + private final String value; + + DetectFileRequestDataType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java b/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java new file mode 100644 index 00000000..bdc82ccf --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DetectRequestDeidentifyOption.java @@ -0,0 +1,26 @@ +/** + * 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 DetectRequestDeidentifyOption { + UNKNOWN("UNKNOWN"), + + ENTITY_UNQ_COUNTER("ENTITY_UNQ_COUNTER"), + + ENTITY_ONLY("ENTITY_ONLY"); + + private final String value; + + DetectRequestDeidentifyOption(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java b/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java new file mode 100644 index 00000000..6de2200a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DetectedEntity.java @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = DetectedEntity.Builder.class) +public final class DetectedEntity { + private final Optional token; + + private final Optional value; + + private final Optional location; + + private final Optional entityType; + + private final Optional> entityScores; + + private final Map additionalProperties; + + private DetectedEntity( + Optional token, + Optional value, + Optional location, + Optional entityType, + Optional> entityScores, + Map additionalProperties) { + this.token = token; + this.value = value; + this.location = location; + this.entityType = entityType; + this.entityScores = entityScores; + this.additionalProperties = additionalProperties; + } + + /** + * @return Processed text of the entity. + */ + @JsonProperty("token") + public Optional getToken() { + return token; + } + + /** + * @return Original text of the entity. + */ + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @JsonProperty("location") + public Optional getLocation() { + return location; + } + + /** + * @return Highest-rated label. + */ + @JsonProperty("entity_type") + public Optional getEntityType() { + return entityType; + } + + /** + * @return entity_scores and their scores. + */ + @JsonProperty("entity_scores") + public Optional> getEntityScores() { + return entityScores; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetectedEntity && equalTo((DetectedEntity) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetectedEntity other) { + return token.equals(other.token) + && value.equals(other.value) + && location.equals(other.location) + && entityType.equals(other.entityType) + && entityScores.equals(other.entityScores); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.token, this.value, this.location, this.entityType, this.entityScores); + } + + @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 token = Optional.empty(); + + private Optional value = Optional.empty(); + + private Optional location = Optional.empty(); + + private Optional entityType = Optional.empty(); + + private Optional> entityScores = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DetectedEntity other) { + token(other.getToken()); + value(other.getValue()); + location(other.getLocation()); + entityType(other.getEntityType()); + entityScores(other.getEntityScores()); + return this; + } + + /** + *

Processed text of the entity.

+ */ + @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; + } + + /** + *

Original text of the entity.

+ */ + @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; + } + + @JsonSetter(value = "location", nulls = Nulls.SKIP) + public Builder location(Optional location) { + this.location = location; + return this; + } + + public Builder location(EntityLocation location) { + this.location = Optional.ofNullable(location); + return this; + } + + /** + *

Highest-rated label.

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

entity_scores and their scores.

+ */ + @JsonSetter(value = "entity_scores", nulls = Nulls.SKIP) + public Builder entityScores(Optional> entityScores) { + this.entityScores = entityScores; + return this; + } + + public Builder entityScores(Map entityScores) { + this.entityScores = Optional.ofNullable(entityScores); + return this; + } + + public DetectedEntity build() { + return new DetectedEntity(token, value, location, entityType, entityScores, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java b/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java new file mode 100644 index 00000000..f192c14f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/DetokenizeRecordResponseValueType.java @@ -0,0 +1,38 @@ +/** + * 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 DetokenizeRecordResponseValueType { + NONE("NONE"), + + STRING("STRING"), + + INTEGER("INTEGER"), + + FLOAT("FLOAT"), + + BOOL("BOOL"), + + DATETIME("DATETIME"), + + JSON("JSON"), + + ARRAY("ARRAY"), + + DATE("DATE"); + + private final String value; + + DetokenizeRecordResponseValueType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java b/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java new file mode 100644 index 00000000..6e711422 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/EntityLocation.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = EntityLocation.Builder.class) +public final class EntityLocation { + private final Optional startIndex; + + private final Optional endIndex; + + private final Optional startIndexProcessed; + + private final Optional endIndexProcessed; + + private final Map additionalProperties; + + private EntityLocation( + Optional startIndex, + Optional endIndex, + Optional startIndexProcessed, + Optional endIndexProcessed, + Map additionalProperties) { + this.startIndex = startIndex; + this.endIndex = endIndex; + this.startIndexProcessed = startIndexProcessed; + this.endIndexProcessed = endIndexProcessed; + this.additionalProperties = additionalProperties; + } + + /** + * @return Index of the first character of the string in the original text. + */ + @JsonProperty("start_index") + public Optional getStartIndex() { + return startIndex; + } + + /** + * @return Index of the last character of the string in the original text. + */ + @JsonProperty("end_index") + public Optional getEndIndex() { + return endIndex; + } + + /** + * @return Index of the first character of the string in the processed text. + */ + @JsonProperty("start_index_processed") + public Optional getStartIndexProcessed() { + return startIndexProcessed; + } + + /** + * @return Index of the last character of the string in the processed text. + */ + @JsonProperty("end_index_processed") + public Optional getEndIndexProcessed() { + return endIndexProcessed; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntityLocation && equalTo((EntityLocation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntityLocation other) { + return startIndex.equals(other.startIndex) + && endIndex.equals(other.endIndex) + && startIndexProcessed.equals(other.startIndexProcessed) + && endIndexProcessed.equals(other.endIndexProcessed); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.startIndex, this.endIndex, this.startIndexProcessed, this.endIndexProcessed); + } + + @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 startIndex = Optional.empty(); + + private Optional endIndex = Optional.empty(); + + private Optional startIndexProcessed = Optional.empty(); + + private Optional endIndexProcessed = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(EntityLocation other) { + startIndex(other.getStartIndex()); + endIndex(other.getEndIndex()); + startIndexProcessed(other.getStartIndexProcessed()); + endIndexProcessed(other.getEndIndexProcessed()); + return this; + } + + /** + *

Index of the first character of the string in the original text.

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

Index of the last character of the string in the original text.

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

Index of the first character of the string in the processed text.

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

Index of the last character of the string in the processed text.

+ */ + @JsonSetter(value = "end_index_processed", nulls = Nulls.SKIP) + public Builder endIndexProcessed(Optional endIndexProcessed) { + this.endIndexProcessed = endIndexProcessed; + return this; + } + + public Builder endIndexProcessed(Integer endIndexProcessed) { + this.endIndexProcessed = Optional.ofNullable(endIndexProcessed); + return this; + } + + public EntityLocation build() { + return new EntityLocation( + startIndex, endIndex, startIndexProcessed, endIndexProcessed, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/EntityType.java b/src/main/java/com/skyflow/generated/rest/types/EntityType.java new file mode 100644 index 00000000..605282ed --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/EntityType.java @@ -0,0 +1,146 @@ +/** + * 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 EntityType { + ACCOUNT_NUMBER("account_number"), + + AGE("age"), + + ALL("all"), + + BANK_ACCOUNT("bank_account"), + + BLOOD_TYPE("blood_type"), + + CONDITION("condition"), + + CORPORATE_ACTION("corporate_action"), + + CREDIT_CARD("credit_card"), + + CREDIT_CARD_EXPIRATION("credit_card_expiration"), + + CVV("cvv"), + + DATE("date"), + + DATE_INTERVAL("date_interval"), + + DOB("dob"), + + DOSE("dose"), + + DRIVER_LICENSE("driver_license"), + + DRUG("drug"), + + DURATION("duration"), + + EMAIL_ADDRESS("email_address"), + + EVENT("event"), + + FILENAME("filename"), + + FINANCIAL_METRIC("financial_metric"), + + GENDER_SEXUALITY("gender_sexuality"), + + HEALTHCARE_NUMBER("healthcare_number"), + + INJURY("injury"), + + IP_ADDRESS("ip_address"), + + LANGUAGE("language"), + + LOCATION("location"), + + LOCATION_ADDRESS("location_address"), + + LOCATION_ADDRESS_STREET("location_address_street"), + + LOCATION_CITY("location_city"), + + LOCATION_COORDINATE("location_coordinate"), + + LOCATION_COUNTRY("location_country"), + + LOCATION_STATE("location_state"), + + LOCATION_ZIP("location_zip"), + + MARITAL_STATUS("marital_status"), + + MEDICAL_CODE("medical_code"), + + MEDICAL_PROCESS("medical_process"), + + MONEY("money"), + + NAME("name"), + + NAME_FAMILY("name_family"), + + NAME_GIVEN("name_given"), + + NAME_MEDICAL_PROFESSIONAL("name_medical_professional"), + + NUMERICAL_PII("numerical_pii"), + + OCCUPATION("occupation"), + + ORGANIZATION("organization"), + + ORGANIZATION_MEDICAL_FACILITY("organization_medical_facility"), + + ORIGIN("origin"), + + PASSPORT_NUMBER("passport_number"), + + PASSWORD("password"), + + PHONE_NUMBER("phone_number"), + + PHYSICAL_ATTRIBUTE("physical_attribute"), + + POLITICAL_AFFILIATION("political_affiliation"), + + PRODUCT("product"), + + RELIGION("religion"), + + ROUTING_NUMBER("routing_number"), + + SSN("ssn"), + + STATISTICS("statistics"), + + TIME("time"), + + TREND("trend"), + + URL("url"), + + USERNAME("username"), + + VEHICLE_ID("vehicle_id"), + + ZODIAC_SIGN("zodiac_sign"); + + private final String value; + + EntityType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java b/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java new file mode 100644 index 00000000..68778cb1 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/ErrorResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.databind.annotation.JsonDeserialize; +import com.skyflow.generated.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ErrorResponse.Builder.class) +public final class ErrorResponse { + private final ErrorResponseError error; + + private final Map additionalProperties; + + private ErrorResponse(ErrorResponseError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public ErrorResponseError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ErrorResponse && equalTo((ErrorResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponse other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull ErrorResponseError error); + + Builder from(ErrorResponse other); + } + + public interface _FinalStage { + ErrorResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private ErrorResponseError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ErrorResponse other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull ErrorResponseError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public ErrorResponse build() { + return new ErrorResponse(error, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java b/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java new file mode 100644 index 00000000..5d0ee57d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/ErrorResponseError.java @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ErrorResponseError.Builder.class) +public final class ErrorResponseError { + private final int grpcCode; + + private final int httpCode; + + private final String httpStatus; + + private final String message; + + private final Optional>> details; + + private final Map additionalProperties; + + private ErrorResponseError( + int grpcCode, + int httpCode, + String httpStatus, + String message, + Optional>> details, + Map additionalProperties) { + this.grpcCode = grpcCode; + this.httpCode = httpCode; + this.httpStatus = httpStatus; + this.message = message; + this.details = details; + this.additionalProperties = additionalProperties; + } + + /** + * @return gRPC status codes. See https://grpc.io/docs/guides/status-codes. + */ + @JsonProperty("grpc_code") + public int getGrpcCode() { + return grpcCode; + } + + /** + * @return HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status. + */ + @JsonProperty("http_code") + public int getHttpCode() { + return httpCode; + } + + /** + * @return HTTP status message. + */ + @JsonProperty("http_status") + public String getHttpStatus() { + return httpStatus; + } + + @JsonProperty("message") + public String 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 ErrorResponseError && equalTo((ErrorResponseError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponseError other) { + return grpcCode == other.grpcCode + && httpCode == other.httpCode + && httpStatus.equals(other.httpStatus) + && message.equals(other.message) + && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.grpcCode, this.httpCode, this.httpStatus, this.message, this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GrpcCodeStage builder() { + return new Builder(); + } + + public interface GrpcCodeStage { + /** + * gRPC status codes. See https://grpc.io/docs/guides/status-codes. + */ + HttpCodeStage grpcCode(int grpcCode); + + Builder from(ErrorResponseError other); + } + + public interface HttpCodeStage { + /** + * HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status. + */ + HttpStatusStage httpCode(int httpCode); + } + + public interface HttpStatusStage { + /** + * HTTP status message. + */ + MessageStage httpStatus(@NotNull String httpStatus); + } + + public interface MessageStage { + _FinalStage message(@NotNull String message); + } + + public interface _FinalStage { + ErrorResponseError build(); + + _FinalStage details(Optional>> details); + + _FinalStage details(List> details); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements GrpcCodeStage, HttpCodeStage, HttpStatusStage, MessageStage, _FinalStage { + private int grpcCode; + + private int httpCode; + + private String httpStatus; + + private String message; + + private Optional>> details = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ErrorResponseError other) { + grpcCode(other.getGrpcCode()); + httpCode(other.getHttpCode()); + httpStatus(other.getHttpStatus()); + message(other.getMessage()); + details(other.getDetails()); + return this; + } + + /** + * 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 + @JsonSetter("grpc_code") + public HttpCodeStage grpcCode(int grpcCode) { + this.grpcCode = grpcCode; + return this; + } + + /** + * 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 + @JsonSetter("http_code") + public HttpStatusStage httpCode(int httpCode) { + this.httpCode = httpCode; + return this; + } + + /** + * HTTP status message.

HTTP status message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.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 + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage details(List> details) { + this.details = Optional.ofNullable(details); + return this; + } + + @java.lang.Override + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public _FinalStage details(Optional>> details) { + this.details = details; + return this; + } + + @java.lang.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/src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java new file mode 100644 index 00000000..d0290573 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/GooglerpcStatus.java @@ -0,0 +1,144 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java b/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java new file mode 100644 index 00000000..0563503c --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/ProcessedFileOutputProcessedFileType.java @@ -0,0 +1,40 @@ +/** + * 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 ProcessedFileOutputProcessedFileType { + NONE("none"), + + REDACTED_AUDIO("redacted_audio"), + + REDACTED_IMAGE("redacted_image"), + + REDACTED_TRANSCRIPTION("redacted_transcription"), + + REDACTED_FILE("redacted_file"), + + REDACTED_TEXT("redacted_text"), + + ENTITIES("entities"), + + REDACTED_AWS_TRANSCRIPTION_DIARIZE_JSON("redacted_aws_transcription_diarize_json"), + + REDACTED_DEEPGRAM_TRANSCRIPTION_DIARIZE_JSON("redacted_deepgram_transcription_diarize_json"), + + PLAINTEXT_TRANSCRIBED("plaintext_transcribed"); + + private final String value; + + ProcessedFileOutputProcessedFileType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java b/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java new file mode 100644 index 00000000..37555aae --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/ProtobufAny.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java b/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java new file mode 100644 index 00000000..3e83052b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/RedactionEnumRedaction.java @@ -0,0 +1,28 @@ +/** + * 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 RedactionEnumRedaction { + DEFAULT("DEFAULT"), + + REDACTED("REDACTED"), + + MASKED("MASKED"), + + PLAIN_TEXT("PLAIN_TEXT"); + + private final String value; + + RedactionEnumRedaction(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java b/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java new file mode 100644 index 00000000..ba305e63 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/ReidentifyStringResponse.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = ReidentifyStringResponse.Builder.class) +public final class ReidentifyStringResponse { + private final Optional text; + + private final Map additionalProperties; + + private ReidentifyStringResponse(Optional text, Map additionalProperties) { + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return Re-identified text. + */ + @JsonProperty("text") + public Optional getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReidentifyStringResponse && equalTo((ReidentifyStringResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReidentifyStringResponse other) { + return text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text); + } + + @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 text = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReidentifyStringResponse other) { + text(other.getText()); + return this; + } + + /** + *

Re-identified text.

+ */ + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + public ReidentifyStringResponse build() { + return new ReidentifyStringResponse(text, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java b/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java new file mode 100644 index 00000000..436a1de8 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/RequestActionType.java @@ -0,0 +1,56 @@ +/** + * 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 RequestActionType { + NONE("NONE"), + + ASSIGN("ASSIGN"), + + CREATE("CREATE"), + + DELETE("DELETE"), + + EXECUTE("EXECUTE"), + + LIST("LIST"), + + READ("READ"), + + UNASSIGN("UNASSIGN"), + + UPDATE("UPDATE"), + + VALIDATE("VALIDATE"), + + LOGIN("LOGIN"), + + ROTATE("ROTATE"), + + SCHEDULEROTATION("SCHEDULEROTATION"), + + SCHEDULEROTATIONALERT("SCHEDULEROTATIONALERT"), + + IMPORT("IMPORT"), + + GETIMPORTPARAMETERS("GETIMPORTPARAMETERS"), + + PING("PING"), + + GETCLOUDPROVIDER("GETCLOUDPROVIDER"); + + private final String value; + + RequestActionType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenType.java b/src/main/java/com/skyflow/generated/rest/types/TokenType.java new file mode 100644 index 00000000..a50e861b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/TokenType.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.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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenType.Builder.class) +public final class TokenType { + private final Optional default_; + + private final Optional> vaultToken; + + private final Optional> entityUnqCounter; + + private final Optional> entityOnly; + + private final Map additionalProperties; + + private TokenType( + Optional default_, + Optional> vaultToken, + Optional> entityUnqCounter, + Optional> entityOnly, + Map additionalProperties) { + this.default_ = default_; + this.vaultToken = vaultToken; + this.entityUnqCounter = entityUnqCounter; + this.entityOnly = entityOnly; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + /** + * @return Entity types to replace with vault tokens. + */ + @JsonProperty("vault_token") + public Optional> getVaultToken() { + return vaultToken; + } + + /** + * @return Entity types to replace with entity tokens with unique counters. + */ + @JsonProperty("entity_unq_counter") + public Optional> getEntityUnqCounter() { + return entityUnqCounter; + } + + /** + * @return Entity types to replace with entity tokens. + */ + @JsonProperty("entity_only") + public Optional> getEntityOnly() { + return entityOnly; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenType && equalTo((TokenType) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenType other) { + return default_.equals(other.default_) + && vaultToken.equals(other.vaultToken) + && entityUnqCounter.equals(other.entityUnqCounter) + && entityOnly.equals(other.entityOnly); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.default_, this.vaultToken, this.entityUnqCounter, this.entityOnly); + } + + @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 default_ = Optional.empty(); + + private Optional> vaultToken = Optional.empty(); + + private Optional> entityUnqCounter = Optional.empty(); + + private Optional> entityOnly = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenType other) { + default_(other.getDefault()); + vaultToken(other.getVaultToken()); + entityUnqCounter(other.getEntityUnqCounter()); + entityOnly(other.getEntityOnly()); + return this; + } + + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public Builder default_(Optional default_) { + this.default_ = default_; + return this; + } + + public Builder default_(TokenTypeDefault default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + /** + *

Entity types to replace with vault tokens.

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

Entity types to replace with entity tokens with unique counters.

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

Entity types to replace with entity tokens.

+ */ + @JsonSetter(value = "entity_only", nulls = Nulls.SKIP) + public Builder entityOnly(Optional> entityOnly) { + this.entityOnly = entityOnly; + return this; + } + + public Builder entityOnly(List entityOnly) { + this.entityOnly = Optional.ofNullable(entityOnly); + return this; + } + + public TokenType build() { + return new TokenType(default_, vaultToken, entityUnqCounter, entityOnly, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java b/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java new file mode 100644 index 00000000..14ab8f0f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/TokenTypeDefault.java @@ -0,0 +1,26 @@ +/** + * 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 TokenTypeDefault { + ENTITY_ONLY("entity_only"), + + ENTITY_UNQ_COUNTER("entity_unq_counter"), + + VAULT_TOKEN("vault_token"); + + private final String value; + + TokenTypeDefault(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java b/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java new file mode 100644 index 00000000..5f5938a0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVault.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = TokenTypeWithoutVault.Builder.class) +public final class TokenTypeWithoutVault { + private final Optional default_; + + private final Optional> entityUnqCounter; + + private final Optional> entityOnly; + + private final Map additionalProperties; + + private TokenTypeWithoutVault( + Optional default_, + Optional> entityUnqCounter, + Optional> entityOnly, + Map additionalProperties) { + this.default_ = default_; + this.entityUnqCounter = entityUnqCounter; + this.entityOnly = entityOnly; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + /** + * @return Entity types to replace with entity tokens with unique counters. + */ + @JsonProperty("entity_unq_counter") + public Optional> getEntityUnqCounter() { + return entityUnqCounter; + } + + /** + * @return Entity types to replace with entity tokens. + */ + @JsonProperty("entity_only") + public Optional> getEntityOnly() { + return entityOnly; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenTypeWithoutVault && equalTo((TokenTypeWithoutVault) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenTypeWithoutVault other) { + return default_.equals(other.default_) + && entityUnqCounter.equals(other.entityUnqCounter) + && entityOnly.equals(other.entityOnly); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.default_, this.entityUnqCounter, this.entityOnly); + } + + @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 default_ = Optional.empty(); + + private Optional> entityUnqCounter = Optional.empty(); + + private Optional> entityOnly = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenTypeWithoutVault other) { + default_(other.getDefault()); + entityUnqCounter(other.getEntityUnqCounter()); + entityOnly(other.getEntityOnly()); + return this; + } + + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public Builder default_(Optional default_) { + this.default_ = default_; + return this; + } + + public Builder default_(TokenTypeWithoutVaultDefault default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + /** + *

Entity types to replace with entity tokens with unique counters.

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

Entity types to replace with entity tokens.

+ */ + @JsonSetter(value = "entity_only", nulls = Nulls.SKIP) + public Builder entityOnly(Optional> entityOnly) { + this.entityOnly = entityOnly; + return this; + } + + public Builder entityOnly(List entityOnly) { + this.entityOnly = Optional.ofNullable(entityOnly); + return this; + } + + public TokenTypeWithoutVault build() { + return new TokenTypeWithoutVault(default_, entityUnqCounter, entityOnly, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java b/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.java new file mode 100644 index 00000000..45dba579 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/TokenTypeWithoutVaultDefault.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 TokenTypeWithoutVaultDefault { + ENTITY_ONLY("entity_only"), + + ENTITY_UNQ_COUNTER("entity_unq_counter"); + + private final String value; + + TokenTypeWithoutVaultDefault(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/Transformations.java b/src/main/java/com/skyflow/generated/rest/types/Transformations.java new file mode 100644 index 00000000..46022faa --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/Transformations.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = Transformations.Builder.class) +public final class Transformations { + private final Optional shiftDates; + + private final Map additionalProperties; + + private Transformations(Optional shiftDates, Map additionalProperties) { + this.shiftDates = shiftDates; + this.additionalProperties = additionalProperties; + } + + /** + * @return Shift dates by a specified number of days. + */ + @JsonProperty("shift_dates") + public Optional getShiftDates() { + return shiftDates; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Transformations && equalTo((Transformations) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Transformations other) { + return shiftDates.equals(other.shiftDates); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.shiftDates); + } + + @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 shiftDates = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Transformations other) { + shiftDates(other.getShiftDates()); + return this; + } + + /** + *

Shift dates by a specified number of days.

+ */ + @JsonSetter(value = "shift_dates", nulls = Nulls.SKIP) + public Builder shiftDates(Optional shiftDates) { + this.shiftDates = shiftDates; + return this; + } + + public Builder shiftDates(TransformationsShiftDates shiftDates) { + this.shiftDates = Optional.ofNullable(shiftDates); + return this; + } + + public Transformations build() { + return new Transformations(shiftDates, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java b/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java new file mode 100644 index 00000000..1e11938b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDates.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = TransformationsShiftDates.Builder.class) +public final class TransformationsShiftDates { + private final Optional maxDays; + + private final Optional minDays; + + private final Optional> entityTypes; + + private final Map additionalProperties; + + private TransformationsShiftDates( + Optional maxDays, + Optional minDays, + Optional> entityTypes, + Map additionalProperties) { + this.maxDays = maxDays; + this.minDays = minDays; + this.entityTypes = entityTypes; + this.additionalProperties = additionalProperties; + } + + /** + * @return Maximum number of days to shift the date by. + */ + @JsonProperty("max_days") + public Optional getMaxDays() { + return maxDays; + } + + /** + * @return Minimum number of days to shift the date by. + */ + @JsonProperty("min_days") + public Optional getMinDays() { + return minDays; + } + + /** + * @return Entity types to shift dates for. + */ + @JsonProperty("entity_types") + public Optional> getEntityTypes() { + return entityTypes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransformationsShiftDates && equalTo((TransformationsShiftDates) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransformationsShiftDates other) { + return maxDays.equals(other.maxDays) && minDays.equals(other.minDays) && entityTypes.equals(other.entityTypes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.maxDays, this.minDays, this.entityTypes); + } + + @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 maxDays = Optional.empty(); + + private Optional minDays = Optional.empty(); + + private Optional> entityTypes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TransformationsShiftDates other) { + maxDays(other.getMaxDays()); + minDays(other.getMinDays()); + entityTypes(other.getEntityTypes()); + return this; + } + + /** + *

Maximum number of days to shift the date by.

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

Minimum number of days to shift the date by.

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

Entity types to shift dates for.

+ */ + @JsonSetter(value = "entity_types", nulls = Nulls.SKIP) + public Builder entityTypes(Optional> entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + public Builder entityTypes(List entityTypes) { + this.entityTypes = Optional.ofNullable(entityTypes); + return this; + } + + public TransformationsShiftDates build() { + return new TransformationsShiftDates(maxDays, minDays, entityTypes, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java b/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java new file mode 100644 index 00000000..148cea23 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/TransformationsShiftDatesEntityTypesItem.java @@ -0,0 +1,26 @@ +/** + * 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 TransformationsShiftDatesEntityTypesItem { + DATE("date"), + + DATE_INTERVAL("date_interval"), + + DOB("dob"); + + private final String value; + + TransformationsShiftDatesEntityTypesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java b/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java new file mode 100644 index 00000000..999153e4 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AdvancedOptions.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1AdvancedOptions.Builder.class) +public final class V1AdvancedOptions { + private final Optional dateShift; + + private final Optional customClient; + + private final Optional schema; + + private final Map additionalProperties; + + private V1AdvancedOptions( + Optional dateShift, + Optional customClient, + Optional schema, + Map additionalProperties) { + this.dateShift = dateShift; + this.customClient = customClient; + this.schema = schema; + this.additionalProperties = additionalProperties; + } + + /** + * @return No. of days by which original date has to be shifted to. + */ + @JsonProperty("date_shift") + public Optional getDateShift() { + return dateShift; + } + + /** + * @return Custom client specific logic. + */ + @JsonProperty("custom_client") + public Optional getCustomClient() { + return customClient; + } + + @JsonProperty("schema") + public Optional getSchema() { + return schema; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AdvancedOptions && equalTo((V1AdvancedOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AdvancedOptions other) { + return dateShift.equals(other.dateShift) + && customClient.equals(other.customClient) + && schema.equals(other.schema); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dateShift, this.customClient, this.schema); + } + + @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 dateShift = Optional.empty(); + + private Optional customClient = Optional.empty(); + + private Optional schema = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AdvancedOptions other) { + dateShift(other.getDateShift()); + customClient(other.getCustomClient()); + schema(other.getSchema()); + return this; + } + + /** + *

No. of days by which original date has to be shifted to.

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

Custom client specific logic.

+ */ + @JsonSetter(value = "custom_client", nulls = Nulls.SKIP) + public Builder customClient(Optional customClient) { + this.customClient = customClient; + return this; + } + + public Builder customClient(Boolean customClient) { + this.customClient = Optional.ofNullable(customClient); + return this; + } + + @JsonSetter(value = "schema", nulls = Nulls.SKIP) + public Builder schema(Optional schema) { + this.schema = schema; + return this; + } + + public Builder schema(AdvancedOptionsVaultSchema schema) { + this.schema = Optional.ofNullable(schema); + return this; + } + + public V1AdvancedOptions build() { + return new V1AdvancedOptions(dateShift, customClient, schema, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java b/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java new file mode 100644 index 00000000..50e5508a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AudioConfig.java @@ -0,0 +1,151 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1AudioConfig.Builder.class) +public final class V1AudioConfig { + private final Optional outputTranscription; + + private final Optional outputProcessedAudio; + + private final Optional options; + + private final Map additionalProperties; + + private V1AudioConfig( + Optional outputTranscription, + Optional outputProcessedAudio, + Optional options, + Map additionalProperties) { + this.outputTranscription = outputTranscription; + this.outputProcessedAudio = outputProcessedAudio; + this.options = options; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("output_transcription") + public Optional getOutputTranscription() { + return outputTranscription; + } + + /** + * @return If true, includes processed audio file in the response. + */ + @JsonProperty("output_processed_audio") + public Optional getOutputProcessedAudio() { + return outputProcessedAudio; + } + + @JsonProperty("options") + public Optional getOptions() { + return options; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AudioConfig && equalTo((V1AudioConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AudioConfig other) { + return outputTranscription.equals(other.outputTranscription) + && outputProcessedAudio.equals(other.outputProcessedAudio) + && options.equals(other.options); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.outputTranscription, this.outputProcessedAudio, this.options); + } + + @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 outputTranscription = Optional.empty(); + + private Optional outputProcessedAudio = Optional.empty(); + + private Optional options = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AudioConfig other) { + outputTranscription(other.getOutputTranscription()); + outputProcessedAudio(other.getOutputProcessedAudio()); + options(other.getOptions()); + return this; + } + + @JsonSetter(value = "output_transcription", nulls = Nulls.SKIP) + public Builder outputTranscription(Optional outputTranscription) { + this.outputTranscription = outputTranscription; + return this; + } + + public Builder outputTranscription(AudioConfigTranscriptionType outputTranscription) { + this.outputTranscription = Optional.ofNullable(outputTranscription); + return this; + } + + /** + *

If true, includes processed audio file in the response.

+ */ + @JsonSetter(value = "output_processed_audio", nulls = Nulls.SKIP) + public Builder outputProcessedAudio(Optional outputProcessedAudio) { + this.outputProcessedAudio = outputProcessedAudio; + return this; + } + + public Builder outputProcessedAudio(Boolean outputProcessedAudio) { + this.outputProcessedAudio = Optional.ofNullable(outputProcessedAudio); + return this; + } + + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional options) { + this.options = options; + return this; + } + + public Builder options(V1AudioOptions options) { + this.options = Optional.ofNullable(options); + return this; + } + + public V1AudioConfig build() { + return new V1AudioConfig(outputTranscription, outputProcessedAudio, options, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java b/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java new file mode 100644 index 00000000..d71b77a0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AudioOptions.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1AudioOptions.Builder.class) +public final class V1AudioOptions { + private final Optional bleepStartPadding; + + private final Optional bleepEndPadding; + + private final Optional distortionSteps; + + private final Optional bleepFrequency; + + private final Optional bleepGain; + + private final Map additionalProperties; + + private V1AudioOptions( + Optional bleepStartPadding, + Optional bleepEndPadding, + Optional distortionSteps, + Optional bleepFrequency, + Optional bleepGain, + Map additionalProperties) { + this.bleepStartPadding = bleepStartPadding; + this.bleepEndPadding = bleepEndPadding; + this.distortionSteps = distortionSteps; + this.bleepFrequency = bleepFrequency; + this.bleepGain = bleepGain; + this.additionalProperties = additionalProperties; + } + + /** + * @return Padding added to the beginning of a bleep, in seconds. + */ + @JsonProperty("bleep_start_padding") + public Optional getBleepStartPadding() { + return bleepStartPadding; + } + + /** + * @return Padding added to the end of a bleep, in seconds. + */ + @JsonProperty("bleep_end_padding") + public Optional getBleepEndPadding() { + return bleepEndPadding; + } + + /** + * @return Specifies how the distortion will be made. Providing a number more than 0 will result in a higher tone and a coefficient less than 0 will result in a lower tone. + */ + @JsonProperty("distortion_steps") + public Optional getDistortionSteps() { + return distortionSteps; + } + + /** + * @return This parameter configures the frequency of the sine wave used for the bleep sound in an audio segment. + */ + @JsonProperty("bleep_frequency") + public Optional getBleepFrequency() { + return bleepFrequency; + } + + /** + * @return It controls the relative loudness of the bleep,positive values increase its loudness, and negative values decrease it. + */ + @JsonProperty("bleep_gain") + public Optional getBleepGain() { + return bleepGain; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AudioOptions && equalTo((V1AudioOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AudioOptions other) { + return bleepStartPadding.equals(other.bleepStartPadding) + && bleepEndPadding.equals(other.bleepEndPadding) + && distortionSteps.equals(other.distortionSteps) + && bleepFrequency.equals(other.bleepFrequency) + && bleepGain.equals(other.bleepGain); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bleepStartPadding, + this.bleepEndPadding, + this.distortionSteps, + this.bleepFrequency, + this.bleepGain); + } + + @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 bleepStartPadding = Optional.empty(); + + private Optional bleepEndPadding = Optional.empty(); + + private Optional distortionSteps = Optional.empty(); + + private Optional bleepFrequency = Optional.empty(); + + private Optional bleepGain = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AudioOptions other) { + bleepStartPadding(other.getBleepStartPadding()); + bleepEndPadding(other.getBleepEndPadding()); + distortionSteps(other.getDistortionSteps()); + bleepFrequency(other.getBleepFrequency()); + bleepGain(other.getBleepGain()); + return this; + } + + /** + *

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

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

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

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

Specifies how the distortion will be made. Providing a number more than 0 will result in a higher tone and a coefficient less than 0 will result in a lower tone.

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

This parameter configures the frequency of the sine wave used for the bleep sound in an audio segment.

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

It controls the relative loudness of the bleep,positive values increase its loudness, and negative values decrease it.

+ */ + @JsonSetter(value = "bleep_gain", nulls = Nulls.SKIP) + public Builder bleepGain(Optional bleepGain) { + this.bleepGain = bleepGain; + return this; + } + + public Builder bleepGain(Integer bleepGain) { + this.bleepGain = Optional.ofNullable(bleepGain); + return this; + } + + public V1AudioOptions build() { + return new V1AudioOptions( + bleepStartPadding, + bleepEndPadding, + distortionSteps, + bleepFrequency, + bleepGain, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java b/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java new file mode 100644 index 00000000..1453dd99 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AuditAfterOptions.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1AuditAfterOptions.Builder.class) +public final class V1AuditAfterOptions { + private final Optional timestamp; + + private final Optional changeId; + + private final Map additionalProperties; + + private V1AuditAfterOptions( + Optional timestamp, Optional changeId, Map additionalProperties) { + this.timestamp = timestamp; + this.changeId = changeId; + this.additionalProperties = additionalProperties; + } + + /** + * @return 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. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return 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. + */ + @JsonProperty("changeID") + public Optional getChangeId() { + return changeId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AuditAfterOptions && equalTo((V1AuditAfterOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AuditAfterOptions other) { + return timestamp.equals(other.timestamp) && changeId.equals(other.changeId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.timestamp, this.changeId); + } + + @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 timestamp = Optional.empty(); + + private Optional changeId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AuditAfterOptions other) { + timestamp(other.getTimestamp()); + changeId(other.getChangeId()); + return this; + } + + /** + *

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.

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

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.

+ */ + @JsonSetter(value = "changeID", nulls = Nulls.SKIP) + public Builder changeId(Optional changeId) { + this.changeId = changeId; + return this; + } + + public Builder changeId(String changeId) { + this.changeId = Optional.ofNullable(changeId); + return this; + } + + public V1AuditAfterOptions build() { + return new V1AuditAfterOptions(timestamp, changeId, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java new file mode 100644 index 00000000..2dd2ca4e --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AuditEventResponse.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1AuditEventResponse.Builder.class) +public final class V1AuditEventResponse { + private final Optional code; + + private final Optional message; + + private final Optional data; + + private final Optional timestamp; + + private final Map additionalProperties; + + private V1AuditEventResponse( + Optional code, + Optional message, + Optional data, + Optional timestamp, + Map additionalProperties) { + this.code = code; + this.message = message; + this.data = data; + this.timestamp = timestamp; + this.additionalProperties = additionalProperties; + } + + /** + * @return The status of the overall operation. + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return The status message for the overall operation. + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @JsonProperty("data") + public Optional getData() { + return data; + } + + /** + * @return time when this response is generated, use extention method to set it. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AuditEventResponse && equalTo((V1AuditEventResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AuditEventResponse other) { + return code.equals(other.code) + && message.equals(other.message) + && data.equals(other.data) + && timestamp.equals(other.timestamp); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.data, this.timestamp); + } + + @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 data = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AuditEventResponse other) { + code(other.getCode()); + message(other.getMessage()); + data(other.getData()); + timestamp(other.getTimestamp()); + return this; + } + + /** + *

The status of the overall operation.

+ */ + @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; + } + + /** + *

The status message for the overall operation.

+ */ + @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 = "data", nulls = Nulls.SKIP) + public Builder data(Optional data) { + this.data = data; + return this; + } + + public Builder data(AuditEventData data) { + this.data = Optional.ofNullable(data); + return this; + } + + /** + *

time when this response is generated, use extention method to set it.

+ */ + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + public V1AuditEventResponse build() { + return new V1AuditEventResponse(code, message, data, timestamp, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.java new file mode 100644 index 00000000..88496f03 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AuditResponse.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.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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1AuditResponse.Builder.class) +public final class V1AuditResponse { + private final Optional> event; + + private final Optional nextOps; + + private final Map additionalProperties; + + private V1AuditResponse( + Optional> event, + Optional nextOps, + Map additionalProperties) { + this.event = event; + this.nextOps = nextOps; + this.additionalProperties = additionalProperties; + } + + /** + * @return Events matching the query. + */ + @JsonProperty("event") + public Optional> getEvent() { + return event; + } + + @JsonProperty("nextOps") + public Optional getNextOps() { + return nextOps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AuditResponse && equalTo((V1AuditResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AuditResponse other) { + return event.equals(other.event) && nextOps.equals(other.nextOps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.event, this.nextOps); + } + + @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> event = Optional.empty(); + + private Optional nextOps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AuditResponse other) { + event(other.getEvent()); + nextOps(other.getNextOps()); + return this; + } + + /** + *

Events matching the query.

+ */ + @JsonSetter(value = "event", nulls = Nulls.SKIP) + public Builder event(Optional> event) { + this.event = event; + return this; + } + + public Builder event(List event) { + this.event = Optional.ofNullable(event); + return this; + } + + @JsonSetter(value = "nextOps", nulls = Nulls.SKIP) + public Builder nextOps(Optional nextOps) { + this.nextOps = nextOps; + return this; + } + + public Builder nextOps(V1AuditAfterOptions nextOps) { + this.nextOps = Optional.ofNullable(nextOps); + return this; + } + + public V1AuditResponse build() { + return new V1AuditResponse(event, nextOps, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java b/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java new file mode 100644 index 00000000..595b724c --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEvent.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1AuditResponseEvent.Builder.class) +public final class V1AuditResponseEvent { + private final Optional context; + + private final Optional request; + + private final Optional response; + + private final Optional parentAccountId; + + private final Optional accountId; + + private final Optional> resourceIDs; + + private final Map additionalProperties; + + private V1AuditResponseEvent( + Optional context, + Optional request, + Optional response, + Optional parentAccountId, + Optional accountId, + Optional> resourceIDs, + Map additionalProperties) { + this.context = context; + this.request = request; + this.response = response; + this.parentAccountId = parentAccountId; + this.accountId = accountId; + this.resourceIDs = resourceIDs; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("context") + public Optional getContext() { + return context; + } + + @JsonProperty("request") + public Optional getRequest() { + return request; + } + + @JsonProperty("response") + public Optional getResponse() { + return response; + } + + /** + * @return Parent account ID of the account that made the request, if any. + */ + @JsonProperty("parentAccountID") + public Optional getParentAccountId() { + return parentAccountId; + } + + /** + * @return ID of the account that made the request. + */ + @JsonProperty("accountID") + public Optional getAccountId() { + return accountId; + } + + /** + * @return IDs for resources involved in the event. Presented in {resourceType}/{resourceID} format. For example, VAULT/cd1d815aa09b4cbfbb803bd20349f202. + */ + @JsonProperty("resourceIDs") + public Optional> getResourceIDs() { + return resourceIDs; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AuditResponseEvent && equalTo((V1AuditResponseEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AuditResponseEvent other) { + return context.equals(other.context) + && request.equals(other.request) + && response.equals(other.response) + && parentAccountId.equals(other.parentAccountId) + && accountId.equals(other.accountId) + && resourceIDs.equals(other.resourceIDs); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.context, this.request, this.response, this.parentAccountId, this.accountId, this.resourceIDs); + } + + @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 context = Optional.empty(); + + private Optional request = Optional.empty(); + + private Optional response = Optional.empty(); + + private Optional parentAccountId = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional> resourceIDs = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AuditResponseEvent other) { + context(other.getContext()); + request(other.getRequest()); + response(other.getResponse()); + parentAccountId(other.getParentAccountId()); + accountId(other.getAccountId()); + resourceIDs(other.getResourceIDs()); + return this; + } + + @JsonSetter(value = "context", nulls = Nulls.SKIP) + public Builder context(Optional context) { + this.context = context; + return this; + } + + public Builder context(AuditEventContext context) { + this.context = Optional.ofNullable(context); + return this; + } + + @JsonSetter(value = "request", nulls = Nulls.SKIP) + public Builder request(Optional request) { + this.request = request; + return this; + } + + public Builder request(V1AuditResponseEventRequest request) { + this.request = Optional.ofNullable(request); + return this; + } + + @JsonSetter(value = "response", nulls = Nulls.SKIP) + public Builder response(Optional response) { + this.response = response; + return this; + } + + public Builder response(V1AuditEventResponse response) { + this.response = Optional.ofNullable(response); + return this; + } + + /** + *

Parent account ID of the account that made the request, if any.

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

ID of the account that made the request.

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

IDs for resources involved in the event. Presented in {resourceType}/{resourceID} format. For example, VAULT/cd1d815aa09b4cbfbb803bd20349f202.

+ */ + @JsonSetter(value = "resourceIDs", nulls = Nulls.SKIP) + public Builder resourceIDs(Optional> resourceIDs) { + this.resourceIDs = resourceIDs; + return this; + } + + public Builder resourceIDs(List resourceIDs) { + this.resourceIDs = Optional.ofNullable(resourceIDs); + return this; + } + + public V1AuditResponseEvent build() { + return new V1AuditResponseEvent( + context, request, response, parentAccountId, accountId, resourceIDs, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java b/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java new file mode 100644 index 00000000..c77bc31f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1AuditResponseEventRequest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1AuditResponseEventRequest.Builder.class) +public final class V1AuditResponseEventRequest { + private final Optional data; + + private final Optional apiName; + + private final Optional workspaceId; + + private final Optional vaultId; + + private final Optional> tags; + + private final Optional timestamp; + + private final Optional actionType; + + private final Optional resourceType; + + private final Optional httpInfo; + + private final Map additionalProperties; + + private V1AuditResponseEventRequest( + Optional data, + Optional apiName, + Optional workspaceId, + Optional vaultId, + Optional> tags, + Optional timestamp, + Optional actionType, + Optional resourceType, + Optional httpInfo, + Map additionalProperties) { + this.data = data; + this.apiName = apiName; + this.workspaceId = workspaceId; + this.vaultId = vaultId; + this.tags = tags; + this.timestamp = timestamp; + this.actionType = actionType; + this.resourceType = resourceType; + this.httpInfo = httpInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public Optional getData() { + return data; + } + + /** + * @return API name. + */ + @JsonProperty("apiName") + public Optional getApiName() { + return apiName; + } + + /** + * @return The workspaceID (if any) of the request. + */ + @JsonProperty("workspaceID") + public Optional getWorkspaceId() { + return workspaceId; + } + + /** + * @return The vaultID (if any) of the request. + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Tags associated with the event. To provide better search capabilities. Like login. + */ + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + /** + * @return time when this request is generated, use extention method to set it. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + @JsonProperty("actionType") + public Optional getActionType() { + return actionType; + } + + @JsonProperty("resourceType") + public Optional getResourceType() { + return resourceType; + } + + @JsonProperty("httpInfo") + public Optional getHttpInfo() { + return httpInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1AuditResponseEventRequest && equalTo((V1AuditResponseEventRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1AuditResponseEventRequest other) { + return data.equals(other.data) + && apiName.equals(other.apiName) + && workspaceId.equals(other.workspaceId) + && vaultId.equals(other.vaultId) + && tags.equals(other.tags) + && timestamp.equals(other.timestamp) + && actionType.equals(other.actionType) + && resourceType.equals(other.resourceType) + && httpInfo.equals(other.httpInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.data, + this.apiName, + this.workspaceId, + this.vaultId, + this.tags, + this.timestamp, + this.actionType, + this.resourceType, + this.httpInfo); + } + + @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 data = Optional.empty(); + + private Optional apiName = Optional.empty(); + + private Optional workspaceId = Optional.empty(); + + private Optional vaultId = Optional.empty(); + + private Optional> tags = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional actionType = Optional.empty(); + + private Optional resourceType = Optional.empty(); + + private Optional httpInfo = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1AuditResponseEventRequest other) { + data(other.getData()); + apiName(other.getApiName()); + workspaceId(other.getWorkspaceId()); + vaultId(other.getVaultId()); + tags(other.getTags()); + timestamp(other.getTimestamp()); + actionType(other.getActionType()); + resourceType(other.getResourceType()); + httpInfo(other.getHttpInfo()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional data) { + this.data = data; + return this; + } + + public Builder data(AuditEventData data) { + this.data = Optional.ofNullable(data); + return this; + } + + /** + *

API name.

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

The workspaceID (if any) of the request.

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

The vaultID (if any) of the request.

+ */ + @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; + } + + /** + *

Tags associated with the event. To provide better search capabilities. Like login.

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

time when this request is generated, use extention method to set it.

+ */ + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "actionType", nulls = Nulls.SKIP) + public Builder actionType(Optional actionType) { + this.actionType = actionType; + return this; + } + + public Builder actionType(RequestActionType actionType) { + this.actionType = Optional.ofNullable(actionType); + return this; + } + + @JsonSetter(value = "resourceType", nulls = Nulls.SKIP) + public Builder resourceType(Optional resourceType) { + this.resourceType = resourceType; + return this; + } + + public Builder resourceType(AuditEventAuditResourceType resourceType) { + this.resourceType = Optional.ofNullable(resourceType); + return this; + } + + @JsonSetter(value = "httpInfo", nulls = Nulls.SKIP) + public Builder httpInfo(Optional httpInfo) { + this.httpInfo = httpInfo; + return this; + } + + public Builder httpInfo(AuditEventHttpInfo httpInfo) { + this.httpInfo = Optional.ofNullable(httpInfo); + return this; + } + + public V1AuditResponseEventRequest build() { + return new V1AuditResponseEventRequest( + data, + apiName, + workspaceId, + vaultId, + tags, + timestamp, + actionType, + resourceType, + httpInfo, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java new file mode 100644 index 00000000..03d752d9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1BatchOperationResponse.java @@ -0,0 +1,133 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1BatchOperationResponse.Builder.class) +public final class V1BatchOperationResponse { + private final Optional vaultId; + + private final Optional>> responses; + + private final Map additionalProperties; + + private V1BatchOperationResponse( + Optional vaultId, + Optional>> responses, + Map additionalProperties) { + this.vaultId = vaultId; + this.responses = responses; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault. + */ + @JsonProperty("vaultID") + public Optional getVaultId() { + return vaultId; + } + + /** + * @return Responses in the same order as in the request. Responses have the same payload structure as their corresponding APIs: <br/><ul><li>POST returns an Insert Records response.</li><li>PUT returns an Update Record response.</li><li>GET returns a Get Record response.</li><li>DELETE returns a Delete Record response.</li></ul> + */ + @JsonProperty("responses") + public Optional>> getResponses() { + return responses; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1BatchOperationResponse && equalTo((V1BatchOperationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1BatchOperationResponse other) { + return vaultId.equals(other.vaultId) && responses.equals(other.responses); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.vaultId, this.responses); + } + + @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 vaultId = Optional.empty(); + + private Optional>> responses = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1BatchOperationResponse other) { + vaultId(other.getVaultId()); + responses(other.getResponses()); + return this; + } + + /** + *

ID of the vault.

+ */ + @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; + } + + /** + *

Responses in the same order as in the request. Responses have the same payload structure as their corresponding APIs: <br/><ul><li>POST returns an Insert Records response.</li><li>PUT returns an Update Record response.</li><li>GET returns a Get Record response.</li><li>DELETE returns a Delete Record response.</li></ul>

+ */ + @JsonSetter(value = "responses", nulls = Nulls.SKIP) + public Builder responses(Optional>> responses) { + this.responses = responses; + return this; + } + + public Builder responses(List> responses) { + this.responses = Optional.ofNullable(responses); + return this; + } + + public V1BatchOperationResponse build() { + return new V1BatchOperationResponse(vaultId, responses, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java b/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java new file mode 100644 index 00000000..39eb2e68 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1BatchRecord.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1BatchRecord.Builder.class) +public final class V1BatchRecord { + private final Optional> fields; + + private final Optional tableName; + + private final Optional method; + + private final Optional batchId; + + private final Optional redaction; + + private final Optional tokenization; + + private final Optional id; + + private final Optional downloadUrl; + + private final Optional upsert; + + private final Optional> tokens; + + private final Map additionalProperties; + + private V1BatchRecord( + Optional> fields, + Optional tableName, + Optional method, + Optional batchId, + Optional redaction, + Optional tokenization, + Optional id, + Optional downloadUrl, + Optional upsert, + Optional> tokens, + Map additionalProperties) { + this.fields = fields; + this.tableName = tableName; + this.method = method; + this.batchId = batchId; + this.redaction = redaction; + this.tokenization = tokenization; + this.id = id; + this.downloadUrl = downloadUrl; + this.upsert = upsert; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return Field and value key pairs. For example, {'field_1':'value_1', 'field_2':'value_2'}. Only valid when method is POST or PUT. + */ + @JsonProperty("fields") + public Optional> getFields() { + return fields; + } + + /** + * @return Name of the table to perform the operation on. + */ + @JsonProperty("tableName") + public Optional getTableName() { + return tableName; + } + + @JsonProperty("method") + public Optional getMethod() { + return method; + } + + /** + * @return ID to group operations by. Operations in the same group are executed sequentially. + */ + @JsonProperty("batchID") + public Optional getBatchId() { + return batchId; + } + + @JsonProperty("redaction") + public Optional getRedaction() { + return redaction; + } + + /** + * @return If true, this operation returns tokens for fields with tokenization enabled. Only applicable if skyflow_id values are specified. + */ + @JsonProperty("tokenization") + public Optional getTokenization() { + return tokenization; + } + + /** + * @return skyflow_id for the record. Only valid when method is GET, DELETE, or PUT. + */ + @JsonProperty("ID") + public Optional getId() { + return id; + } + + /** + * @return If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean. + */ + @JsonProperty("downloadURL") + public Optional getDownloadUrl() { + return downloadUrl; + } + + /** + * @return Column that stores primary keys for upsert operations. The column must be marked as unique in the vault schema. Only valid when method is POST. + */ + @JsonProperty("upsert") + public Optional getUpsert() { + return upsert; + } + + /** + * @return Fields and tokens for the record. For example, {'field_1':'token_1', 'field_2':'token_2'}. + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1BatchRecord && equalTo((V1BatchRecord) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1BatchRecord other) { + return fields.equals(other.fields) + && tableName.equals(other.tableName) + && method.equals(other.method) + && batchId.equals(other.batchId) + && redaction.equals(other.redaction) + && tokenization.equals(other.tokenization) + && id.equals(other.id) + && downloadUrl.equals(other.downloadUrl) + && upsert.equals(other.upsert) + && tokens.equals(other.tokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fields, + this.tableName, + this.method, + this.batchId, + this.redaction, + this.tokenization, + this.id, + this.downloadUrl, + this.upsert, + this.tokens); + } + + @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> fields = Optional.empty(); + + private Optional tableName = Optional.empty(); + + private Optional method = Optional.empty(); + + private Optional batchId = Optional.empty(); + + private Optional redaction = Optional.empty(); + + private Optional tokenization = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional downloadUrl = Optional.empty(); + + private Optional upsert = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1BatchRecord other) { + fields(other.getFields()); + tableName(other.getTableName()); + method(other.getMethod()); + batchId(other.getBatchId()); + redaction(other.getRedaction()); + tokenization(other.getTokenization()); + id(other.getId()); + downloadUrl(other.getDownloadUrl()); + upsert(other.getUpsert()); + tokens(other.getTokens()); + return this; + } + + /** + *

Field and value key pairs. For example, {'field_1':'value_1', 'field_2':'value_2'}. Only valid when method is POST or PUT.

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

Name of the table to perform the operation on.

+ */ + @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; + } + + @JsonSetter(value = "method", nulls = Nulls.SKIP) + public Builder method(Optional method) { + this.method = method; + return this; + } + + public Builder method(BatchRecordMethod method) { + this.method = Optional.ofNullable(method); + return this; + } + + /** + *

ID to group operations by. Operations in the same group are executed sequentially.

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

If true, this operation returns tokens for fields with tokenization enabled. Only applicable if skyflow_id values are specified.

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

skyflow_id for the record. Only valid when method is GET, DELETE, or PUT.

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

If true, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean.

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

Column that stores primary keys for upsert operations. The column must be marked as unique in the vault schema. Only valid when method is POST.

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

Fields and tokens for the record. For example, {'field_1':'token_1', 'field_2':'token_2'}.

+ */ + @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 V1BatchRecord build() { + return new V1BatchRecord( + fields, + tableName, + method, + batchId, + redaction, + tokenization, + id, + downloadUrl, + upsert, + tokens, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java new file mode 100644 index 00000000..cf3a3326 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1BinListResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1BinListResponse.Builder.class) +public final class V1BinListResponse { + private final Optional> cardsData; + + private final Map additionalProperties; + + private V1BinListResponse(Optional> cardsData, Map additionalProperties) { + this.cardsData = cardsData; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card metadata associated with the specified BIN. + */ + @JsonProperty("cards_data") + public Optional> getCardsData() { + return cardsData; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1BinListResponse && equalTo((V1BinListResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1BinListResponse other) { + return cardsData.equals(other.cardsData); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardsData); + } + + @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> cardsData = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1BinListResponse other) { + cardsData(other.getCardsData()); + return this; + } + + /** + *

Card metadata associated with the specified BIN.

+ */ + @JsonSetter(value = "cards_data", nulls = Nulls.SKIP) + public Builder cardsData(Optional> cardsData) { + this.cardsData = cardsData; + return this; + } + + public Builder cardsData(List cardsData) { + this.cardsData = Optional.ofNullable(cardsData); + return this; + } + + public V1BinListResponse build() { + return new V1BinListResponse(cardsData, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java new file mode 100644 index 00000000..5f781686 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1BulkDeleteRecordResponse.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1BulkDeleteRecordResponse.Builder.class) +public final class V1BulkDeleteRecordResponse { + private final Optional> recordIdResponse; + + private final Map additionalProperties; + + private V1BulkDeleteRecordResponse( + Optional> recordIdResponse, Map additionalProperties) { + this.recordIdResponse = recordIdResponse; + this.additionalProperties = additionalProperties; + } + + /** + * @return IDs for the deleted records, or * if all records were deleted. + */ + @JsonProperty("RecordIDResponse") + public Optional> getRecordIdResponse() { + return recordIdResponse; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1BulkDeleteRecordResponse && equalTo((V1BulkDeleteRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1BulkDeleteRecordResponse other) { + return recordIdResponse.equals(other.recordIdResponse); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.recordIdResponse); + } + + @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> recordIdResponse = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1BulkDeleteRecordResponse other) { + recordIdResponse(other.getRecordIdResponse()); + return this; + } + + /** + *

IDs for the deleted records, or * if all records were deleted.

+ */ + @JsonSetter(value = "RecordIDResponse", nulls = Nulls.SKIP) + public Builder recordIdResponse(Optional> recordIdResponse) { + this.recordIdResponse = recordIdResponse; + return this; + } + + public Builder recordIdResponse(List recordIdResponse) { + this.recordIdResponse = Optional.ofNullable(recordIdResponse); + return this; + } + + public V1BulkDeleteRecordResponse build() { + return new V1BulkDeleteRecordResponse(recordIdResponse, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java new file mode 100644 index 00000000..70d31034 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1BulkGetRecordResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1BulkGetRecordResponse.Builder.class) +public final class V1BulkGetRecordResponse { + private final Optional> records; + + private final Map additionalProperties; + + private V1BulkGetRecordResponse(Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return The specified records. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1BulkGetRecordResponse && equalTo((V1BulkGetRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1BulkGetRecordResponse other) { + return records.equals(other.records); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.records); + } + + @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> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1BulkGetRecordResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

The specified records.

+ */ + @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 V1BulkGetRecordResponse build() { + return new V1BulkGetRecordResponse(records, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1Byot.java b/src/main/java/com/skyflow/generated/rest/types/V1Byot.java new file mode 100644 index 00000000..819fdb42 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1Byot.java @@ -0,0 +1,26 @@ +/** + * 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 V1Byot { + DISABLE("DISABLE"), + + ENABLE("ENABLE"), + + ENABLE_STRICT("ENABLE_STRICT"); + + private final String value; + + V1Byot(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1Card.java b/src/main/java/com/skyflow/generated/rest/types/V1Card.java new file mode 100644 index 00000000..d19d3099 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1Card.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1Card.Builder.class) +public final class V1Card { + private final Optional bin; + + private final Optional issuerName; + + private final Optional countryCode; + + private final Optional currency; + + private final Optional cardType; + + private final Optional cardCategory; + + private final Optional cardScheme; + + private final Optional cardLastFourDigits; + + private final Optional cardExpiry; + + private final Map additionalProperties; + + private V1Card( + Optional bin, + Optional issuerName, + Optional countryCode, + Optional currency, + Optional cardType, + Optional cardCategory, + Optional cardScheme, + Optional cardLastFourDigits, + Optional cardExpiry, + Map additionalProperties) { + this.bin = bin; + this.issuerName = issuerName; + this.countryCode = countryCode; + this.currency = currency; + this.cardType = cardType; + this.cardCategory = cardCategory; + this.cardScheme = cardScheme; + this.cardLastFourDigits = cardLastFourDigits; + this.cardExpiry = cardExpiry; + this.additionalProperties = additionalProperties; + } + + /** + * @return BIN of the card. + */ + @JsonProperty("BIN") + public Optional getBin() { + return bin; + } + + /** + * @return Name of the card issuer bank. + */ + @JsonProperty("issuer_name") + public Optional getIssuerName() { + return issuerName; + } + + /** + * @return Country code of the card. + */ + @JsonProperty("country_code") + public Optional getCountryCode() { + return countryCode; + } + + /** + * @return Currency of the card. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Type of the card. + */ + @JsonProperty("card_type") + public Optional getCardType() { + return cardType; + } + + /** + * @return Category of the card. + */ + @JsonProperty("card_category") + public Optional getCardCategory() { + return cardCategory; + } + + /** + * @return Scheme of the card. + */ + @JsonProperty("card_scheme") + public Optional getCardScheme() { + return cardScheme; + } + + /** + * @return Last four digits of the card number. + */ + @JsonProperty("card_last_four_digits") + public Optional getCardLastFourDigits() { + return cardLastFourDigits; + } + + /** + * @return Expiry date of the card. + */ + @JsonProperty("card_expiry") + public Optional getCardExpiry() { + return cardExpiry; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1Card && equalTo((V1Card) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1Card other) { + return bin.equals(other.bin) + && issuerName.equals(other.issuerName) + && countryCode.equals(other.countryCode) + && currency.equals(other.currency) + && cardType.equals(other.cardType) + && cardCategory.equals(other.cardCategory) + && cardScheme.equals(other.cardScheme) + && cardLastFourDigits.equals(other.cardLastFourDigits) + && cardExpiry.equals(other.cardExpiry); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bin, + this.issuerName, + this.countryCode, + this.currency, + this.cardType, + this.cardCategory, + this.cardScheme, + this.cardLastFourDigits, + this.cardExpiry); + } + + @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 bin = Optional.empty(); + + private Optional issuerName = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional cardType = Optional.empty(); + + private Optional cardCategory = Optional.empty(); + + private Optional cardScheme = Optional.empty(); + + private Optional cardLastFourDigits = Optional.empty(); + + private Optional cardExpiry = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1Card other) { + bin(other.getBin()); + issuerName(other.getIssuerName()); + countryCode(other.getCountryCode()); + currency(other.getCurrency()); + cardType(other.getCardType()); + cardCategory(other.getCardCategory()); + cardScheme(other.getCardScheme()); + cardLastFourDigits(other.getCardLastFourDigits()); + cardExpiry(other.getCardExpiry()); + return this; + } + + /** + *

BIN of the card.

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

Name of the card issuer bank.

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

Country code of the card.

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

Currency of the card.

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

Type of the card.

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

Category of the card.

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

Scheme of the card.

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

Last four digits of the card number.

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

Expiry date of the card.

+ */ + @JsonSetter(value = "card_expiry", nulls = Nulls.SKIP) + public Builder cardExpiry(Optional cardExpiry) { + this.cardExpiry = cardExpiry; + return this; + } + + public Builder cardExpiry(String cardExpiry) { + this.cardExpiry = Optional.ofNullable(cardExpiry); + return this; + } + + public V1Card build() { + return new V1Card( + bin, + issuerName, + countryCode, + currency, + cardType, + cardCategory, + cardScheme, + cardLastFourDigits, + cardExpiry, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java new file mode 100644 index 00000000..efdb8e42 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DeleteFileResponse.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1DeleteFileResponse.Builder.class) +public final class V1DeleteFileResponse { + private final Optional skyflowId; + + private final Optional deleted; + + private final Map additionalProperties; + + private V1DeleteFileResponse( + Optional skyflowId, Optional deleted, Map additionalProperties) { + this.skyflowId = skyflowId; + this.deleted = deleted; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the record. + */ + @JsonProperty("skyflow_id") + public Optional getSkyflowId() { + return skyflowId; + } + + /** + * @return If true, the file was deleted. + */ + @JsonProperty("deleted") + public Optional getDeleted() { + return deleted; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DeleteFileResponse && equalTo((V1DeleteFileResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DeleteFileResponse other) { + return skyflowId.equals(other.skyflowId) && deleted.equals(other.deleted); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.skyflowId, this.deleted); + } + + @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 skyflowId = Optional.empty(); + + private Optional deleted = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DeleteFileResponse other) { + skyflowId(other.getSkyflowId()); + deleted(other.getDeleted()); + return this; + } + + /** + *

ID of the record.

+ */ + @JsonSetter(value = "skyflow_id", 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; + } + + /** + *

If true, the file was deleted.

+ */ + @JsonSetter(value = "deleted", nulls = Nulls.SKIP) + public Builder deleted(Optional deleted) { + this.deleted = deleted; + return this; + } + + public Builder deleted(Boolean deleted) { + this.deleted = Optional.ofNullable(deleted); + return this; + } + + public V1DeleteFileResponse build() { + return new V1DeleteFileResponse(skyflowId, deleted, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java new file mode 100644 index 00000000..700bfe2f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DeleteRecordResponse.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1DeleteRecordResponse.Builder.class) +public final class V1DeleteRecordResponse { + private final Optional skyflowId; + + private final Optional deleted; + + private final Map additionalProperties; + + private V1DeleteRecordResponse( + Optional skyflowId, Optional deleted, Map additionalProperties) { + this.skyflowId = skyflowId; + this.deleted = deleted; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the deleted record. + */ + @JsonProperty("skyflow_id") + public Optional getSkyflowId() { + return skyflowId; + } + + /** + * @return If true, the record was deleted. + */ + @JsonProperty("deleted") + public Optional getDeleted() { + return deleted; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DeleteRecordResponse && equalTo((V1DeleteRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DeleteRecordResponse other) { + return skyflowId.equals(other.skyflowId) && deleted.equals(other.deleted); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.skyflowId, this.deleted); + } + + @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 skyflowId = Optional.empty(); + + private Optional deleted = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DeleteRecordResponse other) { + skyflowId(other.getSkyflowId()); + deleted(other.getDeleted()); + return this; + } + + /** + *

ID of the deleted record.

+ */ + @JsonSetter(value = "skyflow_id", 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; + } + + /** + *

If true, the record was deleted.

+ */ + @JsonSetter(value = "deleted", nulls = Nulls.SKIP) + public Builder deleted(Optional deleted) { + this.deleted = deleted; + return this; + } + + public Builder deleted(Boolean deleted) { + this.deleted = Optional.ofNullable(deleted); + return this; + } + + public V1DeleteRecordResponse build() { + return new V1DeleteRecordResponse(skyflowId, deleted, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java new file mode 100644 index 00000000..0c309cb9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetectFileResponse.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1DetectFileResponse.Builder.class) +public final class V1DetectFileResponse { + private final Optional statusUrl; + + private final Map additionalProperties; + + private V1DetectFileResponse(Optional statusUrl, Map additionalProperties) { + this.statusUrl = statusUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Status URL for the deidentification request. + */ + @JsonProperty("status_url") + public Optional getStatusUrl() { + return statusUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetectFileResponse && equalTo((V1DetectFileResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetectFileResponse other) { + return statusUrl.equals(other.statusUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.statusUrl); + } + + @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 statusUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DetectFileResponse other) { + statusUrl(other.getStatusUrl()); + return this; + } + + /** + *

Status URL for the deidentification request.

+ */ + @JsonSetter(value = "status_url", nulls = Nulls.SKIP) + public Builder statusUrl(Optional statusUrl) { + this.statusUrl = statusUrl; + return this; + } + + public Builder statusUrl(String statusUrl) { + this.statusUrl = Optional.ofNullable(statusUrl); + return this; + } + + public V1DetectFileResponse build() { + return new V1DetectFileResponse(statusUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.java new file mode 100644 index 00000000..95e7845c --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponse.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.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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1DetectStatusResponse.Builder.class) +public final class V1DetectStatusResponse { + private final Optional status; + + private final Optional> output; + + private final Optional message; + + private final Map additionalProperties; + + private V1DetectStatusResponse( + Optional status, + Optional> output, + Optional message, + Map additionalProperties) { + this.status = status; + this.output = output; + this.message = message; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return How the input file was specified. + */ + @JsonProperty("output") + public Optional> getOutput() { + return output; + } + + /** + * @return Status details about the deidentification request. + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetectStatusResponse && equalTo((V1DetectStatusResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetectStatusResponse other) { + return status.equals(other.status) && output.equals(other.output) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status, this.output, this.message); + } + + @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 status = Optional.empty(); + + private Optional> output = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DetectStatusResponse other) { + status(other.getStatus()); + output(other.getOutput()); + message(other.getMessage()); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(V1DetectStatusResponseStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

How the input file was specified.

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

Status details about the deidentification request.

+ */ + @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; + } + + public V1DetectStatusResponse build() { + return new V1DetectStatusResponse(status, output, message, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java b/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java new file mode 100644 index 00000000..c819b167 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetectStatusResponseStatus.java @@ -0,0 +1,28 @@ +/** + * 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 V1DetectStatusResponseStatus { + UNKNOWN("UNKNOWN"), + + FAILED("FAILED"), + + SUCCESS("SUCCESS"), + + IN_PROGRESS("IN_PROGRESS"); + + private final String value; + + V1DetectStatusResponseStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java b/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java new file mode 100644 index 00000000..57778d80 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetectTextRequest.java @@ -0,0 +1,522 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.rest.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1DetectTextRequest.Builder.class) +public final class V1DetectTextRequest { + private final String text; + + private final String vaultId; + + private final Optional sessionId; + + private final Optional> restrictEntityTypes; + + private final Optional deidentifyTokenFormat; + + private final Optional> allowRegex; + + private final Optional> restrictRegex; + + private final Optional returnEntities; + + private final Optional accuracy; + + private final Optional advancedOptions; + + private final Optional storeEntities; + + private final Map additionalProperties; + + private V1DetectTextRequest( + String text, + String vaultId, + Optional sessionId, + Optional> restrictEntityTypes, + Optional deidentifyTokenFormat, + Optional> allowRegex, + Optional> restrictRegex, + Optional returnEntities, + Optional accuracy, + Optional advancedOptions, + Optional storeEntities, + Map additionalProperties) { + this.text = text; + this.vaultId = vaultId; + this.sessionId = sessionId; + this.restrictEntityTypes = restrictEntityTypes; + this.deidentifyTokenFormat = deidentifyTokenFormat; + this.allowRegex = allowRegex; + this.restrictRegex = restrictRegex; + this.returnEntities = returnEntities; + this.accuracy = accuracy; + this.advancedOptions = advancedOptions; + this.storeEntities = storeEntities; + this.additionalProperties = additionalProperties; + } + + /** + * @return Data to deidentify. + */ + @JsonProperty("text") + public String getText() { + return text; + } + + /** + * @return ID of the vault. + */ + @JsonProperty("vault_id") + public String getVaultId() { + return vaultId; + } + + /** + * @return Will give a handle to delete the tokens generated during a specific interaction. + */ + @JsonProperty("session_id") + public Optional getSessionId() { + return sessionId; + } + + /** + * @return Entities to detect and deidentify. + */ + @JsonProperty("restrict_entity_types") + public Optional> getRestrictEntityTypes() { + return restrictEntityTypes; + } + + @JsonProperty("deidentify_token_format") + public Optional getDeidentifyTokenFormat() { + return deidentifyTokenFormat; + } + + /** + * @return Regular expressions to ignore when detecting entities. + */ + @JsonProperty("allow_regex") + public Optional> getAllowRegex() { + return allowRegex; + } + + /** + * @return Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'. + */ + @JsonProperty("restrict_regex") + public Optional> getRestrictRegex() { + return restrictRegex; + } + + /** + * @return If true, returns the details for the detected entities. + */ + @JsonProperty("return_entities") + public Optional getReturnEntities() { + return returnEntities; + } + + @JsonProperty("accuracy") + public Optional getAccuracy() { + return accuracy; + } + + @JsonProperty("advanced_options") + public Optional getAdvancedOptions() { + return advancedOptions; + } + + /** + * @return Indicates whether entities should be stored in the vault. + */ + @JsonProperty("store_entities") + public Optional getStoreEntities() { + return storeEntities; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetectTextRequest && equalTo((V1DetectTextRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetectTextRequest other) { + return text.equals(other.text) + && vaultId.equals(other.vaultId) + && sessionId.equals(other.sessionId) + && restrictEntityTypes.equals(other.restrictEntityTypes) + && deidentifyTokenFormat.equals(other.deidentifyTokenFormat) + && allowRegex.equals(other.allowRegex) + && restrictRegex.equals(other.restrictRegex) + && returnEntities.equals(other.returnEntities) + && accuracy.equals(other.accuracy) + && advancedOptions.equals(other.advancedOptions) + && storeEntities.equals(other.storeEntities); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.text, + this.vaultId, + this.sessionId, + this.restrictEntityTypes, + this.deidentifyTokenFormat, + this.allowRegex, + this.restrictRegex, + this.returnEntities, + this.accuracy, + this.advancedOptions, + this.storeEntities); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + * Data to deidentify. + */ + VaultIdStage text(@NotNull String text); + + Builder from(V1DetectTextRequest other); + } + + public interface VaultIdStage { + /** + * ID of the vault. + */ + _FinalStage vaultId(@NotNull String vaultId); + } + + public interface _FinalStage { + V1DetectTextRequest build(); + + /** + *

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

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

Entities to detect and deidentify.

+ */ + _FinalStage restrictEntityTypes(Optional> restrictEntityTypes); + + _FinalStage restrictEntityTypes(List restrictEntityTypes); + + _FinalStage deidentifyTokenFormat(Optional deidentifyTokenFormat); + + _FinalStage deidentifyTokenFormat(DetectRequestDeidentifyOption deidentifyTokenFormat); + + /** + *

Regular expressions to ignore when detecting entities.

+ */ + _FinalStage allowRegex(Optional> allowRegex); + + _FinalStage allowRegex(List allowRegex); + + /** + *

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

+ */ + _FinalStage restrictRegex(Optional> restrictRegex); + + _FinalStage restrictRegex(List restrictRegex); + + /** + *

If true, returns the details for the detected entities.

+ */ + _FinalStage returnEntities(Optional returnEntities); + + _FinalStage returnEntities(Boolean returnEntities); + + _FinalStage accuracy(Optional accuracy); + + _FinalStage accuracy(DetectDataAccuracy accuracy); + + _FinalStage advancedOptions(Optional advancedOptions); + + _FinalStage advancedOptions(V1AdvancedOptions advancedOptions); + + /** + *

Indicates whether entities should be stored in the vault.

+ */ + _FinalStage storeEntities(Optional storeEntities); + + _FinalStage storeEntities(Boolean storeEntities); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, VaultIdStage, _FinalStage { + private String text; + + private String vaultId; + + private Optional storeEntities = Optional.empty(); + + private Optional advancedOptions = Optional.empty(); + + private Optional accuracy = Optional.empty(); + + private Optional returnEntities = Optional.empty(); + + private Optional> restrictRegex = Optional.empty(); + + private Optional> allowRegex = Optional.empty(); + + private Optional deidentifyTokenFormat = Optional.empty(); + + private Optional> restrictEntityTypes = Optional.empty(); + + private Optional sessionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(V1DetectTextRequest other) { + text(other.getText()); + vaultId(other.getVaultId()); + sessionId(other.getSessionId()); + restrictEntityTypes(other.getRestrictEntityTypes()); + deidentifyTokenFormat(other.getDeidentifyTokenFormat()); + allowRegex(other.getAllowRegex()); + restrictRegex(other.getRestrictRegex()); + returnEntities(other.getReturnEntities()); + accuracy(other.getAccuracy()); + advancedOptions(other.getAdvancedOptions()); + storeEntities(other.getStoreEntities()); + return this; + } + + /** + * Data to deidentify.

Data to deidentify.

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

ID of the vault.

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

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 + public _FinalStage storeEntities(Boolean storeEntities) { + this.storeEntities = Optional.ofNullable(storeEntities); + return this; + } + + /** + *

Indicates whether entities should be stored in the vault.

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

If true, returns the details for the detected entities.

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

If true, returns the details for the detected entities.

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

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

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

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

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

Regular expressions to ignore when detecting entities.

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

Regular expressions to ignore when detecting entities.

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

Entities to detect and deidentify.

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

Entities to detect and deidentify.

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

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

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

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

+ */ + @java.lang.Override + @JsonSetter(value = "session_id", nulls = Nulls.SKIP) + public _FinalStage sessionId(Optional sessionId) { + this.sessionId = sessionId; + return this; + } + + @java.lang.Override + public V1DetectTextRequest build() { + return new V1DetectTextRequest( + text, + vaultId, + sessionId, + restrictEntityTypes, + deidentifyTokenFormat, + allowRegex, + restrictRegex, + returnEntities, + accuracy, + advancedOptions, + storeEntities, + additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java new file mode 100644 index 00000000..a07c3344 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetectTextResponse.java @@ -0,0 +1,133 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1DetectTextResponse.Builder.class) +public final class V1DetectTextResponse { + private final Optional processedText; + + private final Optional> entities; + + private final Map additionalProperties; + + private V1DetectTextResponse( + Optional processedText, + Optional> entities, + Map additionalProperties) { + this.processedText = processedText; + this.entities = entities; + this.additionalProperties = additionalProperties; + } + + /** + * @return Deidentified text. If the input was a file, text that was extracted or transcribed from the file and deidentified. + */ + @JsonProperty("processed_text") + public Optional getProcessedText() { + return processedText; + } + + /** + * @return Detected entities. + */ + @JsonProperty("entities") + public Optional> getEntities() { + return entities; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetectTextResponse && equalTo((V1DetectTextResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetectTextResponse other) { + return processedText.equals(other.processedText) && entities.equals(other.entities); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.processedText, this.entities); + } + + @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 processedText = Optional.empty(); + + private Optional> entities = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DetectTextResponse other) { + processedText(other.getProcessedText()); + entities(other.getEntities()); + return this; + } + + /** + *

Deidentified text. If the input was a file, text that was extracted or transcribed from the file and deidentified.

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

Detected entities.

+ */ + @JsonSetter(value = "entities", nulls = Nulls.SKIP) + public Builder entities(Optional> entities) { + this.entities = entities; + return this; + } + + public Builder entities(List entities) { + this.entities = Optional.ofNullable(entities); + return this; + } + + public V1DetectTextResponse build() { + return new V1DetectTextResponse(processedText, entities, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java b/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java new file mode 100644 index 00000000..5b6927d1 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordRequest.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1DetokenizeRecordRequest.Builder.class) +public final class V1DetokenizeRecordRequest { + private final Optional token; + + private final Optional redaction; + + private final Map additionalProperties; + + private V1DetokenizeRecordRequest( + Optional token, + Optional redaction, + Map additionalProperties) { + this.token = token; + this.redaction = redaction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Token that identifies the record to detokenize. + */ + @JsonProperty("token") + public Optional getToken() { + return token; + } + + @JsonProperty("redaction") + public Optional getRedaction() { + return redaction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetokenizeRecordRequest && equalTo((V1DetokenizeRecordRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetokenizeRecordRequest other) { + return token.equals(other.token) && redaction.equals(other.redaction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.token, this.redaction); + } + + @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 token = Optional.empty(); + + private Optional redaction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DetokenizeRecordRequest other) { + token(other.getToken()); + redaction(other.getRedaction()); + return this; + } + + /** + *

Token that identifies the record to detokenize.

+ */ + @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 = "redaction", nulls = Nulls.SKIP) + public Builder redaction(Optional redaction) { + this.redaction = redaction; + return this; + } + + public Builder redaction(RedactionEnumRedaction redaction) { + this.redaction = Optional.ofNullable(redaction); + return this; + } + + public V1DetokenizeRecordRequest build() { + return new V1DetokenizeRecordRequest(token, redaction, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java new file mode 100644 index 00000000..423abfe8 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeRecordResponse.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1DetokenizeRecordResponse.Builder.class) +public final class V1DetokenizeRecordResponse { + private final Optional token; + + private final Optional valueType; + + private final Optional value; + + private final Optional error; + + private final Map additionalProperties; + + private V1DetokenizeRecordResponse( + Optional token, + Optional valueType, + Optional value, + Optional error, + Map additionalProperties) { + this.token = token; + this.valueType = valueType; + this.value = value; + this.error = error; + this.additionalProperties = additionalProperties; + } + + /** + * @return Token of the record. + */ + @JsonProperty("token") + public Optional getToken() { + return token; + } + + @JsonProperty("valueType") + public Optional getValueType() { + return valueType; + } + + /** + * @return Data corresponding to the token. + */ + @JsonProperty("value") + public Optional getValue() { + return value; + } + + /** + * @return Error if token isn't found. + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetokenizeRecordResponse && equalTo((V1DetokenizeRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetokenizeRecordResponse other) { + return token.equals(other.token) + && valueType.equals(other.valueType) + && value.equals(other.value) + && error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.token, this.valueType, this.value, this.error); + } + + @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 token = Optional.empty(); + + private Optional valueType = Optional.empty(); + + private Optional value = Optional.empty(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DetokenizeRecordResponse other) { + token(other.getToken()); + valueType(other.getValueType()); + value(other.getValue()); + error(other.getError()); + return this; + } + + /** + *

Token of the record.

+ */ + @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 = "valueType", nulls = Nulls.SKIP) + public Builder valueType(Optional valueType) { + this.valueType = valueType; + return this; + } + + public Builder valueType(DetokenizeRecordResponseValueType valueType) { + this.valueType = Optional.ofNullable(valueType); + return this; + } + + /** + *

Data corresponding to the token.

+ */ + @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 token isn't found.

+ */ + @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; + } + + public V1DetokenizeRecordResponse build() { + return new V1DetokenizeRecordResponse(token, valueType, value, error, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java new file mode 100644 index 00000000..20d7d8e4 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1DetokenizeResponse.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1DetokenizeResponse.Builder.class) +public final class V1DetokenizeResponse { + private final Optional> records; + + private final Map additionalProperties; + + private V1DetokenizeResponse( + Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return Records corresponding to the specified tokens. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1DetokenizeResponse && equalTo((V1DetokenizeResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1DetokenizeResponse other) { + return records.equals(other.records); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.records); + } + + @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> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1DetokenizeResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

Records corresponding to the specified tokens.

+ */ + @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 V1DetokenizeResponse build() { + return new V1DetokenizeResponse(records, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java b/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java new file mode 100644 index 00000000..8d520d3b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1FieldRecords.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1FieldRecords.Builder.class) +public final class V1FieldRecords { + private final Optional> fields; + + private final Optional> tokens; + + private final Map additionalProperties; + + private V1FieldRecords( + Optional> fields, + Optional> tokens, + Map additionalProperties) { + this.fields = fields; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return Fields and values for the record. For example, {'field_1':'value_1', 'field_2':'value_2'}. + */ + @JsonProperty("fields") + public Optional> getFields() { + return fields; + } + + /** + * @return Fields and tokens for the record. For example, {'field_1':'token_1', 'field_2':'token_2'}. + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1FieldRecords && equalTo((V1FieldRecords) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1FieldRecords other) { + return fields.equals(other.fields) && tokens.equals(other.tokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fields, this.tokens); + } + + @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> fields = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1FieldRecords other) { + fields(other.getFields()); + tokens(other.getTokens()); + return this; + } + + /** + *

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

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

Fields and tokens for the record. For example, {'field_1':'token_1', 'field_2':'token_2'}.

+ */ + @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 V1FieldRecords build() { + return new V1FieldRecords(fields, tokens, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java b/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java new file mode 100644 index 00000000..afe545fe --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1FileAvScanStatus.java @@ -0,0 +1,38 @@ +/** + * 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 V1FileAvScanStatus { + SCAN_NONE("SCAN_NONE"), + + SCAN_CLEAN("SCAN_CLEAN"), + + SCAN_INFECTED("SCAN_INFECTED"), + + SCAN_DELETED("SCAN_DELETED"), + + SCAN_ERROR("SCAN_ERROR"), + + SCAN_PENDING("SCAN_PENDING"), + + SCAN_UNSCANNABLE("SCAN_UNSCANNABLE"), + + SCAN_FILE_NOT_FOUND("SCAN_FILE_NOT_FOUND"), + + SCAN_INVALID("SCAN_INVALID"); + + private final String value; + + V1FileAvScanStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java b/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java new file mode 100644 index 00000000..a384af7f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1FileDataFormat.java @@ -0,0 +1,58 @@ +/** + * 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 V1FileDataFormat { + BMP("bmp"), + + CSV("csv"), + + DOC("doc"), + + DOCX("docx"), + + JPEG("jpeg"), + + JPG("jpg"), + + JSON("json"), + + MP_3("mp3"), + + PDF("pdf"), + + PNG("png"), + + PPT("ppt"), + + PPTX("pptx"), + + TIF("tif"), + + TIFF("tiff"), + + TXT("txt"), + + UNKNOWN("unknown"), + + WAV("wav"), + + XLS("xls"), + + XLSX("xlsx"); + + private final String value; + + V1FileDataFormat(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java new file mode 100644 index 00000000..9b6be70b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1GetAuthTokenResponse.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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/generated/rest/types/V1GetFileScanStatusResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.java new file mode 100644 index 00000000..27100e6d --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1GetFileScanStatusResponse.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.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; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1GetFileScanStatusResponse.Builder.class) +public final class V1GetFileScanStatusResponse { + private final Optional avScanStatus; + + private final Map additionalProperties; + + private V1GetFileScanStatusResponse( + Optional avScanStatus, Map additionalProperties) { + this.avScanStatus = avScanStatus; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("av_scan_status") + public Optional getAvScanStatus() { + return avScanStatus; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1GetFileScanStatusResponse && equalTo((V1GetFileScanStatusResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1GetFileScanStatusResponse other) { + return avScanStatus.equals(other.avScanStatus); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.avScanStatus); + } + + @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 avScanStatus = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1GetFileScanStatusResponse other) { + avScanStatus(other.getAvScanStatus()); + return this; + } + + @JsonSetter(value = "av_scan_status", nulls = Nulls.SKIP) + public Builder avScanStatus(Optional avScanStatus) { + this.avScanStatus = avScanStatus; + return this; + } + + public Builder avScanStatus(V1FileAvScanStatus avScanStatus) { + this.avScanStatus = Optional.ofNullable(avScanStatus); + return this; + } + + public V1GetFileScanStatusResponse build() { + return new V1GetFileScanStatusResponse(avScanStatus, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java new file mode 100644 index 00000000..6a8689ae --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1GetQueryResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1GetQueryResponse.Builder.class) +public final class V1GetQueryResponse { + private final Optional> records; + + private final Map additionalProperties; + + private V1GetQueryResponse(Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return Records returned by the query. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1GetQueryResponse && equalTo((V1GetQueryResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1GetQueryResponse other) { + return records.equals(other.records); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.records); + } + + @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> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1GetQueryResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

Records returned by the 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 V1GetQueryResponse build() { + return new V1GetQueryResponse(records, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java b/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java new file mode 100644 index 00000000..cd40fb5b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1ImageOptions.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1ImageOptions.Builder.class) +public final class V1ImageOptions { + private final Optional outputProcessedImage; + + private final Optional outputOcrText; + + private final Map additionalProperties; + + private V1ImageOptions( + Optional outputProcessedImage, + Optional outputOcrText, + Map additionalProperties) { + this.outputProcessedImage = outputProcessedImage; + this.outputOcrText = outputOcrText; + this.additionalProperties = additionalProperties; + } + + /** + * @return If true, includes processed image in the output. + */ + @JsonProperty("output_processed_image") + public Optional getOutputProcessedImage() { + return outputProcessedImage; + } + + /** + * @return If true, includes OCR text output in the response. + */ + @JsonProperty("output_ocr_text") + public Optional getOutputOcrText() { + return outputOcrText; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1ImageOptions && equalTo((V1ImageOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1ImageOptions other) { + return outputProcessedImage.equals(other.outputProcessedImage) && outputOcrText.equals(other.outputOcrText); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.outputProcessedImage, this.outputOcrText); + } + + @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 outputProcessedImage = Optional.empty(); + + private Optional outputOcrText = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1ImageOptions other) { + outputProcessedImage(other.getOutputProcessedImage()); + outputOcrText(other.getOutputOcrText()); + return this; + } + + /** + *

If true, includes processed image in the output.

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

If true, includes OCR text output in the response.

+ */ + @JsonSetter(value = "output_ocr_text", nulls = Nulls.SKIP) + public Builder outputOcrText(Optional outputOcrText) { + this.outputOcrText = outputOcrText; + return this; + } + + public Builder outputOcrText(Boolean outputOcrText) { + this.outputOcrText = Optional.ofNullable(outputOcrText); + return this; + } + + public V1ImageOptions build() { + return new V1ImageOptions(outputProcessedImage, outputOcrText, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java new file mode 100644 index 00000000..724bee91 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1InsertRecordResponse.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1InsertRecordResponse.Builder.class) +public final class V1InsertRecordResponse { + private final Optional> records; + + private final Map additionalProperties; + + private V1InsertRecordResponse( + Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return Identifiers for the inserted records. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1InsertRecordResponse && equalTo((V1InsertRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1InsertRecordResponse other) { + return records.equals(other.records); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.records); + } + + @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> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1InsertRecordResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

Identifiers for the inserted records.

+ */ + @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 V1InsertRecordResponse build() { + return new V1InsertRecordResponse(records, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1Locations.java b/src/main/java/com/skyflow/generated/rest/types/V1Locations.java new file mode 100644 index 00000000..ef1593ca --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1Locations.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1Locations.Builder.class) +public final class V1Locations { + private final Optional startIndex; + + private final Optional endIndex; + + private final Optional startIndexProcessed; + + private final Optional endIndexProcessed; + + private final Map additionalProperties; + + private V1Locations( + Optional startIndex, + Optional endIndex, + Optional startIndexProcessed, + Optional endIndexProcessed, + Map additionalProperties) { + this.startIndex = startIndex; + this.endIndex = endIndex; + this.startIndexProcessed = startIndexProcessed; + this.endIndexProcessed = endIndexProcessed; + this.additionalProperties = additionalProperties; + } + + /** + * @return Index of the first character of the string in the original text. + */ + @JsonProperty("start_index") + public Optional getStartIndex() { + return startIndex; + } + + /** + * @return Index of the last character of the string in the original text. + */ + @JsonProperty("end_index") + public Optional getEndIndex() { + return endIndex; + } + + /** + * @return Index of the first character of the string in the processed text. + */ + @JsonProperty("start_index_processed") + public Optional getStartIndexProcessed() { + return startIndexProcessed; + } + + /** + * @return Index of the last character of the string in the processed text. + */ + @JsonProperty("end_index_processed") + public Optional getEndIndexProcessed() { + return endIndexProcessed; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1Locations && equalTo((V1Locations) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1Locations other) { + return startIndex.equals(other.startIndex) + && endIndex.equals(other.endIndex) + && startIndexProcessed.equals(other.startIndexProcessed) + && endIndexProcessed.equals(other.endIndexProcessed); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.startIndex, this.endIndex, this.startIndexProcessed, this.endIndexProcessed); + } + + @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 startIndex = Optional.empty(); + + private Optional endIndex = Optional.empty(); + + private Optional startIndexProcessed = Optional.empty(); + + private Optional endIndexProcessed = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1Locations other) { + startIndex(other.getStartIndex()); + endIndex(other.getEndIndex()); + startIndexProcessed(other.getStartIndexProcessed()); + endIndexProcessed(other.getEndIndexProcessed()); + return this; + } + + /** + *

Index of the first character of the string in the original text.

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

Index of the last character of the string in the original text.

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

Index of the first character of the string in the processed text.

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

Index of the last character of the string in the processed text.

+ */ + @JsonSetter(value = "end_index_processed", nulls = Nulls.SKIP) + public Builder endIndexProcessed(Optional endIndexProcessed) { + this.endIndexProcessed = endIndexProcessed; + return this; + } + + public Builder endIndexProcessed(Integer endIndexProcessed) { + this.endIndexProcessed = Optional.ofNullable(endIndexProcessed); + return this; + } + + public V1Locations build() { + return new V1Locations(startIndex, endIndex, startIndexProcessed, endIndexProcessed, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java b/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java new file mode 100644 index 00000000..dacca1b9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1MemberType.java @@ -0,0 +1,26 @@ +/** + * 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 V1MemberType { + NONE("NONE"), + + USER("USER"), + + SERVICE_ACCOUNT("SERVICE_ACCOUNT"); + + private final String value; + + V1MemberType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java b/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java new file mode 100644 index 00000000..8731c1b9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1PdfConfig.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1PdfConfig.Builder.class) +public final class V1PdfConfig { + private final Optional options; + + private final Map additionalProperties; + + private V1PdfConfig(Optional options, Map additionalProperties) { + this.options = options; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("options") + public Optional getOptions() { + return options; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1PdfConfig && equalTo((V1PdfConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1PdfConfig other) { + return options.equals(other.options); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options); + } + + @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 options = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1PdfConfig other) { + options(other.getOptions()); + return this; + } + + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional options) { + this.options = options; + return this; + } + + public Builder options(V1PdfOptions options) { + this.options = Optional.ofNullable(options); + return this; + } + + public V1PdfConfig build() { + return new V1PdfConfig(options, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java b/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java new file mode 100644 index 00000000..63de909b --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1PdfOptions.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1PdfOptions.Builder.class) +public final class V1PdfOptions { + private final Optional density; + + private final Optional maxResolution; + + private final Map additionalProperties; + + private V1PdfOptions( + Optional density, Optional maxResolution, Map additionalProperties) { + this.density = density; + this.maxResolution = maxResolution; + this.additionalProperties = additionalProperties; + } + + /** + * @return Pixel density at which to process the PDF file. + */ + @JsonProperty("density") + public Optional getDensity() { + return density; + } + + /** + * @return Max resolution at which to process the PDF file. + */ + @JsonProperty("max_resolution") + public Optional getMaxResolution() { + return maxResolution; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1PdfOptions && equalTo((V1PdfOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1PdfOptions other) { + return density.equals(other.density) && maxResolution.equals(other.maxResolution); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.density, this.maxResolution); + } + + @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 density = Optional.empty(); + + private Optional maxResolution = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1PdfOptions other) { + density(other.getDensity()); + maxResolution(other.getMaxResolution()); + return this; + } + + /** + *

Pixel density at which to process the PDF file.

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

Max resolution at which to process the PDF file.

+ */ + @JsonSetter(value = "max_resolution", nulls = Nulls.SKIP) + public Builder maxResolution(Optional maxResolution) { + this.maxResolution = maxResolution; + return this; + } + + public Builder maxResolution(Integer maxResolution) { + this.maxResolution = Optional.ofNullable(maxResolution); + return this; + } + + public V1PdfOptions build() { + return new V1PdfOptions(density, maxResolution, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java b/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java new file mode 100644 index 00000000..e4117109 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1ProcessedFileOutput.java @@ -0,0 +1,151 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1ProcessedFileOutput.Builder.class) +public final class V1ProcessedFileOutput { + private final Optional outputType; + + private final Optional processedFile; + + private final Optional processedFileType; + + private final Map additionalProperties; + + private V1ProcessedFileOutput( + Optional outputType, + Optional processedFile, + Optional processedFileType, + Map additionalProperties) { + this.outputType = outputType; + this.processedFile = processedFile; + this.processedFileType = processedFileType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("output_type") + public Optional getOutputType() { + return outputType; + } + + /** + * @return URL or base64-encoded data of the output. + */ + @JsonProperty("processed_file") + public Optional getProcessedFile() { + return processedFile; + } + + @JsonProperty("processed_file_type") + public Optional getProcessedFileType() { + return processedFileType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1ProcessedFileOutput && equalTo((V1ProcessedFileOutput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1ProcessedFileOutput other) { + return outputType.equals(other.outputType) + && processedFile.equals(other.processedFile) + && processedFileType.equals(other.processedFileType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.outputType, this.processedFile, this.processedFileType); + } + + @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 outputType = Optional.empty(); + + private Optional processedFile = Optional.empty(); + + private Optional processedFileType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1ProcessedFileOutput other) { + outputType(other.getOutputType()); + processedFile(other.getProcessedFile()); + processedFileType(other.getProcessedFileType()); + return this; + } + + @JsonSetter(value = "output_type", nulls = Nulls.SKIP) + public Builder outputType(Optional outputType) { + this.outputType = outputType; + return this; + } + + public Builder outputType(DetectFileRequestDataType outputType) { + this.outputType = Optional.ofNullable(outputType); + return this; + } + + /** + *

URL or base64-encoded data of the output.

+ */ + @JsonSetter(value = "processed_file", nulls = Nulls.SKIP) + public Builder processedFile(Optional processedFile) { + this.processedFile = processedFile; + return this; + } + + public Builder processedFile(String processedFile) { + this.processedFile = Optional.ofNullable(processedFile); + return this; + } + + @JsonSetter(value = "processed_file_type", nulls = Nulls.SKIP) + public Builder processedFileType(Optional processedFileType) { + this.processedFileType = processedFileType; + return this; + } + + public Builder processedFileType(ProcessedFileOutputProcessedFileType processedFileType) { + this.processedFileType = Optional.ofNullable(processedFileType); + return this; + } + + public V1ProcessedFileOutput build() { + return new V1ProcessedFileOutput(outputType, processedFile, processedFileType, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java b/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java new file mode 100644 index 00000000..419b8e16 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1RecordMetaProperties.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1RecordMetaProperties.Builder.class) +public final class V1RecordMetaProperties { + private final Optional skyflowId; + + private final Optional> tokens; + + private final Map additionalProperties; + + private V1RecordMetaProperties( + Optional skyflowId, + Optional> tokens, + Map additionalProperties) { + this.skyflowId = skyflowId; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the inserted record. + */ + @JsonProperty("skyflow_id") + public Optional getSkyflowId() { + return skyflowId; + } + + /** + * @return Tokens for the record. + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1RecordMetaProperties && equalTo((V1RecordMetaProperties) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1RecordMetaProperties other) { + return skyflowId.equals(other.skyflowId) && tokens.equals(other.tokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.skyflowId, this.tokens); + } + + @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 skyflowId = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1RecordMetaProperties other) { + skyflowId(other.getSkyflowId()); + tokens(other.getTokens()); + return this; + } + + /** + *

ID of the inserted record.

+ */ + @JsonSetter(value = "skyflow_id", 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 for the record.

+ */ + @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 V1RecordMetaProperties build() { + return new V1RecordMetaProperties(skyflowId, tokens, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java b/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java new file mode 100644 index 00000000..c02ab39f --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1ResponseEntities.java @@ -0,0 +1,218 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1ResponseEntities.Builder.class) +public final class V1ResponseEntities { + private final Optional processedText; + + private final Optional originalText; + + private final Optional location; + + private final Optional bestLabel; + + private final Optional> labels; + + private final Map additionalProperties; + + private V1ResponseEntities( + Optional processedText, + Optional originalText, + Optional location, + Optional bestLabel, + Optional> labels, + Map additionalProperties) { + this.processedText = processedText; + this.originalText = originalText; + this.location = location; + this.bestLabel = bestLabel; + this.labels = labels; + this.additionalProperties = additionalProperties; + } + + /** + * @return Processed text of the entity. + */ + @JsonProperty("processed_text") + public Optional getProcessedText() { + return processedText; + } + + /** + * @return Original text of the entity. + */ + @JsonProperty("original_text") + public Optional getOriginalText() { + return originalText; + } + + @JsonProperty("location") + public Optional getLocation() { + return location; + } + + /** + * @return Highest rated label. + */ + @JsonProperty("best_label") + public Optional getBestLabel() { + return bestLabel; + } + + /** + * @return Labels and their scores. + */ + @JsonProperty("labels") + public Optional> getLabels() { + return labels; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1ResponseEntities && equalTo((V1ResponseEntities) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1ResponseEntities other) { + return processedText.equals(other.processedText) + && originalText.equals(other.originalText) + && location.equals(other.location) + && bestLabel.equals(other.bestLabel) + && labels.equals(other.labels); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.processedText, this.originalText, this.location, this.bestLabel, this.labels); + } + + @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 processedText = Optional.empty(); + + private Optional originalText = Optional.empty(); + + private Optional location = Optional.empty(); + + private Optional bestLabel = Optional.empty(); + + private Optional> labels = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1ResponseEntities other) { + processedText(other.getProcessedText()); + originalText(other.getOriginalText()); + location(other.getLocation()); + bestLabel(other.getBestLabel()); + labels(other.getLabels()); + return this; + } + + /** + *

Processed text of the entity.

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

Original text of the entity.

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

Highest rated label.

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

Labels and their scores.

+ */ + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public Builder labels(Optional> labels) { + this.labels = labels; + return this; + } + + public Builder labels(Map labels) { + this.labels = Optional.ofNullable(labels); + return this; + } + + public V1ResponseEntities build() { + return new V1ResponseEntities( + processedText, originalText, location, bestLabel, labels, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java b/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java new file mode 100644 index 00000000..03c5ef89 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordRequest.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1TokenizeRecordRequest.Builder.class) +public final class V1TokenizeRecordRequest { + private final Optional value; + + private final Optional columnGroup; + + private final Map additionalProperties; + + private V1TokenizeRecordRequest( + Optional value, Optional columnGroup, Map additionalProperties) { + this.value = value; + this.columnGroup = columnGroup; + this.additionalProperties = additionalProperties; + } + + /** + * @return Existing value to return a token for. + */ + @JsonProperty("value") + public Optional getValue() { + return value; + } + + /** + * @return Name of the column group that the value belongs to. + */ + @JsonProperty("columnGroup") + public Optional getColumnGroup() { + return columnGroup; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1TokenizeRecordRequest && equalTo((V1TokenizeRecordRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1TokenizeRecordRequest other) { + return value.equals(other.value) && columnGroup.equals(other.columnGroup); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value, this.columnGroup); + } + + @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 value = Optional.empty(); + + private Optional columnGroup = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1TokenizeRecordRequest other) { + value(other.getValue()); + columnGroup(other.getColumnGroup()); + return this; + } + + /** + *

Existing value to return a token for.

+ */ + @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; + } + + /** + *

Name of the column group that the value belongs to.

+ */ + @JsonSetter(value = "columnGroup", nulls = Nulls.SKIP) + public Builder columnGroup(Optional columnGroup) { + this.columnGroup = columnGroup; + return this; + } + + public Builder columnGroup(String columnGroup) { + this.columnGroup = Optional.ofNullable(columnGroup); + return this; + } + + public V1TokenizeRecordRequest build() { + return new V1TokenizeRecordRequest(value, columnGroup, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java new file mode 100644 index 00000000..4cd41dd0 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1TokenizeRecordResponse.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1TokenizeRecordResponse.Builder.class) +public final class V1TokenizeRecordResponse { + private final Optional token; + + private final Map additionalProperties; + + private V1TokenizeRecordResponse(Optional token, Map additionalProperties) { + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return Token corresponding to a value. + */ + @JsonProperty("token") + public Optional getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1TokenizeRecordResponse && equalTo((V1TokenizeRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1TokenizeRecordResponse other) { + return token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.token); + } + + @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 token = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1TokenizeRecordResponse other) { + token(other.getToken()); + return this; + } + + /** + *

Token corresponding to a 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; + } + + public V1TokenizeRecordResponse build() { + return new V1TokenizeRecordResponse(token, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java new file mode 100644 index 00000000..38159283 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1TokenizeResponse.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1TokenizeResponse.Builder.class) +public final class V1TokenizeResponse { + private final Optional> records; + + private final Map additionalProperties; + + private V1TokenizeResponse( + Optional> records, Map additionalProperties) { + this.records = records; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tokens corresponding to the specified values. + */ + @JsonProperty("records") + public Optional> getRecords() { + return records; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1TokenizeResponse && equalTo((V1TokenizeResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1TokenizeResponse other) { + return records.equals(other.records); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.records); + } + + @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> records = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1TokenizeResponse other) { + records(other.getRecords()); + return this; + } + + /** + *

Tokens corresponding to the specified values.

+ */ + @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 V1TokenizeResponse build() { + return new V1TokenizeResponse(records, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java b/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java new file mode 100644 index 00000000..658926b9 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1UpdateRecordResponse.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1UpdateRecordResponse.Builder.class) +public final class V1UpdateRecordResponse { + private final Optional skyflowId; + + private final Optional> tokens; + + private final Map additionalProperties; + + private V1UpdateRecordResponse( + Optional skyflowId, + Optional> tokens, + Map additionalProperties) { + this.skyflowId = skyflowId; + this.tokens = tokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the updated record. + */ + @JsonProperty("skyflow_id") + public Optional getSkyflowId() { + return skyflowId; + } + + /** + * @return Tokens for the record. + */ + @JsonProperty("tokens") + public Optional> getTokens() { + return tokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1UpdateRecordResponse && equalTo((V1UpdateRecordResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1UpdateRecordResponse other) { + return skyflowId.equals(other.skyflowId) && tokens.equals(other.tokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.skyflowId, this.tokens); + } + + @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 skyflowId = Optional.empty(); + + private Optional> tokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1UpdateRecordResponse other) { + skyflowId(other.getSkyflowId()); + tokens(other.getTokens()); + return this; + } + + /** + *

ID of the updated record.

+ */ + @JsonSetter(value = "skyflow_id", 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 for the record.

+ */ + @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 V1UpdateRecordResponse build() { + return new V1UpdateRecordResponse(skyflowId, tokens, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java b/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java new file mode 100644 index 00000000..bad4474a --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1VaultFieldMapping.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1VaultFieldMapping.Builder.class) +public final class V1VaultFieldMapping { + private final Optional cardNumber; + + private final Optional cardLastFourDigits; + + private final Optional cardExpiry; + + private final Map additionalProperties; + + private V1VaultFieldMapping( + Optional cardNumber, + Optional cardLastFourDigits, + Optional cardExpiry, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cardLastFourDigits = cardLastFourDigits; + this.cardExpiry = cardExpiry; + this.additionalProperties = additionalProperties; + } + + /** + * @return Name of the column that stores the card number. + */ + @JsonProperty("card_number") + public Optional getCardNumber() { + return cardNumber; + } + + /** + * @return Name of the column that stores the card number suffix. + */ + @JsonProperty("card_last_four_digits") + public Optional getCardLastFourDigits() { + return cardLastFourDigits; + } + + /** + * @return Name of the column that stores the expiry date. + */ + @JsonProperty("card_expiry") + public Optional getCardExpiry() { + return cardExpiry; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1VaultFieldMapping && equalTo((V1VaultFieldMapping) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1VaultFieldMapping other) { + return cardNumber.equals(other.cardNumber) + && cardLastFourDigits.equals(other.cardLastFourDigits) + && cardExpiry.equals(other.cardExpiry); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cardLastFourDigits, this.cardExpiry); + } + + @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 cardNumber = Optional.empty(); + + private Optional cardLastFourDigits = Optional.empty(); + + private Optional cardExpiry = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1VaultFieldMapping other) { + cardNumber(other.getCardNumber()); + cardLastFourDigits(other.getCardLastFourDigits()); + cardExpiry(other.getCardExpiry()); + return this; + } + + /** + *

Name of the column that stores the card number.

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

Name of the column that stores the card number suffix.

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

Name of the column that stores the expiry date.

+ */ + @JsonSetter(value = "card_expiry", nulls = Nulls.SKIP) + public Builder cardExpiry(Optional cardExpiry) { + this.cardExpiry = cardExpiry; + return this; + } + + public Builder cardExpiry(String cardExpiry) { + this.cardExpiry = Optional.ofNullable(cardExpiry); + return this; + } + + public V1VaultFieldMapping build() { + return new V1VaultFieldMapping(cardNumber, cardLastFourDigits, cardExpiry, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java b/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java new file mode 100644 index 00000000..28a609b6 --- /dev/null +++ b/src/main/java/com/skyflow/generated/rest/types/V1VaultSchemaConfig.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.skyflow.generated.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.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 = V1VaultSchemaConfig.Builder.class) +public final class V1VaultSchemaConfig { + private final Optional id; + + private final Optional tableName; + + private final Optional mapping; + + private final Map additionalProperties; + + private V1VaultSchemaConfig( + Optional id, + Optional tableName, + Optional mapping, + Map additionalProperties) { + this.id = id; + this.tableName = tableName; + this.mapping = mapping; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the vault that stores card details. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return Name of the table that stores card details. + */ + @JsonProperty("table_name") + public Optional getTableName() { + return tableName; + } + + @JsonProperty("mapping") + public Optional getMapping() { + return mapping; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1VaultSchemaConfig && equalTo((V1VaultSchemaConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1VaultSchemaConfig other) { + return id.equals(other.id) && tableName.equals(other.tableName) && mapping.equals(other.mapping); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.tableName, this.mapping); + } + + @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 id = Optional.empty(); + + private Optional tableName = Optional.empty(); + + private Optional mapping = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1VaultSchemaConfig other) { + id(other.getId()); + tableName(other.getTableName()); + mapping(other.getMapping()); + return this; + } + + /** + *

ID of the vault that stores card details.

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

Name of the table that stores card details.

+ */ + @JsonSetter(value = "table_name", 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; + } + + @JsonSetter(value = "mapping", nulls = Nulls.SKIP) + public Builder mapping(Optional mapping) { + this.mapping = mapping; + return this; + } + + public Builder mapping(V1VaultFieldMapping mapping) { + this.mapping = Optional.ofNullable(mapping); + return this; + } + + public V1VaultSchemaConfig build() { + return new V1VaultSchemaConfig(id, tableName, mapping, additionalProperties); + } + } +} diff --git a/src/main/java/com/skyflow/logs/ErrorLogs.java b/src/main/java/com/skyflow/logs/ErrorLogs.java index ad588aa0..3415860c 100644 --- a/src/main/java/com/skyflow/logs/ErrorLogs.java +++ b/src/main/java/com/skyflow/logs/ErrorLogs.java @@ -108,6 +108,24 @@ public enum ErrorLogs { EMPTY_REQUEST_BODY("Invalid %s1 request. Request body can not be empty."), INVALID_REQUEST_BODY("Invalid %s1 request. Request body can not be empty."), INVOKE_CONNECTION_REQUEST_REJECTED("Invoke connection request resulted in failure."), + + + // detect interface + INVALID_TEXT_IN_DEIDENTIFY("Invalid %s1 request. The text field is required and must be a non-empty string. Specify a valid text."), + DEIDENTIFY_TEXT_REQUEST_REJECTED("DeIdentify text request resulted in failure."), + INVALID_TEXT_IN_REIDENTIFY("Invalid %s1 request. The text field is required and must be a non-empty string. Specify a valid text."), + REIDENTIFY_TEXT_REQUEST_REJECTED("ReIdentify text request resulted in failure."), + DEIDENTIFY_FILE_REQUEST_REJECTED("DeIdentify file request resulted in failure."), + GET_DETECT_RUN_REQUEST_REJECTED("Get detect run request resulted in failure."), + INVALID_NULL_FILE_IN_DEIDENTIFY_FILE("Invalid %s1 request. The file field is required and must not be null. Specify a valid file."), + FILE_NOT_FOUND_TO_DEIDENTIFY("Invalid %s1 request. The file field is required and must not be empty. Specify a valid file."), + FILE_NOT_READABLE_TO_DEIDENTIFY("Invalid %s1 request. The file is not readable. Please check the file permissions or path."), + INVALID_PIXEL_DENSITY_TO_DEIDENTIFY_FILE("Invalid %s1 request. Pixel density must be a positive integer greater than 0. Specify a valid pixel density."), + INVALID_MAX_RESOLUTION("Invalid %s1 request. Max resolution must be a positive integer greater than 0. Specify a valid max resolution."), + INVALID_BLEEP_TO_DEIDENTIFY_AUDIO("Invalid %s1 request. Specify a valid bleep as AudioBleep"), + 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."), ; private final String log; diff --git a/src/main/java/com/skyflow/logs/InfoLogs.java b/src/main/java/com/skyflow/logs/InfoLogs.java index 5beecfd3..efd81a49 100644 --- a/src/main/java/com/skyflow/logs/InfoLogs.java +++ b/src/main/java/com/skyflow/logs/InfoLogs.java @@ -7,6 +7,7 @@ public enum InfoLogs { VALIDATING_CONNECTION_CONFIG("Validating connection config."), UNABLE_TO_GENERATE_SDK_METRIC("Unable to generate %s1 metric."), VAULT_CONTROLLER_INITIALIZED("Initialized vault controller with vault ID %s1."), + DETECT_CONTROLLER_INITIALIZED("Initialized detect controller with vault ID %s1."), CONNECTION_CONTROLLER_INITIALIZED("Initialized connection controller with connection ID %s1."), LOGGER_SETUP_DONE("Set up logger."), CURRENT_LOG_LEVEL("Current log level is %s1."), @@ -68,10 +69,29 @@ public enum InfoLogs { TOKENIZE_REQUEST_RESOLVED("Tokenize request resolved."), TOKENIZE_SUCCESS("Data tokenized."), + // Invoke connection interface INVOKE_CONNECTION_TRIGGERED("Invoke connection method triggered."), VALIDATING_INVOKE_CONNECTION_REQUEST("Validating invoke connection request."), - INVOKE_CONNECTION_REQUEST_RESOLVED("Invoke connection request resolved."); + INVOKE_CONNECTION_REQUEST_RESOLVED("Invoke connection request resolved."), + + // detect + VALIDATE_DEIDENTIFY_TEXT_REQUEST("Validating deidentify text request."), + DEIDENTIFY_TEXT_SUCCESS("Text data de-identified."), + DEIDENTIFY_TEXT_TRIGGERED("DeIdentify text method triggered."), + DEIDENTIFY_TEXT_REQUEST_RESOLVED("DeIdentify text request resolved."), + VALIDATE_REIDENTIFY_TEXT_REQUEST("Validating reidentify text request."), + REIDENTIFY_TEXT_TRIGGERED("ReIdentify text method triggered."), + REIDENTIFY_TEXT_REQUEST_RESOLVED("ReIdentify text request resolved."), + DEIDENTIFY_FILE_TRIGGERED("DeIdentify file method triggered."), + VALIDATE_DEIDENTIFY_FILE_REQUEST("Validating deidentify file request."), + DEIDENTIFY_FILE_REQUEST_RESOLVED("DeIdentify file request resolved."), + DEIDENTIFY_FILE_SUCCESS("File deidentified successfully."), + 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."), + ; + private final String log; diff --git a/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java b/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java index e6e4b534..23d09ab8 100644 --- a/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java +++ b/src/main/java/com/skyflow/serviceaccount/util/BearerToken.java @@ -1,17 +1,15 @@ package com.skyflow.serviceaccount.util; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; +import com.google.gson.*; 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.ApiException; -import com.skyflow.generated.rest.api.AuthenticationApi; -import com.skyflow.generated.rest.models.V1GetAuthTokenRequest; -import com.skyflow.generated.rest.models.V1GetAuthTokenResponse; +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.logs.ErrorLogs; import com.skyflow.logs.InfoLogs; import com.skyflow.utils.Constants; @@ -30,8 +28,8 @@ import java.util.Objects; public class BearerToken { - private static final ApiClient apiClient = new ApiClient(); - private static final AuthenticationApi authenticationApi = new AuthenticationApi(apiClient); + private static final Gson gson = new GsonBuilder().serializeNulls().create(); + private static final ApiClientBuilder apiClientBuilder = new ApiClientBuilder(); private final File credentialsFile; private final String credentialsString; private final String ctx; @@ -125,23 +123,24 @@ private static V1GetAuthTokenResponse getBearerTokenFromCredentials( ); String basePath = Utils.getBaseURL(tokenURI.getAsString()); - apiClient.setBasePath(basePath); + apiClientBuilder.url(basePath); + ApiClient apiClient = apiClientBuilder.token("token").build(); + AuthenticationClient authenticationApi = apiClient.authentication(); - V1GetAuthTokenRequest body = new V1GetAuthTokenRequest(); - body.setGrantType(Constants.GRANT_TYPE); - body.setAssertion(signedUserJWT); + V1GetAuthTokenRequest._FinalStage authTokenBuilder = V1GetAuthTokenRequest.builder().grantType(Constants.GRANT_TYPE).assertion(signedUserJWT); if (roles != null) { String scopedRoles = getScopeUsingRoles(roles); - body.setScope(scopedRoles); + authTokenBuilder.scope(scopedRoles); } - return authenticationApi.authenticationServiceGetAuthToken(body); + return authenticationApi.authenticationServiceGetAuthToken(authTokenBuilder.build()); } catch (MalformedURLException e) { LogUtil.printErrorLog(ErrorLogs.INVALID_TOKEN_URI.getLog()); throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidTokenUri.getMessage()); - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.BEARER_TOKEN_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } } @@ -177,10 +176,10 @@ public synchronized String getBearerToken() throws SkyflowException { String accessToken = null; if (this.credentialsFile != null && Objects.equals(this.credentialsType, "FILE")) { response = generateBearerTokenFromCredentials(this.credentialsFile, this.ctx, this.roles); - accessToken = response.getAccessToken(); + accessToken = response.getAccessToken().get(); } else if (this.credentialsString != null && Objects.equals(this.credentialsType, "STRING")) { response = generateBearerTokenFromCredentialString(this.credentialsString, this.ctx, this.roles); - accessToken = response.getAccessToken(); + accessToken = response.getAccessToken().get(); } LogUtil.printInfoLog(InfoLogs.GET_BEARER_TOKEN_SUCCESS.getLog()); return accessToken; diff --git a/src/main/java/com/skyflow/utils/Constants.java b/src/main/java/com/skyflow/utils/Constants.java index 500d8c94..b9264a22 100644 --- a/src/main/java/com/skyflow/utils/Constants.java +++ b/src/main/java/com/skyflow/utils/Constants.java @@ -25,5 +25,7 @@ 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 ERROR_FROM_CLIENT_HEADER_KEY = "error-from-client"; + 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";; } diff --git a/src/main/java/com/skyflow/utils/validations/Validations.java b/src/main/java/com/skyflow/utils/validations/Validations.java index 5e192349..841c03b6 100644 --- a/src/main/java/com/skyflow/utils/validations/Validations.java +++ b/src/main/java/com/skyflow/utils/validations/Validations.java @@ -17,11 +17,13 @@ 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.tokens.ColumnValue; import com.skyflow.vault.tokens.DetokenizeData; import com.skyflow.vault.tokens.DetokenizeRequest; import com.skyflow.vault.tokens.TokenizeRequest; +import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; @@ -183,12 +185,12 @@ public static void validateCredentials(Credentials credentials) throws SkyflowEx 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()); - } + 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()) { @@ -685,6 +687,28 @@ public static void validateTokenizeRequest(TokenizeRequest tokenizeRequest) thro } } + public static void validateDeidentifyTextRequest(DeidentifyTextRequest deidentifyTextRequest) throws SkyflowException { + // Validate required fields + String deidentifyText = deidentifyTextRequest.getText(); + if (deidentifyText == null || deidentifyText.trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.INVALID_TEXT_IN_DEIDENTIFY.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidTextInDeIdentify.getMessage()); + } + } + + public static void validateReidentifyTextRequest(ReidentifyTextRequest reidentifyTextRequest) throws SkyflowException { + // Validate required fields + String reidentifyText = reidentifyTextRequest.getText(); + if (reidentifyText == null || reidentifyText.trim().isEmpty()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.INVALID_TEXT_IN_REIDENTIFY.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidTextInReIdentify.getMessage()); + } + } + private static boolean isInvalidURL(String configURL) { try { URL url = new URL(configURL); @@ -755,4 +779,114 @@ private static void validateTokensMapWithTokenStrict( } } } + + public static void validateDeidentifyFileRequest(DeidentifyFileRequest request) throws SkyflowException { + if (request == null) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_REQUEST_BODY.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyRequestBody.getMessage()); + } + + File file = request.getFileInput().getFile(); + String filePath = request.getFileInput().getFilePath(); + + if (file == null && filePath == null) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.EMPTY_FILE_AND_FILE_PATH_IN_DEIDENTIFY_FILE.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyFileAndFilePathInDeIdentifyFile.getMessage()); + } + + if (filePath != null && file != null) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.BothFileAndFilePathProvided.getMessage()); + } + + if (filePath != null && filePath.trim().isEmpty()){ + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidFilePath.getMessage()); + } + + if (file != null && (!file.exists() || !file.isFile())) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.FILE_NOT_FOUND_TO_DEIDENTIFY.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.FileNotFoundToDeidentify.getMessage()); + } + if (file != null && !file.canRead()) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.FILE_NOT_READABLE_TO_DEIDENTIFY.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.FileNotReadableToDeidentify.getMessage()); + } + + + // Validate pixelDensity and maxResolution + if (request.getPixelDensity() != null && request.getPixelDensity().doubleValue() <= 0) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.INVALID_PIXEL_DENSITY_TO_DEIDENTIFY_FILE.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidPixelDensityToDeidentifyFile.getMessage()); + } + if (request.getMaxResolution() != null && request.getMaxResolution().doubleValue() <= 0) { + LogUtil.printErrorLog(Utils.parameterizedString( + ErrorLogs.INVALID_MAX_RESOLUTION.getLog(), InterfaceName.DETECT.getName() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidMaxResolution.getMessage()); + } + + // Validate AudioBleep + 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() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidRequestBody.getMessage()); + } + if (request.getBleep().getGain() == null) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidRequestBody.getMessage()); + } + if (request.getBleep().getStartPadding() == null || request.getBleep().getStartPadding() < 0) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidRequestBody.getMessage()); + } + if (request.getBleep().getStopPadding() == null || request.getBleep().getStopPadding() < 0) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidRequestBody.getMessage()); + } + } + + // Validate outputDirectory if provided + if (request.getOutputDirectory() != null) { + File outDir = new File(request.getOutputDirectory()); + if (!outDir.exists() || !outDir.isDirectory()) { + LogUtil.printErrorLog(Utils.parameterizedString( + 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() + )); + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidPermission.getMessage()); + } + } + + // Validate waitTime if provided + if (request.getWaitTime() != null && request.getWaitTime() <= 0) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidWaitTime.getMessage()); + } + if(request.getWaitTime() > 64) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.WaitTimeExceedsLimit.getMessage()); + } + } + + public static void validateGetDetectRunRequest(GetDetectRunRequest request) throws SkyflowException { + if (request == null) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyRequestBody.getMessage()); + } + + String runId = request.getRunId(); + if (runId == null || runId.trim().isEmpty()) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidOrEmptyRunId.getMessage()); + } + } } diff --git a/src/main/java/com/skyflow/vault/controller/AuditController.java b/src/main/java/com/skyflow/vault/controller/AuditController.java index 9d605e6c..2faa04a6 100644 --- a/src/main/java/com/skyflow/vault/controller/AuditController.java +++ b/src/main/java/com/skyflow/vault/controller/AuditController.java @@ -1,15 +1,13 @@ package com.skyflow.vault.controller; import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.api.AuditApi; import com.skyflow.vault.audit.ListEventRequest; import com.skyflow.vault.audit.ListEventResponse; public class AuditController { - private final AuditApi auditApi; public AuditController(ApiClient apiClient) { - this.auditApi = new AuditApi(apiClient); + } // Check for correct return type in python interfaces diff --git a/src/main/java/com/skyflow/vault/controller/BinLookupController.java b/src/main/java/com/skyflow/vault/controller/BinLookupController.java index e5d9cc62..4eb7a1c8 100644 --- a/src/main/java/com/skyflow/vault/controller/BinLookupController.java +++ b/src/main/java/com/skyflow/vault/controller/BinLookupController.java @@ -1,15 +1,12 @@ package com.skyflow.vault.controller; import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.api.BinLookupApi; import com.skyflow.vault.bin.GetBinRequest; import com.skyflow.vault.bin.GetBinResponse; public class BinLookupController { - private BinLookupApi binLookupApi; public BinLookupController(ApiClient apiClient) { - this.binLookupApi = new BinLookupApi(apiClient); } public GetBinResponse get(GetBinRequest getBinRequest) { diff --git a/src/main/java/com/skyflow/vault/controller/DetectController.java b/src/main/java/com/skyflow/vault/controller/DetectController.java index 5b507d89..411658ae 100644 --- a/src/main/java/com/skyflow/vault/controller/DetectController.java +++ b/src/main/java/com/skyflow/vault/controller/DetectController.java @@ -1,26 +1,375 @@ package com.skyflow.vault.controller; -import com.skyflow.generated.rest.ApiClient; -import com.skyflow.vault.detect.DeIdentifyRequest; -import com.skyflow.vault.detect.DeIdentifyResponse; +import com.google.gson.*; +import com.skyflow.VaultClient; +import com.skyflow.config.Credentials; +import com.skyflow.config.VaultConfig; +import com.skyflow.enums.DeidentifyFileStatus; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.ErrorMessage; +import com.skyflow.errors.SkyflowException; +import com.skyflow.generated.rest.core.ApiClientApiException; +import com.skyflow.generated.rest.resources.files.requests.*; +import com.skyflow.generated.rest.resources.strings.requests.DeidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.requests.ReidentifyStringRequest; +import com.skyflow.generated.rest.types.*; +import com.skyflow.logs.ErrorLogs; +import com.skyflow.logs.InfoLogs; +import com.skyflow.utils.Constants; +import com.skyflow.utils.logger.LogUtil; +import com.skyflow.utils.validations.Validations; +import com.skyflow.vault.detect.*; +import com.skyflow.vault.detect.DeidentifyFileRequest; +import com.skyflow.vault.detect.DeidentifyFileResponse; +import com.skyflow.vault.detect.DeidentifyTextRequest; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.*; + +public final class DetectController extends VaultClient { + private static final Gson gson = new GsonBuilder().serializeNulls().create(); + + public DetectController(VaultConfig vaultConfig, Credentials credentials) { + super(vaultConfig, credentials); + } + + public DeidentifyTextResponse deidentifyText(DeidentifyTextRequest deidentifyTextRequest) throws SkyflowException { + LogUtil.printInfoLog(InfoLogs.DEIDENTIFY_TEXT_TRIGGERED.getLog()); + DeidentifyStringResponse deidentifyStringResponse = null; + DeidentifyTextResponse deidentifyTextResponse = null; + try { + // Validate the request + LogUtil.printInfoLog(InfoLogs.VALIDATE_DEIDENTIFY_TEXT_REQUEST.getLog()); + Validations.validateDeidentifyTextRequest(deidentifyTextRequest); + setBearerToken(); + + // Parse the request to DeidentifyStringRequest + String vaultId = super.getVaultConfig().getVaultId(); + DeidentifyStringRequest request = getDeidentifyStringRequest(deidentifyTextRequest, vaultId); + + // Call the API to de-identify the string + deidentifyStringResponse = super.getDetectTextApi().deidentifyString(request); + + // Parse the response to DeIdentifyTextResponse + deidentifyTextResponse = getDeIdentifyTextResponse(deidentifyStringResponse); + LogUtil.printInfoLog(InfoLogs.DEIDENTIFY_TEXT_REQUEST_RESOLVED.getLog()); + } catch (ApiClientApiException ex) { + String bodyString = gson.toJson(ex.body()); + LogUtil.printErrorLog(ErrorLogs.DEIDENTIFY_TEXT_REQUEST_REJECTED.getLog()); + throw new SkyflowException(ex.statusCode(), ex, ex.headers(), bodyString); + } + LogUtil.printInfoLog(InfoLogs.DEIDENTIFY_TEXT_SUCCESS.getLog()); + return deidentifyTextResponse; + } + + public ReidentifyTextResponse reidentifyText(ReidentifyTextRequest reidentifyTextRequest) throws SkyflowException { + LogUtil.printInfoLog(InfoLogs.REIDENTIFY_TEXT_TRIGGERED.getLog()); + ReidentifyTextResponse reidentifyTextResponse = null; + try { + // Validate the request + LogUtil.printInfoLog(InfoLogs.VALIDATE_REIDENTIFY_TEXT_REQUEST.getLog()); + Validations.validateReidentifyTextRequest(reidentifyTextRequest); + setBearerToken(); + // Parse the request to ReidentifyTextRequest + String vaultId = super.getVaultConfig().getVaultId(); + ReidentifyStringRequest request = getReidentifyStringRequest(reidentifyTextRequest, vaultId); + + // Call the API to re-identify the string + ReidentifyStringResponse reidentifyStringResponse = super.getDetectTextApi().reidentifyString(request); + + // Parse the response to ReidentifyTextResponse + reidentifyTextResponse = new ReidentifyTextResponse(reidentifyStringResponse.getText().orElse(null)); + LogUtil.printInfoLog(InfoLogs.REIDENTIFY_TEXT_REQUEST_RESOLVED.getLog()); + } catch (ApiClientApiException ex) { + String bodyString = gson.toJson(ex.body()); + LogUtil.printErrorLog(ErrorLogs.REIDENTIFY_TEXT_REQUEST_REJECTED.getLog()); + throw new SkyflowException(ex.statusCode(), ex, ex.headers(), bodyString); + } + LogUtil.printInfoLog(InfoLogs.REIDENTIFY_TEXT_SUCCESS.getLog()); + return reidentifyTextResponse; + } + + public DeidentifyFileResponse deidentifyFile(DeidentifyFileRequest request) throws SkyflowException { + DeidentifyFileResponse response; + LogUtil.printInfoLog(InfoLogs.DEIDENTIFY_FILE_TRIGGERED.getLog()); + try { + LogUtil.printInfoLog(InfoLogs.VALIDATE_DEIDENTIFY_FILE_REQUEST.getLog()); + Validations.validateDeidentifyFileRequest(request); + setBearerToken(); + + String vaultId = super.getVaultConfig().getVaultId(); + + File file; + if (request.getFileInput().getFilePath() != null) { + file = new File(request.getFileInput().getFilePath()); + } else { + file = request.getFileInput().getFile(); + } + String fileName = file.getName(); + String fileExtension = getFileExtension(fileName); + String base64Content; + + try { + base64Content = encodeFileToBase64(file); + } catch (IOException ioe) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.FailedToEncodeFile.getMessage()); + } + + + com.skyflow.generated.rest.types.DeidentifyFileResponse apiResponse = processFileByType(fileExtension, base64Content, request, vaultId); + try { + response = pollForResults(apiResponse.getRunId(), request.getWaitTime()); + } catch (Exception ex) { + throw new SkyflowException(ErrorCode.SERVER_ERROR.getCode(), ErrorMessage.PollingForResultsFailed.getMessage()); + } + + if (DeidentifyFileStatus.SUCCESS.value().equalsIgnoreCase(response.getStatus())) { + String base64File = response.getFileBase64(); + if (base64File != null) { + byte[] decodedBytes = Base64.getDecoder().decode(base64File); + String outputDir = request.getOutputDirectory(); + String outputFileName = Constants.PROCESSED_FILE_NAME_PREFIX + fileName; + File outputFile; + if (outputDir != null && !outputDir.isEmpty()) { + outputFile = new File(outputDir, outputFileName); + } else { + outputFile = new File(outputFileName); + } + try { + java.nio.file.Files.write(outputFile.toPath(), decodedBytes); + } catch (IOException ioe) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.FailedtoSaveProcessedFile.getMessage()); + } + + } + } + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); + LogUtil.printErrorLog(ErrorLogs.DEIDENTIFY_FILE_REQUEST_REJECTED.getLog()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); + } + return response; + } + + private String getFileExtension(String fileName) { + return fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); + } + + private String encodeFileToBase64(File file) throws IOException { + byte[] fileContent = Files.readAllBytes(file.toPath()); + return Base64.getEncoder().encodeToString(fileContent); + } + + private DeidentifyFileResponse pollForResults(String runId, Integer maxWaitTime) throws Exception { + int currentWaitTime = 1; + maxWaitTime = maxWaitTime == null ? 64 : maxWaitTime; + + DeidentifyStatusResponse response = null; + + while (true) { + try { + GetRunRequest getRunRequest = GetRunRequest.builder() + .vaultId(super.getVaultConfig().getVaultId()) + .build(); + response = super.getDetectFileAPi() + .getRun(runId, getRunRequest); + + DeidentifyStatusResponseStatus status = response.getStatus(); + + if (DeidentifyFileStatus.IN_PROGRESS.value().equalsIgnoreCase(String.valueOf(status))) { + if (currentWaitTime >= maxWaitTime) { + return new DeidentifyFileResponse(runId, DeidentifyFileStatus.IN_PROGRESS.value()); + } + + int nextWaitTime = currentWaitTime * 2; + int waitTime; + + if (nextWaitTime >= maxWaitTime) { + waitTime = maxWaitTime - currentWaitTime; + currentWaitTime = maxWaitTime; + } else { + waitTime = nextWaitTime; + currentWaitTime = nextWaitTime; + } + + Thread.sleep(waitTime * 1000); + + } else if (status == DeidentifyStatusResponseStatus.SUCCESS || + status == DeidentifyStatusResponseStatus.FAILED) { + return parseDeidentifyFileResponse(response, runId, status.toString()); + } + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); + LogUtil.printErrorLog(ErrorLogs.GET_DETECT_RUN_REQUEST_REJECTED.getLog()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); + } + } -public class DetectController { - public DetectController(ApiClient apiClient) { } - // should return detect controller - public DetectController deIdentify() { - // return detect controller - return null; + private static synchronized DeidentifyFileResponse parseDeidentifyFileResponse(DeidentifyStatusResponse response, + String runId, String status) throws SkyflowException { + DeidentifyFileOutput firstOutput = getFirstOutput(response); + + Object wordCharObj = response.getAdditionalProperties().get("word_character_count"); + Integer wordCount = null; + Integer charCount = null; + + if (wordCharObj instanceof Map) { + Map wordCharMap = (Map) wordCharObj; + Object wc = wordCharMap.get("word_count"); + Object cc = wordCharMap.get("character_count"); + if (wc instanceof Number) { + wordCount = ((Number) wc).intValue(); + } + if (cc instanceof Number) { + charCount = ((Number) cc).intValue(); + } + } + + File processedFileObject = null; + FileInfo fileInfo = null; + Optional processedFileBase64 = firstOutput != null ? firstOutput.getProcessedFile() : Optional.empty(); + Optional processedFileExtension = firstOutput != null ? firstOutput.getProcessedFileExtension() : Optional.empty(); + + if (processedFileBase64.isPresent() && processedFileExtension.isPresent()) { + try { + byte[] decodedBytes = Base64.getDecoder().decode(processedFileBase64.get()); + String suffix = "." + processedFileExtension.get(); + String fileName = Constants.DEIDENTIFIED_FILE_PREFIX + suffix; + processedFileObject = new File(System.getProperty("java.io.tmpdir"), fileName); + Files.write(processedFileObject.toPath(), decodedBytes); + fileInfo = new FileInfo(processedFileObject); + processedFileObject.deleteOnExit(); + } catch (IOException ioe) { + throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.FailedToEncodeFile.getMessage()); + } + } + + return new DeidentifyFileResponse( + fileInfo, + firstOutput.getProcessedFile().orElse(null), + firstOutput.getProcessedFileType().get().toString(), + firstOutput.getProcessedFileExtension().get(), + wordCount, + charCount, + response.getSize().map(Double::valueOf).orElse(null), + response.getDuration().map(Double::valueOf).orElse(null), + response.getPages().orElse(null), + response.getSlides().orElse(null), + getEntities(response), + runId, + status, + null + ); + } + + private static synchronized DeidentifyFileOutput getFirstOutput(DeidentifyStatusResponse response) { + List outputs = response.getOutput(); + return outputs != null && !outputs.isEmpty() ? outputs.get(0) : null; } - public DeIdentifyResponse text(DeIdentifyRequest deIdentifyRequest) { - // return detect response - return null; + private static synchronized List getEntities(DeidentifyStatusResponse response) { + List entities = new ArrayList<>(); + + List outputs = response.getOutput(); + DeidentifyFileOutput deidentifyFileOutput = outputs != null && !outputs.isEmpty() ? outputs.get(1) : null; + + if (deidentifyFileOutput != null) { + entities.add(new FileEntityInfo( + deidentifyFileOutput.getProcessedFile().orElse(null), + deidentifyFileOutput.getProcessedFileType().orElse(null), + deidentifyFileOutput.getProcessedFileExtension().orElse(null) + )); + } + + return entities; } - public DeIdentifyResponse file(DeIdentifyRequest deIdentifyRequest) { - // return detect response - return null; + private com.skyflow.generated.rest.types.DeidentifyFileResponse processFileByType(String fileExtension, String base64Content, DeidentifyFileRequest request, String vaultId) throws SkyflowException { + switch (fileExtension.toLowerCase()) { + case "txt": + com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest textFileRequest = + super.getDeidentifyTextFileRequest(request, vaultId, base64Content); + return super.getDetectFileAPi().deidentifyText(textFileRequest); + + case "mp3": + case "wav": + DeidentifyAudioRequest audioRequest = + super.getDeidentifyAudioRequest(request, vaultId, base64Content, fileExtension); + return super.getDetectFileAPi().deidentifyAudio(audioRequest); + + case "pdf": + DeidentifyPdfRequest pdfRequest = + super.getDeidentifyPdfRequest(request, vaultId, base64Content); + + return super.getDetectFileAPi().deidentifyPdf(pdfRequest); + + case "jpg": + case "jpeg": + case "png": + case "bmp": + case "tif": + case "tiff": + DeidentifyImageRequest imageRequest = + super.getDeidentifyImageRequest(request, vaultId, base64Content, fileExtension); + return super.getDetectFileAPi().deidentifyImage(imageRequest); + + case "ppt": + case "pptx": + DeidentifyPresentationRequest presentationRequest = + super.getDeidentifyPresentationRequest(request, vaultId, base64Content, fileExtension); + return super.getDetectFileAPi().deidentifyPresentation(presentationRequest); + + case "csv": + case "xls": + case "xlsx": + DeidentifySpreadsheetRequest spreadsheetRequest = + super.getDeidentifySpreadsheetRequest(request, vaultId, base64Content, fileExtension); + return super.getDetectFileAPi().deidentifySpreadsheet(spreadsheetRequest); + + case "doc": + case "docx": + DeidentifyDocumentRequest documentRequest = + super.getDeidentifyDocumentRequest(request, vaultId, base64Content, fileExtension); + return super.getDetectFileAPi().deidentifyDocument(documentRequest); + + case "json": + case "xml": + DeidentifyStructuredTextRequest structuredTextRequest = + super.getDeidentifyStructuredTextRequest(request, vaultId, base64Content, fileExtension); + return super.getDetectFileAPi().deidentifyStructuredText(structuredTextRequest); + + default: + com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest genericFileRequest = + super.getDeidentifyGenericFileRequest(request, vaultId, base64Content, fileExtension); + return super.getDetectFileAPi().deidentifyFile(genericFileRequest); + } + } + + public DeidentifyFileResponse getDetectRun(GetDetectRunRequest request) throws SkyflowException { + LogUtil.printInfoLog(InfoLogs.GET_DETECT_RUN_TRIGGERED.getLog()); + try { + LogUtil.printInfoLog(InfoLogs.VALIDATE_GET_DETECT_RUN_REQUEST.getLog()); + Validations.validateGetDetectRunRequest(request); + setBearerToken(); + String runId = request.getRunId(); + String vaultId = super.getVaultConfig().getVaultId(); + + GetRunRequest getRunRequest = + GetRunRequest.builder() + .vaultId(vaultId) + .build(); + + com.skyflow.generated.rest.types.DeidentifyStatusResponse apiResponse = + super.getDetectFileAPi().getRun(runId, getRunRequest); + + return parseDeidentifyFileResponse(apiResponse, runId, apiResponse.getStatus().toString()); + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); + LogUtil.printErrorLog(ErrorLogs.GET_DETECT_RUN_REQUEST_REJECTED.getLog()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); + } } } diff --git a/src/main/java/com/skyflow/vault/controller/VaultController.java b/src/main/java/com/skyflow/vault/controller/VaultController.java index f2130706..84e528b0 100644 --- a/src/main/java/com/skyflow/vault/controller/VaultController.java +++ b/src/main/java/com/skyflow/vault/controller/VaultController.java @@ -6,9 +6,15 @@ import com.skyflow.config.VaultConfig; import com.skyflow.enums.RedactionType; import com.skyflow.errors.SkyflowException; -import com.skyflow.generated.rest.ApiException; -import com.skyflow.generated.rest.ApiResponse; -import com.skyflow.generated.rest.models.*; +import com.skyflow.generated.rest.core.ApiClientApiException; +import com.skyflow.generated.rest.core.ApiClientHttpResponse; +import com.skyflow.generated.rest.resources.query.requests.QueryServiceExecuteQueryBody; +import com.skyflow.generated.rest.resources.records.requests.*; +import com.skyflow.generated.rest.resources.records.types.RecordServiceBulkGetRecordRequestOrderBy; +import com.skyflow.generated.rest.resources.records.types.RecordServiceBulkGetRecordRequestRedaction; +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.logs.ErrorLogs; import com.skyflow.logs.InfoLogs; import com.skyflow.utils.Constants; @@ -16,23 +22,13 @@ import com.skyflow.utils.validations.Validations; import com.skyflow.vault.data.*; import com.skyflow.vault.tokens.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public final class VaultController extends VaultClient { private static final Gson gson = new GsonBuilder().serializeNulls().create(); - private DetectController detectController; - private AuditController auditController; - private BinLookupController binLookupController; public VaultController(VaultConfig vaultConfig, Credentials credentials) { super(vaultConfig, credentials); - this.auditController = null; - this.binLookupController = null; - this.detectController = null; } private static synchronized HashMap getFormattedBatchInsertRecord(Object record, int requestIndex) { @@ -62,41 +58,38 @@ private static synchronized HashMap getFormattedBatchInsertRecor private static synchronized HashMap getFormattedBulkInsertRecord(V1RecordMetaProperties record) { HashMap insertRecord = new HashMap<>(); - String skyflowId = record.getSkyflowId(); - Object tokens = record.getTokens(); - insertRecord.put("skyflowId", skyflowId); - if (tokens != null) { - String tokensString = gson.toJson(tokens); - JsonObject tokensObject = JsonParser.parseString(tokensString).getAsJsonObject(); - insertRecord.putAll(tokensObject.asMap()); + if (record.getSkyflowId().isPresent()) { + insertRecord.put("skyflowId", record.getSkyflowId().get()); + } + + if (record.getTokens().isPresent()) { + Map tokensMap = record.getTokens().get(); + insertRecord.putAll(tokensMap); } return insertRecord; } private static synchronized HashMap getFormattedGetRecord(V1FieldRecords record) { HashMap getRecord = new HashMap<>(); - Object fields = record.getFields(); - Object tokens = record.getTokens(); - if (fields != null) { - String fieldsString = gson.toJson(fields); - JsonObject fieldsObject = JsonParser.parseString(fieldsString).getAsJsonObject(); - getRecord.putAll(fieldsObject.asMap()); - } else if (tokens != null) { - String tokensString = gson.toJson(tokens); - JsonObject tokensObject = JsonParser.parseString(tokensString).getAsJsonObject(); - getRecord.putAll(tokensObject.asMap()); + + Optional> fieldsOpt = record.getFields(); + Optional> tokensOpt = record.getTokens(); + + if (fieldsOpt.isPresent()) { + getRecord.putAll(fieldsOpt.get()); + } else if (tokensOpt.isPresent()) { + getRecord.putAll(tokensOpt.get()); } return getRecord; } private static synchronized HashMap getFormattedUpdateRecord(V1UpdateRecordResponse record) { HashMap updateTokens = new HashMap<>(); - Object tokens = record.getTokens(); - if (tokens != null) { - String tokensString = gson.toJson(tokens); - JsonObject tokensObject = JsonParser.parseString(tokensString).getAsJsonObject(); - updateTokens.putAll(tokensObject.asMap()); - } + + record.getSkyflowId().ifPresent(skyflowId -> updateTokens.put("skyflowId", skyflowId)); + + record.getTokens().ifPresent(tokensMap -> updateTokens.putAll(tokensMap)); + return updateTokens; } @@ -114,7 +107,7 @@ private static synchronized HashMap getFormattedQueryRecord(V1Fi public InsertResponse insert(InsertRequest insertRequest) throws SkyflowException { LogUtil.printInfoLog(InfoLogs.INSERT_TRIGGERED.getLog()); V1InsertRecordResponse bulkInsertResult = null; - ApiResponse batchInsertResult = null; + ApiClientHttpResponse batchInsertResult = null; ArrayList> insertedFields = new ArrayList<>(); ArrayList> errorFields = new ArrayList<>(); Boolean continueOnError = insertRequest.getContinueOnError(); @@ -124,19 +117,23 @@ public InsertResponse insert(InsertRequest insertRequest) throws SkyflowExceptio setBearerToken(); if (continueOnError) { RecordServiceBatchOperationBody insertBody = super.getBatchInsertRequestBody(insertRequest); - batchInsertResult = super.getRecordsApi().recordServiceBatchOperationWithHttpInfo(super.getVaultConfig().getVaultId(), insertBody); + batchInsertResult = super.getRecordsApi().withRawResponse().recordServiceBatchOperation(super.getVaultConfig().getVaultId(), insertBody); LogUtil.printInfoLog(InfoLogs.INSERT_REQUEST_RESOLVED.getLog()); - Map> responseHeaders = batchInsertResult.getHeaders(); - String requestId = responseHeaders.get(Constants.REQUEST_ID_HEADER_KEY).get(0); - List records = batchInsertResult.getData().getResponses(); - for (int index = 0; index < records.size(); index++) { - Object record = records.get(index); - HashMap insertRecord = getFormattedBatchInsertRecord(record, index); - if (insertRecord.containsKey("skyflowId")) { - insertedFields.add(insertRecord); - } else { - insertRecord.put("requestId", requestId); - errorFields.add(insertRecord); + Optional>> records = batchInsertResult.body().getResponses(); + + if (records.isPresent()) { + List> recordList = records.get(); + + for (int index = 0; index < recordList.size(); index++) { + Map record = recordList.get(index); + HashMap insertRecord = getFormattedBatchInsertRecord(record, index); + + if (insertRecord.containsKey("skyflowId")) { + insertedFields.add(insertRecord); + } else { + insertRecord.put("requestId", batchInsertResult.headers().get("x-request-id").get(0)); + errorFields.add(insertRecord); + } } } } else { @@ -144,25 +141,32 @@ public InsertResponse insert(InsertRequest insertRequest) throws SkyflowExceptio bulkInsertResult = super.getRecordsApi().recordServiceInsertRecord( super.getVaultConfig().getVaultId(), insertRequest.getTable(), insertBody); LogUtil.printInfoLog(InfoLogs.INSERT_REQUEST_RESOLVED.getLog()); - List records = bulkInsertResult.getRecords(); - if (records != null) { - for (V1RecordMetaProperties record : records) { + Optional> records = bulkInsertResult.getRecords(); + if (records.isPresent()) { + for (V1RecordMetaProperties record : records.get()) { HashMap insertRecord = getFormattedBulkInsertRecord(record); insertedFields.add(insertRecord); } } } - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.INSERT_RECORDS_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } LogUtil.printInfoLog(InfoLogs.INSERT_SUCCESS.getLog()); + if (insertedFields.isEmpty()) { + return new InsertResponse(null, errorFields.isEmpty() ? null : errorFields); + } + if (errorFields.isEmpty()) { + return new InsertResponse(insertedFields.isEmpty() ? null : insertedFields, null); + } return new InsertResponse(insertedFields, errorFields); } public DetokenizeResponse detokenize(DetokenizeRequest detokenizeRequest) throws SkyflowException { LogUtil.printInfoLog(InfoLogs.DETOKENIZE_TRIGGERED.getLog()); - ApiResponse result = null; + ApiClientHttpResponse result = null; ArrayList detokenizedFields = new ArrayList<>(); ArrayList errorRecords = new ArrayList<>(); try { @@ -170,15 +174,17 @@ public DetokenizeResponse detokenize(DetokenizeRequest detokenizeRequest) throws Validations.validateDetokenizeRequest(detokenizeRequest); setBearerToken(); V1DetokenizePayload payload = super.getDetokenizePayload(detokenizeRequest); - result = super.getTokensApi().recordServiceDetokenizeWithHttpInfo(super.getVaultConfig().getVaultId(), payload); + result = super.getTokensApi().withRawResponse().recordServiceDetokenize(super.getVaultConfig().getVaultId(), payload); LogUtil.printInfoLog(InfoLogs.DETOKENIZE_REQUEST_RESOLVED.getLog()); - Map> responseHeaders = result.getHeaders(); + Map> responseHeaders = result.headers(); String requestId = responseHeaders.get(Constants.REQUEST_ID_HEADER_KEY).get(0); - List records = result.getData().getRecords(); + Optional> records = result.body().getRecords(); - if (records != null) { - for (V1DetokenizeRecordResponse record : records) { - if (record.getError() != null) { + if (records.isPresent()) { + List recordList = records.get(); + + for (V1DetokenizeRecordResponse record : recordList) { + if (record.getError().isPresent()) { DetokenizeRecordResponse recordResponse = new DetokenizeRecordResponse(record, requestId); errorRecords.add(recordResponse); } else { @@ -187,9 +193,10 @@ public DetokenizeResponse detokenize(DetokenizeRequest detokenizeRequest) throws } } } - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.DETOKENIZE_REQUEST_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } if (!errorRecords.isEmpty()) { @@ -197,6 +204,12 @@ public DetokenizeResponse detokenize(DetokenizeRequest detokenizeRequest) throws } else { LogUtil.printInfoLog(InfoLogs.DETOKENIZE_SUCCESS.getLog()); } + if (detokenizedFields.isEmpty()) { + return new DetokenizeResponse(null, errorRecords.isEmpty() ? null : errorRecords); + } + if (errorRecords.isEmpty()) { + return new DetokenizeResponse(detokenizedFields, null); + } return new DetokenizeResponse(detokenizedFields, errorRecords); } @@ -210,33 +223,38 @@ public GetResponse get(GetRequest getRequest) throws SkyflowException { Validations.validateGetRequest(getRequest); setBearerToken(); RedactionType redactionType = getRequest.getRedactionType(); + RecordServiceBulkGetRecordRequest recordServiceBulkGetRecordRequest = RecordServiceBulkGetRecordRequest.builder() + .skyflowIds(getRequest.getIds()) + .redaction(redactionType != null ? RecordServiceBulkGetRecordRequestRedaction.valueOf(redactionType.toString()) : null) + .tokenization(getRequest.getReturnTokens()) + .offset(getRequest.getOffset()) + .limit(getRequest.getLimit()) + .downloadUrl(getRequest.getDownloadURL()) + .columnName(getRequest.getColumnName()) + .columnValues(getRequest.getColumnValues()) + .orderBy(RecordServiceBulkGetRecordRequestOrderBy.valueOf(getRequest.getOrderBy())) + .build(); + + result = super.getRecordsApi().recordServiceBulkGetRecord( super.getVaultConfig().getVaultId(), getRequest.getTable(), - getRequest.getIds(), - redactionType != null ? redactionType.toString() : null, - getRequest.getReturnTokens(), - getRequest.getFields(), - getRequest.getOffset(), - getRequest.getLimit(), - getRequest.getDownloadURL(), - getRequest.getColumnName(), - getRequest.getColumnValues(), - getRequest.getOrderBy() + recordServiceBulkGetRecordRequest ); LogUtil.printInfoLog(InfoLogs.GET_REQUEST_RESOLVED.getLog()); - List records = result.getRecords(); + List records = result.getRecords().get(); if (records != null) { for (V1FieldRecords record : records) { data.add(getFormattedGetRecord(record)); } } - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.GET_REQUEST_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } LogUtil.printInfoLog(InfoLogs.GET_SUCCESS.getLog()); - return new GetResponse(data, errors); + return new GetResponse(data, null); } public UpdateResponse update(UpdateRequest updateRequest) throws SkyflowException { @@ -256,11 +274,12 @@ public UpdateResponse update(UpdateRequest updateRequest) throws SkyflowExceptio updateBody ); LogUtil.printInfoLog(InfoLogs.UPDATE_REQUEST_RESOLVED.getLog()); - skyflowId = result.getSkyflowId(); + skyflowId = String.valueOf(result.getSkyflowId()); tokensMap = getFormattedUpdateRecord(result); - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.UPDATE_REQUEST_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } LogUtil.printInfoLog(InfoLogs.UPDATE_SUCCESS.getLog()); return new UpdateResponse(skyflowId, tokensMap); @@ -273,23 +292,19 @@ public DeleteResponse delete(DeleteRequest deleteRequest) throws SkyflowExceptio LogUtil.printInfoLog(InfoLogs.VALIDATING_DELETE_REQUEST.getLog()); Validations.validateDeleteRequest(deleteRequest); setBearerToken(); - RecordServiceBulkDeleteRecordBody deleteBody = new RecordServiceBulkDeleteRecordBody(); - for (String id : deleteRequest.getIds()) { - deleteBody.addSkyflowIdsItem(id); - } + RecordServiceBulkDeleteRecordBody deleteBody = RecordServiceBulkDeleteRecordBody.builder().skyflowIds(deleteRequest.getIds()) + .build(); + result = super.getRecordsApi().recordServiceBulkDeleteRecord( super.getVaultConfig().getVaultId(), deleteRequest.getTable(), deleteBody); LogUtil.printInfoLog(InfoLogs.DELETE_REQUEST_RESOLVED.getLog()); - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.DELETE_REQUEST_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } LogUtil.printInfoLog(InfoLogs.DELETE_SUCCESS.getLog()); - return new DeleteResponse((ArrayList) result.getRecordIDResponse()); - } - - public Object uploadFile(Object uploadFileRequest) { - return null; + return new DeleteResponse(result.getRecordIdResponse().get()); } public QueryResponse query(QueryRequest queryRequest) throws SkyflowException { @@ -301,16 +316,18 @@ public QueryResponse query(QueryRequest queryRequest) throws SkyflowException { Validations.validateQueryRequest(queryRequest); setBearerToken(); result = super.getQueryApi().queryServiceExecuteQuery( - super.getVaultConfig().getVaultId(), new QueryServiceExecuteQueryBody().query(queryRequest.getQuery())); + super.getVaultConfig().getVaultId(), QueryServiceExecuteQueryBody.builder().query(queryRequest.getQuery()).build()); LogUtil.printInfoLog(InfoLogs.QUERY_REQUEST_RESOLVED.getLog()); - if (result.getRecords() != null) { - for (V1FieldRecords record : result.getRecords()) { + if (result.getRecords().isPresent()) { + List records = result.getRecords().get(); // Extract the List from Optional + for (V1FieldRecords record : records) { fields.add(getFormattedQueryRecord(record)); } } - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.QUERY_REQUEST_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } LogUtil.printInfoLog(InfoLogs.QUERY_SUCCESS.getLog()); return new QueryResponse(fields); @@ -327,39 +344,19 @@ public TokenizeResponse tokenize(TokenizeRequest tokenizeRequest) throws Skyflow V1TokenizePayload payload = super.getTokenizePayload(tokenizeRequest); result = super.getTokensApi().recordServiceTokenize(super.getVaultConfig().getVaultId(), payload); LogUtil.printInfoLog(InfoLogs.TOKENIZE_REQUEST_RESOLVED.getLog()); - if (result != null && result.getRecords().size() > 0) { - for (V1TokenizeRecordResponse response : result.getRecords()) { - if (response.getToken() != null) { - list.add(response.getToken()); + if (result != null && result.getRecords().isPresent() && !result.getRecords().get().isEmpty()) { + for (V1TokenizeRecordResponse response : result.getRecords().get()) { + if (response.getToken().isPresent()) { + list.add(response.getToken().get()); } } } - } catch (ApiException e) { + } catch (ApiClientApiException e) { + String bodyString = gson.toJson(e.body()); LogUtil.printErrorLog(ErrorLogs.TOKENIZE_REQUEST_REJECTED.getLog()); - throw new SkyflowException(e.getCode(), e, e.getResponseHeaders(), e.getResponseBody()); + throw new SkyflowException(e.statusCode(), e, e.headers(), bodyString); } LogUtil.printInfoLog(InfoLogs.TOKENIZE_SUCCESS.getLog()); return new TokenizeResponse(list); } - - public BinLookupController lookUpBin() { - if (this.binLookupController == null) { - this.binLookupController = new BinLookupController(super.getApiClient()); - } - return this.binLookupController; - } - - public AuditController audit() { - if (this.auditController == null) { - this.auditController = new AuditController(super.getApiClient()); - } - return this.auditController; - } - - public DetectController detect() { - if (this.detectController == null) { - this.detectController = new DetectController(super.getApiClient()); - } - return this.detectController; - } } diff --git a/src/main/java/com/skyflow/vault/data/DeleteResponse.java b/src/main/java/com/skyflow/vault/data/DeleteResponse.java index 7b245bf1..f34d219a 100644 --- a/src/main/java/com/skyflow/vault/data/DeleteResponse.java +++ b/src/main/java/com/skyflow/vault/data/DeleteResponse.java @@ -1,20 +1,19 @@ 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; -import java.util.ArrayList; +import java.util.List; public class DeleteResponse { - private final ArrayList deletedIds; + private final List deletedIds; - public DeleteResponse(ArrayList deletedIds) { + public DeleteResponse(List deletedIds) { this.deletedIds = deletedIds; } - public ArrayList getDeletedIds() { + public List getDeletedIds() { return deletedIds; } @@ -22,7 +21,7 @@ public ArrayList getDeletedIds() { public String toString() { Gson gson = new Gson(); JsonObject responseObject = JsonParser.parseString(gson.toJson(this)).getAsJsonObject(); - responseObject.add("errors", new JsonArray()); + responseObject.add("errors", null); return responseObject.toString(); } } diff --git a/src/main/java/com/skyflow/vault/data/GetRequest.java b/src/main/java/com/skyflow/vault/data/GetRequest.java index 12aef7fa..04626e35 100644 --- a/src/main/java/com/skyflow/vault/data/GetRequest.java +++ b/src/main/java/com/skyflow/vault/data/GetRequest.java @@ -76,7 +76,6 @@ public static final class GetRequestBuilder { private GetRequestBuilder() { this.downloadURL = true; this.orderBy = Constants.ORDER_ASCENDING; - this.redactionType = RedactionType.PLAIN_TEXT; } public GetRequestBuilder table(String table) { diff --git a/src/main/java/com/skyflow/vault/data/QueryResponse.java b/src/main/java/com/skyflow/vault/data/QueryResponse.java index 1906a218..7a1bca51 100644 --- a/src/main/java/com/skyflow/vault/data/QueryResponse.java +++ b/src/main/java/com/skyflow/vault/data/QueryResponse.java @@ -25,7 +25,7 @@ public String toString() { for (JsonElement fieldElement : fieldsArray) { fieldElement.getAsJsonObject().add("tokenizedData", new JsonObject()); } - responseObject.add("errors", new JsonArray()); + responseObject.add("errors", null); responseObject.remove("tokenizedData"); return responseObject.toString(); } diff --git a/src/main/java/com/skyflow/vault/data/UpdateResponse.java b/src/main/java/com/skyflow/vault/data/UpdateResponse.java index 4dd32f1b..068b29be 100644 --- a/src/main/java/com/skyflow/vault/data/UpdateResponse.java +++ b/src/main/java/com/skyflow/vault/data/UpdateResponse.java @@ -34,7 +34,7 @@ public String toString() { } JsonObject finalResponseObject = new JsonObject(); finalResponseObject.add("updatedField", responseObject); - finalResponseObject.add("errors", new JsonArray()); + finalResponseObject.add("errors", null); return finalResponseObject.toString(); } } diff --git a/src/main/java/com/skyflow/vault/detect/AudioBleep.java b/src/main/java/com/skyflow/vault/detect/AudioBleep.java new file mode 100644 index 00000000..1a75f93b --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/AudioBleep.java @@ -0,0 +1,64 @@ +package com.skyflow.vault.detect; + +public class AudioBleep { + private final AudioBleepBuilder builder; + + private AudioBleep(AudioBleepBuilder builder) { + this.builder = builder; + } + + public static AudioBleepBuilder builder() { + return new AudioBleepBuilder(); + } + + public Double getGain() { + return this.builder.gain; + } + + public Double getFrequency() { + return this.builder.frequency; + } + + public Double getStartPadding() { + return this.builder.startPadding; + } + + public Double getStopPadding() { + return this.builder.stopPadding; + } + + public static final class AudioBleepBuilder { + private Double gain; + private Double frequency; + private Double startPadding; + private Double stopPadding; + + private AudioBleepBuilder() { + // Default constructor + } + + public AudioBleepBuilder gain(Double gain) { + this.gain = gain; + return this; + } + + public AudioBleepBuilder frequency(Double frequency) { + this.frequency = frequency; + return this; + } + + public AudioBleepBuilder startPadding(Double startPadding) { + this.startPadding = startPadding; + return this; + } + + public AudioBleepBuilder stopPadding(Double stopPadding) { + this.stopPadding = stopPadding; + return this; + } + + public AudioBleep build() { + return new AudioBleep(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/vault/detect/DateTransformation.java b/src/main/java/com/skyflow/vault/detect/DateTransformation.java new file mode 100644 index 00000000..819927d2 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/DateTransformation.java @@ -0,0 +1,30 @@ +package com.skyflow.vault.detect; + + +import com.skyflow.enums.DetectEntities; + +import java.util.List; + +public class DateTransformation { + private final int max; + private final int min; + private final List entities; + + public DateTransformation(int max, int min, List entities) { + this.max = max; + this.min = min; + this.entities = entities; + } + + public int getMax() { + return max; + } + + public int getMin() { + return min; + } + + public List getEntities() { + return entities; + } +} diff --git a/src/main/java/com/skyflow/vault/detect/DeIdentifyRequest.java b/src/main/java/com/skyflow/vault/detect/DeIdentifyRequest.java deleted file mode 100644 index 92be4962..00000000 --- a/src/main/java/com/skyflow/vault/detect/DeIdentifyRequest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.skyflow.vault.detect; - -public class DeIdentifyRequest { - // members - - public DeIdentifyRequest() { - } - - // getters ans setters -} diff --git a/src/main/java/com/skyflow/vault/detect/DeIdentifyResponse.java b/src/main/java/com/skyflow/vault/detect/DeIdentifyResponse.java deleted file mode 100644 index 05fe9a6e..00000000 --- a/src/main/java/com/skyflow/vault/detect/DeIdentifyResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.skyflow.vault.detect; - -public class DeIdentifyResponse { - // members - - public DeIdentifyResponse() { - } - - // getters ans setters -} diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyFileRequest.java b/src/main/java/com/skyflow/vault/detect/DeidentifyFileRequest.java new file mode 100644 index 00000000..3ebc450e --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/DeidentifyFileRequest.java @@ -0,0 +1,192 @@ +package com.skyflow.vault.detect; + +import com.skyflow.enums.DetectEntities; +import com.skyflow.enums.DetectOutputTranscriptions; +import com.skyflow.enums.MaskingMethod; +import java.util.List; + +public class DeidentifyFileRequest { + private final DeidentifyFileRequestBuilder builder; + + private DeidentifyFileRequest(DeidentifyFileRequestBuilder builder) { + this.builder = builder; + } + + public static DeidentifyFileRequestBuilder builder() { + return new DeidentifyFileRequestBuilder(); + } + + public FileInput getFileInput() { + return this.builder.fileInput; + } + + public List getEntities() { + return this.builder.entities; + } + + public List getAllowRegexList() { + return this.builder.allowRegexList; + } + + public List getRestrictRegexList() { + return this.builder.restrictRegexList; + } + + public TokenFormat getTokenFormat() { + return this.builder.tokenFormat; + } + + public Transformations getTransformations() { + return this.builder.transformations; + } + + public Boolean getOutputProcessedImage() { + return this.builder.outputProcessedImage; + } + + public Boolean getOutputOcrText() { + return this.builder.outputOcrText; + } + + public MaskingMethod getMaskingMethod() { + return this.builder.maskingMethod; + } + + public Number getPixelDensity() { + return this.builder.pixelDensity; + } + + public Number getMaxResolution() { + return this.builder.maxResolution; + } + + public Boolean getOutputProcessedAudio() { + return this.builder.outputProcessedAudio; + } + + public DetectOutputTranscriptions getOutputTranscription() { + return this.builder.outputTranscription; + } + + public AudioBleep getBleep() { + return this.builder.bleep; + } + + public String getOutputDirectory() { + return this.builder.outputDirectory; + } + + public Integer getWaitTime() { + return this.builder.waitTime; + } + + public static final class DeidentifyFileRequestBuilder { + private List entities; + private List allowRegexList; + private List restrictRegexList; + private TokenFormat tokenFormat; + private Transformations transformations; + private Boolean outputProcessedImage; + private Boolean outputOcrText; + private MaskingMethod maskingMethod; + private Number pixelDensity; + private Number maxResolution; + private Boolean outputProcessedAudio; + private DetectOutputTranscriptions outputTranscription; + private AudioBleep bleep; + private FileInput fileInput; + private String outputDirectory; + private Integer waitTime; + + private DeidentifyFileRequestBuilder() { + // Set default values + this.outputProcessedImage = false; + this.outputOcrText = false; + this.outputProcessedAudio = false; + } + + public DeidentifyFileRequestBuilder file(FileInput fileInput) { + this.fileInput = fileInput; + return this; + } + + public DeidentifyFileRequestBuilder entities(List entities) { + this.entities = entities; + return this; + } + + public DeidentifyFileRequestBuilder allowRegexList(List allowRegexList) { + this.allowRegexList = allowRegexList; + return this; + } + + public DeidentifyFileRequestBuilder restrictRegexList(List restrictRegexList) { + this.restrictRegexList = restrictRegexList; + return this; + } + + public DeidentifyFileRequestBuilder tokenFormat(TokenFormat tokenFormat) { + this.tokenFormat = tokenFormat; + return this; + } + + public DeidentifyFileRequestBuilder transformations(Transformations transformations) { + this.transformations = transformations; + return this; + } + + public DeidentifyFileRequestBuilder outputProcessedImage(Boolean outputProcessedImage) { + this.outputProcessedImage = outputProcessedImage != null ? outputProcessedImage : false; + return this; + } + + public DeidentifyFileRequestBuilder outputOcrText(Boolean outputOcrText) { + this.outputOcrText = outputOcrText != null ? outputOcrText : false; + return this; + } + + public DeidentifyFileRequestBuilder maskingMethod(MaskingMethod maskingMethod) { + this.maskingMethod = maskingMethod; + return this; + } + + public DeidentifyFileRequestBuilder pixelDensity(Number pixelDensity) { + this.pixelDensity = pixelDensity; + return this; + } + + public DeidentifyFileRequestBuilder maxResolution(Number maxResolution) { + this.maxResolution = maxResolution; + return this; + } + + public DeidentifyFileRequestBuilder outputProcessedAudio(Boolean outputProcessedAudio) { + this.outputProcessedAudio = outputProcessedAudio != null ? outputProcessedAudio : false; + return this; + } + + public DeidentifyFileRequestBuilder outputTranscription(DetectOutputTranscriptions outputTranscription) { + this.outputTranscription = outputTranscription; + return this; + } + + public DeidentifyFileRequestBuilder bleep(AudioBleep bleep) { + this.bleep = bleep; + return this; + } + + public DeidentifyFileRequestBuilder outputDirectory(String outputDirectory) { + this.outputDirectory = outputDirectory; + return this; + } + + public DeidentifyFileRequestBuilder waitTime(Integer waitTime) { + this.waitTime = waitTime; + return this; + } + + public DeidentifyFileRequest build() { + return new DeidentifyFileRequest(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java b/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java new file mode 100644 index 00000000..95effea0 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/DeidentifyFileResponse.java @@ -0,0 +1,112 @@ +package com.skyflow.vault.detect; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.io.File; +import java.util.List; + +public class DeidentifyFileResponse { + private final FileInfo file; + private final String fileBase64; + private final String type; + private final String extension; + private final Integer wordCount; + private final Integer charCount; + private final Double sizeInKb; + private final Double durationInSeconds; + private final Integer pageCount; + private final Integer slideCount; + private final List entities; + private final String runId; + private final String status; + private final List errors; + + + public DeidentifyFileResponse(FileInfo file, String fileBase64, String type, String extension, + Integer wordCount, Integer charCount, Double sizeInKb, + Double durationInSeconds, Integer pageCount, Integer slideCount, + List entities, String runId, String status, List errors) { + this.file = file; + this.fileBase64 = fileBase64; + this.type = type; + this.extension = extension; + this.wordCount = wordCount; + this.charCount = charCount; + this.sizeInKb = sizeInKb; + this.durationInSeconds = durationInSeconds; + this.pageCount = pageCount; + this.slideCount = slideCount; + this.entities = entities; + this.runId = runId; + this.status = status; + this.errors = errors; + } + + public DeidentifyFileResponse(String runId, String status) { + this(null, null, null, null, null, null, null, null, null, null, null, runId, status, null); + } + + public FileInfo getFile() { + return file; + } + + public String getFileBase64(){ + return fileBase64; + } + + public String getType() { + return type; + } + + public String getExtension() { + return extension; + } + + public Integer getWordCount() { + return wordCount; + } + + public Integer getCharCount() { + return charCount; + } + + public Double getSizeInKb() { + return sizeInKb; + } + + public Double getDurationInSeconds() { + return durationInSeconds; + } + + public Integer getPageCount() { + return pageCount; + } + + public Integer getSlideCount() { + return slideCount; + } + + public List getEntities() { + return entities; + } + + public String getRunId() { + return runId; + } + + public String getStatus() { + return status; + } + + public List getErrors() { + return errors; + } + + @Override + public String toString() { + Gson gson = new GsonBuilder().serializeNulls().create(); + return gson.toJson(this); + } + +} diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyTextRequest.java b/src/main/java/com/skyflow/vault/detect/DeidentifyTextRequest.java new file mode 100644 index 00000000..5f57e3a9 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/DeidentifyTextRequest.java @@ -0,0 +1,88 @@ +package com.skyflow.vault.detect; + + +import com.skyflow.enums.DetectEntities; + +import java.util.List; + +public class DeidentifyTextRequest { + private final DeidentifyTextRequestBuilder builder; + + private DeidentifyTextRequest(DeidentifyTextRequestBuilder builder) { + this.builder = builder; + } + + public static DeidentifyTextRequestBuilder builder() { + return new DeidentifyTextRequestBuilder(); + } + + public String getText() { + return this.builder.text; + } + + public List getEntities() { + return this.builder.entities; + } + + public List getAllowRegexList() { + return this.builder.allowRegexList; + } + + public List getRestrictRegexList() { + return this.builder.restrictRegexList; + } + + public TokenFormat getTokenFormat() { + return this.builder.tokenFormat; + } + + public Transformations getTransformations() { + return this.builder.transformations; + } + + public static final class DeidentifyTextRequestBuilder { + private String text; + private List entities; + private List allowRegexList; + private List restrictRegexList; + private TokenFormat tokenFormat; + private Transformations transformations; + + private DeidentifyTextRequestBuilder() { + } + + public DeidentifyTextRequestBuilder text(String text) { + this.text = text; + return this; + } + + public DeidentifyTextRequestBuilder entities(List entities) { + this.entities = entities; + return this; + } + + public DeidentifyTextRequestBuilder allowRegexList(List allowRegexList) { + this.allowRegexList = allowRegexList; + return this; + } + + public DeidentifyTextRequestBuilder restrictRegexList(List restrictRegexList) { + this.restrictRegexList = restrictRegexList; + return this; + } + + public DeidentifyTextRequestBuilder tokenFormat(TokenFormat tokenFormat) { + this.tokenFormat = tokenFormat; + return this; + } + + public DeidentifyTextRequestBuilder transformations(Transformations transformations) { + this.transformations = transformations; + return this; + } + + public DeidentifyTextRequest build() { + return new DeidentifyTextRequest(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/vault/detect/DeidentifyTextResponse.java b/src/main/java/com/skyflow/vault/detect/DeidentifyTextResponse.java new file mode 100644 index 00000000..6b6118e0 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/DeidentifyTextResponse.java @@ -0,0 +1,44 @@ +package com.skyflow.vault.detect; + + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.util.List; + +public class DeidentifyTextResponse { + private final String processedText; + private final List entities; + private final int wordCount; + private final int charCount; + + public DeidentifyTextResponse(String processedText, List entities, int wordCount, int charCount) { + this.processedText = processedText; + this.entities = entities; + this.wordCount = wordCount; + this.charCount = charCount; + } + + public String getProcessedText() { + return processedText; + } + + public List getEntities() { + return entities; + } + + public int getWordCount() { + return wordCount; + } + + public int getCharCount() { + return charCount; + } + + @Override + public String toString() { + Gson gson = new GsonBuilder().serializeNulls().create(); + return gson.toJson(this); + } + +} diff --git a/src/main/java/com/skyflow/vault/detect/EntityInfo.java b/src/main/java/com/skyflow/vault/detect/EntityInfo.java new file mode 100644 index 00000000..4a84acf9 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/EntityInfo.java @@ -0,0 +1,46 @@ +package com.skyflow.vault.detect; + + +import java.util.Map; + +public class EntityInfo { + private final String token; + private final String value; + private final TextIndex textIndex; + private final TextIndex processedIndex; + private final String entity; + private final Map scores; + + public EntityInfo(String token, String value, TextIndex textIndex, TextIndex processedIndex, String entity, java.util.Map scores) { + this.token = token; + this.value = value; + this.textIndex = textIndex; + this.processedIndex = processedIndex; + this.entity = entity; + this.scores = scores; + } + + public String getToken() { + return token; + } + + public String getValue() { + return value; + } + + public TextIndex getTextIndex() { + return textIndex; + } + + public TextIndex getProcessedIndex() { + return processedIndex; + } + + public String getEntity() { + return entity; + } + + public Map getScores() { + return scores; + } +} diff --git a/src/main/java/com/skyflow/vault/detect/FileEntityInfo.java b/src/main/java/com/skyflow/vault/detect/FileEntityInfo.java new file mode 100644 index 00000000..e177a99a --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/FileEntityInfo.java @@ -0,0 +1,19 @@ +package com.skyflow.vault.detect; + +import com.skyflow.generated.rest.types.DeidentifyFileOutputProcessedFileType; + +public class FileEntityInfo { + private final String file; + private final String type; + private final String extension; + + public FileEntityInfo(String file, DeidentifyFileOutputProcessedFileType type, String extension) { + this.file = file; + this.type = String.valueOf(type); + this.extension = extension; + } + + public String getFile() { return file; } + public String getType() { return type; } + public String getExtension() { return extension; } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/vault/detect/FileInfo.java b/src/main/java/com/skyflow/vault/detect/FileInfo.java new file mode 100644 index 00000000..2f13c4f2 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/FileInfo.java @@ -0,0 +1,33 @@ +package com.skyflow.vault.detect; + +import java.io.File; + +public class FileInfo { + private String name; + private long size; + private String type; + private long lastModified; + + public FileInfo(File file) { + this.name = file.getName(); + this.size = file.length(); + this.type = ""; + this.lastModified = file.lastModified(); + } + + public String getName() { + return name; + } + + public long getSize() { + return size; + } + + public String getType() { + return type; + } + + public long getLastModified() { + return lastModified; + } +} diff --git a/src/main/java/com/skyflow/vault/detect/FileInput.java b/src/main/java/com/skyflow/vault/detect/FileInput.java new file mode 100644 index 00000000..3ff1a77e --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/FileInput.java @@ -0,0 +1,46 @@ +package com.skyflow.vault.detect; + +import java.io.File; + +public class FileInput { + private final FileInputBuilder builder; + + private FileInput(FileInputBuilder builder) { + this.builder = builder; + } + + public static FileInputBuilder builder() { + return new FileInputBuilder(); + } + + public File getFile() { + return this.builder.file; + } + + public String getFilePath() { + return this.builder.filePath; + } + + public static final class FileInputBuilder { + private File file; + private String filePath; + + private FileInputBuilder() { + // Default constructor + } + + public FileInputBuilder file(File file) { + this.file = file; + return this; + } + + public FileInputBuilder filePath(String filePath) { + this.filePath = filePath; + return this; + } + + public FileInput build() { + return new FileInput(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/vault/detect/GetDetectRunRequest.java b/src/main/java/com/skyflow/vault/detect/GetDetectRunRequest.java new file mode 100644 index 00000000..cebec9f2 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/GetDetectRunRequest.java @@ -0,0 +1,33 @@ +package com.skyflow.vault.detect; + +public class GetDetectRunRequest { + private final String runId; + + private GetDetectRunRequest(GetDetectRunRequestBuilder builder) { + this.runId = builder.runId; + } + + public static GetDetectRunRequestBuilder builder() { + return new GetDetectRunRequestBuilder(); + } + + public String getRunId() { + return this.runId; + } + + public static final class GetDetectRunRequestBuilder { + private String runId; + + private GetDetectRunRequestBuilder() { + } + + public GetDetectRunRequestBuilder runId(String runId) { + this.runId = runId; + return this; + } + + public GetDetectRunRequest build() { + return new GetDetectRunRequest(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/vault/detect/ReidentifyTextRequest.java b/src/main/java/com/skyflow/vault/detect/ReidentifyTextRequest.java new file mode 100644 index 00000000..cc0e216a --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/ReidentifyTextRequest.java @@ -0,0 +1,68 @@ +package com.skyflow.vault.detect; + + +import com.skyflow.enums.DetectEntities; + +import java.util.List; + +public class ReidentifyTextRequest { + private final ReidentifyTextRequestBuilder builder; + + private ReidentifyTextRequest(ReidentifyTextRequestBuilder builder) { + this.builder = builder; + } + + public static ReidentifyTextRequestBuilder builder() { + return new ReidentifyTextRequestBuilder(); + } + + public String getText() { + return this.builder.text; + } + + public List getRedactedEntities() { + return this.builder.redactedEntities; + } + + public List getMaskedEntities() { + return this.builder.maskedEntities; + } + + public List getPlainTextEntities() { + return this.builder.plainTextEntities; + } + + public static final class ReidentifyTextRequestBuilder { + private String text; + private List redactedEntities; + private List maskedEntities; + private List plainTextEntities; + + private ReidentifyTextRequestBuilder() { + } + + public ReidentifyTextRequestBuilder text(String text) { + this.text = text; + return this; + } + + public ReidentifyTextRequestBuilder redactedEntities(List redactedEntities) { + this.redactedEntities = redactedEntities; + return this; + } + + public ReidentifyTextRequestBuilder maskedEntities(List maskedEntities) { + this.maskedEntities = maskedEntities; + return this; + } + + public ReidentifyTextRequestBuilder plainTextEntities(List plainTextEntities) { + this.plainTextEntities = plainTextEntities; + return this; + } + + public ReidentifyTextRequest build() { + return new ReidentifyTextRequest(this); + } + } +} diff --git a/src/main/java/com/skyflow/vault/detect/ReidentifyTextResponse.java b/src/main/java/com/skyflow/vault/detect/ReidentifyTextResponse.java new file mode 100644 index 00000000..3a517968 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/ReidentifyTextResponse.java @@ -0,0 +1,23 @@ +package com.skyflow.vault.detect; + + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class ReidentifyTextResponse { + private final String processedText; + + public ReidentifyTextResponse(String processedText) { + this.processedText = processedText; + } + + public String getProcessedText() { + return processedText; + } + + @Override + public String toString() { + Gson gson = new GsonBuilder().serializeNulls().create(); + return gson.toJson(this); + } +} diff --git a/src/main/java/com/skyflow/vault/detect/TextIndex.java b/src/main/java/com/skyflow/vault/detect/TextIndex.java new file mode 100644 index 00000000..6fe99c1d --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/TextIndex.java @@ -0,0 +1,29 @@ +package com.skyflow.vault.detect; + + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class TextIndex { + private final Integer start; + private final Integer end; + + public TextIndex(Integer start, Integer end) { + this.start = start; + this.end = end; + } + + public int getStart() { + return start; + } + + public int getEnd() { + return end; + } + + @Override + public String toString() { + Gson gson = new GsonBuilder().serializeNulls().create(); + return gson.toJson(this); + } +} diff --git a/src/main/java/com/skyflow/vault/detect/TokenFormat.java b/src/main/java/com/skyflow/vault/detect/TokenFormat.java new file mode 100644 index 00000000..8809d0a3 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/TokenFormat.java @@ -0,0 +1,71 @@ +package com.skyflow.vault.detect; + + +import com.skyflow.enums.DetectEntities; +import com.skyflow.enums.TokenType; + +import java.util.List; + + +public class TokenFormat { + private final TokenFormatBuilder builder; + + private TokenFormat(TokenFormatBuilder builder) { + this.builder = builder; + } + + public static TokenFormatBuilder builder() { + return new TokenFormatBuilder(); + } + + public TokenType getDefault() { + return this.builder.defaultType; + } + + public List getVaultToken() { + return this.builder.vaultToken; + } + + public List getEntityUniqueCounter() { + return this.builder.entityUniqueCounter; + } + + public List getEntityOnly() { + return this.builder.entityOnly; + } + + public static final class TokenFormatBuilder { + private TokenType defaultType; + private List vaultToken; + private List entityUniqueCounter; + private List entityOnly; + + private TokenFormatBuilder() { + this.defaultType = TokenType.ENTITY_UNIQUE_COUNTER; + } + + public TokenFormatBuilder defaultType(TokenType defaultType) { + this.defaultType = defaultType != null ? defaultType : TokenType.ENTITY_UNIQUE_COUNTER; + return this; + } + + public TokenFormatBuilder vaultToken(List vaultToken) { + this.vaultToken = vaultToken; + return this; + } + + public TokenFormatBuilder entityUniqueCounter(List entityUniqueCounter) { + this.entityUniqueCounter = entityUniqueCounter; + return this; + } + + public TokenFormatBuilder entityOnly(List entityOnly) { + this.entityOnly = entityOnly; + return this; + } + + public TokenFormat build() { + return new TokenFormat(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/skyflow/vault/detect/Transformations.java b/src/main/java/com/skyflow/vault/detect/Transformations.java new file mode 100644 index 00000000..2e219101 --- /dev/null +++ b/src/main/java/com/skyflow/vault/detect/Transformations.java @@ -0,0 +1,14 @@ +package com.skyflow.vault.detect; + + +public class Transformations { + private final DateTransformation shiftDates; + + public Transformations(DateTransformation shiftDates) { + this.shiftDates = shiftDates; + } + + public DateTransformation getShiftDates() { + return shiftDates; + } +} diff --git a/src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java b/src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java index 0904d6b6..7d2ae73c 100644 --- a/src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java +++ b/src/main/java/com/skyflow/vault/tokens/DetokenizeRecordResponse.java @@ -1,6 +1,7 @@ package com.skyflow.vault.tokens; -import com.skyflow.generated.rest.models.V1DetokenizeRecordResponse; + +import com.skyflow.generated.rest.types.V1DetokenizeRecordResponse; public class DetokenizeRecordResponse { private final String token; @@ -14,13 +15,23 @@ public DetokenizeRecordResponse(V1DetokenizeRecordResponse record) { } public DetokenizeRecordResponse(V1DetokenizeRecordResponse record, String requestId) { - this.token = record.getToken(); - this.value = record.getValue().isEmpty() ? null : record.getValue(); - this.type = record.getValueType().getValue().equals("NONE") ? null : record.getValueType().getValue(); - this.error = record.getError(); + this.token = record.getToken().orElse(null); + + this.value = record.getValue() + .filter(val -> val != null && !val.toString().isEmpty()) + .orElse(null); + + this.type = record.getValueType() + .map(Enum::toString) + .filter(val -> !"NONE".equals(val)) + .orElse(null); + + this.error = record.getError().orElse(null); + this.requestId = requestId; } + public String getError() { return error; } diff --git a/src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java b/src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java index a0e48273..d8d8072b 100644 --- a/src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java +++ b/src/main/java/com/skyflow/vault/tokens/TokenizeResponse.java @@ -27,7 +27,7 @@ public String toString() { newTokensArray.add(jsonObject); } responseObject.add("tokens", newTokensArray); - responseObject.add("errors", new JsonArray()); + responseObject.add("errors", null); return responseObject.toString(); } } diff --git a/src/test/java/com/skyflow/SkyflowTests.java b/src/test/java/com/skyflow/SkyflowTests.java index 8ccff81d..0b44c0b4 100644 --- a/src/test/java/com/skyflow/SkyflowTests.java +++ b/src/test/java/com/skyflow/SkyflowTests.java @@ -440,4 +440,130 @@ public void testUpdateLogLevel() { } } + @Test + public void testVaultMethodWithNoConfig() { + try { + Skyflow skyflowClient = Skyflow.builder().build(); + skyflowClient.vault(); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.VaultIdNotInConfigList.getMessage(), e.getMessage()); + } + } + + @Test + public void testVaultMethodWithValidConfig() { + try { + VaultConfig config = new VaultConfig(); + config.setVaultId(vaultID); + config.setClusterId(clusterID); + config.setEnv(Env.SANDBOX); + Skyflow skyflowClient = Skyflow.builder().addVaultConfig(config).build(); + Assert.assertNotNull(skyflowClient.vault()); + Assert.assertNotNull(skyflowClient.vault(vaultID)); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testVaultMethodWithInvalidVaultId() { + try { + VaultConfig config = new VaultConfig(); + config.setVaultId(vaultID); + config.setClusterId(clusterID); + config.setEnv(Env.SANDBOX); + Skyflow skyflowClient = Skyflow.builder().addVaultConfig(config).build(); + skyflowClient.vault("invalid_vault_id"); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.VaultIdNotInConfigList.getMessage(), e.getMessage()); + } + } + + @Test + public void testConnectionMethodWithNoConfig() { + try { + Skyflow skyflowClient = Skyflow.builder().build(); + skyflowClient.connection(); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.ConnectionIdNotInConfigList.getMessage(), e.getMessage()); + } + } + + @Test + public void testConnectionMethodWithValidConfig() { + try { + ConnectionConfig config = new ConnectionConfig(); + config.setConnectionId(connectionID); + config.setConnectionUrl(connectionURL); + Skyflow skyflowClient = Skyflow.builder().addConnectionConfig(config).build(); + Assert.assertNotNull(skyflowClient.connection()); + Assert.assertNotNull(skyflowClient.connection(connectionID)); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testConnectionMethodWithInvalidConnectionId() { + try { + ConnectionConfig config = new ConnectionConfig(); + config.setConnectionId(connectionID); + config.setConnectionUrl(connectionURL); + Skyflow skyflowClient = Skyflow.builder().addConnectionConfig(config).build(); + skyflowClient.connection("invalid_connection_id"); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.ConnectionIdNotInConfigList.getMessage(), e.getMessage()); + } + } + + @Test + public void testDetectMethodWithNoConfig() { + try { + Skyflow skyflowClient = Skyflow.builder().build(); + skyflowClient.detect(); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.VaultIdNotInConfigList.getMessage(), e.getMessage()); + } + } + + @Test + public void testDetectMethodWithValidConfig() { + try { + VaultConfig config = new VaultConfig(); + config.setVaultId(vaultID); + config.setClusterId(clusterID); + config.setEnv(Env.SANDBOX); + Skyflow skyflowClient = Skyflow.builder().addVaultConfig(config).build(); + Assert.assertNotNull(skyflowClient.detect()); + Assert.assertNotNull(skyflowClient.detect(vaultID)); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testDetectMethodWithInvalidVaultId() { + try { + VaultConfig config = new VaultConfig(); + config.setVaultId(vaultID); + config.setClusterId(clusterID); + config.setEnv(Env.SANDBOX); + Skyflow skyflowClient = Skyflow.builder().addVaultConfig(config).build(); + skyflowClient.detect("invalid_vault_id"); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(ErrorMessage.VaultIdNotInConfigList.getMessage(), e.getMessage()); + } + } } diff --git a/src/test/java/com/skyflow/VaultClientTests.java b/src/test/java/com/skyflow/VaultClientTests.java index 0cd99614..1ebb1b23 100644 --- a/src/test/java/com/skyflow/VaultClientTests.java +++ b/src/test/java/com/skyflow/VaultClientTests.java @@ -2,12 +2,31 @@ import com.skyflow.config.Credentials; import com.skyflow.config.VaultConfig; -import com.skyflow.enums.Env; -import com.skyflow.enums.TokenMode; -import com.skyflow.generated.rest.auth.HttpBearerAuth; -import com.skyflow.generated.rest.models.*; +import com.skyflow.enums.*; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.SkyflowException; +import com.skyflow.generated.rest.resources.files.FilesClient; +import com.skyflow.generated.rest.resources.files.requests.*; +import com.skyflow.generated.rest.resources.query.QueryClient; +import com.skyflow.generated.rest.resources.records.RecordsClient; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceBatchOperationBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceInsertRecordBody; +import com.skyflow.generated.rest.resources.records.requests.RecordServiceUpdateRecordBody; +import com.skyflow.generated.rest.resources.strings.StringsClient; +import com.skyflow.generated.rest.resources.strings.requests.DeidentifyStringRequest; +import com.skyflow.generated.rest.resources.strings.requests.ReidentifyStringRequest; +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.DeidentifyStringResponse; +import com.skyflow.generated.rest.types.DetectedEntity; +import com.skyflow.generated.rest.types.EntityLocation; +import com.skyflow.generated.rest.types.V1Byot; 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.tokens.ColumnValue; import com.skyflow.vault.tokens.DetokenizeData; import com.skyflow.vault.tokens.DetokenizeRequest; @@ -17,13 +36,11 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import java.io.File; +import java.util.*; public class VaultClientTests { 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 VaultClient vaultClient; private static String vaultID = null; private static String clusterID = null; @@ -31,7 +48,7 @@ public class VaultClientTests { private static String table = null; private static String value = null; private static String columnGroup = null; - private static String apiKey = null; + private static String apiKey = "sky-ab123-abcd1234cdef1234abcd4321cdef4321"; private static ArrayList detokenizeData = null; private static ArrayList> insertValues = null; private static ArrayList> insertTokens = null; @@ -40,7 +57,7 @@ public class VaultClientTests { private static VaultConfig vaultConfig; @BeforeClass - public static void setup() { + public static void setup() throws SkyflowException { vaultID = "vault123"; clusterID = "cluster123"; token = "test_token"; @@ -48,44 +65,62 @@ public static void setup() { table = "test_table"; value = "test_value"; columnGroup = "test_column_group"; - apiKey = "sky-ab123-abcd1234cdef1234abcd4321cdef4321"; + apiKey = null; insertValues = new ArrayList<>(); insertTokens = new ArrayList<>(); valueMap = new HashMap<>(); tokenMap = new HashMap<>(); - Credentials credentials = new Credentials(); - credentials.setApiKey(apiKey); - 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(); } @Test - public void testVaultClientGetApiClient() { + public void testVaultClientGetRecordsAPI() { try { - Assert.assertNotNull(vaultClient.getApiClient()); + RecordsClient recordsClient = vaultClient.getRecordsApi(); + Assert.assertNotNull(recordsClient); } catch (Exception e) { - Assert.fail(INVALID_EXCEPTION_THROWN); + e.printStackTrace(); + Assert.fail(INVALID_EXCEPTION_THROWN + e.getMessage()); } } @Test - public void testVaultClientGetRecordsAPI() { + public void testVaultClientDetectAPI() { try { - Assert.assertNotNull(vaultClient.getRecordsApi()); + FilesClient filesClient = vaultClient.getDetectFileAPi(); + Assert.assertNotNull(filesClient); } catch (Exception e) { - Assert.fail(INVALID_EXCEPTION_THROWN); + e.printStackTrace(); + Assert.fail(INVALID_EXCEPTION_THROWN + e.getMessage()); + } + } + + @Test + public void testVaultClientDetectTextAPI() { + try { + StringsClient stringsClient = vaultClient.getDetectTextApi(); + Assert.assertNotNull(stringsClient); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail(INVALID_EXCEPTION_THROWN + e.getMessage()); } } @Test public void testVaultClientGetTokensAPI() { try { - Assert.assertNotNull(vaultClient.getTokensApi()); + TokensClient tokensClient = vaultClient.getTokensApi(); + Assert.assertNotNull(tokensClient); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -94,7 +129,8 @@ public void testVaultClientGetTokensAPI() { @Test public void testVaultClientGetQueryAPI() { try { - Assert.assertNotNull(vaultClient.getQueryApi()); + QueryClient queryClient = vaultClient.getQueryApi(); + Assert.assertNotNull(queryClient); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -121,11 +157,14 @@ public void testGetDetokenizePayload() { detokenizeData.add(detokenizeDataRecord1); detokenizeData.add(detokenizeDataRecord2); DetokenizeRequest detokenizeRequest = DetokenizeRequest.builder() - .detokenizeData(detokenizeData).downloadURL(true).build(); + .detokenizeData(detokenizeData) + .downloadURL(true) + .continueOnError(false) + .build(); V1DetokenizePayload payload = vaultClient.getDetokenizePayload(detokenizeRequest); - Assert.assertFalse(payload.getContinueOnError()); - Assert.assertTrue(payload.getDownloadURL()); - Assert.assertEquals(2, payload.getDetokenizationParameters().size()); + Assert.assertFalse(payload.getContinueOnError().get()); + Assert.assertTrue(payload.getDownloadUrl().get()); + Assert.assertEquals(2, payload.getDetokenizationParameters().get().size()); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -152,13 +191,16 @@ public void testGetBulkInsertRequestBody() { .returnTokens(true) .build(); RecordServiceInsertRecordBody body1 = vaultClient.getBulkInsertRequestBody(insertRequest1); - Assert.assertTrue(body1.getTokenization()); - Assert.assertNull(body1.getUpsert()); - Assert.assertEquals(2, body1.getRecords().size()); + Assert.assertTrue(body1.getTokenization().get()); + Assert.assertEquals(V1Byot.ENABLE, body1.getByot().get()); + Assert.assertEquals(2, body1.getRecords().get().size()); - InsertRequest insertRequest2 = InsertRequest.builder().table(table).values(insertValues).build(); + InsertRequest insertRequest2 = InsertRequest.builder() + .table(table) + .values(insertValues) + .build(); RecordServiceInsertRecordBody body2 = vaultClient.getBulkInsertRequestBody(insertRequest2); - Assert.assertEquals(2, body2.getRecords().size()); + Assert.assertEquals(2, body2.getRecords().get().size()); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -185,12 +227,12 @@ public void testGetBatchInsertRequestBody() { .returnTokens(false) .build(); RecordServiceBatchOperationBody body1 = vaultClient.getBatchInsertRequestBody(insertRequest1); - Assert.assertTrue(body1.getContinueOnError()); - Assert.assertEquals(2, body1.getRecords().size()); + Assert.assertTrue(body1.getContinueOnError().get()); + Assert.assertEquals(2, body1.getRecords().get().size()); InsertRequest insertRequest2 = InsertRequest.builder().table(table).values(insertValues).build(); RecordServiceBatchOperationBody body2 = vaultClient.getBatchInsertRequestBody(insertRequest2); - Assert.assertEquals(2, body2.getRecords().size()); + Assert.assertEquals(2, body2.getRecords().get().size()); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -211,7 +253,7 @@ public void testGetUpdateRequestBodyWithTokens() { .returnTokens(true) .build(); RecordServiceUpdateRecordBody body = vaultClient.getUpdateRequestBody(updateRequest); - Assert.assertTrue(body.getTokenization()); + Assert.assertTrue(body.getTokenization().get()); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -231,7 +273,7 @@ public void testGetUpdateRequestBodyWithoutTokens() { .returnTokens(false) .build(); RecordServiceUpdateRecordBody body = vaultClient.getUpdateRequestBody(updateRequest); - Assert.assertFalse(body.getTokenization()); + Assert.assertFalse(body.getTokenization().get()); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -245,7 +287,7 @@ public void testGetTokenizePayload() { columnValues.add(columnValue); TokenizeRequest tokenizeRequest = TokenizeRequest.builder().values(columnValues).build(); V1TokenizePayload payload = vaultClient.getTokenizePayload(tokenizeRequest); - Assert.assertEquals(1, payload.getTokenizationParameters().size()); + Assert.assertEquals(1, payload.getTokenizationParameters().get().size()); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } @@ -254,22 +296,18 @@ public void testGetTokenizePayload() { @Test public void testSetBearerToken() { try { - Dotenv dotenv = Dotenv.load(); - String bearerToken = dotenv.get("TEST_REUSABLE_TOKEN"); Credentials credentials = new Credentials(); - credentials.setToken(bearerToken); + credentials.setApiKey("sky-ab123-abcd1234cdef1234abcd4321cdef4321"); vaultConfig.setCredentials(credentials); - vaultClient.updateVaultConfig(); - - // regular scenario + vaultClient = new VaultClient(vaultConfig, credentials); vaultClient.setBearerToken(); - // re-use scenario + Assert.assertNotNull(vaultClient.getTokensApi()); + vaultClient.setBearerToken(); - HttpBearerAuth auth = (HttpBearerAuth) vaultClient.getApiClient().getAuthentication("Bearer"); - Assert.assertEquals(bearerToken, auth.getBearerToken()); + Assert.assertNotNull(vaultClient.getTokensApi()); } catch (Exception e) { - Assert.fail(INVALID_EXCEPTION_THROWN); + Assert.fail(INVALID_EXCEPTION_THROWN + ": " + e.getMessage()); } } @@ -277,8 +315,8 @@ public void testSetBearerToken() { public void testSetBearerTokenWithApiKey() { try { Credentials credentials = new Credentials(); - credentials.setApiKey(apiKey); - vaultConfig.setCredentials(null); + credentials.setApiKey("sky-ab123-abcd1234cdef1234abcd4321cdef4321"); // Use a non-null dummy API key + vaultConfig.setCredentials(credentials); vaultClient.updateVaultConfig(); vaultClient.setCommonCredentials(credentials); @@ -287,22 +325,609 @@ public void testSetBearerTokenWithApiKey() { // re-use scenario vaultClient.setBearerToken(); - HttpBearerAuth auth = (HttpBearerAuth) vaultClient.getApiClient().getAuthentication("Bearer"); - Assert.assertEquals(apiKey, auth.getBearerToken()); + + // If no exception is thrown, the test passes + Assert.assertTrue(true); } catch (Exception e) { - Assert.fail(INVALID_EXCEPTION_THROWN); + Assert.fail(INVALID_EXCEPTION_THROWN + ": " + e.getMessage()); } } @Test public void testSetBearerTokenWithEnvCredentials() { try { + Dotenv dotenv = Dotenv.load(); vaultConfig.setCredentials(null); vaultClient.updateVaultConfig(); vaultClient.setCommonCredentials(null); + vaultClient.setBearerToken(); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); Assert.assertNull(vaultClient.getVaultConfig().getCredentials()); } catch (Exception e) { Assert.fail(INVALID_EXCEPTION_THROWN); } } + + @Test + public void testGetDeIdentifyTextResponse() { + List entities = new ArrayList<>(); + EntityLocation location = EntityLocation.builder() + .startIndex(2) + .endIndex(10) + .startIndexProcessed(3) + .endIndexProcessed(8) + .build(); + + DetectedEntity detectedEntity = DetectedEntity.builder() + .token("token123") + .value("value123") + .location(location) + .build(); + entities.add(detectedEntity); + + DeidentifyStringResponse response = DeidentifyStringResponse.builder() + .processedText("processed text") + .wordCount(2) + .characterCount(13) + .entities(entities) + .build(); + + + DeidentifyTextResponse result = vaultClient.getDeIdentifyTextResponse(response); + + Assert.assertNotNull(result); + Assert.assertEquals("processed text", result.getProcessedText()); + Assert.assertEquals(2, result.getWordCount()); + Assert.assertEquals(13, result.getCharCount()); + Assert.assertNotNull(result.getEntities()); + Assert.assertEquals(1, result.getEntities().size()); + Assert.assertEquals("token123", result.getEntities().get(0).getToken()); + Assert.assertEquals("value123", result.getEntities().get(0).getValue()); + Assert.assertEquals(2, result.getEntities().get(0).getTextIndex().getStart()); + Assert.assertEquals(10, result.getEntities().get(0).getTextIndex().getEnd()); + Assert.assertEquals(3, result.getEntities().get(0).getProcessedIndex().getStart()); + Assert.assertEquals(8, result.getEntities().get(0).getProcessedIndex().getEnd()); + } + + @Test + public void testGetDeidentifyStringRequest() { + + List detectEntitiesList = new ArrayList<>(); + detectEntitiesList.add(DetectEntities.NAME); + + List vaultTokenList = new ArrayList<>(); + vaultTokenList.add(DetectEntities.SSN); + + + List entityOnlyList = new ArrayList<>(); + entityOnlyList.add(DetectEntities.DOB); + + List entityUniqueCounterList = new ArrayList<>(); + entityUniqueCounterList.add(DetectEntities.NAME); + + + List restrictRegexList = new ArrayList<>(); + restrictRegexList.add("([0-9]{3}-[0-9]{2}-[0-9]{4})"); + + TokenFormat tokenFormat = TokenFormat.builder() + .vaultToken(vaultTokenList) + .entityOnly(entityOnlyList) + .entityUniqueCounter(entityUniqueCounterList) + .build(); + + + List detectEntitiesTransformationList = new ArrayList<>(); + detectEntitiesTransformationList.add(DetectEntities.DOB); + detectEntitiesTransformationList.add(DetectEntities.DATE); + + DateTransformation dateTransformation = new DateTransformation(20, 5, detectEntitiesTransformationList); + Transformations transformations = new Transformations(dateTransformation); + + + DeidentifyTextRequest req = DeidentifyTextRequest.builder() + .text("Sensitive data to deidentify, like Name: Joy SSN 123-45-6789 and DOB 01-01-2000.") + .entities(detectEntitiesList) + .restrictRegexList(restrictRegexList) + .tokenFormat(tokenFormat) + .transformations(transformations) + .build(); + + } + + @Test + public void testDeidentifyFileRequestBuilderAndGetters() { + File file = new File("testfile.txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + DetectEntities entity = DetectEntities.NAME; + String allowRegex = "^[A-Za-z]+$"; + String restrictRegex = "\\d+"; + TokenFormat tokenFormat = TokenFormat.builder().vaultToken(Collections.singletonList(entity)).build(); + Boolean outputProcessedImage = true; + Boolean outputOcrText = true; + MaskingMethod maskingMethod = MaskingMethod.BLACKBOX; + Double pixelDensity = 300.0; + Double maxResolution = 1024.0; + Boolean outputProcessedAudio = false; + DetectOutputTranscriptions outputTranscription = DetectOutputTranscriptions.TRANSCRIPTION; + AudioBleep bleep = AudioBleep.builder().gain(20.0).build(); + String outputDirectory = "/tmp"; + Integer waitTime = 10; + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(Arrays.asList(entity)) + .allowRegexList(Collections.singletonList(allowRegex)) + .restrictRegexList(Collections.singletonList(restrictRegex)) + .tokenFormat(tokenFormat) + .outputProcessedImage(outputProcessedImage) + .outputOcrText(outputOcrText) + .maskingMethod(maskingMethod) + .pixelDensity(pixelDensity) + .maxResolution(maxResolution) + .outputProcessedAudio(outputProcessedAudio) + .outputTranscription(outputTranscription) + .bleep(bleep) + .outputDirectory(outputDirectory) + .waitTime(waitTime) + .build(); + + Assert.assertEquals(file, request.getFileInput().getFile()); + Assert.assertEquals(1, request.getEntities().size()); + Assert.assertEquals(allowRegex, request.getAllowRegexList().get(0)); + Assert.assertEquals(restrictRegex, request.getRestrictRegexList().get(0)); + Assert.assertEquals(tokenFormat, request.getTokenFormat()); + Assert.assertEquals(outputProcessedImage, request.getOutputProcessedImage()); + Assert.assertEquals(outputOcrText, request.getOutputOcrText()); + Assert.assertEquals(maskingMethod, request.getMaskingMethod()); + Assert.assertEquals(pixelDensity, request.getPixelDensity()); + Assert.assertEquals(maxResolution, request.getMaxResolution()); + Assert.assertEquals(outputProcessedAudio, request.getOutputProcessedAudio()); + Assert.assertEquals(outputTranscription, request.getOutputTranscription()); + Assert.assertEquals(bleep, request.getBleep()); + Assert.assertEquals(outputDirectory, request.getOutputDirectory()); + Assert.assertEquals(waitTime, request.getWaitTime()); + } + + @Test + public void testDeidentifyFileRequestBuilderDefaults() { + DeidentifyFileRequest request = DeidentifyFileRequest.builder().build(); + Assert.assertNull(request.getEntities()); + Assert.assertNull(request.getAllowRegexList()); + Assert.assertNull(request.getRestrictRegexList()); + Assert.assertNull(request.getTokenFormat()); + Assert.assertNull(request.getTransformations()); + Assert.assertEquals(false, request.getOutputProcessedImage()); + Assert.assertEquals(false, request.getOutputOcrText()); + Assert.assertNull(request.getMaskingMethod()); + Assert.assertNull(request.getPixelDensity()); + Assert.assertNull(request.getMaxResolution()); + Assert.assertEquals(false, request.getOutputProcessedAudio()); + Assert.assertNull(request.getOutputTranscription()); + Assert.assertNull(request.getBleep()); + Assert.assertNull(request.getOutputDirectory()); + Assert.assertNull(request.getWaitTime()); + } + + @Test + public void testGetDeidentifyImageRequest() { + File file = new File("test.jpg"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME, DetectEntities.DOB); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .outputProcessedImage(true) + .outputOcrText(true) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + String format = "jpg"; + + DeidentifyImageRequest imageRequest = vaultClient.getDeidentifyImageRequest(request, vaultId, base64Content, format); + + Assert.assertEquals(vaultId, imageRequest.getVaultId()); + Assert.assertEquals(base64Content, imageRequest.getFile().getBase64()); + Assert.assertEquals(format.toUpperCase(), imageRequest.getFile().getDataFormat().name()); + } + + @Test + public void testGetDeidentifyPresentationRequest() { + File file = new File("test.pptx"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + String format = "pptx"; + + DeidentifyPresentationRequest presRequest = vaultClient.getDeidentifyPresentationRequest(request, vaultId, base64Content, format); + + Assert.assertEquals(vaultId, presRequest.getVaultId()); + Assert.assertEquals(base64Content, presRequest.getFile().getBase64()); + Assert.assertEquals(format.toUpperCase(), presRequest.getFile().getDataFormat().name()); + } + + @Test + public void testGetDeidentifySpreadsheetRequest() { + File file = new File("test.csv"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + String format = "csv"; + + DeidentifySpreadsheetRequest spreadsheetRequest = vaultClient.getDeidentifySpreadsheetRequest(request, vaultId, base64Content, format); + + Assert.assertEquals(vaultId, spreadsheetRequest.getVaultId()); + Assert.assertEquals(base64Content, spreadsheetRequest.getFile().getBase64()); + Assert.assertEquals(format.toUpperCase(), spreadsheetRequest.getFile().getDataFormat().name()); + } + + @Test + public void testGetDeidentifyStructuredTextRequest() { + File file = new File("test.json"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + String format = "json"; + + DeidentifyStructuredTextRequest structuredTextRequest = vaultClient.getDeidentifyStructuredTextRequest(request, vaultId, base64Content, format); + + Assert.assertEquals(vaultId, structuredTextRequest.getVaultId()); + Assert.assertEquals(base64Content, structuredTextRequest.getFile().getBase64()); + Assert.assertEquals(format.toUpperCase(), structuredTextRequest.getFile().getDataFormat().name()); + } + + @Test + public void testGetDeidentifyDocumentRequest() { + File file = new File("test.docx"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + String format = "docx"; + + DeidentifyDocumentRequest documentRequest = vaultClient.getDeidentifyDocumentRequest(request, vaultId, base64Content, format); + + Assert.assertEquals(vaultId, documentRequest.getVaultId()); + Assert.assertEquals(base64Content, documentRequest.getFile().getBase64()); + Assert.assertEquals(format.toUpperCase(), documentRequest.getFile().getDataFormat().name()); + } + + @Test + public void testGetDeidentifyPdfRequest() { + File file = new File("test.pdf"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .pixelDensity(200) + .maxResolution(300) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + + DeidentifyPdfRequest pdfRequest = vaultClient.getDeidentifyPdfRequest(request, vaultId, base64Content); + + Assert.assertEquals(vaultId, pdfRequest.getVaultId()); + Assert.assertEquals(base64Content, pdfRequest.getFile().getBase64()); + } + + @Test + public void testGetDeidentifyAudioRequest() throws SkyflowException { + File file = new File("test.mp3"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + AudioBleep bleep = AudioBleep.builder().frequency(1000.0).gain(10.0).startPadding(1.0).stopPadding(1.0).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .bleep(bleep) + .outputProcessedAudio(true) + .outputTranscription(DetectOutputTranscriptions.PLAINTEXT_TRANSCRIPTION) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + String dataFormat = "mp3"; + + DeidentifyAudioRequest audioRequest = vaultClient.getDeidentifyAudioRequest(request, vaultId, base64Content, dataFormat); + + Assert.assertEquals(vaultId, audioRequest.getVaultId()); + Assert.assertEquals(base64Content, audioRequest.getFile().getBase64()); + Assert.assertEquals(dataFormat, audioRequest.getFile().getDataFormat().toString()); + } + + @Test + public void testGetDeidentifyTextFileRequest() { + File file = new File("test.txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME, DetectEntities.DOB); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + + com.skyflow.generated.rest.resources.files.requests.DeidentifyTextRequest textRequest = + vaultClient.getDeidentifyTextFileRequest(request, vaultId, base64Content); + + Assert.assertEquals(vaultId, textRequest.getVaultId()); + Assert.assertEquals(base64Content, textRequest.getFile().getBase64()); + } + + @Test + public void testGetDeidentifyStringRequest_AllTokenFormatFields() throws Exception { + List entities = Arrays.asList(DetectEntities.DOB); + List vaultToken = Collections.singletonList(DetectEntities.SSN); + List entityOnly = Collections.singletonList(DetectEntities.DOB); + List entityUniqueCounter = Collections.singletonList(DetectEntities.NAME); + + TokenFormat tokenFormat = TokenFormat.builder() + .vaultToken(vaultToken) + .entityOnly(entityOnly) + .entityUniqueCounter(entityUniqueCounter) + .build(); + + List allowRegex = Collections.singletonList("a.*"); + List restrictRegex = Collections.singletonList("b.*"); + + DateTransformation dateTransformation = new DateTransformation(10, 5, entities); + Transformations transformations = new Transformations(dateTransformation); + + DeidentifyTextRequest req = DeidentifyTextRequest.builder() + .text("Sensitive data") + .entities(entities) + .allowRegexList(allowRegex) + .restrictRegexList(restrictRegex) + .tokenFormat(tokenFormat) + .transformations(transformations) + .build(); + + DeidentifyStringRequest result = vaultClient.getDeidentifyStringRequest(req, "vaultId"); + Assert.assertNotNull(result); + Assert.assertEquals("vaultId", result.getVaultId()); + Assert.assertEquals("Sensitive data", result.getText()); + Assert.assertTrue(result.getAllowRegex().isPresent()); + Assert.assertTrue(result.getRestrictRegex().isPresent()); + Assert.assertTrue(result.getTransformations().isPresent()); + } + + @Test + public void testGetDeidentifyStringRequest_NullTokenFormatAndEntities() throws Exception { + DeidentifyTextRequest req = DeidentifyTextRequest.builder() + .text("No entities or tokenFormat") + .build(); + + DeidentifyStringRequest result = vaultClient.getDeidentifyStringRequest(req, "vaultId"); + Assert.assertNotNull(result); + Assert.assertEquals("vaultId", result.getVaultId()); + Assert.assertEquals("No entities or tokenFormat", result.getText()); + } + + @Test + public void testGetReidentifyStringRequest_AllFields() throws Exception { + List masked = Arrays.asList(DetectEntities.NAME, DetectEntities.DOB); + List plaintext = Collections.singletonList(DetectEntities.SSN); + List redacted = Collections.singletonList(DetectEntities.DATE); + + ReidentifyTextRequest req = ReidentifyTextRequest.builder() + .text("Sensitive data") + .maskedEntities(masked) + .plainTextEntities(plaintext) + .redactedEntities(redacted) + .build(); + + ReidentifyStringRequest result = vaultClient.getReidentifyStringRequest(req, "vaultId"); + Assert.assertNotNull(result); + Assert.assertEquals("vaultId", result.getVaultId()); + Assert.assertEquals("Sensitive data", result.getText()); + Assert.assertNotNull(result.getFormat()); + } + + @Test + public void testGetReidentifyStringRequest_NullFields() throws Exception { + ReidentifyTextRequest req = ReidentifyTextRequest.builder() + .text("No entities") + .build(); + + ReidentifyStringRequest result = vaultClient.getReidentifyStringRequest(req, "vaultId"); + Assert.assertNotNull(result); + Assert.assertEquals("vaultId", result.getVaultId()); + Assert.assertEquals("No entities", result.getText()); + Assert.assertNotNull(result.getFormat()); + } + + @Test + public void testGetTransformations_NullInput() throws Exception { + // Should return null if input is null + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("getTransformations", Transformations.class); + method.setAccessible(true); + Object result = method.invoke(vaultClient, new Object[]{null}); + Assert.assertNull(result); + } + + @Test + public void testGetTransformations_NullShiftDates() throws Exception { + Transformations transformations = new Transformations(null); + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("getTransformations", Transformations.class); + method.setAccessible(true); + Object result = method.invoke(vaultClient, transformations); + Assert.assertNull(result); + } + + @Test + public void testGetTransformations_EmptyEntities() throws Exception { + DateTransformation dateTransformation = new DateTransformation(10, 5, new ArrayList<>()); + Transformations transformations = new Transformations(dateTransformation); + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("getTransformations", Transformations.class); + method.setAccessible(true); + Object result = method.invoke(vaultClient, transformations); + Assert.assertNotNull(result); + // Should have empty entityTypes list + com.skyflow.generated.rest.types.Transformations restTransform = (com.skyflow.generated.rest.types.Transformations) result; + Assert.assertTrue(restTransform.getShiftDates().get().getEntityTypes().get().isEmpty()); + } + + @Test + public void testGetTransformations_WithEntities() throws Exception { + List entities = Arrays.asList(DetectEntities.DOB, DetectEntities.DATE); + DateTransformation dateTransformation = new DateTransformation(20, 5, entities); + Transformations transformations = new Transformations(dateTransformation); + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("getTransformations", Transformations.class); + method.setAccessible(true); + Object result = method.invoke(vaultClient, transformations); + Assert.assertNotNull(result); + com.skyflow.generated.rest.types.Transformations restTransform = (com.skyflow.generated.rest.types.Transformations) result; + Assert.assertEquals(2, restTransform.getShiftDates().get().getEntityTypes().get().size()); + } + + @Test + public void testGetDeidentifyGenericFileRequest_AllFields() { + File file = new File("test.custom"); + FileInput fileInput = FileInput.builder().file(file).build(); + List entities = Arrays.asList(DetectEntities.NAME, DetectEntities.DOB); + TokenFormat tokenFormat = TokenFormat.builder().entityOnly(entities).build(); + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(entities) + .tokenFormat(tokenFormat) + .allowRegexList(Arrays.asList("a.*")) + .restrictRegexList(Arrays.asList("b.*")) + .build(); + + String vaultId = "vault123"; + String base64Content = "base64string"; + String fileExtension = "txt"; + + com.skyflow.generated.rest.resources.files.requests.DeidentifyFileRequest genericRequest = + vaultClient.getDeidentifyGenericFileRequest(request, vaultId, base64Content, fileExtension); + + Assert.assertEquals(vaultId, genericRequest.getVaultId()); + Assert.assertEquals(base64Content, genericRequest.getFile().getBase64()); + Assert.assertNotNull(genericRequest.getEntityTypes()); + Assert.assertNotNull(genericRequest.getTokenType()); + Assert.assertTrue(genericRequest.getAllowRegex().isPresent()); + Assert.assertTrue(genericRequest.getRestrictRegex().isPresent()); + } + + @Test + public void testMapAudioDataFormat_mp3() throws Exception { + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("mapAudioDataFormat", String.class); + method.setAccessible(true); + Object result = method.invoke(vaultClient, "mp3"); + Assert.assertEquals(com.skyflow.generated.rest.resources.files.types.DeidentifyAudioRequestFileDataFormat.MP_3, result); + } + + @Test + public void testMapAudioDataFormat_wav() throws Exception { + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("mapAudioDataFormat", String.class); + method.setAccessible(true); + Object result = method.invoke(vaultClient, "wav"); + Assert.assertEquals(com.skyflow.generated.rest.resources.files.types.DeidentifyAudioRequestFileDataFormat.WAV, result); + } + + @Test + public void testMapAudioDataFormat_invalid() throws Exception { + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("mapAudioDataFormat", String.class); + method.setAccessible(true); + try { + method.invoke(vaultClient, "ogg"); + Assert.fail("Should throw SkyflowException for invalid audio type"); + } catch (Exception e) { + Throwable cause = e.getCause(); + Assert.assertTrue(cause instanceof SkyflowException); + } + } + + @Test + public void testPrioritiseCredentials_VaultConfigCredentials() throws Exception { + Credentials creds = new Credentials(); + creds.setApiKey("test_api_key"); + vaultConfig.setCredentials(creds); + + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("prioritiseCredentials"); + method.setAccessible(true); + method.invoke(vaultClient); + + Assert.assertEquals(creds, getPrivateField(vaultClient, "finalCredentials")); + } + + @Test + public void testPrioritiseCredentials_CommonCredentials() throws Exception { + vaultConfig.setCredentials(null); + Credentials creds = new Credentials(); + creds.setApiKey("common_api_key"); + setPrivateField(vaultClient, "commonCredentials", creds); + + java.lang.reflect.Method method = VaultClient.class.getDeclaredMethod("prioritiseCredentials"); + method.setAccessible(true); + method.invoke(vaultClient); + + Assert.assertEquals(creds, 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); + } + + private void setPrivateField(Object obj, String fieldName, Object value) throws Exception { + java.lang.reflect.Field field = obj.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(obj, value); + } } diff --git a/src/test/java/com/skyflow/errors/SkyflowExceptionTest.java b/src/test/java/com/skyflow/errors/SkyflowExceptionTest.java new file mode 100644 index 00000000..89e0643b --- /dev/null +++ b/src/test/java/com/skyflow/errors/SkyflowExceptionTest.java @@ -0,0 +1,98 @@ +package com.skyflow.errors; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SkyflowExceptionTest { + + @Test + public void testConstructorWithMessage() { + SkyflowException ex = new SkyflowException("Test message"); + Assert.assertEquals("Test message", ex.getMessage()); + Assert.assertNull(ex.getHttpStatus()); + Assert.assertNull(ex.getGrpcCode()); + } + + @Test + public void testConstructorWithThrowable() { + Throwable cause = new RuntimeException("Root cause"); + SkyflowException ex = new SkyflowException(cause); + Assert.assertEquals("Root cause", ex.getMessage()); + } + + @Test + public void testConstructorWithMessageAndCause() { + Throwable cause = new RuntimeException("Root cause"); + SkyflowException ex = new SkyflowException("Test message", cause); + Assert.assertEquals("Test message", ex.getMessage()); + } + + @Test + public void testConstructorWithCodeAndMessage() { + SkyflowException ex = new SkyflowException(400, "Bad Request"); + Assert.assertEquals(Integer.valueOf(400), Integer.valueOf(ex.getHttpCode())); + Assert.assertEquals("Bad Request", ex.getMessage()); + Assert.assertEquals("Bad Request", ex.toString().contains("Bad Request") ? "Bad Request" : null); + } + + @Test + public void testToStringFormat() { + SkyflowException ex = new SkyflowException(404, "Not Found"); + String str = ex.toString(); + Assert.assertTrue(str.contains("httpCode: 404")); + Assert.assertTrue(str.contains("message: Not Found")); + } + + @Test + public void testConstructorWithJsonErrorBody() { + String json = "{\"error\":{\"message\":\"json error\",\"grpc_code\":7,\"http_status\":\"NOT_FOUND\",\"details\":[{\"info\":\"detail1\"}]}}"; + Map> headers = new HashMap<>(); + headers.put("x-request-id", Collections.singletonList("req-123")); + SkyflowException ex = new SkyflowException(404, new RuntimeException("fail"), headers, json); + Assert.assertEquals("json error", ex.getMessage()); + Assert.assertEquals(Integer.valueOf(7), ex.getGrpcCode()); + Assert.assertEquals("NOT_FOUND", ex.getHttpStatus()); + Assert.assertEquals("req-123", ex.getRequestId()); + Assert.assertNotNull(ex.getDetails()); + Assert.assertTrue(ex.getDetails().size() > 0); + } + + + @Test + public void testConstructorWithNullErrorBody() { + Map> headers = new HashMap<>(); + SkyflowException ex = new SkyflowException(500, new RuntimeException("fail"), headers, null); + Assert.assertNull(ex.getMessage()); + Assert.assertNull(ex.getGrpcCode()); + Assert.assertNull(ex.getHttpStatus()); + } + + @Test + public void testGettersAndSetters() { + SkyflowException ex = new SkyflowException("msg"); + // Simulate setting fields via reflection or constructor + // (getters are already tested above) + Assert.assertNull(ex.getRequestId()); + Assert.assertNull(ex.getDetails()); + Assert.assertNull(ex.getGrpcCode()); + Assert.assertNull(ex.getHttpStatus()); + } + + @Test + public void testSetDetailsWithErrorFromClientHeader() { + String json = "{\"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); + + Assert.assertNotNull(ex.getDetails()); + Assert.assertEquals(1, ex.getDetails().size()); + Assert.assertEquals("client error", ex.getDetails().get(0).getAsJsonObject().get("errorFromClient").getAsString()); + } +} \ No newline at end of file diff --git a/src/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java b/src/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java new file mode 100644 index 00000000..da8494e1 --- /dev/null +++ b/src/test/java/com/skyflow/vault/controller/DetectControllerFileTests.java @@ -0,0 +1,409 @@ +package com.skyflow.vault.controller; + +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.vault.detect.AudioBleep; +import com.skyflow.vault.detect.DeidentifyFileRequest; +import com.skyflow.vault.detect.FileInput; +import com.skyflow.vault.detect.GetDetectRunRequest; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.File; +import java.nio.file.Files; +import java.util.ArrayList; + +public class DetectControllerFileTests { + private static final String EXCEPTION_NOT_THROWN = "Should have thrown an exception"; + private static String vaultID = null; + private static String clusterID = null; + private static VaultConfig vaultConfig = null; + private static DetectController detectController = null; + + @BeforeClass + public static void setup() { + vaultID = "vault123"; + clusterID = "cluster123"; + + Credentials credentials = new Credentials(); + credentials.setToken("valid-token"); + + vaultConfig = new VaultConfig(); + vaultConfig.setVaultId(vaultID); + vaultConfig.setClusterId(clusterID); + vaultConfig.setEnv(com.skyflow.enums.Env.DEV); + vaultConfig.setCredentials(credentials); + + detectController = new DetectController(vaultConfig, credentials); + } + + @Test + public void testUnreadableFileInDeidentifyFileRequest() { + try { + File file = new File("unreadable.txt") { + @Override + public boolean exists() { return true; } + @Override + public boolean isFile() { return true; } + @Override + public boolean canRead() { return false; } + }; + FileInput fileInput = FileInput.builder().file(file).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder().file(fileInput).build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException | RuntimeException e) { + // Depending on implementation, could be SkyflowException or RuntimeException + Assert.assertTrue(e.getMessage().contains("not readable") || e.getMessage().contains("unreadable.txt")); + } + } + + @Test + public void testNullEntitiesInDeidentifyFileRequest() { + try { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(new ArrayList<>()) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testNullRequest() { + try { + detectController.deidentifyFile(null); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testFileInputBothFileAndFilePathNull() { + try { + FileInput fileInput = FileInput.builder().build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder().file(fileInput).build(); + detectController.deidentifyFile(request); + Assert.fail("Should have thrown an exception for both file and filePath being null"); + } catch (Exception e) { + Assert.assertTrue(e.getMessage().contains(ErrorMessage.EmptyFileAndFilePathInDeIdentifyFile.getMessage())); + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testFileInputBothFileAndFilePathProvided() { + try { + java.io.File file = java.io.File.createTempFile("test", ".txt"); + String filePath = file.getAbsolutePath(); + FileInput fileInput = FileInput.builder().file(file).filePath(filePath).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder().file(fileInput).build(); + detectController.deidentifyFile(request); + Assert.fail("Should have thrown an exception for both file and filePath being provided"); + } catch (Exception e) { + Assert.assertTrue(e.getMessage().contains(ErrorMessage.BothFileAndFilePathProvided.getMessage())); + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testFileInputEmptyFilePath() { + try { + FileInput fileInput = FileInput.builder().filePath("").build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder().file(fileInput).build(); + detectController.deidentifyFile(request); + Assert.fail("Should have thrown an exception for empty filePath"); + } catch (Exception e) { + Assert.assertTrue(e.getMessage().contains(ErrorMessage.InvalidFilePath.getMessage())); + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testFileInputNonExistentFile() { + try { + java.io.File file = new java.io.File("nonexistent.txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder().file(fileInput).build(); + detectController.deidentifyFile(request); + Assert.fail("Should have thrown an exception for non-existent file"); + } catch (Exception e) { + Assert.assertTrue(e.getMessage().contains(ErrorMessage.FileNotFoundToDeidentify.getMessage())); + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testFileInputUnreadableFile() { + try { + java.io.File file = new java.io.File("unreadable.txt") { + @Override + public boolean exists() { return true; } + @Override + public boolean isFile() { return true; } + @Override + public boolean canRead() { return false; } + }; + FileInput fileInput = FileInput.builder().file(file).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder().file(fileInput).build(); + detectController.deidentifyFile(request); + Assert.fail("Should have thrown an exception for unreadable file"); + } catch (Exception e) { + Assert.assertTrue(e.getMessage().contains(ErrorMessage.FileNotReadableToDeidentify.getMessage())); + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testNonExistentFileInDeidentifyFileRequest() { + try { + File file = new File("nonexistent.txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder().file(fileInput).build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testInvalidPixelDensity() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .pixelDensity(-1) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testInvalidMaxResolution() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .maxResolution(-1) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testInvalidBleepFrequency() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + AudioBleep bleep = AudioBleep.builder().build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .bleep(bleep) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testInvalidOutputDirectory() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .outputDirectory("not/a/real/dir") + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testInvalidWaitTime() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .waitTime(-1) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testWaitTimeExceedsLimit() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .waitTime(100) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testNullGetDetectRunRequest() { + try { + detectController.getDetectRun(null); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testEmptyRunIdInGetDetectRunRequest() { + try { + GetDetectRunRequest request = GetDetectRunRequest.builder().build(); + detectController.getDetectRun(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testNullRunIdInGetDetectRunRequest() { + try { + GetDetectRunRequest request = GetDetectRunRequest.builder().runId(null).build(); + detectController.getDetectRun(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + } + + @Test + public void testInvalidBleepGain() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + AudioBleep bleep = AudioBleep.builder().frequency(440.0).gain(-1.0).startPadding(0.1).stopPadding(0.1).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .bleep(bleep) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testInvalidBleepStartPadding() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + AudioBleep bleep = AudioBleep.builder().frequency(440.0).gain(0.5).startPadding(-0.1).stopPadding(0.1).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .bleep(bleep) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testInvalidBleepStopPadding() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + try { + AudioBleep bleep = AudioBleep.builder().frequency(440.0).gain(0.5).startPadding(0.1).stopPadding(-0.1).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .bleep(bleep) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + } + + @Test + public void testOutputDirectoryNotDirectory() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + File notADir = File.createTempFile("notadir", ".txt"); + try { + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .outputDirectory(notADir.getAbsolutePath()) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } + file.delete(); + notADir.delete(); + } + + @Test + public void testOutputDirectoryNotWritable() throws Exception { + File file = File.createTempFile("test", ".txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + File dir = Files.createTempDirectory("notwritabledir").toFile(); + dir.setWritable(false); + try { + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .outputDirectory(dir.getAbsolutePath()) + .build(); + detectController.deidentifyFile(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (Exception e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); + } finally { + dir.setWritable(true); + file.delete(); + dir.delete(); + } + } +} \ No newline at end of file diff --git a/src/test/java/com/skyflow/vault/controller/DetectControllerTests.java b/src/test/java/com/skyflow/vault/controller/DetectControllerTests.java new file mode 100644 index 00000000..aae713b1 --- /dev/null +++ b/src/test/java/com/skyflow/vault/controller/DetectControllerTests.java @@ -0,0 +1,121 @@ +package com.skyflow.vault.controller; + +import com.skyflow.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.ErrorMessage; +import com.skyflow.errors.HttpStatus; +import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.Constants; +import com.skyflow.utils.Utils; +import com.skyflow.vault.detect.DeidentifyTextRequest; +import com.skyflow.vault.detect.ReidentifyTextRequest; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class DetectControllerTests { + private static final String EXCEPTION_NOT_THROWN = "Should have thrown an exception"; + private static String vaultID = null; + private static String clusterID = null; + private static VaultConfig vaultConfig = null; + private static Skyflow skyflowClient = null; + + @BeforeClass + public static void setup() throws SkyflowException, NoSuchMethodException { + vaultID = "vault123"; + clusterID = "cluster123"; + + Credentials credentials = new Credentials(); + credentials.setToken("valid-token"); + + vaultConfig = new VaultConfig(); + vaultConfig.setVaultId(vaultID); + vaultConfig.setClusterId(clusterID); + vaultConfig.setEnv(Env.DEV); + vaultConfig.setCredentials(credentials); + + + skyflowClient = Skyflow.builder() + .setLogLevel(LogLevel.DEBUG) + .addVaultConfig(vaultConfig) + .build(); + } + + + @Test + public void testNullTextInRequestInDeidentifyStringMethod() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder().text(null).build(); + skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); + skyflowClient.detect(vaultID).deidentifyText(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.InvalidTextInDeIdentify.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + Assert.assertNull(e.getRequestId()); + Assert.assertNull(e.getGrpcCode()); + Assert.assertEquals(HttpStatus.BAD_REQUEST.getHttpStatus(), e.getHttpStatus()); + } + } + + @Test + public void testEmptyTextInRequestInDeidentifyStringMethod() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder().text("").build(); + skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); + skyflowClient.detect(vaultID).deidentifyText(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.InvalidTextInDeIdentify.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + Assert.assertNull(e.getRequestId()); + Assert.assertNull(e.getGrpcCode()); + Assert.assertEquals(HttpStatus.BAD_REQUEST.getHttpStatus(), e.getHttpStatus()); + } + } + + @Test + public void testNullTextInRequestInReidentifyStringMethod() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder().text(null).build(); + skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); + skyflowClient.detect(vaultID).reidentifyText(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.InvalidTextInReIdentify.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + Assert.assertNull(e.getRequestId()); + Assert.assertNull(e.getGrpcCode()); + Assert.assertEquals(HttpStatus.BAD_REQUEST.getHttpStatus(), e.getHttpStatus()); + } + } + + @Test + public void testEmptyTextInRequestInReidentifyStringMethod() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder().text("").build(); + skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); + skyflowClient.detect(vaultID).reidentifyText(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals( + Utils.parameterizedString(ErrorMessage.InvalidTextInReIdentify.getMessage(), Constants.SDK_PREFIX), + e.getMessage() + ); + Assert.assertNull(e.getRequestId()); + Assert.assertNull(e.getGrpcCode()); + Assert.assertEquals(HttpStatus.BAD_REQUEST.getHttpStatus(), e.getHttpStatus()); + } + } + +} + diff --git a/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java b/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java index 6084e9c3..5f3ae771 100644 --- a/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java +++ b/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java @@ -10,7 +10,6 @@ import com.skyflow.errors.HttpStatus; import com.skyflow.errors.SkyflowException; import com.skyflow.generated.rest.ApiClient; -import com.skyflow.generated.rest.api.TokensApi; import com.skyflow.utils.Constants; import com.skyflow.utils.Utils; import com.skyflow.vault.data.*; @@ -28,7 +27,6 @@ public class VaultControllerTests { private static VaultConfig vaultConfig = null; private static Skyflow skyflowClient = null; private ApiClient mockApiClient; - private TokensApi mockTokensApi; @BeforeClass public static void setup() throws SkyflowException, NoSuchMethodException { @@ -43,13 +41,19 @@ public static void setup() throws SkyflowException, NoSuchMethodException { vaultConfig.setClusterId(clusterID); vaultConfig.setEnv(Env.DEV); vaultConfig.setCredentials(credentials); + + + skyflowClient = Skyflow.builder() + .setLogLevel(LogLevel.DEBUG) + .addVaultConfig(vaultConfig) + .build(); + } @Test public void testInvalidRequestInInsertMethod() { try { InsertRequest request = InsertRequest.builder().build(); - skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); skyflowClient.vault().insert(request); Assert.fail(EXCEPTION_NOT_THROWN); } catch (SkyflowException e) { @@ -161,37 +165,4 @@ public void testInvalidRequestInTokenizeMethod() { } } - @Test - public void testLookUpBin() { - try { - skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); - skyflowClient.vault().lookUpBin(); - skyflowClient.vault().lookUpBin(); - } catch (SkyflowException e) { - Assert.fail(INVALID_EXCEPTION_THROWN); - } - } - - @Test - public void testAudit() { - try { - skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); - skyflowClient.vault().audit(); - skyflowClient.vault().audit(); - } catch (SkyflowException e) { - Assert.fail(INVALID_EXCEPTION_THROWN); - } - } - - @Test - public void testDetect() { - try { - skyflowClient = Skyflow.builder().setLogLevel(LogLevel.DEBUG).addVaultConfig(vaultConfig).build(); - skyflowClient.vault().detect(); - skyflowClient.vault().detect(); - } catch (SkyflowException e) { - Assert.fail(INVALID_EXCEPTION_THROWN); - } - } - } diff --git a/src/test/java/com/skyflow/vault/data/DeleteTests.java b/src/test/java/com/skyflow/vault/data/DeleteTests.java index 6749e31d..befc3d26 100644 --- a/src/test/java/com/skyflow/vault/data/DeleteTests.java +++ b/src/test/java/com/skyflow/vault/data/DeleteTests.java @@ -163,7 +163,7 @@ public void testDeleteResponse() { try { ids.add(skyflowID); DeleteResponse response = new DeleteResponse(ids); - String responseString = "{\"deletedIds\":[\"" + skyflowID + "\"],\"errors\":[]}"; + String responseString = "{\"deletedIds\":[\"" + skyflowID + "\"],\"errors\":null}"; Assert.assertEquals(1, response.getDeletedIds().size()); Assert.assertEquals(responseString, response.toString()); } catch (Exception e) { diff --git a/src/test/java/com/skyflow/vault/data/QueryTests.java b/src/test/java/com/skyflow/vault/data/QueryTests.java index 7a8cca5e..c8e453f5 100644 --- a/src/test/java/com/skyflow/vault/data/QueryTests.java +++ b/src/test/java/com/skyflow/vault/data/QueryTests.java @@ -97,7 +97,7 @@ public void testQueryResponse() { String responseString = "{\"fields\":" + "[{\"card_number\":\"test_card_number\",\"name\":\"test_name\",\"tokenizedData\":{}}," + "{\"card_number\":\"test_card_number\",\"name\":\"test_name\",\"tokenizedData\":{}}]," + - "\"errors\":[]}"; + "\"errors\":null}"; Assert.assertEquals(2, response.getFields().size()); Assert.assertEquals(responseString, response.toString()); } catch (Exception e) { diff --git a/src/test/java/com/skyflow/vault/data/UpdateTests.java b/src/test/java/com/skyflow/vault/data/UpdateTests.java index 7032fcb0..be702d4e 100644 --- a/src/test/java/com/skyflow/vault/data/UpdateTests.java +++ b/src/test/java/com/skyflow/vault/data/UpdateTests.java @@ -448,7 +448,7 @@ public void testUpdateResponse() { UpdateResponse response = new UpdateResponse(skyflowID, tokenMap); String responseString = "{\"updatedField\":{\"skyflowId\":\"" + skyflowID + "\"," + "\"test_column_1\":\"test_token_1\",\"test_column_2\":\"test_token_2\"}" + - ",\"errors\":[]}"; + ",\"errors\":null}"; Assert.assertEquals(skyflowID, response.getSkyflowId()); Assert.assertEquals(2, response.getTokens().size()); Assert.assertEquals(responseString, response.toString()); diff --git a/src/test/java/com/skyflow/vault/detect/DeidentifyFileRequestTest.java b/src/test/java/com/skyflow/vault/detect/DeidentifyFileRequestTest.java new file mode 100644 index 00000000..1b19d9d9 --- /dev/null +++ b/src/test/java/com/skyflow/vault/detect/DeidentifyFileRequestTest.java @@ -0,0 +1,99 @@ +package com.skyflow.vault.detect; + +import com.skyflow.enums.DetectEntities; +import com.skyflow.enums.DetectOutputTranscriptions; +import com.skyflow.enums.MaskingMethod; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; + +public class DeidentifyFileRequestTest { + + @Test + public void testBuilderAndGetters() { + File file = new File("test.txt"); + FileInput fileInput = FileInput.builder().file(file).build(); + DetectEntities entity = DetectEntities.DOB; + MaskingMethod maskingMethod = MaskingMethod.BLACKBOX; + DetectOutputTranscriptions transcription = DetectOutputTranscriptions.TRANSCRIPTION; + String outputDir = "/tmp/output"; + int waitTime = 42; + + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(Arrays.asList(entity)) + .allowRegexList(Arrays.asList("a.*")) + .restrictRegexList(Arrays.asList("b.*")) + .maskingMethod(maskingMethod) + .outputProcessedImage(true) + .outputOcrText(true) + .outputProcessedAudio(true) + .outputTranscription(transcription) + .outputDirectory(outputDir) + .waitTime(waitTime) + .build(); + + Assert.assertEquals(entity, request.getEntities().get(0)); + Assert.assertEquals("a.*", request.getAllowRegexList().get(0)); + Assert.assertEquals("b.*", request.getRestrictRegexList().get(0)); + Assert.assertEquals(maskingMethod, request.getMaskingMethod()); + Assert.assertTrue(request.getOutputProcessedImage()); + Assert.assertTrue(request.getOutputOcrText()); + Assert.assertTrue(request.getOutputProcessedAudio()); + Assert.assertEquals(transcription, request.getOutputTranscription()); + Assert.assertEquals(outputDir, request.getOutputDirectory()); + Assert.assertEquals(Integer.valueOf(waitTime), request.getWaitTime()); + } + + @Test + public void testBuilderDefaults() { + DeidentifyFileRequest request = DeidentifyFileRequest.builder().build(); + Assert.assertFalse(request.getOutputProcessedImage()); + Assert.assertFalse(request.getOutputOcrText()); + Assert.assertFalse(request.getOutputProcessedAudio()); + Assert.assertNull(request.getOutputDirectory()); + Assert.assertNull(request.getWaitTime()); + } + + @Test + public void testBuilderWithFilePath() { + String filePath = "/tmp/test.txt"; + FileInput fileInput = FileInput.builder().filePath(filePath).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(Collections.singletonList(DetectEntities.DOB)) + .build(); + + Assert.assertEquals(filePath, request.getFileInput().getFilePath()); + Assert.assertNull(request.getFileInput().getFile()); + } + + @Test + public void testBuilderWithFileAndFilePath() { + File file = new File("test.txt"); + String filePath = "/tmp/test.txt"; + FileInput fileInput = FileInput.builder().file(file).filePath(filePath).build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(Collections.singletonList(DetectEntities.DOB)) + .build(); + + Assert.assertEquals(file, request.getFileInput().getFile()); + Assert.assertEquals(filePath, request.getFileInput().getFilePath()); + } + + @Test + public void testBuilderWithNullFileAndFilePath() { + FileInput fileInput = FileInput.builder().build(); + DeidentifyFileRequest request = DeidentifyFileRequest.builder() + .file(fileInput) + .entities(Collections.singletonList(DetectEntities.DOB)) + .build(); + + Assert.assertNull(request.getFileInput().getFile()); + Assert.assertNull(request.getFileInput().getFilePath()); + } +} \ No newline at end of file diff --git a/src/test/java/com/skyflow/vault/detect/DeidentifyFileResponseTest.java b/src/test/java/com/skyflow/vault/detect/DeidentifyFileResponseTest.java new file mode 100644 index 00000000..a1243eea --- /dev/null +++ b/src/test/java/com/skyflow/vault/detect/DeidentifyFileResponseTest.java @@ -0,0 +1,60 @@ +package com.skyflow.vault.detect; + +import com.skyflow.generated.rest.types.DeidentifyFileOutputProcessedFileType; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; + +public class DeidentifyFileResponseTest { + + @Test + public void testAllGettersAndToString() { + File fileObject = new File("test-path.txt"); + String file = "test-path.txt"; + String type = "pdf"; + String extension = ".pdf"; + Integer wordCount = 100; + Integer charCount = 500; + Double sizeInKb = 123.45; + Double durationInSeconds = 12.3; + Integer pageCount = 5; + Integer slideCount = 0; + FileEntityInfo entityInfo = new FileEntityInfo("PERSON", DeidentifyFileOutputProcessedFileType.ENTITIES, "John Doe"); + java.util.List entities = Collections.singletonList(entityInfo); + String runId = "run-123"; + String status = "SUCCESS"; + java.util.List errors = Arrays.asList("error1", "error2"); + FileInfo fileInfo = new FileInfo(fileObject); + + DeidentifyFileResponse response = new DeidentifyFileResponse( + fileInfo, file, type, extension, wordCount, charCount, sizeInKb, + durationInSeconds, pageCount, slideCount, entities, runId, status, errors + ); + + Assert.assertEquals(type, response.getType()); + Assert.assertEquals(extension, response.getExtension()); + Assert.assertEquals(wordCount, response.getWordCount()); + Assert.assertEquals(charCount, response.getCharCount()); + Assert.assertEquals(sizeInKb, response.getSizeInKb()); + Assert.assertEquals(durationInSeconds, response.getDurationInSeconds()); + Assert.assertEquals(pageCount, response.getPageCount()); + Assert.assertEquals(slideCount, response.getSlideCount()); + Assert.assertEquals(entities, response.getEntities()); + Assert.assertEquals(runId, response.getRunId()); + Assert.assertEquals(status, response.getStatus()); + Assert.assertEquals(errors, response.getErrors()); + + // toString should return a JSON string containing all fields + String json = response.toString(); + Assert.assertTrue(json.contains(file)); + Assert.assertTrue(json.contains(type)); + Assert.assertTrue(json.contains(extension)); + Assert.assertTrue(json.contains(runId)); + Assert.assertTrue(json.contains(status)); + Assert.assertTrue(json.contains("error1")); + Assert.assertTrue(json.contains("PERSON")); + } +} \ No newline at end of file diff --git a/src/test/java/com/skyflow/vault/detect/DeidentifyTextTests.java b/src/test/java/com/skyflow/vault/detect/DeidentifyTextTests.java new file mode 100644 index 00000000..08cde4c3 --- /dev/null +++ b/src/test/java/com/skyflow/vault/detect/DeidentifyTextTests.java @@ -0,0 +1,217 @@ +package com.skyflow.vault.detect; + +import com.skyflow.enums.DetectEntities; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.validations.Validations; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static com.skyflow.errors.ErrorMessage.InvalidTextInDeIdentify; + +public class DeidentifyTextTests { + + 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 text = "Sensitive data to deidentify"; + private static final List detectEntities = new ArrayList<>(); + private static final List allowRegexList = new ArrayList<>(); + private static final List restrictRegexList = new ArrayList<>(); + private static final TokenFormat tokenFormat = TokenFormat.builder() + .vaultToken(detectEntities) + .entityUniqueCounter(detectEntities) + .entityOnly(detectEntities) + .build(); + + private static Transformations transformations = null; + + + @BeforeClass + public static void setup() { + detectEntities.add(DetectEntities.NAME); + detectEntities.add(DetectEntities.DOB); + + allowRegexList.add("^[A-Za-z]+$"); + restrictRegexList.add("([0-9]{3}-[0-9]{2}-[0-9]{4})"); + + transformations = new Transformations( + new DateTransformation(20, 5, detectEntities) + ); + } + + + @Test + public void testValidInputInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder() + .text(text) + .entities(detectEntities) + .allowRegexList(allowRegexList) + .restrictRegexList(restrictRegexList) + .tokenFormat(tokenFormat) + .transformations(transformations) + .build(); + + Validations.validateDeidentifyTextRequest(request); + Assert.assertEquals(detectEntities, request.getEntities()); + Assert.assertEquals(allowRegexList, request.getAllowRegexList()); + Assert.assertEquals(restrictRegexList, request.getRestrictRegexList()); + Assert.assertEquals(tokenFormat, request.getTokenFormat()); + Assert.assertEquals(transformations, request.getTransformations()); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + + @Test + public void testNullTextInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder().text(null).build(); + Validations.validateDeidentifyTextRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(InvalidTextInDeIdentify.getMessage(), e.getMessage()); + } + } + + @Test + public void testEmptyTextInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder().text("").build(); + Validations.validateDeidentifyTextRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(InvalidTextInDeIdentify.getMessage(), e.getMessage()); + } + } + + @Test + public void testEmptyEntitiesInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder() + .text(text) + .entities(new ArrayList<>()) + .build(); + Validations.validateDeidentifyTextRequest(request); + Assert.assertTrue(request.getEntities().isEmpty()); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + + @Test + public void testNoEntitiesInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder().text("").build(); + Validations.validateDeidentifyTextRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + + @Test + public void testEmptyAllowRegexListInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder() + .text(text) + .allowRegexList(new ArrayList<>()) + .build(); + Validations.validateDeidentifyTextRequest(request); + Assert.assertTrue(request.getAllowRegexList().isEmpty()); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + @Test + public void testEmptyRestrictRegexListInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder() + .text(text) + .restrictRegexList(new ArrayList<>()) + .build(); + Validations.validateDeidentifyTextRequest(request); + Assert.assertTrue(request.getRestrictRegexList().isEmpty()); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + + @Test + public void testNullTokenFormatInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder() + .text(text) + .entities(detectEntities) + .allowRegexList(allowRegexList) + .restrictRegexList(restrictRegexList) + .tokenFormat(null) + .build(); + Validations.validateDeidentifyTextRequest(request); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + @Test + public void testNoTransformationsInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder() + .text(text) + .entities(detectEntities) + .allowRegexList(allowRegexList) + .restrictRegexList(restrictRegexList) + .tokenFormat(tokenFormat) + .build(); + Validations.validateDeidentifyTextRequest(request); + Assert.assertNull(request.getTransformations()); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testNullOrEmptyTransformationsInDeidentifyTextRequestValidations() { + try { + DeidentifyTextRequest request = DeidentifyTextRequest.builder() + .text(text) + .entities(detectEntities) + .allowRegexList(allowRegexList) + .restrictRegexList(restrictRegexList) + .tokenFormat(tokenFormat) + .transformations(null) + .build(); + Validations.validateDeidentifyTextRequest(request); + Assert.assertNull(request.getTransformations()); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + @Test + public void testDeidentifyResponse() { + try { + List entityInfos = new ArrayList<>(); + int wordCount = 5; + int charCount = 30; + DeidentifyTextResponse response = new DeidentifyTextResponse(text, entityInfos, wordCount, charCount); + Assert.assertEquals(text, response.getProcessedText()); + Assert.assertEquals(wordCount, response.getWordCount()); + Assert.assertEquals(charCount, response.getCharCount()); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } +} diff --git a/src/test/java/com/skyflow/vault/detect/FileEntityInfoTest.java b/src/test/java/com/skyflow/vault/detect/FileEntityInfoTest.java new file mode 100644 index 00000000..e1f1e152 --- /dev/null +++ b/src/test/java/com/skyflow/vault/detect/FileEntityInfoTest.java @@ -0,0 +1,21 @@ +package com.skyflow.vault.detect; + +import com.skyflow.generated.rest.types.DeidentifyFileOutputProcessedFileType; +import org.junit.Assert; +import org.junit.Test; + +public class FileEntityInfoTest { + + @Test + public void testConstructorAndGetters() { + String file = "entity.pdf"; + DeidentifyFileOutputProcessedFileType type = DeidentifyFileOutputProcessedFileType.ENTITIES; + String extension = ".pdf"; + + FileEntityInfo info = new FileEntityInfo(file, type, extension); + + Assert.assertEquals(file, info.getFile()); + Assert.assertEquals(type.toString(), info.getType()); + Assert.assertEquals(extension, info.getExtension()); + } +} \ No newline at end of file diff --git a/src/test/java/com/skyflow/vault/detect/FileInfoTest.java b/src/test/java/com/skyflow/vault/detect/FileInfoTest.java new file mode 100644 index 00000000..29a81f6a --- /dev/null +++ b/src/test/java/com/skyflow/vault/detect/FileInfoTest.java @@ -0,0 +1,41 @@ +package com.skyflow.vault.detect; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +public class FileInfoTest { + + @Test + public void testFileInfoFields() throws IOException { + // Create a temp file + File tempFile = File.createTempFile("testfileinfo", ".txt"); + tempFile.deleteOnExit(); + + // Write some content to ensure size > 0 + FileWriter writer = new FileWriter(tempFile); + writer.write("Hello Skyflow!"); + writer.close(); + + FileInfo fileInfo = new FileInfo(tempFile); + + Assert.assertEquals(tempFile.getName(), fileInfo.getName()); + Assert.assertEquals(tempFile.length(), fileInfo.getSize()); + Assert.assertEquals("", fileInfo.getType()); + Assert.assertEquals(tempFile.lastModified(), fileInfo.getLastModified()); + } + + @Test + public void testFileInfoWithNonExistentFile() { + File fakeFile = new File("nonexistentfile.txt"); + FileInfo fileInfo = new FileInfo(fakeFile); + + Assert.assertEquals("nonexistentfile.txt", fileInfo.getName()); + Assert.assertEquals(0, fileInfo.getSize()); + Assert.assertEquals("", fileInfo.getType()); + Assert.assertEquals(0, fileInfo.getLastModified()); + } +} \ No newline at end of file diff --git a/src/test/java/com/skyflow/vault/detect/ReidentifyTextTests.java b/src/test/java/com/skyflow/vault/detect/ReidentifyTextTests.java new file mode 100644 index 00000000..e96a6422 --- /dev/null +++ b/src/test/java/com/skyflow/vault/detect/ReidentifyTextTests.java @@ -0,0 +1,149 @@ +package com.skyflow.vault.detect; + +import com.skyflow.enums.DetectEntities; +import com.skyflow.errors.ErrorCode; +import com.skyflow.errors.SkyflowException; +import com.skyflow.utils.validations.Validations; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static com.skyflow.errors.ErrorMessage.InvalidTextInReIdentify; + +public class ReidentifyTextTests { + + 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 text = "Sensitive data to reidentify"; + private static final List redactedEntities = new ArrayList<>(); + private static final List maskedEntities = new ArrayList<>(); + private static final List plainTextEntities = new ArrayList<>(); + + @BeforeClass + public static void setup() { + redactedEntities.add(DetectEntities.NAME); + redactedEntities.add(DetectEntities.DOB); + + maskedEntities.add(DetectEntities.USERNAME); + + plainTextEntities.add(DetectEntities.PHONE_NUMBER); + } + + @Test + public void testValidInputInReidentifyTextRequestValidations() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder() + .text(text) + .redactedEntities(redactedEntities) + .maskedEntities(maskedEntities) + .plainTextEntities(plainTextEntities) + .build(); + + Validations.validateReidentifyTextRequest(request); + Assert.assertEquals(text, request.getText()); + Assert.assertEquals(redactedEntities, request.getRedactedEntities()); + Assert.assertEquals(maskedEntities, request.getMaskedEntities()); + Assert.assertEquals(plainTextEntities, request.getPlainTextEntities()); + } catch (SkyflowException e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } + + @Test + public void testNoTextInReidentifyTextRequestValidations() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder().build(); + Validations.validateReidentifyTextRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + @Test + public void testNullTextInReidentifyTextRequestValidations() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder() + .text(null) + .build(); + Validations.validateReidentifyTextRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(InvalidTextInReIdentify.getMessage(), e.getMessage()); + } + } + + @Test + public void testEmptyTextInReidentifyTextRequestValidations() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder() + .text("") + .build(); + Validations.validateReidentifyTextRequest(request); + Assert.fail(EXCEPTION_NOT_THROWN); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + Assert.assertEquals(InvalidTextInReIdentify.getMessage(), e.getMessage()); + } + } + + + @Test + public void testEmptyRedactedEntitiesInReidentifyTextRequestValidations() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder() + .text(text) + .redactedEntities(new ArrayList<>()) + .build(); + Validations.validateReidentifyTextRequest(request); + Assert.assertTrue(request.getRedactedEntities().isEmpty()); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + + @Test + public void testEmptyMaskedEntitiesInReidentifyTextRequestValidations() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder() + .text(text) + .maskedEntities(new ArrayList<>()) + .build(); + Validations.validateReidentifyTextRequest(request); + Assert.assertTrue(request.getMaskedEntities().isEmpty()); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + @Test + public void testEmptyPlainTextEntitiesInReidentifyTextRequestValidations() { + try { + ReidentifyTextRequest request = ReidentifyTextRequest.builder() + .text(text) + .plainTextEntities(new ArrayList<>()) + .build(); + Validations.validateReidentifyTextRequest(request); + Assert.assertTrue(request.getPlainTextEntities().isEmpty()); + } catch (SkyflowException e) { + Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), e.getHttpCode()); + } + } + + + @Test + public void testReidentifyResponse() { + try { + ReidentifyTextResponse response = new ReidentifyTextResponse(text); + Assert.assertEquals(text, response.getProcessedText()); + } catch (Exception e) { + Assert.fail(INVALID_EXCEPTION_THROWN); + } + } +} \ No newline at end of file diff --git a/src/test/java/com/skyflow/vault/tokens/DetokenizeTests.java b/src/test/java/com/skyflow/vault/tokens/DetokenizeTests.java index 44bcf2a5..ed6804b5 100644 --- a/src/test/java/com/skyflow/vault/tokens/DetokenizeTests.java +++ b/src/test/java/com/skyflow/vault/tokens/DetokenizeTests.java @@ -4,8 +4,8 @@ import com.skyflow.errors.ErrorCode; import com.skyflow.errors.ErrorMessage; import com.skyflow.errors.SkyflowException; -import com.skyflow.generated.rest.models.DetokenizeRecordResponseValueType; -import com.skyflow.generated.rest.models.V1DetokenizeRecordResponse; +import com.skyflow.generated.rest.types.DetokenizeRecordResponseValueType; +import com.skyflow.generated.rest.types.V1DetokenizeRecordResponse; import com.skyflow.utils.Constants; import com.skyflow.utils.Utils; import com.skyflow.utils.validations.Validations; @@ -147,16 +147,19 @@ public void testRedactionAndContinueOnErrorInDetokenizeRequestValidations() { @Test public void testDetokenizeResponse() { try { - V1DetokenizeRecordResponse record1 = new V1DetokenizeRecordResponse(); - record1.setToken("1234-5678-9012-3456"); - record1.setValue("4111111111111111"); - record1.setValueType(DetokenizeRecordResponseValueType.STRING); + V1DetokenizeRecordResponse record1 = V1DetokenizeRecordResponse.builder() + .token("1234-5678-9012-3456") + .value("4111111111111111") + .valueType(DetokenizeRecordResponseValueType.STRING) + .build(); DetokenizeRecordResponse field = new DetokenizeRecordResponse(record1); - V1DetokenizeRecordResponse record2 = new V1DetokenizeRecordResponse(); - record2.setToken("3456-7890-1234-5678"); - record2.setValue(""); - record2.setError("Invalid token"); + V1DetokenizeRecordResponse record2 = V1DetokenizeRecordResponse.builder() + .token("3456-7890-1234-5678") + .value("") + .error("Invalid token") + .build(); + DetokenizeRecordResponse error = new DetokenizeRecordResponse(record2, requestId); ArrayList fields = new ArrayList<>(); diff --git a/src/test/java/com/skyflow/vault/tokens/TokenizeTests.java b/src/test/java/com/skyflow/vault/tokens/TokenizeTests.java index 821ad844..4c279fde 100644 --- a/src/test/java/com/skyflow/vault/tokens/TokenizeTests.java +++ b/src/test/java/com/skyflow/vault/tokens/TokenizeTests.java @@ -159,7 +159,7 @@ public void testTokenizeResponse() { TokenizeResponse response = new TokenizeResponse(tokens); String responseString = "{\"tokens\":[" + "{\"token\":\"1234-5678-9012-3456\"},{\"token\":\"5678-9012-3456-7890\"}]" + - ",\"errors\":[]}"; + ",\"errors\":null}"; Assert.assertEquals(2, response.getTokens().size()); Assert.assertEquals(responseString, response.toString()); } catch (Exception e) {