Skip to content

Commit e584b47

Browse files
authored
Merge branch 'main' into main
2 parents 06293a8 + e5e109d commit e584b47

File tree

20 files changed

+2039
-60
lines changed

20 files changed

+2039
-60
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[bumpversion]
22
commit = True
33
tag = True
4-
current_version = 6.6.0
4+
current_version = 6.8.0
55

66
[bumpversion:file:nylas/_client_sdk_version.py]

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ nylas-python Changelog
33

44
Unreleased
55
----------------
6+
* Support for tentative_as_busy parameter that controls whether tentative events are treated as busy time.
7+
* Available as a query parameter for Events requests and as a property in Availability request bodies
8+
* Added support for Notetaker APIs
9+
* Added support for Notetaker via the calendar and event APIs
10+
11+
v6.8.0
12+
----------------
613
* Added support for `list_import_events`
714

815
v6.7.0
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Notetaker API Demo
2+
3+
This demo showcases how to use the Nylas Notetaker API to create, manage, and interact with notes.
4+
5+
## Features Demonstrated
6+
7+
- Creating new notes
8+
- Retrieving notes
9+
- Updating notes
10+
- Deleting notes
11+
- Managing note metadata
12+
- Sharing notes with other users
13+
14+
## Prerequisites
15+
16+
- Python 3.8+
17+
- Nylas Python SDK (local version from this repository)
18+
- Nylas API credentials (Client ID and Client Secret)
19+
20+
## Setup
21+
22+
1. Install the SDK in development mode:
23+
```bash
24+
# From the root of the nylas-python repository
25+
pip install -e .
26+
```
27+
28+
2. Set up your environment variables:
29+
```bash
30+
export NYLAS_API_KEY='your_api_key'
31+
export NYLAS_API_URI='https://api.nylas.com' # Optional, defaults to https://api.nylas.com
32+
```
33+
34+
## Running the Demo
35+
36+
From the root of the repository:
37+
```bash
38+
python examples/notetaker_api_demo/notetaker_demo.py
39+
```
40+
41+
## Code Examples
42+
43+
The demo includes examples of:
44+
45+
1. Creating a new note
46+
2. Retrieving a list of notes
47+
3. Updating an existing note
48+
4. Deleting a note
49+
5. Managing note metadata
50+
6. Sharing notes with other users
51+
52+
Each example is documented with comments explaining the functionality and expected output.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
import os
2+
import sys
3+
import json
4+
from nylas import Client
5+
from nylas.models.notetakers import NotetakerMeetingSettingsRequest, NotetakerState, InviteNotetakerRequest
6+
from nylas.models.errors import NylasApiError
7+
8+
# Initialize the Nylas client
9+
nylas = Client(
10+
api_key=os.getenv("NYLAS_API_KEY"),
11+
api_uri=os.getenv("NYLAS_API_URI", "https://api.us.nylas.com")
12+
)
13+
14+
def invite_notetaker():
15+
"""Demonstrates how to invite a Notetaker to a meeting."""
16+
print("\n=== Inviting Notetaker to Meeting ===")
17+
18+
try:
19+
meeting_link = os.getenv("MEETING_LINK")
20+
if not meeting_link:
21+
raise ValueError("MEETING_LINK environment variable is not set. Please set it with your meeting URL.")
22+
23+
request_body: InviteNotetakerRequest = {
24+
"meeting_link": meeting_link,
25+
"name": "Nylas Notetaker",
26+
"meeting_settings": {
27+
"video_recording": True,
28+
"audio_recording": True,
29+
"transcription": True
30+
}
31+
}
32+
33+
print(f"Request body: {json.dumps(request_body, indent=2)}")
34+
35+
notetaker = nylas.notetakers.invite(request_body=request_body)
36+
37+
print(f"Invited Notetaker with ID: {notetaker.data.id}")
38+
print(f"Name: {notetaker.data.name}")
39+
print(f"State: {notetaker.data.state}")
40+
return notetaker
41+
except NylasApiError as e:
42+
print(f"Error inviting notetaker: {str(e)}")
43+
print(f"Error details: {e.__dict__}")
44+
raise
45+
except json.JSONDecodeError as e:
46+
print(f"JSON decode error: {str(e)}")
47+
raise
48+
except Exception as e:
49+
print(f"Unexpected error in invite_notetaker: {str(e)}")
50+
print(f"Error type: {type(e)}")
51+
print(f"Error details: {e.__dict__}")
52+
raise
53+
54+
def list_notetakers():
55+
"""Demonstrates how to list all Notetakers."""
56+
print("\n=== Listing All Notetakers ===")
57+
58+
try:
59+
notetakers = nylas.notetakers.list()
60+
61+
print(f"Found {len(notetakers.data)} notetakers:")
62+
for notetaker in notetakers.data:
63+
print(f"- {notetaker.name} (ID: {notetaker.id}, State: {notetaker.state})")
64+
65+
return notetakers
66+
except NylasApiError as e:
67+
print(f"Error listing notetakers: {str(e)}")
68+
raise
69+
except Exception as e:
70+
print(f"Unexpected error in list_notetakers: {str(e)}")
71+
raise
72+
73+
def get_notetaker_media(notetaker_id):
74+
"""Demonstrates how to get media from a Notetaker."""
75+
print("\n=== Getting Notetaker Media ===")
76+
77+
try:
78+
media = nylas.notetakers.get_media(notetaker_id)
79+
80+
if media.recording:
81+
print(f"Recording URL: {media.data.recording.url}")
82+
print(f"Recording Size: {media.data.recording.size} MB")
83+
if media.transcript:
84+
print(f"Transcript URL: {media.data.transcript.url}")
85+
print(f"Transcript Size: {media.data.transcript.size} MB")
86+
87+
return media
88+
except NylasApiError as e:
89+
print(f"Error getting notetaker media: {str(e)}")
90+
raise
91+
except Exception as e:
92+
print(f"Unexpected error in get_notetaker_media: {str(e)}")
93+
raise
94+
95+
def leave_notetaker(notetaker_id):
96+
"""Demonstrates how to leave a Notetaker."""
97+
print("\n=== Leaving Notetaker ===")
98+
99+
try:
100+
nylas.notetakers.leave(notetaker_id)
101+
print(f"Left Notetaker with ID: {notetaker_id}")
102+
except NylasApiError as e:
103+
print(f"Error leaving notetaker: {str(e)}")
104+
raise
105+
except Exception as e:
106+
print(f"Unexpected error in leave_notetaker: {str(e)}")
107+
raise
108+
109+
def main():
110+
"""Main function to run all demo examples."""
111+
try:
112+
# Check for required environment variables
113+
api_key = os.getenv("NYLAS_API_KEY")
114+
if not api_key:
115+
raise ValueError("NYLAS_API_KEY environment variable is not set")
116+
print(f"Using API key: {api_key[:5]}...")
117+
118+
# Invite a Notetaker to a meeting
119+
notetaker = invite_notetaker()
120+
121+
# List all Notetakers
122+
list_notetakers()
123+
124+
# Get media from the Notetaker (if available)
125+
if notetaker.data.state == NotetakerState.MEDIA_AVAILABLE:
126+
get_notetaker_media(notetaker.data.id)
127+
128+
# Leave the Notetaker
129+
leave_notetaker(notetaker.data.id)
130+
131+
except NylasApiError as e:
132+
print(f"\nNylas API Error: {str(e)}")
133+
print(f"Error details: {e.__dict__}")
134+
sys.exit(1)
135+
except ValueError as e:
136+
print(f"\nConfiguration Error: {str(e)}")
137+
sys.exit(1)
138+
except Exception as e:
139+
print(f"\nUnexpected Error: {str(e)}")
140+
print(f"Error type: {type(e)}")
141+
print(f"Error details: {e.__dict__}")
142+
sys.exit(1)
143+
144+
if __name__ == "__main__":
145+
main()
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Notetaker Calendar Integration Demo
2+
3+
This demo showcases how to use the Nylas Notetaker API in conjunction with calendar and event APIs to create and manage notes associated with calendar events.
4+
5+
## Features Demonstrated
6+
7+
- Creating notes linked to calendar events
8+
- Retrieving notes associated with events
9+
- Managing event-related notes
10+
- Syncing notes with event updates
11+
- Using note metadata for event organization
12+
13+
## Prerequisites
14+
15+
- Python 3.8+
16+
- Nylas Python SDK (local version from this repository)
17+
- Nylas API credentials (Client ID and Client Secret)
18+
19+
## Setup
20+
21+
1. Install the SDK in development mode:
22+
```bash
23+
# From the root of the nylas-python repository
24+
pip install -e .
25+
```
26+
27+
2. Set up your environment variables:
28+
```bash
29+
export NYLAS_API_KEY='your_api_key'
30+
export NYLAS_API_URI='https://api.nylas.com' # Optional, defaults to https://api.nylas.com
31+
```
32+
33+
## Running the Demo
34+
35+
From the root of the repository:
36+
```bash
37+
python examples/notetaker_calendar_demo/notetaker_calendar_demo.py
38+
```
39+
40+
## Code Examples
41+
42+
The demo includes examples of:
43+
44+
1. Creating a calendar event with associated notes
45+
2. Retrieving notes linked to specific events
46+
3. Updating event notes when the event changes
47+
4. Managing note metadata for event organization
48+
5. Syncing notes across multiple events
49+
50+
Each example is documented with comments explaining the functionality and expected output.

0 commit comments

Comments
 (0)