;

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2022-02-27 22:36:12 -08:00
parent 669b7aded0
commit 3d8c49afe3
2 changed files with 10 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import base64
import httpx
from ...client import Client
from ...models.error_message import ErrorMessage
from ...models.file_conversion import FileConversion
from ...types import Response
from ...api.file.file_conversion_status import sync as fc_sync, asyncio as fc_asyncio
@ -13,7 +14,7 @@ def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = fc_sync(
@ -21,7 +22,7 @@ def sync(
client=client,
)
if fc.output != "":
if isinstance(fc, FileConversion) and fc.output != "":
fc.output = base64.b64decode(fc.output)
return fc
@ -31,7 +32,7 @@ async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = await fc_asyncio(
@ -39,7 +40,7 @@ async def asyncio(
client=client,
)
if fc.output != "":
if isinstance(fc, FileConversion) and fc.output != "":
fc.output = base64.b64decode(fc.output)
return fc