Skip to content

Commit

Permalink
Add master_event_id to events (#372)
Browse files Browse the repository at this point in the history
* Add master_event_id to events

* Fix master_event_id type

* Address pylint feedback

* Add master_event_id to event list queries
  • Loading branch information
nickbair-nylas authored Jun 4, 2024
1 parent edb8b06 commit 420443f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions nylas/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class Event:
status: The Event's status.
visibility: The Event's visibility (private or public).
capacity: Sets the maximum number of participants that may attend the event.
master_event_id: For recurring events, this field contains the main (master) event's ID.
"""

id: str
Expand Down Expand Up @@ -341,6 +342,7 @@ class Event:
capacity: Optional[int] = None
created_at: Optional[int] = None
updated_at: Optional[int] = None
master_event_id: Optional[str] = None


class CreateParticipant(TypedDict):
Expand Down Expand Up @@ -727,6 +729,8 @@ class ListEventQueryParams(ListQueryParams):
This value should be taken from a ListResponse object's next_cursor parameter.
event_type (NotRequired[List[EventType]]): (Google only) Filter events by event type.
You can pass the query parameter multiple times to select or exclude multiple event types.
master_event_id (NotRequired[str]): Filter for instances of recurring events with the
specified master_event_id. Not respected by metadata filtering.
"""

calendar_id: str
Expand All @@ -741,6 +745,7 @@ class ListEventQueryParams(ListQueryParams):
busy: NotRequired[bool]
order_by: NotRequired[str]
event_type: NotRequired[List[EventType]]
master_event_id: NotRequired[str]


class CreateEventQueryParams(TypedDict):
Expand Down
6 changes: 4 additions & 2 deletions tests/resources/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def test_event_deserialization(self):
"hide_participants": False,
"grant_id": "41009df5-bf11-4c97-aa18-b285b5f2e386",
"html_link": "https://www.google.com/calendar/event?eid=bTMzcGJrNW4yYjk4bjk3OWE4Ef3feD2VuM29fMjAyMjA2MjdUMjIwMDAwWiBoYWxsYUBueWxhcy5jb20",
"id": "5d3qmne77v32r8l4phyuksl2x",
"id": "5d3qmne77v32r8l4phyuksl2x_20240603T180000Z",
"master_event_id": "5d3qmne77v32r8l4phyuksl2x",
"location": "Roller Rink",
"metadata": {"your_key": "your_value"},
"object": "event",
Expand Down Expand Up @@ -73,7 +74,8 @@ def test_event_deserialization(self):
event.html_link
== "https://www.google.com/calendar/event?eid=bTMzcGJrNW4yYjk4bjk3OWE4Ef3feD2VuM29fMjAyMjA2MjdUMjIwMDAwWiBoYWxsYUBueWxhcy5jb20"
)
assert event.id == "5d3qmne77v32r8l4phyuksl2x"
assert event.id == "5d3qmne77v32r8l4phyuksl2x_20240603T180000Z"
assert event.master_event_id == "5d3qmne77v32r8l4phyuksl2x"
assert event.location == "Roller Rink"
assert event.metadata == {"your_key": "your_value"}
assert event.object == "event"
Expand Down

0 comments on commit 420443f

Please sign in to comment.