Skip to content

Commit

Permalink
Fix bug when deserializing delete response (#277)
Browse files Browse the repository at this point in the history
For `.destroy()` method we are not using the correct model to deserialize the response to. We just discard it and use `Response` which results in a KeyError.
  • Loading branch information
mrashed-dev authored Sep 28, 2023
1 parent 0275b3e commit 71af6b5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ nylas-python Changelog
v6.0.0b3
----------------
* Fix bug when deserializing Union types
* Fix bug when deserializing delete response

v6.0.0b2
----------------
Expand Down
2 changes: 1 addition & 1 deletion nylas/handler/api_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ def destroy(
response_json = self._http_client._execute(
"DELETE", path, headers, query_params, request_body
)
return Response.from_dict(response_json, response_type)
return response_type.from_dict(response_json)
2 changes: 1 addition & 1 deletion nylas/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class Event:
participants: List[Participant]
when: When = field(metadata=config(decoder=_decode_when))
conferencing: Optional[Conferencing] = field(
metadata=config(decoder=_decode_conferencing)
default=None, metadata=config(decoder=_decode_conferencing)
)
object: str = "event"
description: Optional[str] = None
Expand Down

0 comments on commit 71af6b5

Please sign in to comment.