From bcd2b2c7f547b11ac59c6cd2b18aba3f11f8cfa6 Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:30:11 -0400 Subject: [PATCH] Add support for free-busy endpoint --- CHANGELOG.md | 1 + lib/nylas/resources/calendars.rb | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91d1f1a8..c86aa570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### 6.0.0-beta.2 / TBD * Added additional error classes +* Added support for free/busy endpoint * Set default timeout to 30 seconds ### 6.0.0-beta.1 / 2023-08-16 diff --git a/lib/nylas/resources/calendars.rb b/lib/nylas/resources/calendars.rb index 219be418..bf84ae22 100644 --- a/lib/nylas/resources/calendars.rb +++ b/lib/nylas/resources/calendars.rb @@ -19,13 +19,25 @@ def initialize(sdk_instance) # Checks multiple calendars to find available time slots for a single meeting. # - # @param request_body [Hash, nil] Request body to pass to the request. + # @param request_body Hash Request body to pass to the request. # @return [Array(Hash, String)] Availability object and API request ID. - def get_availability(request_body: nil) + def get_availability(request_body:) post( path: "#{api_uri}/v3/calendars/availability", request_body: request_body ) end + + # Get the free/busy schedule for a list of email addresses. + # + # @param identifier [str] The identifier of the grant to act upon. + # @param request_body [Hash] Request body to pass to the request. + # @return [Array(Array(Hash), String)] The free/busy response. + def get_free_busy(identifier:, request_body:) + post( + path: "#{api_uri}/v3/grants/#{identifier}/calendars/availability", + request_body: request_body + ) + end end end