Skip to content

Commit 3926b0e

Browse files
SK-2262: Fix Inconsistencies in Java SDK v2 (#197)
* SK-2262: Fix Inconsistencies in Java SDK v2 (#194)
1 parent 02e622d commit 3926b0e

File tree

199 files changed

+3084
-6214
lines changed

Some content is hidden

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

199 files changed

+3084
-6214
lines changed

.github/workflows/beta-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
profile: maven-central
1212
tag: 'beta'
1313
secrets:
14-
server-username: ${{ secrets.OSSRH_USERNAME }}
15-
server-password: ${{ secrets.OSSRH_PASSWORD }}
14+
server-username: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_USERNAME }}
15+
server-password: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_PASSWORD }}
1616
gpg-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
1717
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
1818
skyflow-credentials: ${{ secrets.SKYFLOW_CREDENTIALS }} >> .env

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
profile: maven-central
1212
tag: 'public'
1313
secrets:
14-
server-username: ${{ secrets.OSSRH_USERNAME }}
15-
server-password: ${{ secrets.OSSRH_PASSWORD }}
14+
server-username: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_USERNAME }}
15+
server-password: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_PASSWORD }}
1616
gpg-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
1717
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
1818
skyflow-credentials: ${{ secrets.SKYFLOW_CREDENTIALS }} >> .env

pom.xml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.skyflow</groupId>
88
<artifactId>skyflow-java</artifactId>
9-
<version>2.0.0-beta.2</version>
9+
<version>2.0.0-beta.2-dev.6e93095</version>
1010
<packaging>jar</packaging>
1111

1212
<name>${project.groupId}:${project.artifactId}</name>
@@ -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>
@@ -263,25 +259,25 @@
263259
<id>maven-central</id>
264260
<distributionManagement>
265261
<repository>
266-
<id>ossrh</id>
267-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
262+
<id>central</id>
263+
<url>https://central.sonatype.com/api/v1/publisher/upload</url>
268264
</repository>
269265
<snapshotRepository>
270-
<id>ossrh</id>
271-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
266+
<id>central-snapshots</id>
267+
<url>https://central.sonatype.com/api/v1/publisher/upload</url>
272268
</snapshotRepository>
273269
</distributionManagement>
274270
<build>
275271
<plugins>
276272
<plugin>
277-
<groupId>org.sonatype.plugins</groupId>
278-
<artifactId>nexus-staging-maven-plugin</artifactId>
279-
<version>1.6.7</version>
273+
<groupId>org.sonatype.central</groupId>
274+
<artifactId>central-publishing-maven-plugin</artifactId>
275+
<version>0.4.0</version>
280276
<extensions>true</extensions>
281277
<configuration>
282-
<serverId>ossrh</serverId>
283-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
284-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
278+
<publishingServerId>central</publishingServerId>
279+
<tokenAuth>true</tokenAuth>
280+
<autoPublish>true</autoPublish>
285281
</configuration>
286282
</plugin>
287283
</plugins>

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(request.getPixelDensity() != null ? request.getPixelDensity().doubleValue() : null)
543+
.maxResolution(request.getMaxResolution() != null ? request.getMaxResolution().doubleValue() : 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/enums/DeidentifyFileStatus.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
public enum DeidentifyFileStatus {
44
IN_PROGRESS("IN_PROGRESS"),
5-
SUCCESS("SUCCESS");
5+
FAILED("FAILED"),
6+
SUCCESS("SUCCESS"),
7+
UNKNOWN("UNKNOWN");
68

79
private final String value;
810

src/main/java/com/skyflow/enums/DetectEntities.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ public enum DetectEntities {
1313
CREDIT_CARD_EXPIRATION("credit_card_expiration"),
1414
CVV("cvv"),
1515
DATE("date"),
16+
DAY("day"),
1617
DATE_INTERVAL("date_interval"),
1718
DOB("dob"),
1819
DOSE("dose"),
1920
DRIVER_LICENSE("driver_license"),
2021
DRUG("drug"),
2122
DURATION("duration"),
23+
EFFECT("effect"),
2224
EMAIL_ADDRESS("email_address"),
2325
EVENT("event"),
2426
FILENAME("filename"),
2527
FINANCIAL_METRIC("financial_metric"),
26-
GENDER_SEXUALITY("gender_sexuality"),
28+
GENDER("gender"),
2729
HEALTHCARE_NUMBER("healthcare_number"),
2830
INJURY("injury"),
2931
IP_ADDRESS("ip_address"),
@@ -40,30 +42,35 @@ public enum DetectEntities {
4042
MEDICAL_CODE("medical_code"),
4143
MEDICAL_PROCESS("medical_process"),
4244
MONEY("money"),
45+
MONTH("month"),
4346
NAME("name"),
4447
NAME_FAMILY("name_family"),
4548
NAME_GIVEN("name_given"),
4649
NAME_MEDICAL_PROFESSIONAL("name_medical_professional"),
4750
NUMERICAL_PII("numerical_pii"),
4851
OCCUPATION("occupation"),
4952
ORGANIZATION("organization"),
53+
ORGANIZATION_ID("organization_id"),
5054
ORGANIZATION_MEDICAL_FACILITY("organization_medical_facility"),
5155
ORIGIN("origin"),
5256
PASSPORT_NUMBER("passport_number"),
5357
PASSWORD("password"),
5458
PHONE_NUMBER("phone_number"),
59+
PROJECT("project"),
5560
PHYSICAL_ATTRIBUTE("physical_attribute"),
5661
POLITICAL_AFFILIATION("political_affiliation"),
5762
PRODUCT("product"),
5863
RELIGION("religion"),
5964
ROUTING_NUMBER("routing_number"),
65+
SEXUALITY("sexuality"),
6066
SSN("ssn"),
6167
STATISTICS("statistics"),
6268
TIME("time"),
6369
TREND("trend"),
6470
URL("url"),
6571
USERNAME("username"),
6672
VEHICLE_ID("vehicle_id"),
73+
YEAR("year"),
6774
ZODIAC_SIGN("zodiac_sign");
6875

6976
private final String detectEntities;

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
+ "}";

0 commit comments

Comments
 (0)