@@ -248,7 +248,13 @@ public CompletableFuture<ClientReadAuthorizationModelResponse> readAuthorization
248
248
ClientReadAuthorizationModelOptions options ) throws FgaInvalidParameterException {
249
249
configuration .assertValid ();
250
250
String storeId = configuration .getStoreIdChecked ();
251
- String authorizationModelId = options .getAuthorizationModelIdChecked ();
251
+ // Set authorizationModelId from options if available; otherwise, require a valid configuration value
252
+ String authorizationModelId ;
253
+ if (options != null && !isNullOrWhitespace (options .getAuthorizationModelId ())) {
254
+ authorizationModelId = options .getAuthorizationModelIdChecked ();
255
+ } else {
256
+ authorizationModelId = configuration .getAuthorizationModelIdChecked ();
257
+ }
252
258
var overrides = new ConfigurationOverride ().addHeaders (options );
253
259
return call (() -> api .readAuthorizationModel (storeId , authorizationModelId , overrides ))
254
260
.thenApply (ClientReadAuthorizationModelResponse ::new );
@@ -552,12 +558,12 @@ private CompletableFuture<ClientWriteResponse> writeNonTransaction(
552
558
? writeOptions
553
559
: new ClientWriteOptions ().transactionChunkSize (DEFAULT_MAX_METHOD_PARALLEL_REQS );
554
560
555
- if ( options .getAdditionalHeaders () == null ) {
556
- options . additionalHeaders ( new HashMap <>());
557
- }
558
- options . getAdditionalHeaders () .putIfAbsent (CLIENT_METHOD_HEADER , "Write" );
559
- options . getAdditionalHeaders ()
560
- . putIfAbsent ( CLIENT_BULK_REQUEST_ID_HEADER , randomUUID (). toString () );
561
+ HashMap < String , String > headers = options .getAdditionalHeaders () != null
562
+ ? new HashMap <>(options . getAdditionalHeaders ())
563
+ : new HashMap <>();
564
+ headers .putIfAbsent (CLIENT_METHOD_HEADER , "Write" );
565
+ headers . putIfAbsent ( CLIENT_BULK_REQUEST_ID_HEADER , randomUUID (). toString ());
566
+ options . additionalHeaders ( headers );
561
567
562
568
int chunkSize = options .getTransactionChunkSize ();
563
569
@@ -832,12 +838,13 @@ public CompletableFuture<List<ClientBatchCheckClientResponse>> clientBatchCheck(
832
838
var options = batchCheckOptions != null
833
839
? batchCheckOptions
834
840
: new ClientBatchCheckClientOptions ().maxParallelRequests (DEFAULT_MAX_METHOD_PARALLEL_REQS );
835
- if (options .getAdditionalHeaders () == null ) {
836
- options .additionalHeaders (new HashMap <>());
837
- }
838
- options .getAdditionalHeaders ().putIfAbsent (CLIENT_METHOD_HEADER , "ClientBatchCheck" );
839
- options .getAdditionalHeaders ()
840
- .putIfAbsent (CLIENT_BULK_REQUEST_ID_HEADER , randomUUID ().toString ());
841
+
842
+ HashMap <String , String > headers = options .getAdditionalHeaders () != null
843
+ ? new HashMap <>(options .getAdditionalHeaders ())
844
+ : new HashMap <>();
845
+ headers .putIfAbsent (CLIENT_METHOD_HEADER , "ClientBatchCheck" );
846
+ headers .putIfAbsent (CLIENT_BULK_REQUEST_ID_HEADER , randomUUID ().toString ());
847
+ options .additionalHeaders (headers );
841
848
842
849
int maxParallelRequests = options .getMaxParallelRequests () != null
843
850
? options .getMaxParallelRequests ()
@@ -892,12 +899,13 @@ public CompletableFuture<ClientBatchCheckResponse> batchCheck(
892
899
: new ClientBatchCheckOptions ()
893
900
.maxParallelRequests (DEFAULT_MAX_METHOD_PARALLEL_REQS )
894
901
.maxBatchSize (DEFAULT_MAX_BATCH_SIZE );
895
- if (options .getAdditionalHeaders () == null ) {
896
- options .additionalHeaders (new HashMap <>());
897
- }
898
- options .getAdditionalHeaders ().putIfAbsent (CLIENT_METHOD_HEADER , "BatchCheck" );
899
- options .getAdditionalHeaders ()
900
- .putIfAbsent (CLIENT_BULK_REQUEST_ID_HEADER , randomUUID ().toString ());
902
+
903
+ HashMap <String , String > headers = options .getAdditionalHeaders () != null
904
+ ? new HashMap <>(options .getAdditionalHeaders ())
905
+ : new HashMap <>();
906
+ headers .putIfAbsent (CLIENT_METHOD_HEADER , "BatchCheck" );
907
+ headers .putIfAbsent (CLIENT_BULK_REQUEST_ID_HEADER , randomUUID ().toString ());
908
+ options .additionalHeaders (headers );
901
909
902
910
Map <String , ClientBatchCheckItem > correlationIdToCheck = new HashMap <>();
903
911
@@ -1124,12 +1132,13 @@ public CompletableFuture<ClientListRelationsResponse> listRelations(
1124
1132
var options = listRelationsOptions != null
1125
1133
? listRelationsOptions
1126
1134
: new ClientListRelationsOptions ().maxParallelRequests (DEFAULT_MAX_METHOD_PARALLEL_REQS );
1127
- if (options .getAdditionalHeaders () == null ) {
1128
- options .additionalHeaders (new HashMap <>());
1129
- }
1130
- options .getAdditionalHeaders ().putIfAbsent (CLIENT_METHOD_HEADER , "ListRelations" );
1131
- options .getAdditionalHeaders ()
1132
- .putIfAbsent (CLIENT_BULK_REQUEST_ID_HEADER , randomUUID ().toString ());
1135
+
1136
+ HashMap <String , String > headers = options .getAdditionalHeaders () != null
1137
+ ? new HashMap <>(options .getAdditionalHeaders ())
1138
+ : new HashMap <>();
1139
+ headers .putIfAbsent (CLIENT_METHOD_HEADER , "ListRelations" );
1140
+ headers .putIfAbsent (CLIENT_BULK_REQUEST_ID_HEADER , randomUUID ().toString ());
1141
+ options .additionalHeaders (headers );
1133
1142
1134
1143
var batchCheckRequests = request .getRelations ().stream ()
1135
1144
.map (relation -> new ClientCheckRequest ()
0 commit comments