Skip to content

Commit dccfa0a

Browse files
authored
Merge pull request #422 from nylas/CUST-4499-Python-SDK-ListThreadQueryParams-missing-earliest_message_date
Cust 4499 python sdk list thread query params missing earliest message date
2 parents ee41164 + d948975 commit dccfa0a

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

CHANGELOG.md

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

44
Unreleased
55
----------------
6+
* Added support for `earliest_message_date` query parameter for threads
67
* Added support for new message fields query parameter values: `include_tracking_options` and `raw_mime`
78
* Added `tracking_options` field to Message model for message tracking settings
89
* Added `raw_mime` field to Message model for Base64url-encoded message data

nylas/models/threads.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class UpdateThreadRequest(TypedDict):
112112
"unread": NotRequired[bool],
113113
"starred": NotRequired[bool],
114114
"thread_id": NotRequired[str],
115+
"earliest_message_date": NotRequired[int],
115116
"latest_message_before": NotRequired[int],
116117
"latest_message_after": NotRequired[int],
117118
"has_attachment": NotRequired[bool],
@@ -133,6 +134,7 @@ class UpdateThreadRequest(TypedDict):
133134
unread: Filter threads by unread status.
134135
starred: Filter threads by starred status.
135136
thread_id: Filter threads by thread_id.
137+
earliest_message_date: Unix timestamp of the earliest or first message in the thread.
136138
latest_message_before: Return threads whose most recent message was received before this Unix timestamp.
137139
latest_message_after: Return threads whose most recent message was received after this Unix timestamp.
138140
has_attachment: Filter threads by whether they have an attachment.

tests/resources/test_threads.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,44 @@ def test_list_threads_with_select_param(self, http_client_list_response):
188188

189189
# The actual response validation is handled by the mock in conftest.py
190190
assert result is not None
191+
192+
def test_list_threads_with_earliest_message_date_param(self, http_client_list_response):
193+
threads = Threads(http_client_list_response)
194+
195+
timestamp = 1672531200
196+
197+
http_client_list_response._execute.return_value = {
198+
"request_id": "abc-123",
199+
"data": [{
200+
"id": "thread-123",
201+
"has_attachments": False,
202+
"earliest_message_date": 1672617600,
203+
"participants": [
204+
{"email": "test@example.com", "name": "Test User"}
205+
],
206+
"snippet": "Test snippet",
207+
"unread": False,
208+
"subject": "Test subject",
209+
"message_ids": ["msg-123"],
210+
"folders": ["folder-123"]
211+
}]
212+
}
213+
214+
result = threads.list(
215+
identifier="abc-123",
216+
query_params={"earliest_message_date": timestamp}
217+
)
218+
219+
http_client_list_response._execute.assert_called_with(
220+
"GET",
221+
"/v3/grants/abc-123/threads",
222+
None,
223+
{"earliest_message_date": timestamp},
224+
None,
225+
overrides=None,
226+
)
227+
228+
assert result is not None
191229

192230
def test_find_thread(self, http_client_response):
193231
threads = Threads(http_client_response)

0 commit comments

Comments
 (0)