Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(java-sdk): Add OpenFgaClient #209

Merged
merged 24 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c56f75e
feat(java-sdk): Add OpenFgaClient
booniepepper Sep 15, 2023
b30bf7c
refactor(java-sdk): No constructor polymorphism in Configuration, no …
booniepepper Sep 18, 2023
7041f3a
refactor(java-sdk): Simplify OpenFgaClient method signatures
booniepepper Sep 21, 2023
02c9c22
test(java-sdk): Client tests and integ tests
booniepepper Sep 22, 2023
b3f16ed
test(java-sdk): Generate coverage reports after tests
booniepepper Sep 22, 2023
8ef62bc
test(java-sdk): Add tests on OpenFgaClient's set methods
booniepepper Sep 22, 2023
f0cb4b5
test: Add tests on OpenFgaClient with static & credential-based OAuth…
booniepepper Sep 25, 2023
82706f7
test: Add tests on OpenFgaClient writeTuples() deleteTuples() and rea…
booniepepper Sep 26, 2023
2763692
fix: fix casing of function OpenFgaClient.readChanges(...)
booniepepper Sep 26, 2023
f3d45d0
test(java-sdk): Ensure testing from OAuth2 workflow caches a first re…
booniepepper Sep 26, 2023
e06db8a
fix: remove some duplication in ClientConfiguration
booniepepper Sep 26, 2023
ea8c6ca
test: Add test for OpenFgaClient list stores with option
booniepepper Sep 26, 2023
6577825
docs(java-sdk): Add more example api calls
booniepepper Sep 26, 2023
2cdba1b
test: Add tests for OpenFgaClient readChanges(options) and readAuthor…
booniepepper Sep 26, 2023
2521257
feat(java-sdk): Add ClientReadRequest
booniepepper Sep 26, 2023
550f8a8
feat(java-sdk): Polishing Java SDK's OpenFgaClient to look more like …
booniepepper Sep 27, 2023
3e9f7a0
feat(java-sdk): Polish check OpenFgaClient.check(...)
booniepepper Sep 27, 2023
53aa585
feat(java-sdk): Polish check OpenFgaClient.expand(...)
booniepepper Sep 27, 2023
62d4997
feat(java-sdk): Polish remaining OpenFgaClient requests
booniepepper Sep 27, 2023
6b8ca1a
docs: Flesh out README
booniepepper Sep 27, 2023
4e8bc00
fix(java-sdk): do not send writes/deletes when they are empty
booniepepper Sep 27, 2023
81936b5
chore(java-sdk): Bump version to 0.0.5
booniepepper Sep 27, 2023
eb25d89
docs: Fix .NET-esque comments in README
booniepepper Sep 28, 2023
cccee40
chore(java-sdk): Update Changelog entries
booniepepper Sep 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/clients/java/CHANGELOG.md.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## v0.0.5

### [0.0.5](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/compare/v0.0.4...v0.0.5) (2023-09-27)

- feat(client): add `OpenFgaClient` wrapping `OpenFgaApi` and exposing a simplified interface.
See [docs](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}?tab=readme-ov-file#initializing-the-api-client)
- chore(docs): update the README with installation and usage instructions.

## v0.0.3, v0.0.4

### [0.0.4](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/compare/v0.0.2...v0.0.4) (2023-09-21)
Expand Down
91 changes: 90 additions & 1 deletion config/clients/java/config.overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"gitRepoId": "java-sdk",
"artifactId": "openfga-sdk",
"groupId": "dev.openfga",
"packageVersion": "0.0.4",
"packageVersion": "0.0.5",
"apiPackage": "dev.openfga.sdk.api",
"authPackage": "dev.openfga.sdk.api.auth",
"clientPackage": "dev.openfga.sdk.api.client",
"configPackage": "dev.openfga.sdk.api.configuration",
"errorsPackage": "dev.openfga.sdk.errors",
"utilPackage": "dev.openfga.sdk.util",
Expand Down Expand Up @@ -42,6 +43,50 @@
"destinationFilename": ".github/workflows/main.yml",
"templateType": "SupportingFiles"
},
"client-ClientAssertion.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientAssertion.java",
"templateType": "SupportingFiles"
},
"client-ClientCheckRequest.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientCheckRequest.java",
"templateType": "SupportingFiles"
},
"client-ClientExpandRequest.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientExpandRequest.java",
"templateType": "SupportingFiles"
},
"client-ClientListObjectsRequest.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientListObjectsRequest.java",
"templateType": "SupportingFiles"
},
"client-ClientListRelationsRequest.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientListRelationsRequest.java",
"templateType": "SupportingFiles"
},
"client-ClientReadRequest.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientReadRequest.java",
"templateType": "SupportingFiles"
},
"client-ClientTupleKey.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientTupleKey.java",
"templateType": "SupportingFiles"
},
"client-ClientWriteRequest.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/ClientWriteRequest.java",
"templateType": "SupportingFiles"
},
"client-OpenFgaClient.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java",
"templateType": "SupportingFiles"
},
"client-OpenFgaClientTest.java.mustache" : {
"destinationFilename": "src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java",
"templateType": "SupportingFiles"
},
"client-OpenFgaClientIntegrationTest.java.mustache" : {
"destinationFilename": "src/test-integration/java/dev/openfga/sdk/api/client/OpenFgaClientIntegrationTest.java",
"templateType": "SupportingFiles"
},
"creds-AccessToken.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/auth/AccessToken.java",
"templateType": "SupportingFiles"
Expand Down Expand Up @@ -70,6 +115,14 @@
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/BaseConfiguration.java",
"templateType": "SupportingFiles"
},
"config-ClientCheckOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ClientCheckOptions.java",
"templateType": "SupportingFiles"
},
"config-ClientConfiguration.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ClientConfiguration.java",
"templateType": "SupportingFiles"
},
"config-ClientCredentials.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ClientCredentials.java",
"templateType": "SupportingFiles"
Expand All @@ -78,6 +131,14 @@
"destinationFilename": "src/test/java/dev/openfga/sdk/api/configuration/ClientCredentialsTest.java",
"templateType": "SupportingFiles"
},
"config-ClientReadOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ClientReadOptions.java",
"templateType": "SupportingFiles"
},
"config-ClientWriteOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ClientWriteOptions.java",
"templateType": "SupportingFiles"
},
"config-Configuration.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/Configuration.java",
"templateType": "SupportingFiles"
Expand All @@ -98,6 +159,30 @@
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/CredentialsMethod.java",
"templateType": "SupportingFiles"
},
"config-ClientExpandOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ClientExpandOptions.java",
"templateType": "SupportingFiles"
},
"config-ClientListObjectsOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ClientListObjectsOptions.java",
"templateType": "SupportingFiles"
},
"config-ListStoresOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ListStoresOptions.java",
"templateType": "SupportingFiles"
},
"config-ReadAuthorizationModelOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ReadAuthorizationModelOptions.java",
"templateType": "SupportingFiles"
},
"config-ReadAuthorizationModelsOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ReadAuthorizationModelsOptions.java",
"templateType": "SupportingFiles"
},
"config-ReadChangesOptions.java.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/api/configuration/ReadChangesOptions.java",
"templateType": "SupportingFiles"
},
"Pair.mustache" : {
"destinationFilename": "src/main/java/dev/openfga/sdk/util/Pair.java",
"templateType": "SupportingFiles"
Expand Down Expand Up @@ -126,6 +211,10 @@
"destinationFilename": "src/test-integration/java/dev/openfga/sdk/api/OpenFgaApiIntegrationTest.java",
"templateType": "SupportingFiles"
},
"package-info.java.mustache" : {
"destinationFilename": "src/test-integration/java/package-info.java",
"templateType": "SupportingFiles"
},
"gradle-wrapper.properties.mustache" : {
"destinationFilename": "gradle/wrapper/gradle-wrapper.properties",
"templateType": "SupportingFiles"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class OpenFgaApiIntegrationTest {

@BeforeEach
public void initializeApi() throws Exception {
Configuration apiConfig = new Configuration("http://localhost:8080");
Configuration apiConfig = new Configuration().apiUrl("http://localhost:8080");
ApiClient apiClient = new ApiClient(HttpClient.newBuilder(), mapper);
api = new OpenFgaApi(apiClient, apiConfig);
}
Expand Down
4 changes: 4 additions & 0 deletions config/clients/java/template/README_api_endpoints.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} |
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
Loading
Loading