Skip to content

Commit 4af82ea

Browse files
committed
feat: support passing consistency parameter
1 parent 360c2e0 commit 4af82ea

23 files changed

+387
-25
lines changed

.openapi-generator/FILES

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ docs/Computed.md
2727
docs/Condition.md
2828
docs/ConditionMetadata.md
2929
docs/ConditionParamTypeRef.md
30+
docs/ConsistencyPreference.md
3031
docs/ContextualTupleKeys.md
3132
docs/CreateStoreRequest.md
3233
docs/CreateStoreResponse.md
@@ -147,6 +148,7 @@ openfga_sdk/models/computed.py
147148
openfga_sdk/models/condition.py
148149
openfga_sdk/models/condition_metadata.py
149150
openfga_sdk/models/condition_param_type_ref.py
151+
openfga_sdk/models/consistency_preference.py
150152
openfga_sdk/models/contextual_tuple_keys.py
151153
openfga_sdk/models/create_store_request.py
152154
openfga_sdk/models/create_store_response.py

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ Class | Method | HTTP request | Description
10441044
*OpenFgaApi* | [**get_store**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#get_store) | **GET** /stores/{store_id} | Get a store
10451045
*OpenFgaApi* | [**list_objects**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_objects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with
10461046
*OpenFgaApi* | [**list_stores**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_stores) | **GET** /stores | List all stores
1047-
*OpenFgaApi* | [**list_users**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_users) | **POST** /stores/{store_id}/list-users | [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type.
1047+
*OpenFgaApi* | [**list_users**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_users) | **POST** /stores/{store_id}/list-users | List the users matching the provided filter who have a certain relation to a particular type.
10481048
*OpenFgaApi* | [**read**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules
10491049
*OpenFgaApi* | [**read_assertions**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_assertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID
10501050
*OpenFgaApi* | [**read_authorization_model**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_authorization_model) | **GET** /stores/{store_id}/authorization-models/{id} | Return a particular version of an authorization model
@@ -1072,6 +1072,7 @@ Class | Method | HTTP request | Description
10721072
- [Condition](https://github.com/openfga/python-sdk/blob/main/docs/Condition.md)
10731073
- [ConditionMetadata](https://github.com/openfga/python-sdk/blob/main/docs/ConditionMetadata.md)
10741074
- [ConditionParamTypeRef](https://github.com/openfga/python-sdk/blob/main/docs/ConditionParamTypeRef.md)
1075+
- [ConsistencyPreference](https://github.com/openfga/python-sdk/blob/main/docs/ConsistencyPreference.md)
10751076
- [ContextualTupleKeys](https://github.com/openfga/python-sdk/blob/main/docs/ContextualTupleKeys.md)
10761077
- [CreateStoreRequest](https://github.com/openfga/python-sdk/blob/main/docs/CreateStoreRequest.md)
10771078
- [CreateStoreResponse](https://github.com/openfga/python-sdk/blob/main/docs/CreateStoreResponse.md)

docs/CheckRequest.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
99
**authorization_model_id** | **str** | | [optional]
1010
**trace** | **bool** | Defaults to false. Making it true has performance implications. | [optional] [readonly]
1111
**context** | **object** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional]
12+
**consistency** | [**ConsistencyPreference**](ConsistencyPreference.md) | | [optional]
1213

1314
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1415

docs/ConsistencyPreference.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ConsistencyPreference
2+
3+
- UNSPECIFIED: Default if not set. Behavior will be the same as MINIMIZE_LATENCY - MINIMIZE_LATENCY: Minimize latency at the potential expense of lower consistency. - HIGHER_CONSISTENCY: Prefer higher consistency, at the potential expense of increased latency.
4+
5+
## Properties
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
9+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10+
11+

docs/ExpandRequest.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**tuple_key** | [**ExpandRequestTupleKey**](ExpandRequestTupleKey.md) | |
88
**authorization_model_id** | **str** | | [optional]
9+
**consistency** | [**ConsistencyPreference**](ConsistencyPreference.md) | | [optional]
910

1011
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1112

docs/ListObjectsRequest.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
1010
**user** | **str** | |
1111
**contextual_tuples** | [**ContextualTupleKeys**](ContextualTupleKeys.md) | | [optional]
1212
**context** | **object** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional]
13+
**consistency** | [**ConsistencyPreference**](ConsistencyPreference.md) | | [optional]
1314

1415
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1516

docs/ListUsersRequest.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
1010
**user_filters** | [**list[UserTypeFilter]**](UserTypeFilter.md) | The type of results returned. Only accepts exactly one value. |
1111
**contextual_tuples** | [**list[TupleKey]**](TupleKey.md) | | [optional]
1212
**context** | **object** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional]
13+
**consistency** | [**ConsistencyPreference**](ConsistencyPreference.md) | | [optional]
1314

1415
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1516

docs/OpenFgaApi.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Method | HTTP request | Description
1111
[**get_store**](OpenFgaApi.md#get_store) | **GET** /stores/{store_id} | Get a store
1212
[**list_objects**](OpenFgaApi.md#list_objects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with
1313
[**list_stores**](OpenFgaApi.md#list_stores) | **GET** /stores | List all stores
14-
[**list_users**](OpenFgaApi.md#list_users) | **POST** /stores/{store_id}/list-users | [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type.
14+
[**list_users**](OpenFgaApi.md#list_users) | **POST** /stores/{store_id}/list-users | List the users matching the provided filter who have a certain relation to a particular type.
1515
[**read**](OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules
1616
[**read_assertions**](OpenFgaApi.md#read_assertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID
1717
[**read_authorization_model**](OpenFgaApi.md#read_authorization_model) | **GET** /stores/{store_id}/authorization-models/{id} | Return a particular version of an authorization model
@@ -598,9 +598,9 @@ No authorization required
598598
# **list_users**
599599
> ListUsersResponse list_users(body)
600600
601-
[EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type.
601+
List the users matching the provided filter who have a certain relation to a particular type.
602602

603-
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 `--experimentals enable-list-users` 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 `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` 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 `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` 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 \"users\" 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. `user:*`), 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.
603+
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 `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` 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 `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` 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 \"users\" 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. `user:*`), 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.
604604

605605
### Example
606606

@@ -637,7 +637,7 @@ async with openfga_sdk.ApiClient(configuration) as api_client:
637637
body = openfga_sdk.ListUsersRequest() # ListUsersRequest |
638638

639639
try:
640-
# [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type.
640+
# List the users matching the provided filter who have a certain relation to a particular type.
641641
api_response = await api_instance.api_instance.list_users(body)
642642
pprint(api_response)
643643
except ApiException as e:

docs/ReadRequest.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
77
**tuple_key** | [**ReadRequestTupleKey**](ReadRequestTupleKey.md) | | [optional]
88
**page_size** | **int** | | [optional]
99
**continuation_token** | **str** | | [optional]
10+
**consistency** | [**ConsistencyPreference**](ConsistencyPreference.md) | | [optional]
1011

1112
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1213

openfga_sdk/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from openfga_sdk.models.condition import Condition
3838
from openfga_sdk.models.condition_metadata import ConditionMetadata
3939
from openfga_sdk.models.condition_param_type_ref import ConditionParamTypeRef
40+
from openfga_sdk.models.consistency_preference import ConsistencyPreference
4041
from openfga_sdk.models.contextual_tuple_keys import ContextualTupleKeys
4142
from openfga_sdk.models.create_store_request import CreateStoreRequest
4243
from openfga_sdk.models.create_store_response import CreateStoreResponse

0 commit comments

Comments
 (0)