33import typing
44from json .decoder import JSONDecodeError
55
6+ from ...attachments .types .send_attachment import SendAttachment
67from ...core .api_error import ApiError
78from ...core .client_wrapper import AsyncClientWrapper , SyncClientWrapper
89from ...core .datetime_utils import serialize_datetime
910from ...core .http_response import AsyncHttpResponse , HttpResponse
1011from ...core .jsonable_encoder import jsonable_encoder
1112from ...core .request_options import RequestOptions
13+ from ...core .serialization import convert_and_respect_annotation_metadata
1214from ...core .unchecked_base_model import construct_type
1315from ...drafts .types .draft import Draft
1416from ...drafts .types .draft_bcc import DraftBcc
@@ -183,6 +185,7 @@ def create(
183185 subject : typing .Optional [DraftSubject ] = OMIT ,
184186 text : typing .Optional [DraftText ] = OMIT ,
185187 html : typing .Optional [DraftHtml ] = OMIT ,
188+ attachments : typing .Optional [typing .Sequence [SendAttachment ]] = OMIT ,
186189 in_reply_to : typing .Optional [DraftInReplyTo ] = OMIT ,
187190 send_at : typing .Optional [DraftSendAt ] = OMIT ,
188191 client_id : typing .Optional [DraftClientId ] = OMIT ,
@@ -209,6 +212,9 @@ def create(
209212
210213 html : typing.Optional[DraftHtml]
211214
215+ attachments : typing.Optional[typing.Sequence[SendAttachment]]
216+ Attachments to include in draft.
217+
212218 in_reply_to : typing.Optional[DraftInReplyTo]
213219
214220 send_at : typing.Optional[DraftSendAt]
@@ -235,6 +241,9 @@ def create(
235241 "subject" : subject ,
236242 "text" : text ,
237243 "html" : html ,
244+ "attachments" : convert_and_respect_annotation_metadata (
245+ object_ = attachments , annotation = typing .Sequence [SendAttachment ], direction = "write"
246+ ),
238247 "in_reply_to" : in_reply_to ,
239248 "send_at" : send_at ,
240249 "client_id" : client_id ,
@@ -628,6 +637,7 @@ async def create(
628637 subject : typing .Optional [DraftSubject ] = OMIT ,
629638 text : typing .Optional [DraftText ] = OMIT ,
630639 html : typing .Optional [DraftHtml ] = OMIT ,
640+ attachments : typing .Optional [typing .Sequence [SendAttachment ]] = OMIT ,
631641 in_reply_to : typing .Optional [DraftInReplyTo ] = OMIT ,
632642 send_at : typing .Optional [DraftSendAt ] = OMIT ,
633643 client_id : typing .Optional [DraftClientId ] = OMIT ,
@@ -654,6 +664,9 @@ async def create(
654664
655665 html : typing.Optional[DraftHtml]
656666
667+ attachments : typing.Optional[typing.Sequence[SendAttachment]]
668+ Attachments to include in draft.
669+
657670 in_reply_to : typing.Optional[DraftInReplyTo]
658671
659672 send_at : typing.Optional[DraftSendAt]
@@ -680,6 +693,9 @@ async def create(
680693 "subject" : subject ,
681694 "text" : text ,
682695 "html" : html ,
696+ "attachments" : convert_and_respect_annotation_metadata (
697+ object_ = attachments , annotation = typing .Sequence [SendAttachment ], direction = "write"
698+ ),
683699 "in_reply_to" : in_reply_to ,
684700 "send_at" : send_at ,
685701 "client_id" : client_id ,
0 commit comments