Skip to content

Commit

Permalink
release: v0.2.0 - OpenFgaClient with batch_check, list_relations and …
Browse files Browse the repository at this point in the history
…more
  • Loading branch information
rhamzeh committed May 25, 2023
1 parent 4c4fa23 commit d35fef5
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 9 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## v0.2.0

### [0.2.0](https://github.com/openfga/python-sdk/compare/v0.1.1...v0.2.0) (2023-05-25)

Changes:
- [BREAKING] feat!: `schema_version` is now required when calling `write_authorization_model`
- [BREAKING] chore!: drop support for python < 3.10
- feat(client): add OpenFgaClient wrapper see [docs](https://github.com/openfga/python-sdk/tree/main#readme), see the `v0.1.1` docs for [the OpenFgaApi docs](https://github.com/openfga/python-sdk/tree/v0.1.1#readme)
- feat(client): implement `batch_check` to check multiple tuples in parallel
- feat(client): implement `list_relations` to check in one call whether a user has multiple relations to an objects
- feat(client): add support for a non-transactional `write`
- feat(validation): ensure storeId and authorizationModelId are in valid ulid format
- chore(config): bump default max retries to `15`
- chore(deps): upgrade dependencies

## v0.1.1

### [0.1.1](https://github.com/openfga/python-sdk/compare/v0.1.0...v0.1.1) (2023-01-17)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1
0.2.0
2 changes: 1 addition & 1 deletion openfga_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
"""

__version__ = "0.1.1"
__version__ = "0.2.0"

from openfga_sdk.client.client import OpenFgaClient
from openfga_sdk.client.configuration import ClientConfiguration
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'openfga-sdk {sdkId}/{packageVersion}'.replace(
'{sdkId}', 'python').replace('{packageVersion}', '0.1.1')
'{sdkId}', 'python').replace('{packageVersion}', '0.2.0')
self.client_side_validation = configuration.client_side_validation

async def __aenter__(self):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 0.1\n"\
"SDK Package Version: 0.1.1".\
"SDK Package Version: 0.2.0".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async def _obtain_token(self, client):
'grant_type': "client_credentials",
}
headers = urllib3.response.HTTPHeaderDict(
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.1.1'})
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.2.0'})
raw_response = await client.POST(token_url, headers=headers, body=body)
if 200 <= raw_response.status <= 299:
try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "openfga-sdk"
VERSION = "0.1.1"
VERSION = "0.2.0"
# To install the library, run the following
#
# python setup.py install
Expand Down
2 changes: 1 addition & 1 deletion test/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ async def test_get_authentication_obtain_client_credentials(self, mock_request):
self.assertGreaterEqual(credential._access_expiry_time,
current_time + timedelta(seconds=int(120)))
expected_header = urllib3.response.HTTPHeaderDict(
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.1.1'})
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.2.0'})
mock_request.assert_called_once_with(
'POST',
'https://www.testme.com/oauth/token',
Expand Down
4 changes: 2 additions & 2 deletions test/test_open_fga_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ async def test_check_api_token(self, mock_request):
self.assertTrue(api_response.allowed)
# Make sure the API was called with the right data
expectedHeader = urllib3.response.HTTPHeaderDict(
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.1.1', 'Authorization': 'Bearer TOKEN1'})
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.2.0', 'Authorization': 'Bearer TOKEN1'})
mock_request.assert_called_once_with(
'POST',
'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4/check',
Expand Down Expand Up @@ -1217,7 +1217,7 @@ async def test_check_custom_header(self, mock_request):
self.assertTrue(api_response.allowed)
# Make sure the API was called with the right data
expectedHeader = urllib3.response.HTTPHeaderDict(
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.1.1', 'Custom Header': 'custom value'})
{'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.2.0', 'Custom Header': 'custom value'})
mock_request.assert_called_once_with(
'POST',
'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4/check',
Expand Down

0 comments on commit d35fef5

Please sign in to comment.