Skip to content

Commit 2eff9fb

Browse files
authored
Merge pull request #28 from Authress/wparad/remove-legacy-parameter
Remove legacy parameter if_unmodified_since. fix #27
2 parents 4b2624a + 924d680 commit 2eff9fb

File tree

7 files changed

+45
-32
lines changed

7 files changed

+45
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Change log
22
This is the changelog for [Authress SDK](readme.md).
33

4-
## 4.0 ##
5-
* [Breaking] Renamed parameter `if_unmodified_since` in the Access Record API to be `expected_last_modified_time`.
6-
74
## 3.0 ##
85
* [Breaking] Added type checking everywhere - This means most models have breaking changes.
96
* [Breaking] Converted properties to be consistent across all generators
@@ -13,6 +10,7 @@ This is the changelog for [Authress SDK](readme.md).
1310
* [Breaking] Moved `authress_client.clients` api to `authress_client.service_clients`.
1411
* [Breaking] Renamed `AccessRecordStatement` model to `Statement` in `models.statement.py`.
1512
* [Breaking] Renamed `AccessRecordResource` model to `Resource` in `models.resource.py`.
13+
* [Breaking] Renamed parameter `if_unmodified_since` in the Access Record API to be `expected_last_modified_time`.
1614
* Add missing `If-Unmodified-Since` support to the `update_group` in the `Groups` API.
1715
* Improve caching in `verify_token`
1816
* Support additionally pydantic v2 dependencies. Support for v1 will be removed in a future version.

authress/api/access_records_api.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,6 @@ def update_record_with_http_info(self,
16221622
_all_params = [
16231623
'record_id',
16241624
'access_record',
1625-
'if_unmodified_since',
16261625
'expected_last_modified_time'
16271626
]
16281627
_all_params.extend(
@@ -1659,8 +1658,6 @@ def update_record_with_http_info(self,
16591658
_query_params = []
16601659
# process the header parameters
16611660
_header_params = dict(_params.get('_headers', {}))
1662-
if _params['if_unmodified_since']:
1663-
_header_params['If-Unmodified-Since'] = _params['if_unmodified_since']
16641661
if _params['expected_last_modified_time']:
16651662
_header_params['If-Unmodified-Since'] = _params['expected_last_modified_time']
16661663

authress/rest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def request(self, method, url, query_params=None, headers=None,
164164
msg = """Cannot prepare a request message for provided
165165
arguments. Please check that your arguments match
166166
declared content type."""
167-
raise ServiceException(status=0, reason=msg)
167+
raise ApiException(status=0, reason=msg)
168168
# For `GET`, `HEAD`, `QUERY`
169169
else:
170170
r = self.pool_manager.request(method, url,
@@ -174,10 +174,10 @@ def request(self, method, url, query_params=None, headers=None,
174174
headers=headers)
175175
except urllib3.exceptions.SSLError as e:
176176
msg = "{0}\n{1}".format(type(e).__name__, str(e))
177-
raise ServiceException(status=0, reason=msg)
177+
raise ApiException(status=0, reason=msg)
178178
except Exception as e:
179179
msg = "{0}\n{1}".format(type(e).__name__, str(e))
180-
raise ServiceException(status=0, reason=msg)
180+
raise ApiException(status=0, reason=msg)
181181

182182
if _preload_content:
183183
r = RESTResponse(r)
@@ -201,7 +201,7 @@ def request(self, method, url, query_params=None, headers=None,
201201
if 500 <= r.status <= 599:
202202
raise ServiceException(http_resp=r)
203203

204-
raise ServiceException(http_resp=r)
204+
raise ApiException(http_resp=r)
205205

206206
return r
207207

docs/AccessRecord.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,24 @@ Name | Type | Description | Notes
2424
```python
2525
from authress.models.access_record import AccessRecord
2626

27-
json = "{}"
28-
# create an instance of AccessRecord from a JSON string
29-
access_record_instance = AccessRecord.from_json(json)
30-
# print the JSON string representation of the object
31-
print AccessRecord.to_json()
32-
33-
# convert the object into a dict
34-
access_record_dict = access_record_instance.to_dict()
35-
# create an instance of AccessRecord from a dict
36-
access_record_from_dict = AccessRecord.from_dict(access_record_dict)
27+
access_record = AccessRecord(
28+
record_id='rec_new_record',
29+
name="Permissions Example",
30+
users=[
31+
User(user_id="user_id")
32+
],
33+
admins=[
34+
User(user_id="admin_user_id")
35+
],
36+
statements=[
37+
Statement(
38+
roles=["Authress:Owner"],
39+
resources=[
40+
Resource(resourceUri="/documents/test_document_id")
41+
]
42+
)
43+
]
44+
)
3745
```
3846
[[API Models]](./README.md#documentation-for-models)[[API Endpoints]](./README.md#documentation-for-api-endpoints)[[Back to Repo]](../README.md)
3947

docs/AccessRecordsApi.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,21 @@ authress_api_url = "https://authress.yourdomain.com" # or "https://ACCOUNT_ID.ap
109109
service_client_access_key = "sc_key_001"
110110
authress_client = AuthressClient(authress_api_url=authress_api_url , service_client_access_key=service_client_access_key)
111111

112-
access_record = authress.AccessRecord() # AccessRecord |
112+
access_record = AccessRecord(
113+
record_id='rec_record_id',
114+
name="Permissions example",
115+
users=[
116+
User(user_id="user_id_1")
117+
],
118+
statements=[
119+
Statement(
120+
roles=["ro_viewer"],
121+
resources=[
122+
Resource(resourceUri="/documents/test_document_id")
123+
]
124+
)
125+
]
126+
)
113127

114128
try:
115129
# Create access record

docs/GroupsApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Name | Type | Description | Notes
284284
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
285285

286286
# **update_group**
287-
> Group update_group(group_id, group, if_unmodified_since=if_unmodified_since)
287+
> Group update_group(group_id, group, expected_last_modified_time=expected_last_modified_time)
288288
289289
Update a group
290290

docs/Statement.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@ Name | Type | Description | Notes
1414
```python
1515
from authress.models.statement import Statement
1616

17-
json = "{}"
18-
# create an instance of Statement from a JSON string
19-
statement_instance = Statement.from_json(json)
20-
# print the JSON string representation of the object
21-
print Statement.to_json()
22-
23-
# convert the object into a dict
24-
statement_dict = statement_instance.to_dict()
25-
# create an instance of Statement from a dict
26-
statement_from_dict = Statement.from_dict(statement_dict)
17+
statement = Statement(
18+
roles=["ro_viewer"],
19+
resources=[
20+
Resource(resourceUri="/accounts/acc_001/documents/*")
21+
]
22+
)
2723
```
2824
[[API Models]](./README.md#documentation-for-models)[[API Endpoints]](./README.md#documentation-for-api-endpoints)[[Back to Repo]](../README.md)
2925

0 commit comments

Comments
 (0)