Skip to content

Commit 524f01c

Browse files
SK-2262: Fix Inconsistencies in Java SDK v2 (#194)
* SK-2262: fix inconsistencies
1 parent 02e622d commit 524f01c

File tree

195 files changed

+3027
-6189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+3027
-6189
lines changed

pom.xml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@
4545
</properties>
4646

4747
<dependencies>
48-
<dependency>
49-
<groupId>com.squareup.okhttp3</groupId>
50-
<artifactId>okhttp</artifactId>
51-
<version>4.12.0</version>
52-
<scope>compile</scope>
53-
</dependency>
5448
<dependency>
5549
<groupId>com.fasterxml.jackson.core</groupId>
5650
<artifactId>jackson-databind</artifactId>
@@ -126,9 +120,10 @@
126120
<dependency>
127121
<groupId>junit</groupId>
128122
<artifactId>junit</artifactId>
129-
<version>${junit-version}</version>
123+
<version>4.13.2</version>
130124
<scope>test</scope>
131125
</dependency>
126+
132127
<dependency>
133128
<groupId>org.powermock</groupId>
134129
<artifactId>powermock-module-junit4</artifactId>
@@ -141,12 +136,6 @@
141136
<version>2.0.9</version>
142137
<scope>test</scope>
143138
</dependency>
144-
<dependency>
145-
<groupId>org.junit.jupiter</groupId>
146-
<artifactId>junit-jupiter</artifactId>
147-
<version>5.13.2</version>
148-
<scope>compile</scope>
149-
</dependency>
150139
</dependencies>
151140

152141
<build>
@@ -185,7 +174,14 @@
185174
<plugin>
186175
<groupId>org.apache.maven.plugins</groupId>
187176
<artifactId>maven-surefire-plugin</artifactId>
188-
<version>2.22.2</version>
177+
<version>3.2.5</version>
178+
<configuration>
179+
<useModulePath>false</useModulePath>
180+
<includes>
181+
<include>**/*Test.java</include>
182+
<include>**/*Tests.java</include>
183+
</includes>
184+
</configuration>
189185
</plugin>
190186
<plugin>
191187
<groupId>org.jacoco</groupId>

src/main/java/com/skyflow/VaultClient.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ protected DeidentifyPdfRequest getDeidentifyPdfRequest(DeidentifyFileRequest req
512512
Optional<List<EntityType>> entityUniqueCounter = Optional.empty();
513513
Optional<List<String>> allowRegex = Optional.ofNullable(request.getAllowRegexList());
514514
Optional<List<String>> restrictRegex = Optional.ofNullable(request.getRestrictRegexList());
515-
Optional<Transformations> transformations = Optional.ofNullable(getTransformations(request.getTransformations()));
516515

517516
if (tokenFormat != null) {
518517
if (tokenFormat.getEntityOnly() != null && !tokenFormat.getEntityOnly().isEmpty()) {
@@ -540,13 +539,12 @@ protected DeidentifyPdfRequest getDeidentifyPdfRequest(DeidentifyFileRequest req
540539
return DeidentifyPdfRequest.builder()
541540
.vaultId(vaultId)
542541
.file(file)
543-
.density(request.getPixelDensity() != null ? request.getPixelDensity().intValue() : null)
544-
.maxResolution(request.getMaxResolution() != null ? request.getMaxResolution().intValue() : null)
542+
.density(Double.valueOf(request.getPixelDensity() != null ? request.getPixelDensity().intValue() : null))
543+
.maxResolution(Double.valueOf(request.getMaxResolution() != null ? request.getMaxResolution().intValue() : null))
545544
.entityTypes(mappedEntityTypes)
546545
.tokenType(tokenType)
547546
.allowRegex(allowRegex)
548547
.restrictRegex(restrictRegex)
549-
.transformations(transformations)
550548
.build();
551549
}
552550

@@ -558,7 +556,6 @@ protected DeidentifyImageRequest getDeidentifyImageRequest(DeidentifyFileRequest
558556
Optional<List<EntityType>> entityUniqueCounter = Optional.empty();
559557
Optional<List<String>> allowRegex = Optional.ofNullable(request.getAllowRegexList());
560558
Optional<List<String>> restrictRegex = Optional.ofNullable(request.getRestrictRegexList());
561-
Optional<Transformations> transformations = Optional.ofNullable(getTransformations(request.getTransformations()));
562559

563560
TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter);
564561

@@ -580,7 +577,6 @@ protected DeidentifyImageRequest getDeidentifyImageRequest(DeidentifyFileRequest
580577
.tokenType(tokenType)
581578
.allowRegex(allowRegex)
582579
.restrictRegex(restrictRegex)
583-
.transformations(transformations)
584580
.outputProcessedImage(request.getOutputProcessedImage())
585581
.outputOcrText(request.getOutputOcrText())
586582
.build();
@@ -594,7 +590,6 @@ protected DeidentifyPresentationRequest getDeidentifyPresentationRequest(Deident
594590
Optional<List<EntityType>> entityUniqueCounter = Optional.empty();
595591
Optional<List<String>> allowRegex = Optional.ofNullable(request.getAllowRegexList());
596592
Optional<List<String>> restrictRegex = Optional.ofNullable(request.getRestrictRegexList());
597-
Optional<Transformations> transformations = Optional.ofNullable(getTransformations(request.getTransformations()));
598593

599594
TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter);
600595

@@ -610,7 +605,6 @@ protected DeidentifyPresentationRequest getDeidentifyPresentationRequest(Deident
610605
.tokenType(tokenType)
611606
.allowRegex(allowRegex)
612607
.restrictRegex(restrictRegex)
613-
.transformations(transformations)
614608
.build();
615609
}
616610

@@ -622,7 +616,6 @@ protected DeidentifySpreadsheetRequest getDeidentifySpreadsheetRequest(Deidentif
622616
Optional<List<EntityType>> entityUniqueCounter = Optional.empty();
623617
Optional<List<String>> allowRegex = Optional.ofNullable(request.getAllowRegexList());
624618
Optional<List<String>> restrictRegex = Optional.ofNullable(request.getRestrictRegexList());
625-
Optional<Transformations> transformations = Optional.ofNullable(getTransformations(request.getTransformations()));
626619

627620
TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter);
628621

@@ -638,7 +631,6 @@ protected DeidentifySpreadsheetRequest getDeidentifySpreadsheetRequest(Deidentif
638631
.tokenType(tokenType)
639632
.allowRegex(allowRegex)
640633
.restrictRegex(restrictRegex)
641-
.transformations(transformations)
642634
.build();
643635
}
644636

@@ -678,7 +670,6 @@ protected DeidentifyDocumentRequest getDeidentifyDocumentRequest(DeidentifyFileR
678670
Optional<List<EntityType>> entityUniqueCounter = Optional.empty();
679671
Optional<List<String>> allowRegex = Optional.ofNullable(request.getAllowRegexList());
680672
Optional<List<String>> restrictRegex = Optional.ofNullable(request.getRestrictRegexList());
681-
Optional<Transformations> transformations = Optional.ofNullable(getTransformations(request.getTransformations()));
682673

683674
TokenTypeWithoutVault tokenType = buildTokenType(tokenFormat, entityTypes, entityUniqueCounter);
684675

@@ -694,7 +685,6 @@ protected DeidentifyDocumentRequest getDeidentifyDocumentRequest(DeidentifyFileR
694685
.tokenType(tokenType)
695686
.allowRegex(allowRegex)
696687
.restrictRegex(restrictRegex)
697-
.transformations(transformations)
698688
.build();
699689
}
700690

src/main/java/com/skyflow/errors/ErrorMessage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public enum ErrorMessage {
144144
FailedToEncodeFile("%s0 Validation error. Failed to encode the file. Ensure the file is in a supported format and try again."),
145145
FailedToDecodeFileFromResponse("%s0 Failed to decode the file from the response. Ensure the response is valid and try again."),
146146
EmptyFileAndFilePathInDeIdentifyFile("%s0 Validation error. Both file and filePath are empty. Specify either file object or filePath, not both."),
147+
VaultTokenFormatIsNotAllowedForFiles("%s0 Validation error. Vault token format is not allowed for deidentify file request."),
147148
PollingForResultsFailed("%s0 API error. Polling for results failed. Unable to retrieve the deidentified file"),
148149
FailedtoSaveProcessedFile("%s0 Validation error. Failed to save the processed file. Ensure the output directory is valid and writable."),
149150
InvalidAudioFileType("%s0 Validation error. The file type is not supported. Specify a valid file type mp3 or wav."),

src/main/java/com/skyflow/generated/rest/ApiClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import com.skyflow.generated.rest.resources.audit.AuditClient;
99
import com.skyflow.generated.rest.resources.authentication.AuthenticationClient;
1010
import com.skyflow.generated.rest.resources.binlookup.BinLookupClient;
11-
import com.skyflow.generated.rest.resources.deprecated.DeprecatedClient;
1211
import com.skyflow.generated.rest.resources.files.FilesClient;
12+
import com.skyflow.generated.rest.resources.guardrails.GuardrailsClient;
1313
import com.skyflow.generated.rest.resources.query.QueryClient;
1414
import com.skyflow.generated.rest.resources.records.RecordsClient;
1515
import com.skyflow.generated.rest.resources.strings.StringsClient;
@@ -31,7 +31,7 @@ public class ApiClient {
3131

3232
protected final Supplier<AuthenticationClient> authenticationClient;
3333

34-
protected final Supplier<DeprecatedClient> deprecatedClient;
34+
protected final Supplier<GuardrailsClient> guardrailsClient;
3535

3636
protected final Supplier<StringsClient> stringsClient;
3737

@@ -45,7 +45,7 @@ public ApiClient(ClientOptions clientOptions) {
4545
this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions));
4646
this.queryClient = Suppliers.memoize(() -> new QueryClient(clientOptions));
4747
this.authenticationClient = Suppliers.memoize(() -> new AuthenticationClient(clientOptions));
48-
this.deprecatedClient = Suppliers.memoize(() -> new DeprecatedClient(clientOptions));
48+
this.guardrailsClient = Suppliers.memoize(() -> new GuardrailsClient(clientOptions));
4949
this.stringsClient = Suppliers.memoize(() -> new StringsClient(clientOptions));
5050
this.filesClient = Suppliers.memoize(() -> new FilesClient(clientOptions));
5151
}
@@ -74,8 +74,8 @@ public AuthenticationClient authentication() {
7474
return this.authenticationClient.get();
7575
}
7676

77-
public DeprecatedClient deprecated() {
78-
return this.deprecatedClient.get();
77+
public GuardrailsClient guardrails() {
78+
return this.guardrailsClient.get();
7979
}
8080

8181
public StringsClient strings() {

src/main/java/com/skyflow/generated/rest/AsyncApiClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import com.skyflow.generated.rest.resources.audit.AsyncAuditClient;
99
import com.skyflow.generated.rest.resources.authentication.AsyncAuthenticationClient;
1010
import com.skyflow.generated.rest.resources.binlookup.AsyncBinLookupClient;
11-
import com.skyflow.generated.rest.resources.deprecated.AsyncDeprecatedClient;
1211
import com.skyflow.generated.rest.resources.files.AsyncFilesClient;
12+
import com.skyflow.generated.rest.resources.guardrails.AsyncGuardrailsClient;
1313
import com.skyflow.generated.rest.resources.query.AsyncQueryClient;
1414
import com.skyflow.generated.rest.resources.records.AsyncRecordsClient;
1515
import com.skyflow.generated.rest.resources.strings.AsyncStringsClient;
@@ -31,7 +31,7 @@ public class AsyncApiClient {
3131

3232
protected final Supplier<AsyncAuthenticationClient> authenticationClient;
3333

34-
protected final Supplier<AsyncDeprecatedClient> deprecatedClient;
34+
protected final Supplier<AsyncGuardrailsClient> guardrailsClient;
3535

3636
protected final Supplier<AsyncStringsClient> stringsClient;
3737

@@ -45,7 +45,7 @@ public AsyncApiClient(ClientOptions clientOptions) {
4545
this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions));
4646
this.queryClient = Suppliers.memoize(() -> new AsyncQueryClient(clientOptions));
4747
this.authenticationClient = Suppliers.memoize(() -> new AsyncAuthenticationClient(clientOptions));
48-
this.deprecatedClient = Suppliers.memoize(() -> new AsyncDeprecatedClient(clientOptions));
48+
this.guardrailsClient = Suppliers.memoize(() -> new AsyncGuardrailsClient(clientOptions));
4949
this.stringsClient = Suppliers.memoize(() -> new AsyncStringsClient(clientOptions));
5050
this.filesClient = Suppliers.memoize(() -> new AsyncFilesClient(clientOptions));
5151
}
@@ -74,8 +74,8 @@ public AsyncAuthenticationClient authentication() {
7474
return this.authenticationClient.get();
7575
}
7676

77-
public AsyncDeprecatedClient deprecated() {
78-
return this.deprecatedClient.get();
77+
public AsyncGuardrailsClient guardrails() {
78+
return this.guardrailsClient.get();
7979
}
8080

8181
public AsyncStringsClient strings() {

src/main/java/com/skyflow/generated/rest/core/ApiClientApiException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Map<String, List<String>> headers() {
6565
return this.headers;
6666
}
6767

68-
@java.lang.Override
68+
@Override
6969
public String toString() {
7070
return "ApiClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body
7171
+ "}";

src/main/java/com/skyflow/generated/rest/core/ClientOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private ClientOptions(
3434
{
3535
put("X-Fern-Language", "JAVA");
3636
put("X-Fern-SDK-Name", "com.skyflow.fern:api-sdk");
37-
put("X-Fern-SDK-Version", "0.0.219");
37+
put("X-Fern-SDK-Version", "0.0.305");
3838
}
3939
});
4040
this.headerSuppliers = headerSuppliers;

0 commit comments

Comments
 (0)