Skip to content

Commit 48dbb61

Browse files
authored
release(v0.3.4): with conditions support (#61)
2 parents 1392817 + 7f1b043 commit 48dbb61

19 files changed

Lines changed: 38 additions & 38 deletions

.openapi-generator/FILES

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ docs/WriteRequestDeletes.md
8282
docs/WriteRequestWrites.md
8383
example/Makefile
8484
example/README.md
85-
example/example1/auth-model.json
8685
example/example1/example1.py
8786
example/example1/requirements.txt
8887
example/example1/setup.cfg

README.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,7 @@ options = {
396396
"authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
397397
}
398398

399-
response = await fga_client.read_authorization_model({
400-
# You can rely on the model id set in the configuration or override it for this specific request
401-
"authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
402-
})
399+
response = await fga_client.read_authorization_model(options)
403400
# response.authorization_model = AuthorizationModel(id='01GXSA8YR785C4FYS3C0RTG7B1', schema_version = '1.1', type_definitions=type_definitions[...])
404401
```
405402

@@ -429,7 +426,7 @@ options = {
429426
"page_size": "25",
430427
"continuation_token": "eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ=="
431428
}
432-
body = ClientReadChangesRequest(type='document')
429+
body = ClientReadChangesRequest(type="document")
433430

434431
response = await fga_client.read_changes(body, options)
435432
# response.continuation_token = ...
@@ -565,6 +562,11 @@ body = ClientWriteRequest(
565562
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
566563
relation="viewer",
567564
object="document:roadmap",
565+
),
566+
ClientTuple(
567+
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
568+
relation="viewer",
569+
object="document:budget",
568570
condition=RelationshipCondition(
569571
name='ViewCountLessThan200',
570572
context=dict(
@@ -573,11 +575,6 @@ body = ClientWriteRequest(
573575
),
574576
),
575577
),
576-
ClientTuple(
577-
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
578-
relation="viewer",
579-
object="document:budget",
580-
),
581578
],
582579
deletes=[
583580
ClientTuple(
@@ -641,7 +638,7 @@ body = [ClientCheckRequest(
641638
],
642639
context=dict(
643640
ViewCount=100
644-
),
641+
)
645642
), ClientCheckRequest(
646643
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
647644
relation="admin",
@@ -675,9 +672,9 @@ response = await fga_client.batch_check(body, options)
675672
# relation: "editor",
676673
# object: "document:roadmap"
677674
# }],
678-
# context=dict(
679-
# ViewCount=100
680-
# ),
675+
# context=dict(
676+
# ViewCount=100
677+
# )
681678
# }
682679
# }, {
683680
# allowed: false,
@@ -798,7 +795,7 @@ Read assertions for a particular authorization model.
798795

799796
[API Documentation](https://openfga.dev/api/service#/Assertions/Read%20Assertions)
800797

801-
```csharp
798+
```python
802799
options = {
803800
# You can rely on the model id set in the configuration or override it for this specific request
804801
"authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
@@ -812,7 +809,7 @@ Update the assertions for a particular authorization model.
812809

813810
[API Documentation](https://openfga.dev/api/service#/Assertions/Write%20Assertions)
814811

815-
```csharp
812+
```python
816813
options = {
817814
# You can rely on the model id set in the configuration or override it for this specific request
818815
"authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.3
1+
0.3.4

example/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ all: run
33
project_name=example1
44
openfga_version=latest
55

6-
run:
7-
python example1/example1.py
6+
setup:
7+
cd "${project_name}/" && pip3 install -r requirements.txt && cd -
8+
9+
run: setup
10+
python3 "${project_name}/${project_name}.py"
811

912
run-openfga:
1013
docker pull docker.io/openfga/openfga:${openfga_version} && \

example/example1/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ attrs==23.1.0
44
frozenlist==1.4.1
55
idna==3.6
66
multidict==6.0.4
7-
openfga-sdk==0.3.2
7+
openfga-sdk==0.3.4
88
python-dateutil==2.8.2
99
six==1.16.0
1010
urllib3==2.1.0

openfga_sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
1515
"""
1616

17-
__version__ = "0.3.3"
17+
__version__ = "0.3.4"
1818

1919
from openfga_sdk.client.client import OpenFgaClient
2020
from openfga_sdk.client.configuration import ClientConfiguration

openfga_sdk/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from openfga_sdk.exceptions import ApiValueError, ApiException, FgaValidationException, RateLimitExceededError
3535

3636

37-
DEFAULT_USER_AGENT = 'openfga-sdk python/0.3.3'
37+
DEFAULT_USER_AGENT = 'openfga-sdk python/0.3.4'
3838

3939

4040
def random_time(loop_count, min_wait_in_ms):

openfga_sdk/client/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ async def list_relations(self, body: ClientListRelationsRequest, options: dict[s
631631
options = set_heading_if_not_set(options, CLIENT_METHOD_HEADER, "ListRelations")
632632
options = set_heading_if_not_set(options, CLIENT_BULK_REQUEST_ID_HEADER, str(uuid.uuid4()))
633633

634-
request_body = [construct_check_request(
635-
user=body.user, relation=i, object=body.object, contextual_tuples=body.contextual_tuples, context=body.context) for i in body.relations]
634+
request_body = [construct_check_request(user=body.user, relation=i, object=body.object,
635+
contextual_tuples=body.contextual_tuples, context=body.context) for i in body.relations]
636636
result = await self.batch_check(request_body, options)
637637
# need to filter with the allowed response
638638
result_iterator = filter(_check_allowed, result)

openfga_sdk/client/models/list_relations_request.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1111
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
1212
"""
13+
1314
from openfga_sdk.client.models.tuple import ClientTuple
1415

1516
from typing import List

openfga_sdk/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def to_debug_report(self):
440440
"OS: {env}\n"\
441441
"Python Version: {pyversion}\n"\
442442
"Version of the API: 0.1\n"\
443-
"SDK Package Version: 0.3.3".\
443+
"SDK Package Version: 0.3.4".\
444444
format(env=sys.platform, pyversion=sys.version)
445445

446446
def get_host_settings(self):

0 commit comments

Comments
 (0)