Skip to content

threads

ListThreadsQueryParams = TypedDict('ListThreadsQueryParams', {None: get_type_hints(ListQueryParams), 'subject': NotRequired[str], 'any_email': NotRequired[str], 'from': NotRequired[str], 'to': NotRequired[str], 'cc': NotRequired[str], 'bcc': NotRequired[str], 'in': NotRequired[str], 'unread': NotRequired[bool], 'starred': NotRequired[bool], 'thread_id': NotRequired[str], 'latest_message_before': NotRequired[int], 'latest_message_after': NotRequired[int], 'has_attachment': NotRequired[bool], 'search_query_native': NotRequired[str]}) module-attribute

Query parameters for listing threads.

Attributes:

Name Type Description
subject

Return threads with matching subject.

any_email

Return threads that have been sent or received by this comma-separated list of email addresses.

from

Return threads sent from this email address.

to

Return threads sent to this email address.

cc

Return threads cc'd to this email address.

bcc

Return threads bcc'd to this email address.

in

Return threads in this specific folder or label, specified by ID.

unread

Filter threads by unread status.

starred

Filter threads by starred status.

thread_id

Filter threads by thread_id.

latest_message_before

Return threads whose most recent message was received before this Unix timestamp.

latest_message_after

Return threads whose most recent message was received after this Unix timestamp.

has_attachment

Filter threads by whether they have an attachment.

search_query_native

A native provider search query for Google or Microsoft.

limit NotRequired[int]

The maximum number of objects to return. This field defaults to 50. The maximum allowed value is 200.

page_token NotRequired[str]

An identifier that specifies which page of data to return. This value should be taken from a ListResponse object's next_cursor parameter.

Thread dataclass

A Thread object.

Attributes:

Name Type Description
id str

Globally unique object identifier.

grant_id str

The grant that this thread belongs to.

latest_draft_or_message Union[Message, Draft]

The latest draft or message in the thread.

has_attachment Union[Message, Draft]

Whether the thread has an attachment.

has_drafts bool

Whether the thread has drafts.

starred bool

A boolean indicating whether the thread is starred or not

unread bool

A boolean indicating whether the thread is read or not.

earliest_message_date int

Unix timestamp of the earliest or first message in the thread.

latest_message_received_date Optional[int]

Unix timestamp of the most recent message received in the thread.

latest_message_sent_date Optional[int]

Unix timestamp of the most recent message sent in the thread.

participant Optional[int]

An array of participants in the thread.

message_ids List[str]

An array of message IDs in the thread.

draft_ids Optional[List[str]]

An array of draft IDs in the thread.

folders List[str]

An array of folder IDs the thread appears in.

object str

The type of object.

snippet Optional[str]

A short snippet of the last received message/draft body. This is the first 100 characters of the message body, with any HTML tags removed.

subject Optional[str]

The subject of the thread.

Source code in nylas/models/threads.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
@dataclass_json
@dataclass
class Thread:
    """
    A Thread object.

    Attributes:
        id: Globally unique object identifier.
        grant_id: The grant that this thread belongs to.
        latest_draft_or_message: The latest draft or message in the thread.
        has_attachment: Whether the thread has an attachment.
        has_drafts: Whether the thread has drafts.
        starred: A boolean indicating whether the thread is starred or not
        unread: A boolean indicating whether the thread is read or not.
        earliest_message_date: Unix timestamp of the earliest or first message in the thread.
        latest_message_received_date: Unix timestamp of the most recent message received in the thread.
        latest_message_sent_date: Unix timestamp of the most recent message sent in the thread.
        participant: An array of participants in the thread.
        message_ids: An array of message IDs in the thread.
        draft_ids: An array of draft IDs in the thread.
        folders: An array of folder IDs the thread appears in.
        object: The type of object.
        snippet: A short snippet of the last received message/draft body.
                This is the first 100 characters of the message body, with any HTML tags removed.
        subject: The subject of the thread.
    """

    id: str
    grant_id: str
    has_drafts: bool
    starred: bool
    unread: bool
    earliest_message_date: int
    message_ids: List[str]
    folders: List[str]
    latest_draft_or_message: Union[Message, Draft] = field(
        metadata=config(decoder=_decode_draft_or_message)
    )
    object: str = "thread"
    latest_message_received_date: Optional[int] = None
    draft_ids: Optional[List[str]] = None
    snippet: Optional[str] = None
    subject: Optional[str] = None
    participants: Optional[List[EmailName]] = None
    latest_message_sent_date: Optional[int] = None
    has_attachments: Optional[bool] = None

UpdateThreadRequest

Bases: TypedDict

A request to update a thread.

Attributes:

Name Type Description
starred NotRequired[bool]

Sets all messages in the thread as starred or unstarred.

unread NotRequired[bool]

Sets all messages in the thread as read or unread.

folders NotRequired[List[str]]

The IDs of the folders to apply, overwriting all previous folders for all messages in the thread.

Source code in nylas/models/threads.py
84
85
86
87
88
89
90
91
92
93
94
95
96
class UpdateThreadRequest(TypedDict):
    """
    A request to update a thread.

    Attributes:
        starred: Sets all messages in the thread as starred or unstarred.
        unread: Sets all messages in the thread as read or unread.
        folders: The IDs of the folders to apply, overwriting all previous folders for all messages in the thread.
    """

    starred: NotRequired[bool]
    unread: NotRequired[bool]
    folders: NotRequired[List[str]]