From 40c37c99552ba6367f46a2af0a806dc2c429de4a Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:14:23 -0500 Subject: [PATCH] Fixed optional field for `GetAvailabilityResponse` (#169) # Description In the response object for getting availability, `order` is only populated for round-robin events. # License I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner. --- CHANGELOG.md | 1 + src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt | 4 ++-- src/main/kotlin/com/nylas/resources/Calendars.kt | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae615843..a70cbf37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Changed * Return webhook object with secret when creating a webhook * Fixed HTTP method for rotating webhook secret +* Fixed optional field for `GetAvailabilityResponse` ## [2.0.0-beta.1] - Released 2023-08-16 diff --git a/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt b/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt index d50542a5..3994498d 100644 --- a/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt +++ b/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt @@ -11,10 +11,10 @@ data class GetAvailabilityResponse( * It will contain the order in which the accounts would be next in line to attend the proposed meeting. */ @Json(name = "order") - val order: List, + val order: List? = null, /** * The available time slots where a new meeting can be created for the requested preferences. */ @Json(name = "time_slots") - val timeSlots: List, + val timeSlots: List? = null, ) diff --git a/src/main/kotlin/com/nylas/resources/Calendars.kt b/src/main/kotlin/com/nylas/resources/Calendars.kt index 14e991e4..8b8889f1 100644 --- a/src/main/kotlin/com/nylas/resources/Calendars.kt +++ b/src/main/kotlin/com/nylas/resources/Calendars.kt @@ -94,7 +94,9 @@ class Calendars(client: NylasClient) : Resource(client, Calendar::clas .adapter(GetAvailabilityRequest::class.java) .toJson(request) - return client.executePost(path, GetAvailabilityResponse::class.java, serializedRequestBody) + val responseType = Types.newParameterizedType(Response::class.java, GetAvailabilityResponse::class.java) + + return client.executePost(path, responseType, serializedRequestBody) } /**