-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for free-busy endpoint (#279)
* Add support for free-busy endpoint Mostly cribbed off the availability support, though radically stripped down as free-busy is a great deal simpler. * debugging * just work * fix docs * fix doc * rename Error to FreeBusyError
- Loading branch information
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
from dataclasses import dataclass | ||
from typing import List, Union | ||
|
||
from dataclasses_json import dataclass_json | ||
from typing_extensions import TypedDict | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class FreeBusyError: | ||
""" | ||
Interface for a Nylas free/busy call error | ||
Attributes: | ||
email: The email address of the participant who had an error. | ||
error: The provider's error message. | ||
""" | ||
|
||
email: str | ||
error: str | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class TimeSlot: | ||
""" | ||
Interface for a Nylas free/busy time slot | ||
Attributes: | ||
start_time: Unix timestamp for the start of the slot. | ||
end_time: Unix timestamp for the end of the slot. | ||
status: The status of the slot. Typically "busy" | ||
""" | ||
|
||
start_time: int | ||
end_time: int | ||
status: str | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class FreeBusy: | ||
""" | ||
Interface for an individual Nylas free/busy response | ||
Attributes: | ||
email: The email address of the participant. | ||
time_slots: List of time slots for the participant. | ||
""" | ||
|
||
email: str | ||
time_slots: List[TimeSlot] | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class GetFreeBusyResponse: | ||
""" | ||
Interface for a Nylas get free/busy response | ||
A list of FreeBusy objects and FreeBusyError objects. | ||
""" | ||
|
||
List[Union[FreeBusy, FreeBusyError]] | ||
|
||
|
||
class GetFreeBusyRequest(TypedDict): | ||
""" | ||
Interface for a Nylas get free/busy request | ||
Attributes: | ||
start_time: Unix timestamp for the start time to check free/busy for. | ||
end_time: Unix timestamp for the end time to check free/busy for. | ||
emails: List of email addresses to check free/busy for. | ||
""" | ||
|
||
start_time: int | ||
end_time: int | ||
emails: List[str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters