Skip to content

Commit

Permalink
Merge pull request #107 from openfga/feat/add-consistency
Browse files Browse the repository at this point in the history
feat: add support for consistency parameter
  • Loading branch information
jimmyjames authored Aug 27, 2024
2 parents 0b7e643 + 5f42012 commit 2a9d11a
Show file tree
Hide file tree
Showing 26 changed files with 525 additions and 96 deletions.
2 changes: 2 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ docs/Computed.md
docs/Condition.md
docs/ConditionMetadata.md
docs/ConditionParamTypeRef.md
docs/ConsistencyPreference.md
docs/ContextualTupleKeys.md
docs/CreateStoreRequest.md
docs/CreateStoreResponse.md
Expand Down Expand Up @@ -199,6 +200,7 @@ src/main/java/dev/openfga/sdk/api/model/Computed.java
src/main/java/dev/openfga/sdk/api/model/Condition.java
src/main/java/dev/openfga/sdk/api/model/ConditionMetadata.java
src/main/java/dev/openfga/sdk/api/model/ConditionParamTypeRef.java
src/main/java/dev/openfga/sdk/api/model/ConsistencyPreference.java
src/main/java/dev/openfga/sdk/api/model/ContextualTupleKeys.java
src/main/java/dev/openfga/sdk/api/model/CreateStoreRequest.java
src/main/java/dev/openfga/sdk/api/model/CreateStoreResponse.java
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ public class Example {
| [**getStore**](docs/OpenFgaApi.md#getstore) | **GET** /stores/{store_id} | Get a store |
| [**listObjects**](docs/OpenFgaApi.md#listobjects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with |
| [**listStores**](docs/OpenFgaApi.md#liststores) | **GET** /stores | List all stores |
| [**listUsers**](docs/OpenFgaApi.md#listusers) | **POST** /stores/{store_id}/list-users | [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. |
| [**listUsers**](docs/OpenFgaApi.md#listusers) | **POST** /stores/{store_id}/list-users | List the users matching the provided filter who have a certain relation to a particular type. |
| [**read**](docs/OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules |
| [**readAssertions**](docs/OpenFgaApi.md#readassertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID |
| [**readAuthorizationModel**](docs/OpenFgaApi.md#readauthorizationmodel) | **GET** /stores/{store_id}/authorization-models/{id} | Return a particular version of an authorization model |
Expand Down Expand Up @@ -927,6 +927,8 @@ public class Example {

- [ConditionParamTypeRef](https://github.com/openfga/java-sdk/blob/main/docs/ConditionParamTypeRef.md)

- [ConsistencyPreference](https://github.com/openfga/java-sdk/blob/main/docs/ConsistencyPreference.md)

- [ContextualTupleKeys](https://github.com/openfga/java-sdk/blob/main/docs/ContextualTupleKeys.md)

- [CreateStoreRequest](https://github.com/openfga/java-sdk/blob/main/docs/CreateStoreRequest.md)
Expand Down
1 change: 1 addition & 0 deletions docs/CheckRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
|**authorizationModelId** | **String** | | [optional] |
|**trace** | **Boolean** | Defaults to false. Making it true has performance implications. | [optional] [readonly] |
|**context** | **Object** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional] |
|**consistency** | **ConsistencyPreference** | | [optional] |



17 changes: 17 additions & 0 deletions docs/ConsistencyPreference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


# ConsistencyPreference

## Enum


* `UNSPECIFIED` (value: `"UNSPECIFIED"`)

* `MINIMIZE_LATENCY` (value: `"MINIMIZE_LATENCY"`)

* `HIGHER_CONSISTENCY` (value: `"HIGHER_CONSISTENCY"`)

* `UNKNOWN_DEFAULT_OPEN_API` (value: `"unknown_default_open_api"`)



1 change: 1 addition & 0 deletions docs/ExpandRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
|------------ | ------------- | ------------- | -------------|
|**tupleKey** | [**ExpandRequestTupleKey**](ExpandRequestTupleKey.md) | | |
|**authorizationModelId** | **String** | | [optional] |
|**consistency** | **ConsistencyPreference** | | [optional] |



1 change: 1 addition & 0 deletions docs/ListObjectsRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
|**user** | **String** | | |
|**contextualTuples** | [**ContextualTupleKeys**](ContextualTupleKeys.md) | | [optional] |
|**context** | **Object** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional] |
|**consistency** | **ConsistencyPreference** | | [optional] |



1 change: 1 addition & 0 deletions docs/ListUsersRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
|**userFilters** | [**List<UserTypeFilter>**](UserTypeFilter.md) | The type of results returned. Only accepts exactly one value. | |
|**contextualTuples** | [**List<TupleKey>**](TupleKey.md) | | [optional] |
|**context** | **Object** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional] |
|**consistency** | **ConsistencyPreference** | | [optional] |



12 changes: 6 additions & 6 deletions docs/OpenFgaApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ All URIs are relative to *http://localhost*
| [**listObjectsWithHttpInfo**](OpenFgaApi.md#listObjectsWithHttpInfo) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with |
| [**listStores**](OpenFgaApi.md#listStores) | **GET** /stores | List all stores |
| [**listStoresWithHttpInfo**](OpenFgaApi.md#listStoresWithHttpInfo) | **GET** /stores | List all stores |
| [**listUsers**](OpenFgaApi.md#listUsers) | **POST** /stores/{store_id}/list-users | [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. |
| [**listUsersWithHttpInfo**](OpenFgaApi.md#listUsersWithHttpInfo) | **POST** /stores/{store_id}/list-users | [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. |
| [**listUsers**](OpenFgaApi.md#listUsers) | **POST** /stores/{store_id}/list-users | List the users matching the provided filter who have a certain relation to a particular type. |
| [**listUsersWithHttpInfo**](OpenFgaApi.md#listUsersWithHttpInfo) | **POST** /stores/{store_id}/list-users | List the users matching the provided filter who have a certain relation to a particular type. |
| [**read**](OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules |
| [**readWithHttpInfo**](OpenFgaApi.md#readWithHttpInfo) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules |
| [**readAssertions**](OpenFgaApi.md#readAssertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID |
Expand Down Expand Up @@ -1142,9 +1142,9 @@ No authorization required

> CompletableFuture<ListUsersResponse> listUsers(storeId, body)
[EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type.
List the users matching the provided filter who have a certain relation to a particular type.

The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the &#x60;--experimentals enable-list-users&#x60; flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as &#x60;document:2021-budget#viewer@document:2021-budget#viewer&#x60;; the set of users who are viewers of &#x60;document:2021-budget&#x60; are the set of users who are the viewers of &#x60;document:2021-budget&#x60;). An &#x60;authorization_model_id&#x60; may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify &#x60;contextual_tuples&#x60; that will be treated as regular tuples. Each of these tuples may have an associated &#x60;condition&#x60;. You may also provide a &#x60;context&#x60; object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \&quot;users\&quot; field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. &#x60;user:*&#x60;), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.
The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as &#x60;document:2021-budget#viewer@document:2021-budget#viewer&#x60;; the set of users who are viewers of &#x60;document:2021-budget&#x60; are the set of users who are the viewers of &#x60;document:2021-budget&#x60;). An &#x60;authorization_model_id&#x60; may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify &#x60;contextual_tuples&#x60; that will be treated as regular tuples. Each of these tuples may have an associated &#x60;condition&#x60;. You may also provide a &#x60;context&#x60; object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \&quot;users\&quot; field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. &#x60;user:*&#x60;), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.

### Example

Expand Down Expand Up @@ -1216,9 +1216,9 @@ No authorization required

> CompletableFuture<ApiResponse<ListUsersResponse>> listUsers listUsersWithHttpInfo(storeId, body)
[EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type.
List the users matching the provided filter who have a certain relation to a particular type.

The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the &#x60;--experimentals enable-list-users&#x60; flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as &#x60;document:2021-budget#viewer@document:2021-budget#viewer&#x60;; the set of users who are viewers of &#x60;document:2021-budget&#x60; are the set of users who are the viewers of &#x60;document:2021-budget&#x60;). An &#x60;authorization_model_id&#x60; may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify &#x60;contextual_tuples&#x60; that will be treated as regular tuples. Each of these tuples may have an associated &#x60;condition&#x60;. You may also provide a &#x60;context&#x60; object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \&quot;users\&quot; field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. &#x60;user:*&#x60;), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.
The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as &#x60;document:2021-budget#viewer@document:2021-budget#viewer&#x60;; the set of users who are viewers of &#x60;document:2021-budget&#x60; are the set of users who are the viewers of &#x60;document:2021-budget&#x60;). An &#x60;authorization_model_id&#x60; may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify &#x60;contextual_tuples&#x60; that will be treated as regular tuples. Each of these tuples may have an associated &#x60;condition&#x60;. You may also provide a &#x60;context&#x60; object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \&quot;users\&quot; field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. &#x60;user:*&#x60;), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.

### Example

Expand Down
1 change: 1 addition & 0 deletions docs/ReadRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
|**tupleKey** | [**ReadRequestTupleKey**](ReadRequestTupleKey.md) | | [optional] |
|**pageSize** | **Integer** | | [optional] |
|**continuationToken** | **String** | | [optional] |
|**consistency** | **ConsistencyPreference** | | [optional] |



Loading

0 comments on commit 2a9d11a

Please sign in to comment.