Skip to content

Commit

Permalink
feat(java-sdk): Add OpenFgaClient (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamzeh authored Sep 29, 2023
2 parents 8f1fb87 + cccee40 commit 303994a
Show file tree
Hide file tree
Showing 36 changed files with 3,833 additions and 37 deletions.
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

0 comments on commit 303994a

Please sign in to comment.