From 97254ffc818bc1dbd20eae01941741a08ec1eee3 Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Fri, 17 Nov 2023 17:42:27 -0500 Subject: [PATCH] Add getter for GetFreeBusyResponse object type (#172) # Description Adds a getter for getting the object type of a free busy response (free busy vs. error). # 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. --- src/main/kotlin/com/nylas/models/GetFreeBusyResponse.kt | 6 ++++++ src/main/kotlin/com/nylas/resources/Calendars.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/nylas/models/GetFreeBusyResponse.kt b/src/main/kotlin/com/nylas/models/GetFreeBusyResponse.kt index 16a5752d..ca4b5542 100644 --- a/src/main/kotlin/com/nylas/models/GetFreeBusyResponse.kt +++ b/src/main/kotlin/com/nylas/models/GetFreeBusyResponse.kt @@ -52,6 +52,12 @@ sealed class GetFreeBusyResponse { override val email: String, ) : GetFreeBusyResponse() + /** + * Returns the type of object. + * @return The type of object. + */ + fun getObject() = obj + companion object { /** * A JsonAdapter factory for the [GetFreeBusyResponse] sealed class (used for deserialization). diff --git a/src/main/kotlin/com/nylas/resources/Calendars.kt b/src/main/kotlin/com/nylas/resources/Calendars.kt index 8b8889f1..715754ef 100644 --- a/src/main/kotlin/com/nylas/resources/Calendars.kt +++ b/src/main/kotlin/com/nylas/resources/Calendars.kt @@ -106,7 +106,7 @@ class Calendars(client: NylasClient) : Resource(client, Calendar::clas * @return The free/busy response */ @Throws(NylasApiError::class, NylasSdkTimeoutError::class) - fun getFreeBusy(identifier: String, request: GetFreeBusyRequest): Response { + fun getFreeBusy(identifier: String, request: GetFreeBusyRequest): Response> { val path = String.format("v3/grants/%s/calendars/free-busy", identifier) val serializedRequestBody = JsonHelper.moshi()