From 71af6b54a77910923301863f8f70b583a2cd9b4a Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:55:12 -0400 Subject: [PATCH] Fix bug when deserializing delete response (#277) 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. --- CHANGELOG.md | 1 + nylas/handler/api_resources.py | 2 +- nylas/models/events.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c884c7ab..758c6905 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ---------------- diff --git a/nylas/handler/api_resources.py b/nylas/handler/api_resources.py index 890bb6b4..38e5bd15 100644 --- a/nylas/handler/api_resources.py +++ b/nylas/handler/api_resources.py @@ -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) diff --git a/nylas/models/events.py b/nylas/models/events.py index aacaefe5..736ac625 100644 --- a/nylas/models/events.py +++ b/nylas/models/events.py @@ -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