Skip to content

threads

Threads

Bases: ListableApiResource, FindableApiResource, UpdatableApiResource, DestroyableApiResource

Nylas Threads API

The threads API allows you to find, update, and delete threads.

Source code in nylas/resources/threads.py
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 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
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
class Threads(
    ListableApiResource,
    FindableApiResource,
    UpdatableApiResource,
    DestroyableApiResource,
):
    """
    Nylas Threads API

    The threads API allows you to find, update, and delete threads.
    """

    def list(
        self,
        identifier: str,
        query_params: ListThreadsQueryParams = None,
        overrides: RequestOverrides = None,
    ) -> ListResponse[Thread]:
        """
        Return all Threads.

        Args:
            identifier: The identifier of the grant to get threads for.
            query_params: The query parameters to filter threads by.
            overrides: The request overrides to apply to the request.

        Returns:
            A list of Threads.
        """
        return super().list(
            path=f"/v3/grants/{identifier}/threads",
            response_type=Thread,
            query_params=query_params,
            overrides=overrides,
        )

    def find(
        self, identifier: str, thread_id: str, overrides: RequestOverrides = None
    ) -> Response[Thread]:
        """
        Return a Thread.

        Args:
            identifier: The identifier of the grant to get the thread for.
            thread_id: The identifier of the thread to get.
            overrides: The request overrides to apply to the request.

        Returns:
            The requested Thread.
        """
        return super().find(
            path=f"/v3/grants/{identifier}/threads/{thread_id}",
            response_type=Thread,
            overrides=overrides,
        )

    def update(
        self,
        identifier: str,
        thread_id: str,
        request_body: UpdateThreadRequest,
        overrides: RequestOverrides = None,
    ) -> Response[Thread]:
        """
        Update a Thread.

        Args:
            identifier: The identifier of the grant to update the thread for.
            thread_id: The identifier of the thread to update.
            request_body: The request body to update the thread with.
            overrides: The request overrides to apply to the request.

        Returns:
            The updated Thread.
        """
        return super().update(
            path=f"/v3/grants/{identifier}/threads/{thread_id}",
            response_type=Thread,
            request_body=request_body,
            overrides=overrides,
        )

    def destroy(
        self, identifier: str, thread_id: str, overrides: RequestOverrides = None
    ) -> DeleteResponse:
        """
        Delete a Thread.

        Args:
            identifier: The identifier of the grant to delete the thread for.
            thread_id: The identifier of the thread to delete.
            overrides: The request overrides to apply to the request.

        Returns:
            The deletion response.
        """
        return super().destroy(
            path=f"/v3/grants/{identifier}/threads/{thread_id}", overrides=overrides
        )

destroy(identifier, thread_id, overrides=None)

Delete a Thread.

Parameters:

Name Type Description Default
identifier str

The identifier of the grant to delete the thread for.

required
thread_id str

The identifier of the thread to delete.

required
overrides RequestOverrides

The request overrides to apply to the request.

None

Returns:

Type Description
DeleteResponse

The deletion response.

Source code in nylas/resources/threads.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
def destroy(
    self, identifier: str, thread_id: str, overrides: RequestOverrides = None
) -> DeleteResponse:
    """
    Delete a Thread.

    Args:
        identifier: The identifier of the grant to delete the thread for.
        thread_id: The identifier of the thread to delete.
        overrides: The request overrides to apply to the request.

    Returns:
        The deletion response.
    """
    return super().destroy(
        path=f"/v3/grants/{identifier}/threads/{thread_id}", overrides=overrides
    )

find(identifier, thread_id, overrides=None)

Return a Thread.

Parameters:

Name Type Description Default
identifier str

The identifier of the grant to get the thread for.

required
thread_id str

The identifier of the thread to get.

required
overrides RequestOverrides

The request overrides to apply to the request.

None

Returns:

Type Description
Response[Thread]

The requested Thread.

Source code in nylas/resources/threads.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def find(
    self, identifier: str, thread_id: str, overrides: RequestOverrides = None
) -> Response[Thread]:
    """
    Return a Thread.

    Args:
        identifier: The identifier of the grant to get the thread for.
        thread_id: The identifier of the thread to get.
        overrides: The request overrides to apply to the request.

    Returns:
        The requested Thread.
    """
    return super().find(
        path=f"/v3/grants/{identifier}/threads/{thread_id}",
        response_type=Thread,
        overrides=overrides,
    )

list(identifier, query_params=None, overrides=None)

Return all Threads.

Parameters:

Name Type Description Default
identifier str

The identifier of the grant to get threads for.

required
query_params ListThreadsQueryParams

The query parameters to filter threads by.

None
overrides RequestOverrides

The request overrides to apply to the request.

None

Returns:

Type Description
ListResponse[Thread]

A list of Threads.

Source code in nylas/resources/threads.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def list(
    self,
    identifier: str,
    query_params: ListThreadsQueryParams = None,
    overrides: RequestOverrides = None,
) -> ListResponse[Thread]:
    """
    Return all Threads.

    Args:
        identifier: The identifier of the grant to get threads for.
        query_params: The query parameters to filter threads by.
        overrides: The request overrides to apply to the request.

    Returns:
        A list of Threads.
    """
    return super().list(
        path=f"/v3/grants/{identifier}/threads",
        response_type=Thread,
        query_params=query_params,
        overrides=overrides,
    )

update(identifier, thread_id, request_body, overrides=None)

Update a Thread.

Parameters:

Name Type Description Default
identifier str

The identifier of the grant to update the thread for.

required
thread_id str

The identifier of the thread to update.

required
request_body UpdateThreadRequest

The request body to update the thread with.

required
overrides RequestOverrides

The request overrides to apply to the request.

None

Returns:

Type Description
Response[Thread]

The updated Thread.

Source code in nylas/resources/threads.py
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def update(
    self,
    identifier: str,
    thread_id: str,
    request_body: UpdateThreadRequest,
    overrides: RequestOverrides = None,
) -> Response[Thread]:
    """
    Update a Thread.

    Args:
        identifier: The identifier of the grant to update the thread for.
        thread_id: The identifier of the thread to update.
        request_body: The request body to update the thread with.
        overrides: The request overrides to apply to the request.

    Returns:
        The updated Thread.
    """
    return super().update(
        path=f"/v3/grants/{identifier}/threads/{thread_id}",
        response_type=Thread,
        request_body=request_body,
        overrides=overrides,
    )