Skip to content

Commit

Permalink
Sync latest from sdk-generator (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris authored Nov 15, 2024
2 parents 9c3a4b1 + 47f2016 commit 041a713
Show file tree
Hide file tree
Showing 29 changed files with 578 additions and 82 deletions.
4 changes: 4 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ docs/AbortedMessageResponse.md
docs/Any.md
docs/Assertion.md
docs/AssertionTupleKey.md
docs/AuthErrorCode.md
docs/AuthorizationModel.md
docs/CheckRequest.md
docs/CheckRequestTupleKey.md
Expand All @@ -37,6 +38,7 @@ docs/ExpandRequest.md
docs/ExpandRequestTupleKey.md
docs/ExpandResponse.md
docs/FgaObject.md
docs/ForbiddenResponse.md
docs/GetStoreResponse.md
docs/InternalErrorCode.md
docs/InternalErrorMessageResponse.md
Expand Down Expand Up @@ -140,6 +142,7 @@ openfga_sdk/models/aborted_message_response.py
openfga_sdk/models/any.py
openfga_sdk/models/assertion.py
openfga_sdk/models/assertion_tuple_key.py
openfga_sdk/models/auth_error_code.py
openfga_sdk/models/authorization_model.py
openfga_sdk/models/check_request.py
openfga_sdk/models/check_request_tuple_key.py
Expand All @@ -158,6 +161,7 @@ openfga_sdk/models/expand_request.py
openfga_sdk/models/expand_request_tuple_key.py
openfga_sdk/models/expand_response.py
openfga_sdk/models/fga_object.py
openfga_sdk/models/forbidden_response.py
openfga_sdk/models/get_store_response.py
openfga_sdk/models/internal_error_code.py
openfga_sdk/models/internal_error_message_response.py
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Updated to include support for [OpenFGA 0.3.0](https://github.com/openfga/openfg

Changes:
- [BREAKING] feat(list-objects)!: response has been changed to include the object type
e.g. response that was `{"object_ids":["roadmap"]}`, will now be `{"objects":["document:roadmap"]}`
e.g. response that was `{"object_ids":["roadmap"]}`, will now be `{"objects":["document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"]}`

Fixes:
- fix(models): update interfaces that had incorrectly optional fields to make them required
Expand Down
62 changes: 32 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ Reads the relationship tuples stored in the database. It does not evaluate nor e
body = ReadRequestTupleKey(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.read(body)
Expand All @@ -518,7 +518,7 @@ response = await fga_client.read(body)
# Find all relationship tuples where a certain user has a relationship as any relation to a certain document
body = ReadRequestTupleKey(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.read(body)
Expand Down Expand Up @@ -551,7 +551,7 @@ response = await fga_client.read(body)

# Find all relationship tuples where any user has a relationship as any relation with a particular document
body = ReadRequestTupleKey(
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.read(body)
Expand Down Expand Up @@ -597,7 +597,7 @@ body = ClientWriteRequest(
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
condition=RelationshipCondition(
name='ViewCountLessThan200',
context=dict(
Expand All @@ -609,14 +609,14 @@ body = ClientWriteRequest(
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:budget",
object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
),
],
deletes=[
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="writer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
),
],
)
Expand Down Expand Up @@ -651,12 +651,12 @@ body = ClientWriteRequest(
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
),
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:budget",
object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
condition=RelationshipCondition(
name='ViewCountLessThan200',
context=dict(
Expand All @@ -670,7 +670,7 @@ body = ClientWriteRequest(
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="writer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
),
],
)
Expand Down Expand Up @@ -700,7 +700,7 @@ options = {
body = ClientCheckRequest(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="writer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
context=dict(
ViewCount=100
),
Expand Down Expand Up @@ -731,12 +731,12 @@ options = {
body = [ClientCheckRequest(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
contextual_tuples=[ # optional
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="editor",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
),
],
context=dict(
Expand All @@ -745,22 +745,22 @@ body = [ClientCheckRequest(
), ClientCheckRequest(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="admin",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
contextual_tuples=[ # optional
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="editor",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
),
]
), ClientCheckRequest(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="creator",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
), ClientCheckRequest(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="deleter",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)]

response = await fga_client.batch_check(body, options)
Expand All @@ -769,11 +769,11 @@ response = await fga_client.batch_check(body, options)
# request: {
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
# relation: "viewer",
# object: "document:roadmap",
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
# contextual_tuples: [{
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
# relation: "editor",
# object: "document:roadmap"
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
# }],
# context=dict(
# ViewCount=100
Expand All @@ -784,27 +784,27 @@ response = await fga_client.batch_check(body, options)
# request: {
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
# relation: "admin",
# object: "document:roadmap",
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
# contextual_tuples: [{
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
# relation: "editor",
# object: "document:roadmap"
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
# }]
# }
# }, {
# allowed: false,
# request: {
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
# relation: "creator",
# object: "document:roadmap",
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
# },
# error: <FgaError ...>
# }, {
# allowed: true,
# request: {
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
# relation: "deleter",
# object: "document:roadmap",
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
# }},
# ]
```
Expand All @@ -828,11 +828,11 @@ options = {
}
body = ClientExpandRequest(
relation="viewer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.expand(body. options)
# response = ExpandResponse({"tree": UsersetTree({"root": Node({"name": "document:roadmap#viewer", "leaf": Leaf({"users": Users({"users": ["user:81684243-9356-4421-8fbf-a4f8d36aa31b", "user:f52a4f7a-054d-47ff-bb6e-3ac81269988f"]})})})})})
# response = ExpandResponse({"tree": UsersetTree({"root": Node({"name": "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#viewer", "leaf": Leaf({"users": Users({"users": ["user:81684243-9356-4421-8fbf-a4f8d36aa31b", "user:f52a4f7a-054d-47ff-bb6e-3ac81269988f"]})})})})})
```

#### List Objects
Expand Down Expand Up @@ -860,7 +860,7 @@ body = ClientListObjectsRequest(
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="writer",
object="document:budget",
object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
),
],
context=dict(
Expand All @@ -869,7 +869,7 @@ body = ClientListObjectsRequest(
)

response = await fga_client.list_objects(body)
# response.objects = ["document:roadmap"]
# response.objects = ["document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"]
```

#### List Relations
Expand All @@ -889,13 +889,13 @@ options = {
}
body = ClientListRelationsRequest(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
relations=["can_view", "can_edit", "can_delete", "can_rename"],
contextual_tuples=[ # optional
ClientTuple(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="writer",
object="document:budget",
object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
),
],
context=dict(
Expand Down Expand Up @@ -946,7 +946,7 @@ async with OpenFgaClient(configuration) as api_client:
ClientTuple(
user="folder:product",
relation="parent",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
),
],
)
Expand Down Expand Up @@ -999,7 +999,7 @@ options = {
body = [ClientAssertion(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:roadmap",
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
expectation=True,
)]

Expand Down Expand Up @@ -1064,6 +1064,7 @@ Class | Method | HTTP request | Description
- [Any](https://github.com/openfga/python-sdk/blob/main/docs/Any.md)
- [Assertion](https://github.com/openfga/python-sdk/blob/main/docs/Assertion.md)
- [AssertionTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/AssertionTupleKey.md)
- [AuthErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/AuthErrorCode.md)
- [AuthorizationModel](https://github.com/openfga/python-sdk/blob/main/docs/AuthorizationModel.md)
- [CheckRequest](https://github.com/openfga/python-sdk/blob/main/docs/CheckRequest.md)
- [CheckRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/CheckRequestTupleKey.md)
Expand All @@ -1082,6 +1083,7 @@ Class | Method | HTTP request | Description
- [ExpandRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/ExpandRequestTupleKey.md)
- [ExpandResponse](https://github.com/openfga/python-sdk/blob/main/docs/ExpandResponse.md)
- [FgaObject](https://github.com/openfga/python-sdk/blob/main/docs/FgaObject.md)
- [ForbiddenResponse](https://github.com/openfga/python-sdk/blob/main/docs/ForbiddenResponse.md)
- [GetStoreResponse](https://github.com/openfga/python-sdk/blob/main/docs/GetStoreResponse.md)
- [InternalErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/InternalErrorCode.md)
- [InternalErrorMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/InternalErrorMessageResponse.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/Assertion.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**tuple_key** | [**AssertionTupleKey**](AssertionTupleKey.md) | |
**expectation** | **bool** | |
**contextual_tuples** | [**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]

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

Expand Down
10 changes: 10 additions & 0 deletions docs/AuthErrorCode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# AuthErrorCode


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

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


2 changes: 1 addition & 1 deletion docs/ConsistencyPreference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ConsistencyPreference

- 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.
Controls the consistency preferences when calling the query APIs. - 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.

## Properties
Name | Type | Description | Notes
Expand Down
12 changes: 12 additions & 0 deletions docs/ForbiddenResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ForbiddenResponse


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | [**AuthErrorCode**](AuthErrorCode.md) | | [optional]
**message** | **str** | | [optional]

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


Loading

0 comments on commit 041a713

Please sign in to comment.