Skip to content

Conversation

@mrashed-dev
Copy link
Contributor

Description

In the free busy, availability, and consecutive availability endpoints of the Nylas Calendar API, there's a new field (calendar) that can be substituted for emails in the event that someone wants to check for availability/free-busy of other calendars within the same organization.

Usage

from nylas import APIClient
nylas = APIClient(
    CLIENT_ID,
    CLIENT_SECRET,
    ACCESS_TOKEN
)

# Free busy with calendars
start_time = datetime.now()
end_time = datetime.now() + timedelta(hours = 24)
calendars = [{
  "account_id": "test_account_id",
  "calendar_ids": ["example_calendar_a", "example_calendar_b"]
}]

free_busy = nylas.free_busy("your_email@example.com", start_time, end_time, calendars)

# Availability with calendars
emails = ["one@example.com", "two@example.com", "three@example.com"]
start_time = datetime.now()
end_time = datetime.now() + timedelta(hours = 24)
duration = timedelta(minutes=30)
interval = timedelta(hours=1, minutes=30)
calendars = [{
  "account_id": "test_account_id",
  "calendar_ids": ["example_calendar_a", "example_calendar_b"]
}]

api_client.availability(emails, duration, interval, start_at, end_at, calendars=calendars)

# Consecutive availability with calendars
emails = [["one@example.com"], ["two@example.com", "three@example.com"]]
start_time = datetime.now()
end_time = datetime.now() + timedelta(hours = 24)
duration = timedelta(minutes=30)
interval = timedelta(hours=1, minutes=30)
calendars = [{
  "account_id": "test_account_id",
  "calendar_ids": ["example_calendar_a", "example_calendar_b"]
}]

api_client.consecutive_availability(emails, duration, interval, start_at, end_at, calendars=calendars)

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.

@mrashed-dev mrashed-dev requested review from a team, dantonpimentel, justin-nylas and tbadun and removed request for a team July 12, 2022 20:28
@mrashed-dev mrashed-dev requested review from a team, maxwell-schwartz and premvilas30 and removed request for a team, dantonpimentel, justin-nylas and tbadun July 25, 2022 18:22
Copy link

@maxwell-schwartz maxwell-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@mrashed-dev mrashed-dev merged commit 655d013 into main Jul 26, 2022
@mrashed-dev mrashed-dev deleted the CUST-805-python-sdk-free-busy-missing-option-to-pass-calendars-array branch July 26, 2022 13:57
@mrashed-dev mrashed-dev mentioned this pull request Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants