Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
nylas-python Changelog
======================

Unreleased
----------------
* Added support for Notetaker APIs
* Added support for Notetaker via the calendar and event APIs

v6.8.0
----------------
* Added support for `list_import_events`
Expand Down
11 changes: 11 additions & 0 deletions nylas/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from nylas.resources.drafts import Drafts
from nylas.resources.grants import Grants
from nylas.resources.scheduler import Scheduler
from nylas.resources.notetakers import Notetakers


class Client:
Expand Down Expand Up @@ -180,3 +181,13 @@ def scheduler(self) -> Scheduler:
The Scheduler API.
"""
return Scheduler(self.http_client)

@property
def notetakers(self) -> Notetakers:
"""
Access the Notetakers API.

Returns:
The Notetakers API.
"""
return Notetakers(self.http_client)
139 changes: 138 additions & 1 deletion nylas/models/calendars.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,91 @@
from dataclasses import dataclass
from typing import Dict, Any, Optional
from typing import Dict, Any, Optional, List
from enum import Enum

from dataclasses_json import dataclass_json
from typing_extensions import TypedDict, NotRequired

from nylas.models.list_query_params import ListQueryParams


class EventSelection(str, Enum):
"""
Enum representing the different types of events to include for notetaking.

Values:
INTERNAL: Events where the host domain matches all participants' domain names
EXTERNAL: Events where the host domain differs from any participant's domain name
OWN_EVENTS: Events where the host is the same as the user's grant
PARTICIPANT_ONLY: Events where the user's grant is a participant but not the host
ALL: When all options are included, all events with meeting links will have Notetakers
"""
INTERNAL = "internal"
EXTERNAL = "external"
OWN_EVENTS = "own_events"
PARTICIPANT_ONLY = "participant_only"
ALL = "all"


@dataclass_json
@dataclass
class NotetakerParticipantFilter:
"""
Class representation of Notetaker participant filter settings.

Attributes:
participants_gte: Only have meeting bot join meetings with greater than or equal to this number of participants.
participants_lte: Only have meeting bot join meetings with less than or equal to this number of participants.
"""
participants_gte: Optional[int] = None
participants_lte: Optional[int] = None


@dataclass_json
@dataclass
class NotetakerRules:
"""
Class representation of Notetaker rules for joining meetings.

Attributes:
event_selection: Types of events to include for notetaking.
participant_filter: Filters to apply based on the number of participants.
"""
event_selection: Optional[List[EventSelection]] = None
participant_filter: Optional[NotetakerParticipantFilter] = None


@dataclass_json
@dataclass
class NotetakerMeetingSettings:
"""
Class representation of Notetaker meeting settings.

Attributes:
video_recording: When true, Notetaker records the meeting's video.
audio_recording: When true, Notetaker records the meeting's audio.
transcription: When true, Notetaker transcribes the meeting's audio.
"""
video_recording: Optional[bool] = True
audio_recording: Optional[bool] = True
transcription: Optional[bool] = True


@dataclass_json
@dataclass
class CalendarNotetaker:
"""
Class representation of Notetaker settings for a calendar.

Attributes:
name: The display name for the Notetaker bot.
meeting_settings: Notetaker Meeting Settings.
rules: Rules for when the Notetaker should join a meeting.
"""
name: Optional[str] = "Nylas Notetaker"
meeting_settings: Optional[NotetakerMeetingSettings] = None
rules: Optional[NotetakerRules] = None


@dataclass_json
@dataclass
class Calendar:
Expand All @@ -30,6 +109,7 @@ class Calendar:
If not defined, the default color is used (Google only).
is_primary: If the Calendar is the account's primary calendar.
metadata: A list of key-value pairs storing additional data.
notetaker: Notetaker meeting bot settings for the calendar.
"""

id: str
Expand All @@ -45,6 +125,7 @@ class Calendar:
hex_foreground_color: Optional[str] = None
is_primary: Optional[bool] = None
metadata: Optional[Dict[str, Any]] = None
notetaker: Optional[CalendarNotetaker] = None


class ListCalendarsQueryParams(ListQueryParams):
Expand Down Expand Up @@ -76,6 +157,58 @@ class FindCalendarQueryParams(TypedDict):
select: NotRequired[str]


class NotetakerCalendarSettings(TypedDict):
"""
Interface for Notetaker meeting settings for a calendar.

Attributes:
video_recording: When true, Notetaker records the meeting's video.
audio_recording: When true, Notetaker records the meeting's audio.
transcription: When true, Notetaker transcribes the meeting's audio.
"""
video_recording: NotRequired[bool]
audio_recording: NotRequired[bool]
transcription: NotRequired[bool]


class NotetakerCalendarParticipantFilter(TypedDict):
"""
Interface for Notetaker participant filter settings.

Attributes:
participants_gte: Only have meeting bot join meetings with greater than or equal to this number of participants.
participants_lte: Only have meeting bot join meetings with less than or equal to this number of participants.
"""
participants_gte: NotRequired[int]
participants_lte: NotRequired[int]


class NotetakerCalendarRules(TypedDict):
"""
Interface for Notetaker rules for joining meetings.

Attributes:
event_selection: Types of events to include for notetaking.
participant_filter: Filters to apply based on the number of participants.
"""
event_selection: NotRequired[List[EventSelection]]
participant_filter: NotRequired[NotetakerCalendarParticipantFilter]


class NotetakerCalendarRequest(TypedDict):
"""
Interface for Notetaker settings in a calendar request.

Attributes:
name: The display name for the Notetaker bot.
meeting_settings: Notetaker Meeting Settings.
rules: Rules for when the Notetaker should join a meeting.
"""
name: NotRequired[str]
meeting_settings: NotRequired[NotetakerCalendarSettings]
rules: NotRequired[NotetakerCalendarRules]


class CreateCalendarRequest(TypedDict):
"""
Interface of a Nylas create calendar request
Expand All @@ -86,13 +219,15 @@ class CreateCalendarRequest(TypedDict):
location: Geographic location of the calendar as free-form text.
timezone: IANA time zone database formatted string (e.g. America/New_York).
metadata: A list of key-value pairs storing additional data.
notetaker: Notetaker meeting bot settings.
"""

name: str
description: NotRequired[str]
location: NotRequired[str]
timezone: NotRequired[str]
metadata: NotRequired[Dict[str, str]]
notetaker: NotRequired[NotetakerCalendarRequest]


class UpdateCalendarRequest(CreateCalendarRequest):
Expand All @@ -104,7 +239,9 @@ class UpdateCalendarRequest(CreateCalendarRequest):
Empty indicates default color.
hexForegroundColor: The background color of the calendar in the hexadecimal format (e.g. #0099EE).
Empty indicates default color. (Google only)
notetaker: Notetaker meeting bot settings.
"""

hexColor: NotRequired[str]
hexForegroundColor: NotRequired[str]
notetaker: NotRequired[NotetakerCalendarRequest]
75 changes: 75 additions & 0 deletions nylas/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ def _decode_conferencing(conferencing: dict) -> Union[Conferencing, None]:

if "autocreate" in conferencing:
return Autocreate.from_dict(conferencing)

# Handle case where provider exists but details/autocreate doesn't
if "provider" in conferencing:
# Create a Details object with empty details
details_dict = {
"provider": conferencing["provider"],
"details": conferencing.get("conf_settings", {}) if "conf_settings" in conferencing else {}
}
return Details.from_dict(details_dict)

raise ValueError(f"Invalid conferencing object, unknown type found: {conferencing}")

Expand Down Expand Up @@ -279,6 +288,38 @@ class Reminders:
overrides: Optional[List[ReminderOverride]] = None


@dataclass_json
@dataclass
class NotetakerMeetingSettings:
"""
Class representing Notetaker meeting settings.

Attributes:
video_recording: When true, Notetaker records the meeting's video.
audio_recording: When true, Notetaker records the meeting's audio.
transcription: When true, Notetaker transcribes the meeting's audio.
"""
video_recording: Optional[bool] = True
audio_recording: Optional[bool] = True
transcription: Optional[bool] = True


@dataclass_json
@dataclass
class EventNotetaker:
"""
Class representing Notetaker settings for an event.

Attributes:
id: The Notetaker bot ID.
name: The display name for the Notetaker bot.
meeting_settings: Notetaker Meeting Settings.
"""
id: Optional[str] = None
name: Optional[str] = "Nylas Notetaker"
meeting_settings: Optional[NotetakerMeetingSettings] = None


@dataclass_json
@dataclass
class Event:
Expand Down Expand Up @@ -313,6 +354,7 @@ class Event:
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.
notetaker: Notetaker meeting bot settings.
"""

id: str
Expand Down Expand Up @@ -343,6 +385,7 @@ class Event:
created_at: Optional[int] = None
updated_at: Optional[int] = None
master_event_id: Optional[str] = None
notetaker: Optional[EventNotetaker] = None


class CreateParticipant(TypedDict):
Expand Down Expand Up @@ -627,6 +670,34 @@ class UpdateDatespan(TypedDict):
""" Union type representing the different types of event time configurations for updating an Event."""


class EventNotetakerSettings(TypedDict):
"""
Interface representing Notetaker meeting settings for an event.

Attributes:
video_recording: When true, Notetaker records the meeting's video.
audio_recording: When true, Notetaker records the meeting's audio.
transcription: When true, Notetaker transcribes the meeting's audio.
"""
video_recording: NotRequired[bool]
audio_recording: NotRequired[bool]
transcription: NotRequired[bool]


class EventNotetakerRequest(TypedDict):
"""
Interface representing Notetaker settings for an event.

Attributes:
id: The Notetaker bot ID.
name: The display name for the Notetaker bot.
meeting_settings: Notetaker Meeting Settings.
"""
id: NotRequired[str]
name: NotRequired[str]
meeting_settings: NotRequired[EventNotetakerSettings]


class CreateEventRequest(TypedDict):
"""
Interface representing a request to create an event.
Expand All @@ -646,6 +717,7 @@ class CreateEventRequest(TypedDict):
visibility: The visibility of the event.
capacity: The capacity of the event.
hide_participants: Whether to hide participants of the event.
notetaker: Notetaker meeting bot settings.
"""

when: CreateWhen
Expand All @@ -661,6 +733,7 @@ class CreateEventRequest(TypedDict):
visibility: NotRequired[Visibility]
capacity: NotRequired[int]
hide_participants: NotRequired[bool]
notetaker: NotRequired[EventNotetakerRequest]


class UpdateEventRequest(TypedDict):
Expand All @@ -681,6 +754,7 @@ class UpdateEventRequest(TypedDict):
visibility: The visibility of the event.
capacity: The capacity of the event.
hide_participants: Whether to hide participants of the event.
notetaker: Notetaker meeting bot settings.
"""

when: NotRequired[UpdateWhen]
Expand All @@ -696,6 +770,7 @@ class UpdateEventRequest(TypedDict):
visibility: NotRequired[Visibility]
capacity: NotRequired[int]
hide_participants: NotRequired[bool]
notetaker: NotRequired[EventNotetakerRequest]


class ListEventQueryParams(ListQueryParams):
Expand Down
Loading
Loading