Skip to content

Commit

Permalink
updates to java start_time in read changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpq committed Dec 5, 2024
1 parent 9d69780 commit 20e0e0c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
15 changes: 10 additions & 5 deletions config/clients/java/template/OpenFgaApiTest.java.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -794,9 +795,10 @@ public class OpenFgaApiTest {
String type = null; // Input is optional
Integer pageSize = null; // Input is optional
String continuationToken = null; // Input is optional
OffsetDateTime startTime = null; //Input is optional
// When
var response = fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken)
var response = fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken, startTime)
.get();
// Then
Expand All @@ -814,7 +816,7 @@ public class OpenFgaApiTest {
@Test
public void readChanges_storeIdRequired() throws Exception {
// When
var exception = assertThrows(FgaInvalidParameterException.class, () -> fga.readChanges(null, null, null, null)
var exception = assertThrows(FgaInvalidParameterException.class, () -> fga.readChanges(null, null, null, null, null)
.get());
// Then
Expand All @@ -831,10 +833,11 @@ public class OpenFgaApiTest {
String type = null; // Input is optional
Integer pageSize = null; // Input is optional
String continuationToken = null; // Input is optional
OffsetDateTime startTime = null; // Input is optional
// When
ExecutionException execException = assertThrows(
ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken)
ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken, startTime)
.get());
// Then
Expand All @@ -856,10 +859,11 @@ public class OpenFgaApiTest {
String type = null; // Input is optional
Integer pageSize = null; // Input is optional
String continuationToken = null; // Input is optional
OffsetDateTime startTime = null; // Input is optional
// When
ExecutionException execException = assertThrows(
ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken)
ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken, startTime)
.get());
// Then
Expand All @@ -880,10 +884,11 @@ public class OpenFgaApiTest {
String type = null; // Input is optional
Integer pageSize = null; // Input is optional
String continuationToken = null; // Input is optional
OffsetDateTime startTime = null; // Input is optional
// When
ExecutionException execException = assertThrows(
ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken)
ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken, startTime)
.get());
// Then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
{{>licenseInfo}}
package {{clientPackage}}.model;

import java.time.OffsetDateTime;

public class ClientReadChangesRequest {
private String type;
private String startTime;
private OffsetDateTime startTime;
public ClientReadChangesRequest type(String type) {
this.type = type;
return this;
}

public ClientReadChangesRequest startTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
Expand All @@ -15,7 +21,7 @@ public class ClientReadChangesRequest {
return type;
}

public String getStartTime(){
public OffsetDateTime getStartTime(){
return startTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public class OpenFgaClient {
var options = readChangesOptions != null ? readChangesOptions : new ClientReadChangesOptions();
var overrides = new ConfigurationOverride().addHeaders(options);
return call(() -> api.readChanges(
storeId, request.getType(), options.getPageSize(), options.getContinuationToken(), overrides))
storeId, request.getType(), options.getPageSize(), options.getContinuationToken(), request.getStartTime(), overrides))
.thenApply(ClientReadChangesResponse::new);
}

Expand Down

0 comments on commit 20e0e0c

Please sign in to comment.