Skip to content

Commit

Permalink
Add getter for GetFreeBusyResponse object type (#172)
Browse files Browse the repository at this point in the history
# Description
Adds a getter for getting the object type of a free busy response (free
busy vs. error).

# License
<!-- Your PR comment must contain the following line for us to merge the
PR. -->
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.
  • Loading branch information
mrashed-dev authored Nov 17, 2023
1 parent 78fd04d commit 97254ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/kotlin/com/nylas/models/GetFreeBusyResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/nylas/resources/Calendars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Calendars(client: NylasClient) : Resource<Calendar>(client, Calendar::clas
* @return The free/busy response
*/
@Throws(NylasApiError::class, NylasSdkTimeoutError::class)
fun getFreeBusy(identifier: String, request: GetFreeBusyRequest): Response<GetFreeBusyResponse> {
fun getFreeBusy(identifier: String, request: GetFreeBusyRequest): Response<List<GetFreeBusyResponse>> {
val path = String.format("v3/grants/%s/calendars/free-busy", identifier)

val serializedRequestBody = JsonHelper.moshi()
Expand Down

0 comments on commit 97254ff

Please sign in to comment.