Skip to content

Commit

Permalink
Convert if_unmodified_since parameter to be called expected_last_modi…
Browse files Browse the repository at this point in the history
…fied_time for access records.
  • Loading branch information
wparad committed Jan 8, 2024
1 parent 876bf8f commit 1d4928d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change log
This is the changelog for [Authress SDK](readme.md).

## 4.0 ##
* [Breaking] Renamed parameter `if_unmodified_since` in the Access Record API to be `expected_last_modified_time`.

## 3.0 ##
* [Breaking] Added type checking everywhere - This means most models have breaking changes.
* [Breaking] Converted properties to be consistent across all generators
Expand Down
31 changes: 21 additions & 10 deletions authress/api/access_records_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,22 +1529,26 @@ def respond_to_access_request_with_http_info(self, request_id : Annotated[constr
_request_auth=_params.get('_request_auth'))

@validate_arguments
def update_record(self, record_id : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="The identifier of the access record.")], access_record : AccessRecord, if_unmodified_since : Annotated[Optional[constr(strict=True, max_length=32, min_length=1)], Field(description="The expected last time the record was modified. (<a href=\"https://tools.ietf.org/html/rfc7231#section-7.1.1.1\" target=\"_blank\">format</a>)")] = None, **kwargs) -> None: # noqa: E501
def update_record(self,
record_id : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="The identifier of the access record.")],
access_record : AccessRecord,
expected_last_modified_time : Annotated[Optional[constr(strict=True, max_length=32, min_length=1)], Field(description="The expected last time the record was modified.")] = None,
**kwargs) -> None: # noqa: E501
"""Update access record # noqa: E501
Updates an access record adding or removing user permissions to resources. (Records have a maximum size of ~100KB) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_record(record_id, access_record, if_unmodified_since, async_req=True)
>>> thread = api.update_record(record_id, access_record, expected_last_modified_time=None, async_req=True)
>>> result = thread.get()
:param record_id: The identifier of the access record. (required)
:type record_id: str
:param access_record: (required)
:type access_record: AccessRecord
:param if_unmodified_since: The expected last time the record was modified. (<a href=\"https://tools.ietf.org/html/rfc7231#section-7.1.1.1\" target=\"_blank\">format</a>)
:type if_unmodified_since: str
:param expected_last_modified_time: The expected last time the record was modified.
:type expected_last_modified_time: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
Expand All @@ -1559,25 +1563,29 @@ def update_record(self, record_id : Annotated[constr(strict=True, max_length=100
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the update_record_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.update_record_with_http_info(record_id, access_record, if_unmodified_since, **kwargs) # noqa: E501
return self.update_record_with_http_info(record_id, access_record, expected_last_modified_time, **kwargs) # noqa: E501

@validate_arguments
def update_record_with_http_info(self, record_id : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="The identifier of the access record.")], access_record : AccessRecord, if_unmodified_since : Annotated[Optional[constr(strict=True, max_length=32, min_length=1)], Field(description="The expected last time the record was modified. (<a href=\"https://tools.ietf.org/html/rfc7231#section-7.1.1.1\" target=\"_blank\">format</a>)")] = None, **kwargs) -> ApiResponse: # noqa: E501
def update_record_with_http_info(self,
record_id : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="The identifier of the access record.")],
access_record : AccessRecord,
expected_last_modified_time : Annotated[Optional[constr(strict=True, max_length=32, min_length=1)], Field(description="The expected last time the record was modified.")] = None,
**kwargs) -> ApiResponse: # noqa: E501
"""Update access record # noqa: E501
Updates an access record adding or removing user permissions to resources. (Records have a maximum size of ~100KB) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_record_with_http_info(record_id, access_record, if_unmodified_since, async_req=True)
>>> thread = api.update_record_with_http_info(record_id, access_record, expected_last_modified_time=None, async_req=True)
>>> result = thread.get()
:param record_id: The identifier of the access record. (required)
:type record_id: str
:param access_record: (required)
:type access_record: AccessRecord
:param if_unmodified_since: The expected last time the record was modified. (<a href=\"https://tools.ietf.org/html/rfc7231#section-7.1.1.1\" target=\"_blank\">format</a>)
:type if_unmodified_since: str
:param expected_last_modified_time: The expected last time the record was modified.
:type expected_last_modified_time: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
Expand Down Expand Up @@ -1608,7 +1616,8 @@ def update_record_with_http_info(self, record_id : Annotated[constr(strict=True,
_all_params = [
'record_id',
'access_record',
'if_unmodified_since'
'if_unmodified_since',
'expected_last_modified_time'
]
_all_params.extend(
[
Expand Down Expand Up @@ -1646,6 +1655,8 @@ def update_record_with_http_info(self, record_id : Annotated[constr(strict=True,
_header_params = dict(_params.get('_headers', {}))
if _params['if_unmodified_since']:
_header_params['If-Unmodified-Since'] = _params['if_unmodified_since']
if _params['expected_last_modified_time']:
_header_params['If-Unmodified-Since'] = _params['expected_last_modified_time']

# process the form parameters
_form_params = []
Expand Down
8 changes: 4 additions & 4 deletions docs/AccessRecordsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ Name | Type | Description | Notes
[[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)

# **update_record**
> update_record(record_id, access_record, if_unmodified_since=if_unmodified_since)
> update_record(record_id, access_record, expected_last_modified_time=expected_last_modified_time)
Update access record

Expand All @@ -728,11 +728,11 @@ authress_client = AuthressClient(authress_api_url=authress_api_url , service_cli

record_id = 'record_id_example' # str | The identifier of the access record.
access_record = authress.AccessRecord() # AccessRecord |
if_unmodified_since = 'Mon, 07 Aug 2023 14:01:12 GMT' # str | The expected last time the record was modified. (<a href=\"https://tools.ietf.org/html/rfc7231#section-7.1.1.1\" target=\"_blank\">format</a>) (optional)
expected_last_modified_time = '2023-08-23T14:01:12 GMT' # str | The expected last time the record was modified. (optional)

try:
# Update access record
authress_client.access_records.update_record(record_id, access_record, if_unmodified_since=if_unmodified_since)
authress_client.access_records.update_record(record_id, access_record, expected_last_modified_time=expected_last_modified_time)
except Exception as e:
print("Exception when calling AccessRecordsApi->update_record: %s\n" % e)
```
Expand All @@ -745,7 +745,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**record_id** | **str**| The identifier of the access record. |
**access_record** | [**AccessRecord**](AccessRecord.md)| |
**if_unmodified_since** | **str**| The expected last time the record was modified. (&lt;a href&#x3D;\&quot;https://tools.ietf.org/html/rfc7231#section-7.1.1.1\&quot; target&#x3D;\&quot;_blank\&quot;&gt;format&lt;/a&gt;) | [optional]
**expected_last_modified_time** | **str**| The expected last time the record was modified. | [optional]

### Return type

Expand Down

0 comments on commit 1d4928d

Please sign in to comment.