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:
@ -1,5 +1,5 @@
|
||||
import base64
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any, Optional, Tuple, Union
|
||||
|
||||
from ...api.file.create_file_conversion import asyncio as fc_asyncio, sync as fc_sync
|
||||
from ...client import Client
|
||||
@ -12,7 +12,7 @@ def sync(
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, Error]]:
|
||||
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
|
||||
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""
|
||||
|
||||
encoded = base64.b64encode(body)
|
||||
@ -26,9 +26,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
|
||||
|
||||
@ -39,7 +38,7 @@ async def asyncio(
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, Error]]:
|
||||
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
|
||||
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""
|
||||
|
||||
encoded = base64.b64encode(body)
|
||||
@ -53,8 +52,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
|
||||
|
Reference in New Issue
Block a user