Skip to content

Commit 7849e8d

Browse files
committed
Add support for expanded message view
Fixes #20
1 parent d7a42dd commit 7849e8d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ for message in thread.messages.items():
175175
print message.raw
176176
```
177177

178+
To get the [expanded message view](https://www.nylas.com/docs/platform#expanded_message_view) that includes convenient header information, include `view='expanded'` in the where clause
179+
```
180+
message = client.messages.where(in_='inbox', view='expanded').first()
181+
message.headers['Message-Id']
182+
message.headers['References']
183+
message.headers['In-Reply-To']
184+
```
185+
178186
### Working with Folders and Labels
179187

180188
The Folders and Labels API replaces the now deprecated Tags API. For Gmail accounts, this API allows you to apply labels to whole threads or individual messages. For providers other than Gmail, you can move threads and messages between folders -- a message can only belong to one folder.

nylas/client/restful_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def update(self):
8080
class Message(NylasAPIObject):
8181
attrs = ["bcc", "body", "cc", "date", "events", "files", "from", "id",
8282
"account_id", "object", "snippet", "starred", "subject",
83-
"thread_id", "to", "unread", "starred", "_folder", "_labels"]
83+
"thread_id", "to", "unread", "starred", "_folder", "_labels",
84+
"headers"]
8485
collection_name = 'messages'
8586

8687
def __init__(self, api):

tests/system.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
draft.tracking = { 'links': 'false', 'opens': 'true', 'thread_replies': 'true', 'payload':'python sdk open tracking test' }
6565
draft.send()
6666

67+
print "Get expanded view for message"
68+
m = client.messages.where(in_='inbox', limit=1, view='expanded').first()
69+
print m.headers['Message-Id']
70+
6771
print 'Listing folders'
6872
for label in client.labels:
6973
print label.display_name

0 commit comments

Comments
 (0)