Update api spec (#124)

* YOYO NEW API SPEC!

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* tuples

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* I have generated the latest API!

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jess Frazelle
2023-08-17 12:48:13 -07:00
committed by GitHub
parent 3cde65018e
commit 9921f5a9f3
97 changed files with 2225 additions and 409 deletions

View File

@ -1,5 +1,5 @@
import base64
from typing import Any, Optional, Union
from typing import Any, Optional, Tuple, Union
from ...api.api_calls.get_async_operation import asyncio as fc_asyncio, sync as fc_sync
from ...client import Client
@ -11,7 +11,7 @@ def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, Error]]:
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = fc_sync(
@ -21,9 +21,8 @@ def sync(
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "=" * (-len(fc.output) % 4))
# decode the bytes to a string
fc.output = b.decode("utf-8")
b = base64.b64decode(fc.output + "===")
return (fc, b)
return fc
@ -32,7 +31,7 @@ async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, Error]]:
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = await fc_asyncio(
@ -42,8 +41,7 @@ async def asyncio(
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "=" * (-len(fc.output) % 4))
# decode the bytes to a string
fc.output = b.decode("utf-8")
b = base64.b64decode(fc.output + "===")
return (fc, b)
return fc