Skip to content

Commit e0755f4

Browse files
authored
Split out _upload_file method on PoeBot (#206)
1 parent 995b9dd commit e0755f4

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/fastapi_poe/base.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
URL_ATTACHMENT_TEMPLATE,
3434
)
3535
from fastapi_poe.types import (
36+
Attachment,
3637
AttachmentUploadResponse,
3738
ContentType,
3839
CostItem,
@@ -420,7 +421,7 @@ async def post_message_attachment(
420421
stacklevel=2,
421422
)
422423

423-
attachment = await upload_file(
424+
attachment = await self._upload_file(
424425
file=file_data,
425426
file_url=download_url,
426427
file_name=filename or download_filename,
@@ -446,6 +447,23 @@ async def post_message_attachment(
446447
inline_ref=inline_ref,
447448
)
448449

450+
async def _upload_file(
451+
self,
452+
*,
453+
file: Optional[Union[bytes, BinaryIO]],
454+
file_url: Optional[str],
455+
file_name: Optional[str],
456+
api_key: str,
457+
base_url: str,
458+
) -> Attachment:
459+
return await upload_file(
460+
file=file,
461+
file_url=file_url,
462+
file_name=file_name,
463+
api_key=api_key,
464+
base_url=base_url,
465+
)
466+
449467
@deprecated(
450468
"This method is deprecated. Use `insert_attachment_messages` instead."
451469
"This method will be removed in a future release."

0 commit comments

Comments
 (0)