Skip to content

attachments

Attachment dataclass

An attachment on a message.

Attributes:

Name Type Description
id str

Globally unique object identifier.

size int

Size of the attachment in bytes.

filename Optional[str]

Name of the attachment.

content_type Optional[str]

MIME type of the attachment.

Source code in nylas/models/attachments.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@dataclass_json
@dataclass
class Attachment:
    """
    An attachment on a message.

    Attributes:
        id: Globally unique object identifier.
        size: Size of the attachment in bytes.
        filename: Name of the attachment.
        content_type: MIME type of the attachment.
    """

    id: str
    size: int
    filename: Optional[str] = None
    content_type: Optional[str] = None

CreateAttachmentRequest

Bases: TypedDict

A request to create an attachment.

You can use attach_file_request_builder() to build this request.

Attributes:

Name Type Description
filename str

Name of the attachment.

content_type str

MIME type of the attachment.

content Union[str, BinaryIO]

Either a Base64 encoded content of the attachment or a pointer to a file.

size int

Size of the attachment in bytes.

content_id NotRequired[str]

The content ID of the attachment.

content_disposition NotRequired[str]

The content disposition of the attachment.

is_inline NotRequired[bool]

Whether the attachment is inline.

Source code in nylas/models/attachments.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class CreateAttachmentRequest(TypedDict):
    """
    A request to create an attachment.

    You can use `attach_file_request_builder()` to build this request.

    Attributes:
        filename: Name of the attachment.
        content_type: MIME type of the attachment.
        content: Either a Base64 encoded content of the attachment or a pointer to a file.
        size: Size of the attachment in bytes.
        content_id: The content ID of the attachment.
        content_disposition: The content disposition of the attachment.
        is_inline: Whether the attachment is inline.
    """

    filename: str
    content_type: str
    content: Union[str, BinaryIO]
    size: int
    content_id: NotRequired[str]
    content_disposition: NotRequired[str]
    is_inline: NotRequired[bool]

FindAttachmentQueryParams

Bases: TypedDict

Interface of the query parameters for finding an attachment.

Attributes:

Name Type Description
message_id str

Message ID to find the attachment in.

Source code in nylas/models/attachments.py
52
53
54
55
56
57
58
59
60
class FindAttachmentQueryParams(TypedDict):
    """
    Interface of the query parameters for finding an attachment.

    Attributes:
        message_id: Message ID to find the attachment in.
    """

    message_id: str