From 53e989a30b343723fcf8995c8caa366fc3eb5071 Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:18:10 -0500 Subject: [PATCH 1/4] Order should be optional --- .../com/nylas/models/GetAvailabilityResponse.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt b/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt index d50542a5..1f4c86f1 100644 --- a/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt +++ b/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt @@ -6,15 +6,15 @@ import com.squareup.moshi.Json * Class representation of a Nylas get availability response */ data class GetAvailabilityResponse( - /** - * This property is only populated for round-robin events. - * 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, /** * The available time slots where a new meeting can be created for the requested preferences. */ @Json(name = "time_slots") val timeSlots: List, + /** + * This property is only populated for round-robin events. + * 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? = null, ) From be01bc85977d379d0efedc5da9530aa3c7313469 Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:18:54 -0500 Subject: [PATCH 2/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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 From b8c4f10212d75982c4a9f041dfffe06d2f8b5c82 Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:59:22 -0500 Subject: [PATCH 3/4] object returns empty if no timeslots match --- .../kotlin/com/nylas/models/GetAvailabilityResponse.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt b/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt index 1f4c86f1..3994498d 100644 --- a/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt +++ b/src/main/kotlin/com/nylas/models/GetAvailabilityResponse.kt @@ -6,15 +6,15 @@ import com.squareup.moshi.Json * Class representation of a Nylas get availability response */ data class GetAvailabilityResponse( - /** - * The available time slots where a new meeting can be created for the requested preferences. - */ - @Json(name = "time_slots") - val timeSlots: List, /** * This property is only populated for round-robin events. * 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? = null, + /** + * The available time slots where a new meeting can be created for the requested preferences. + */ + @Json(name = "time_slots") + val timeSlots: List? = null, ) From 2edf9fb83d40ac4539446c2252f8cd603db8234b Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Tue, 14 Nov 2023 18:28:38 -0500 Subject: [PATCH 4/4] Fix serialization type --- src/main/kotlin/com/nylas/resources/Calendars.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) } /**