@ -143,6 +143,9 @@ def generatePath(
|
||||
params_str += ', ' + \
|
||||
camel_to_snake(parameter_name) + '=' + parameter_type
|
||||
|
||||
if request_body_type:
|
||||
params_str += ', body=' + request_body_type
|
||||
|
||||
example = """from kittycad.models import """ + success_type + """
|
||||
from kittycad.api.""" + tag_name + """ import """ + fn_name + """
|
||||
from kittycad.types import Response
|
||||
|
@ -13,18 +13,18 @@ from ...api.file.post_file_conversion import sync as fc_sync, asyncio as fc_asyn
|
||||
def sync(
|
||||
source_format: ValidSourceFileFormat,
|
||||
output_format: ValidOutputFileFormat,
|
||||
content: bytes,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion]]:
|
||||
"""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(content)
|
||||
encoded = base64.b64encode(body)
|
||||
|
||||
fc = fc_sync(
|
||||
source_format=source_format,
|
||||
output_format=output_format,
|
||||
content=encoded,
|
||||
body=encoded,
|
||||
client=client,
|
||||
)
|
||||
|
||||
@ -37,18 +37,18 @@ def sync(
|
||||
async def asyncio(
|
||||
source_format: ValidSourceFileFormat,
|
||||
output_format: ValidOutputFileFormat,
|
||||
content: bytes,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion]]:
|
||||
"""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(content)
|
||||
encoded = base64.b64encode(body)
|
||||
|
||||
fc = await fc_asyncio(
|
||||
source_format=source_format,
|
||||
output_format=output_format,
|
||||
content=encoded,
|
||||
body=encoded,
|
||||
client=client,
|
||||
)
|
||||
|
||||
|
@ -93,9 +93,9 @@ def test_file_convert_stl():
|
||||
file.close()
|
||||
|
||||
# Get the fc.
|
||||
fc: FileConversion = post_file_convertsion_with_base64_helper.sync(
|
||||
fc: FileConversion = post_file_conversion_with_base64_helper.sync(
|
||||
client=client,
|
||||
content=content,
|
||||
body=content,
|
||||
source_format=ValidSourceFileFormat.STL,
|
||||
output_format=ValidOutputFileFormat.OBJ)
|
||||
|
||||
@ -115,7 +115,7 @@ async def test_file_convert_stl_async():
|
||||
file.close()
|
||||
|
||||
# Get the fc.
|
||||
fc: FileConversion = await post_file_convertsion_with_base64_helper.asyncio(client=client, content=content, source_format=ValidSourceFileFormat.STL, output_format=ValidOutputFileFormat.OBJ)
|
||||
fc: FileConversion = await post_file_conversion_with_base64_helper.asyncio(client=client, body=content, source_format=ValidSourceFileFormat.STL, output_format=ValidOutputFileFormat.OBJ)
|
||||
|
||||
assert fc is not None
|
||||
|
||||
|
@ -646,7 +646,7 @@
|
||||
"libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#FileService.PostConversion"
|
||||
},
|
||||
"x-python": {
|
||||
"example": "from kittycad.models import FileConversion\nfrom kittycad.api.file import file_conversion_status_with_base64_helper\nfrom kittycad.types import Response\n\nfc: FileConversion = file_conversion_status_with_base64_helper.sync(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat)\n\n# OR if you need more info (e.g. status_code)\nresponse: Response[FileConversion] = file_conversion_status_with_base64_helper.sync_detailed(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat)\n\n# OR run async\nfc: FileConversion = await file_conversion_status_with_base64_helper.asyncio(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat)\n\n# OR run async with more info\nresponse: Response[FileConversion] = await file_conversion_status_with_base64_helper.asyncio_detailed(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat)",
|
||||
"example": "from kittycad.models import FileConversion\nfrom kittycad.api.file import file_conversion_status_with_base64_helper\nfrom kittycad.types import Response\n\nfc: FileConversion = file_conversion_status_with_base64_helper.sync(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat, body=bytes)\n\n# OR if you need more info (e.g. status_code)\nresponse: Response[FileConversion] = file_conversion_status_with_base64_helper.sync_detailed(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat, body=bytes)\n\n# OR run async\nfc: FileConversion = await file_conversion_status_with_base64_helper.asyncio(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat, body=bytes)\n\n# OR run async with more info\nresponse: Response[FileConversion] = await file_conversion_status_with_base64_helper.asyncio_detailed(client=client, source_format=ValidSourceFileFormat, output_format=ValidOutputFileFormat, body=bytes)",
|
||||
"libDocsLink": ""
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user