@@ -74,13 +74,13 @@ It can be used with the following:
7474* Gradle (Groovy)
7575
7676``` groovy
77- implementation 'dev.openfga:openfga-sdk:0.0.5 '
77+ implementation 'dev.openfga:openfga-sdk:0.1.0 '
7878```
7979
8080* Gradle (Kotlin)
8181
8282``` kotlin
83- implementation(" dev.openfga:openfga-sdk:0.0.5 " )
83+ implementation(" dev.openfga:openfga-sdk:0.1.0 " )
8484```
8585
8686* Apache Maven
@@ -89,26 +89,26 @@ implementation("dev.openfga:openfga-sdk:0.0.5")
8989<dependency >
9090 <groupId >dev.openfga</groupId >
9191 <artifactId >openfga-sdk</artifactId >
92- <version >0.0.5 </version >
92+ <version >0.1.0 </version >
9393</dependency >
9494```
9595
9696* Ivy
9797
9898``` xml
99- <dependency org =" dev.openfga" name =" openfga-sdk" rev =" 0.0.5 " />
99+ <dependency org =" dev.openfga" name =" openfga-sdk" rev =" 0.1.0 " />
100100```
101101
102102* SBT
103103
104104``` scala
105- libraryDependencies += " dev.openfga" % " openfga-sdk" % " 0.0.5 "
105+ libraryDependencies += " dev.openfga" % " openfga-sdk" % " 0.1.0 "
106106```
107107
108108* Leiningen
109109
110110``` edn
111- [dev.openfga/openfga-sdk " 0.0.5 " ]
111+ [dev.openfga/openfga-sdk " 0.1.0 " ]
112112```
113113
114114
@@ -122,20 +122,18 @@ libraryDependencies += "dev.openfga" % "openfga-sdk" % "0.0.5"
122122
123123``` java
124124import com.fasterxml.jackson.databind.ObjectMapper ;
125- import dev.openfga.sdk.api.client.ApiClient ;
126125import dev.openfga.sdk.api.client.OpenFgaClient ;
127126import dev.openfga.sdk.api.configuration.ClientConfiguration ;
128127import java.net.http.HttpClient ;
129128
130129public class Example {
131130 public static void main (String [] args ) throws Exception {
132- var clientConfig = new ClientConfiguration ()
131+ var config = new ClientConfiguration ()
133132 .apiUrl(System . getenv(" OPENFGA_API_URL" )) // If not specified, will default to "https://localhost:8080"
134133 .storeId(System . getenv(" OPENFGA_STORE_ID" )) // Not required when calling createStore() or listStores()
135134 .authorizationModelId(System . getenv(" OPENFGA_AUTHORIZATION_MODEL_ID" )); // Optional, can be overridden per request
136- var apiClient = new ApiClient (HttpClient . newBuilder(), new ObjectMapper ());
137135
138- var fgaClient = new OpenFgaClient (apiClient, clientConfig );
136+ var fgaClient = new OpenFgaClient (config );
139137 var response = fgaClient. readAuthorizationModels(). get();
140138 }
141139}
@@ -145,7 +143,6 @@ public class Example {
145143
146144``` java
147145import com.fasterxml.jackson.databind.ObjectMapper ;
148- import dev.openfga.sdk.api.client.ApiClient ;
149146import dev.openfga.sdk.api.client.OpenFgaClient ;
150147import dev.openfga.sdk.api.configuration.ApiToken ;
151148import dev.openfga.sdk.api.configuration.ClientConfiguration ;
@@ -154,16 +151,15 @@ import java.net.http.HttpClient;
154151
155152public class Example {
156153 public static void main (String [] args ) throws Exception {
157- var clientConfig = new ClientConfiguration ()
154+ var config = new ClientConfiguration ()
158155 .apiUrl(System . getenv(" OPENFGA_API_URL" )) // If not specified, will default to "https://localhost:8080"
159156 .storeId(System . getenv(" OPENFGA_STORE_ID" )) // Not required when calling createStore() or listStores()
160157 .authorizationModelId(System . getenv(" OPENFGA_AUTHORIZATION_MODEL_ID" )) // Optional, can be overridden per request
161158 .credentials(new Credentials (
162159 new ApiToken (System . getenv(" OPENFGA_API_TOKEN" )) // will be passed as the "Authorization: Bearer ${ApiToken}" request header
163160 ));
164- var apiClient = new ApiClient (HttpClient . newBuilder(), new ObjectMapper ());
165161
166- var fgaClient = new OpenFgaClient (apiClient, clientConfig );
162+ var fgaClient = new OpenFgaClient (config );
167163 var response = fgaClient. readAuthorizationModels(). get();
168164 }
169165}
@@ -173,7 +169,6 @@ public class Example {
173169
174170``` java
175171import com.fasterxml.jackson.databind.ObjectMapper ;
176- import dev.openfga.sdk.api.client.ApiClient ;
177172import dev.openfga.sdk.api.client.OpenFgaClient ;
178173import dev.openfga.sdk.api.configuration.ClientConfiguration ;
179174import dev.openfga.sdk.api.configuration.ClientCredentials ;
@@ -182,7 +177,7 @@ import java.net.http.HttpClient;
182177
183178public class Example {
184179 public static void main (String [] args ) throws Exception {
185- var clientConfig = new ClientConfiguration ()
180+ var config = new ClientConfiguration ()
186181 .apiUrl(System . getenv(" OPENFGA_API_URL" )) // If not specified, will default to "https://localhost:8080"
187182 .storeId(System . getenv(" OPENFGA_STORE_ID" )) // Not required when calling createStore() or listStores()
188183 .authorizationModelId(System . getenv(" OPENFGA_AUTHORIZATION_MODEL_ID" )) // Optional, can be overridden per request
@@ -193,9 +188,8 @@ public class Example {
193188 .clientId(System . getenv(" OPENFGA_CLIENT_ID" ))
194189 .clientSecret(System . getenv(" OPENFGA_CLIENT_SECRET" ))
195190 ));
196- var apiClient = new ApiClient (HttpClient . newBuilder(), new ObjectMapper ());
197191
198- var fgaClient = new OpenFgaClient (apiClient, clientConfig );
192+ var fgaClient = new OpenFgaClient (config );
199193 var response = fgaClient. readAuthorizationModels(). get();
200194 }
201195}
@@ -219,7 +213,7 @@ Get a paginated list of stores.
219213[ API Documentation] ( https://openfga.dev/api/service/docs/api#/Stores/ListStores )
220214
221215``` java
222- var options = new ListStoresOptions ()
216+ var options = new ClientListStoresOptions ()
223217 .pageSize(10 )
224218 .continuationToken(" ..." );
225219var stores = fgaClient. listStores(options);
@@ -282,7 +276,7 @@ Read all authorization models in the store.
282276[ API Documentation] ( https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModels )
283277
284278``` java
285- var options = new ReadAuthorizationModelsOptions ()
279+ var options = new ClientReadAuthorizationModelsOptions ()
286280 .pageSize(10 )
287281 .continuationToken(" ..." );
288282var response = fgaClient. readAuthorizationModels(options). get();
@@ -345,7 +339,7 @@ Read a particular authorization model.
345339[ API Documentation] ( https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModel )
346340
347341``` java
348- var options = new ReadAuthorizationModelOptions ()
342+ var options = new ClientReadAuthorizationModelOptions ()
349343 // You can rely on the model id set in the configuration or override it for this specific request
350344 .authorizationModelId(" 01GXSA8YR785C4FYS3C0RTG7B1" );
351345
@@ -572,7 +566,9 @@ Read assertions for a particular authorization model.
572566[ API Documentation] ( https://openfga.dev/api/service#/Assertions/Read%20Assertions )
573567
574568``` java
575- var response = fgaClient. readAssertions(). get();
569+ var options = new ClientReadAssertionsOptions ()
570+ .authorizationModelId(" 01GXSA8YR785C4FYS3C0RTG7B1" );
571+ var response = fgaClient. readAssertions(options). get();
576572```
577573
578574##### Write Assertions
@@ -582,14 +578,16 @@ Update the assertions for a particular authorization model.
582578[ API Documentation] ( https://openfga.dev/api/service#/Assertions/Write%20Assertions )
583579
584580``` java
581+ var options = new ClientWriteAssertionsOptions ()
582+ .authorizationModelId(" 01GXSA8YR785C4FYS3C0RTG7B1" );
585583var assertions = List . of(
586584 new ClientAssertion ()
587585 .user(" user:81684243-9356-4421-8fbf-a4f8d36aa31b" )
588586 .relation(" viewer" )
589587 ._object(" document:roadmap" )
590588 .expectation(true )
591589);
592- fgaClient. writeAssertions(assertions). get();
590+ fgaClient. writeAssertions(assertions, options ). get();
593591```
594592
595593
0 commit comments