Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
0403eddfd7 | |||
95f22c849d | |||
9fe98c9185 | |||
d90bc06ff4 | |||
e63cda47eb | |||
44e8b10185 |
@ -67,7 +67,7 @@ def generatePaths(cwd: str, parser: dict) -> dict:
|
||||
# Generate the directory/__init__.py for each of the tags.
|
||||
tags = parser['tags']
|
||||
for tag in tags:
|
||||
tag_name = tag['name']
|
||||
tag_name = tag['name'].replace('-', '_')
|
||||
tag_description = tag['description']
|
||||
tag_path = os.path.join(path, tag_name)
|
||||
# Esnure the directory exists.
|
||||
@ -116,7 +116,7 @@ def generatePath(
|
||||
tag_name = ''
|
||||
# Add the tag to the path if it exists.
|
||||
if 'tags' in endpoint:
|
||||
tag_name = endpoint['tags'][0]
|
||||
tag_name = endpoint['tags'][0].replace('-', '_')
|
||||
path = os.path.join(path, tag_name)
|
||||
file_path = os.path.join(path, file_name)
|
||||
print("generating type: ", name, " at: ", file_path)
|
||||
@ -139,6 +139,7 @@ def generatePath(
|
||||
params_str = ''
|
||||
if 'parameters' in endpoint:
|
||||
parameters = endpoint['parameters']
|
||||
optional_args = []
|
||||
for parameter in parameters:
|
||||
parameter_name = parameter['name']
|
||||
parameter_type = ''
|
||||
@ -154,8 +155,20 @@ def generatePath(
|
||||
else:
|
||||
print(" parameter: ", parameter)
|
||||
raise Exception("Unknown parameter type")
|
||||
params_str += ', ' + \
|
||||
camel_to_snake(parameter_name) + '=' + parameter_type
|
||||
if 'nullable' in parameter['schema']:
|
||||
if parameter['schema']['nullable']:
|
||||
parameter_type = 'Optional[' + parameter_type + ']'
|
||||
optional_args.append(
|
||||
', ' + camel_to_snake(parameter_name) + '=' + parameter_type)
|
||||
else:
|
||||
params_str += ', ' + \
|
||||
camel_to_snake(parameter_name) + '=' + parameter_type
|
||||
else:
|
||||
params_str += ', ' + \
|
||||
camel_to_snake(parameter_name) + '=' + parameter_type
|
||||
|
||||
for optional_arg in optional_args:
|
||||
params_str += optional_arg
|
||||
|
||||
if request_body_type:
|
||||
params_str += ', body=' + request_body_type
|
||||
@ -217,6 +230,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
# Define the method.
|
||||
f.write("def _get_kwargs(\n")
|
||||
# Iterate over the parameters.
|
||||
optional_args = []
|
||||
if 'parameters' in endpoint:
|
||||
parameters = endpoint['parameters']
|
||||
for parameter in parameters:
|
||||
@ -232,12 +246,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
else:
|
||||
print(" parameter: ", parameter)
|
||||
raise Exception("Unknown parameter type")
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if 'nullable' in parameter['schema']:
|
||||
if parameter['schema']['nullable']:
|
||||
parameter_type = 'Optional[' + parameter_type + '] = None'
|
||||
optional_args.append("\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if request_body_type:
|
||||
f.write(
|
||||
"\tbody: " +
|
||||
@ -245,6 +275,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
",\n")
|
||||
f.write("\t*,\n")
|
||||
f.write("\tclient: Client,\n")
|
||||
for optional_arg in optional_args:
|
||||
f.write(optional_arg)
|
||||
f.write(") -> Dict[str, Any]:\n")
|
||||
templateUrl = "{}" + name
|
||||
formatTemplate = ".format(client.base_url"
|
||||
@ -426,6 +458,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
f.write("\n")
|
||||
f.write(
|
||||
"def sync_detailed(\n")
|
||||
optional_args = []
|
||||
# Iterate over the parameters.
|
||||
if 'parameters' in endpoint:
|
||||
parameters = endpoint['parameters']
|
||||
@ -442,12 +475,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
else:
|
||||
print(" parameter: ", parameter)
|
||||
raise Exception("Unknown parameter type")
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if 'nullable' in parameter['schema']:
|
||||
if parameter['schema']['nullable']:
|
||||
parameter_type = 'Optional[' + parameter_type + '] = None'
|
||||
optional_args.append("\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if request_body_type:
|
||||
f.write(
|
||||
"\tbody: " +
|
||||
@ -455,6 +504,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
",\n")
|
||||
f.write("\t*,\n")
|
||||
f.write("\tclient: Client,\n")
|
||||
for optional_arg in optional_args:
|
||||
f.write(optional_arg)
|
||||
f.write(") -> Response[Union[Any, " +
|
||||
", ".join(endpoint_refs) +
|
||||
"]]:\n")
|
||||
@ -478,6 +529,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
f.write("\n")
|
||||
f.write(
|
||||
"def sync(\n")
|
||||
optional_args = []
|
||||
# Iterate over the parameters.
|
||||
if 'parameters' in endpoint:
|
||||
parameters = endpoint['parameters']
|
||||
@ -494,12 +546,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
else:
|
||||
print(" parameter: ", parameter)
|
||||
raise Exception("Unknown parameter type")
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if 'nullable' in parameter['schema']:
|
||||
if parameter['schema']['nullable']:
|
||||
parameter_type = 'Optional[' + parameter_type + '] = None'
|
||||
optional_args.append("\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if request_body_type:
|
||||
f.write(
|
||||
"\tbody: " +
|
||||
@ -507,6 +575,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
",\n")
|
||||
f.write("\t*,\n")
|
||||
f.write("\tclient: Client,\n")
|
||||
for optional_arg in optional_args:
|
||||
f.write(optional_arg)
|
||||
f.write(") -> Optional[Union[Any, " +
|
||||
", ".join(endpoint_refs) +
|
||||
"]]:\n")
|
||||
@ -526,6 +596,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
f.write("\n")
|
||||
f.write(
|
||||
"async def asyncio_detailed(\n")
|
||||
optional_args = []
|
||||
# Iterate over the parameters.
|
||||
if 'parameters' in endpoint:
|
||||
parameters = endpoint['parameters']
|
||||
@ -542,12 +613,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
else:
|
||||
print(" parameter: ", parameter)
|
||||
raise Exception("Unknown parameter type")
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if 'nullable' in parameter['schema']:
|
||||
if parameter['schema']['nullable']:
|
||||
parameter_type = 'Optional[' + parameter_type + '] = None'
|
||||
optional_args.append("\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if request_body_type:
|
||||
f.write(
|
||||
"\tbody: " +
|
||||
@ -555,6 +642,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
",\n")
|
||||
f.write("\t*,\n")
|
||||
f.write("\tclient: Client,\n")
|
||||
for optional_arg in optional_args:
|
||||
f.write(optional_arg)
|
||||
f.write(") -> Response[Union[Any, " +
|
||||
", ".join(endpoint_refs) +
|
||||
"]]:\n")
|
||||
@ -576,6 +665,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
f.write("\n")
|
||||
f.write(
|
||||
"async def asyncio(\n")
|
||||
optional_args = []
|
||||
# Iterate over the parameters.
|
||||
if 'parameters' in endpoint:
|
||||
parameters = endpoint['parameters']
|
||||
@ -592,12 +682,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
else:
|
||||
print(" parameter: ", parameter)
|
||||
raise Exception("Unknown parameter type")
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if 'nullable' in parameter['schema']:
|
||||
if parameter['schema']['nullable']:
|
||||
parameter_type = 'Optional[' + parameter_type + '] = None'
|
||||
optional_args.append("\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
camel_to_snake(parameter_name) +
|
||||
": " +
|
||||
parameter_type +
|
||||
",\n")
|
||||
if request_body_type:
|
||||
f.write(
|
||||
"\tbody: " +
|
||||
@ -605,6 +711,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
||||
",\n")
|
||||
f.write("\t*,\n")
|
||||
f.write("\tclient: Client,\n")
|
||||
for optional_arg in optional_args:
|
||||
f.write(optional_arg)
|
||||
f.write(") -> Optional[Union[Any, " +
|
||||
", ".join(endpoint_refs) +
|
||||
"]]:\n")
|
||||
|
File diff suppressed because one or more lines are too long
1
kittycad/api/ai/__init__.py
Normal file
1
kittycad/api/ai/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
""" Contains methods for accessing the ai API paths: AI uses machine learning to generate 3D meshes. """
|
128
kittycad/api/ai/create_image_to_3d.py
Normal file
128
kittycad/api/ai/create_image_to_3d.py
Normal file
@ -0,0 +1,128 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.mesh import Mesh
|
||||
from ...models.error import Error
|
||||
from ...models.image_type import ImageType
|
||||
from ...models.file_export_format import FileExportFormat
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ai/image-to-3d/{input_format}/{output_format}".format(client.base_url, input_format=input_format, output_format=output_format)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Mesh, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Mesh.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Mesh, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, Mesh, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, Mesh, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, Mesh, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, Mesh, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
117
kittycad/api/ai/create_text_to_3d.py
Normal file
117
kittycad/api/ai/create_text_to_3d.py
Normal file
@ -0,0 +1,117 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.mesh import Mesh
|
||||
from ...models.error import Error
|
||||
from ...models.file_export_format import FileExportFormat
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ai/text-to-3d/{output_format}?prompt={prompt}".format(client.base_url, output_format=output_format, prompt=prompt)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Mesh, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Mesh.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Mesh, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, Mesh, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, Mesh, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, Mesh, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, Mesh, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -1 +1 @@
|
||||
""" Contains methods for accessing the api-calls API paths: API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing. """
|
||||
""" Contains methods for accessing the api_calls API paths: API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing. """
|
@ -7,6 +7,7 @@ from ...models.file_conversion import FileConversion
|
||||
from ...models.file2_d_vector_conversion import File2DVectorConversion
|
||||
from ...models.file3_d_conversion import File3DConversion
|
||||
from ...models.file_center_of_mass import FileCenterOfMass
|
||||
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
|
||||
from ...models.file_mass import FileMass
|
||||
from ...models.file_volume import FileVolume
|
||||
from ...models.file_density import FileDensity
|
||||
@ -32,7 +33,7 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
try:
|
||||
@ -63,6 +64,13 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
option = FileCenterOfMassWithUniformDensity.from_dict(data)
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
@ -100,7 +108,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -113,7 +121,7 @@ def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -131,7 +139,7 @@ def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
""" Get the status and output of an async operation.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
|
||||
If the user is not authenticated to view the specified async operation, then it is not returned.
|
||||
@ -147,7 +155,7 @@ async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -163,7 +171,7 @@ async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
""" Get the status and output of an async operation.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
|
||||
If the user is not authenticated to view the specified async operation, then it is not returned.
|
@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
|
||||
|
||||
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiCallW
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -73,11 +73,11 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by a KittyCAD employee. The API calls are returned in order of creation, with the most recently created API calls first. """
|
||||
|
||||
@ -90,11 +90,11 @@ def sync(
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -110,11 +110,11 @@ async def asyncio_detailed(
|
||||
|
||||
|
||||
async def asyncio(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by a KittyCAD employee. The API calls are returned in order of creation, with the most recently created API calls first. """
|
||||
|
@ -10,11 +10,11 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/{id}/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, id=id, limit=limit, page_token=page_token, sort_by=sort_by)
|
||||
|
||||
@ -53,11 +53,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiCallW
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
@ -77,11 +77,11 @@ def sync_detailed(
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user if "me" is passed as the user id.
|
||||
Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.
|
||||
@ -99,11 +99,11 @@ The API calls are returned in order of creation, with the most recently created
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
@ -121,11 +121,11 @@ async def asyncio_detailed(
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user if "me" is passed as the user id.
|
||||
Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.
|
@ -10,12 +10,12 @@ from ...models.api_call_status import ApiCallStatus
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: ApiCallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/async/operations?limit={limit}&page_token={page_token}&sort_by={sort_by}&status={status}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by, status=status)
|
||||
|
||||
@ -53,12 +53,12 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, AsyncApi
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: ApiCallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -77,12 +77,12 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: ApiCallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
""" For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint.
|
||||
This endpoint requires authentication by a KittyCAD employee. """
|
||||
@ -97,12 +97,12 @@ This endpoint requires authentication by a KittyCAD employee. """
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: ApiCallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -119,12 +119,12 @@ async def asyncio_detailed(
|
||||
|
||||
|
||||
async def asyncio(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: ApiCallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
""" For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint.
|
||||
This endpoint requires authentication by a KittyCAD employee. """
|
@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
|
||||
|
||||
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiCallW
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -73,11 +73,11 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user.
|
||||
The API calls are returned in order of creation, with the most recently created API calls first. """
|
||||
@ -91,11 +91,11 @@ The API calls are returned in order of creation, with the most recently created
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -111,11 +111,11 @@ async def asyncio_detailed(
|
||||
|
||||
|
||||
async def asyncio(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user.
|
||||
The API calls are returned in order of creation, with the most recently created API calls first. """
|
@ -1 +1 @@
|
||||
""" Contains methods for accessing the api-tokens API paths: API tokens allow users to call the API outside of their session token that is used as a cookie in the user interface. Users can create, delete, and list their API tokens. But, of course, you need an API token to do this, so first be sure to generate one in the account UI. """
|
||||
""" Contains methods for accessing the api_tokens API paths: API tokens allow users to call the API outside of their session token that is used as a cookie in the user interface. Users can create, delete, and list their API tokens. But, of course, you need an API token to do this, so first be sure to generate one in the account UI. """
|
@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/api-tokens?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
|
||||
|
||||
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiToken
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiTokenResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -73,11 +73,11 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiTokenResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user.
|
||||
The API tokens are returned in order of creation, with the most recently created API tokens first. """
|
||||
@ -91,11 +91,11 @@ The API tokens are returned in order of creation, with the most recently created
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ApiTokenResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -111,11 +111,11 @@ async def asyncio_detailed(
|
||||
|
||||
|
||||
async def asyncio(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ApiTokenResultsPage, Error]]:
|
||||
""" This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user.
|
||||
The API tokens are returned in order of creation, with the most recently created API tokens first. """
|
134
kittycad/api/file/create_file_2d_vector_conversion.py
Normal file
134
kittycad/api/file/create_file_2d_vector_conversion.py
Normal file
@ -0,0 +1,134 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.file2_d_vector_conversion import File2DVectorConversion
|
||||
from ...models.error import Error
|
||||
from ...models.file2_d_vector_export_format import File2DVectorExportFormat
|
||||
from ...models.file2_d_vector_import_format import File2DVectorImportFormat
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: File2DVectorExportFormat,
|
||||
src_format: File2DVectorImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/file/2d/vector/conversion/{src_format}/{output_format}".format(client.base_url, output_format=output_format, src_format=src_format)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, File2DVectorConversion, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = File2DVectorConversion.from_dict(response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, File2DVectorConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: File2DVectorExportFormat,
|
||||
src_format: File2DVectorImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, File2DVectorConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: File2DVectorExportFormat,
|
||||
src_format: File2DVectorImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, File2DVectorConversion, Error]]:
|
||||
""" Convert a 2D Vector file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
|
||||
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: File2DVectorExportFormat,
|
||||
src_format: File2DVectorImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, File2DVectorConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: File2DVectorExportFormat,
|
||||
src_format: File2DVectorImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, File2DVectorConversion, Error]]:
|
||||
""" Convert a 2D Vector file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
|
||||
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
134
kittycad/api/file/create_file_3d_conversion.py
Normal file
134
kittycad/api/file/create_file_3d_conversion.py
Normal file
@ -0,0 +1,134 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.file3_d_conversion import File3DConversion
|
||||
from ...models.error import Error
|
||||
from ...models.file3_d_export_format import File3DExportFormat
|
||||
from ...models.file3_d_import_format import File3DImportFormat
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: File3DExportFormat,
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/file/3d/conversion/{src_format}/{output_format}".format(client.base_url, output_format=output_format, src_format=src_format)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, File3DConversion, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = File3DConversion.from_dict(response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, File3DConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: File3DExportFormat,
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, File3DConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: File3DExportFormat,
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, File3DConversion, Error]]:
|
||||
""" Convert a 3D file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
|
||||
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: File3DExportFormat,
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, File3DConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: File3DExportFormat,
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, File3DConversion, Error]]:
|
||||
""" Convert a 3D file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
|
||||
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -81,6 +81,7 @@ def sync(
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileCenterOfMass, Error]]:
|
||||
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
Does the same as the `center_of_mass_with_uniform_density` endpoint; except, this has a redundant `material_density value`. Kept for legacy in this version.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return sync_detailed(
|
||||
@ -119,6 +120,7 @@ async def asyncio(
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileCenterOfMass, Error]]:
|
||||
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
Does the same as the `center_of_mass_with_uniform_density` endpoint; except, this has a redundant `material_density value`. Kept for legacy in this version.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return (
|
||||
|
@ -0,0 +1,122 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
|
||||
from ...models.error import Error
|
||||
from ...models.file3_d_import_format import File3DImportFormat
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/file/center-of-mass-with-uniform-density?src_format={src_format}".format(client.base_url, src_format=src_format)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = FileCenterOfMassWithUniformDensity.from_dict(response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
|
||||
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return sync_detailed(
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
src_format: File3DImportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
|
||||
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -10,10 +10,10 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
lang: CodeLanguage,
|
||||
output: str,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
output: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/file/execute/{lang}?output={output}".format(client.base_url, lang=lang, output=output)
|
||||
|
||||
@ -53,10 +53,10 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, CodeOutp
|
||||
|
||||
def sync_detailed(
|
||||
lang: CodeLanguage,
|
||||
output: str,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
output: Optional[str] = None,
|
||||
) -> Response[Union[Any, CodeOutput, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
lang=lang,
|
||||
@ -75,10 +75,10 @@ def sync_detailed(
|
||||
|
||||
def sync(
|
||||
lang: CodeLanguage,
|
||||
output: str,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
output: Optional[str] = None,
|
||||
) -> Optional[Union[Any, CodeOutput, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
@ -91,10 +91,10 @@ def sync(
|
||||
|
||||
async def asyncio_detailed(
|
||||
lang: CodeLanguage,
|
||||
output: str,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
output: Optional[str] = None,
|
||||
) -> Response[Union[Any, CodeOutput, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
lang=lang,
|
||||
@ -111,10 +111,10 @@ async def asyncio_detailed(
|
||||
|
||||
async def asyncio(
|
||||
lang: CodeLanguage,
|
||||
output: str,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
output: Optional[str] = None,
|
||||
) -> Optional[Union[Any, CodeOutput, Error]]:
|
||||
|
||||
return (
|
||||
|
@ -7,6 +7,7 @@ from ...models.file_conversion import FileConversion
|
||||
from ...models.file2_d_vector_conversion import File2DVectorConversion
|
||||
from ...models.file3_d_conversion import File3DConversion
|
||||
from ...models.file_center_of_mass import FileCenterOfMass
|
||||
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
|
||||
from ...models.file_mass import FileMass
|
||||
from ...models.file_volume import FileVolume
|
||||
from ...models.file_density import FileDensity
|
||||
@ -32,7 +33,7 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
try:
|
||||
@ -63,6 +64,13 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
option = FileCenterOfMassWithUniformDensity.from_dict(data)
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
@ -100,7 +108,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -113,7 +121,7 @@ def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -131,7 +139,7 @@ def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
""" Get the status and output of an async file conversion.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
|
||||
If the user is not authenticated to view the specified file conversion, then it is not returned.
|
||||
@ -147,7 +155,7 @@ async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -163,7 +171,7 @@ async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
""" Get the status and output of an async file conversion.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
|
||||
If the user is not authenticated to view the specified file conversion, then it is not returned.
|
||||
|
@ -7,6 +7,7 @@ from ...models.file_conversion import FileConversion
|
||||
from ...models.file2_d_vector_conversion import File2DVectorConversion
|
||||
from ...models.file3_d_conversion import File3DConversion
|
||||
from ...models.file_center_of_mass import FileCenterOfMass
|
||||
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
|
||||
from ...models.file_mass import FileMass
|
||||
from ...models.file_volume import FileVolume
|
||||
from ...models.file_density import FileDensity
|
||||
@ -32,7 +33,7 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
try:
|
||||
@ -63,6 +64,13 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
option = FileCenterOfMassWithUniformDensity.from_dict(data)
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
@ -100,7 +108,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -113,7 +121,7 @@ def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -131,7 +139,7 @@ def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
|
||||
|
||||
@ -145,7 +153,7 @@ async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -161,7 +169,7 @@ async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
|
||||
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
|
||||
|
||||
|
@ -7,11 +7,11 @@ from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
callback_url: str,
|
||||
email: str,
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/auth/email/callback?callback_url={callback_url}&email={email}&token={token}".format(client.base_url, callback_url=callback_url, email=email, token=token)
|
||||
|
||||
@ -49,11 +49,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]:
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
callback_url: str,
|
||||
email: str,
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Response[Union[Any, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
callback_url=callback_url,
|
||||
@ -71,11 +71,11 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
callback_url: str,
|
||||
email: str,
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Optional[Union[Any, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
@ -87,11 +87,11 @@ def sync(
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
callback_url: str,
|
||||
email: str,
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Response[Union[Any, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
callback_url=callback_url,
|
||||
@ -107,11 +107,11 @@ async def asyncio_detailed(
|
||||
|
||||
|
||||
async def asyncio(
|
||||
callback_url: str,
|
||||
email: str,
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Optional[Union[Any, Error]]:
|
||||
|
||||
return (
|
||||
|
129
kittycad/api/unit/get_radioactivity_unit_conversion.py
Normal file
129
kittycad/api/unit/get_radioactivity_unit_conversion.py
Normal file
@ -0,0 +1,129 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_radioactivity_conversion import UnitRadioactivityConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_radioactivity_format import UnitRadioactivityFormat
|
||||
from ...models.unit_radioactivity_format import UnitRadioactivityFormat
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/radioactivity/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitRadioactivityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
""" Convert a radioactivity unit value to another radioactivity unit value. This is a nice endpoint to use for helper functions. """
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
""" Convert a radioactivity unit value to another radioactivity unit value. This is a nice endpoint to use for helper functions. """
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
|
||||
|
||||
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, UserResu
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, UserResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -73,11 +73,11 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, UserResultsPage, Error]]:
|
||||
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """
|
||||
|
||||
@ -90,11 +90,11 @@ def sync(
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, UserResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -110,11 +110,11 @@ async def asyncio_detailed(
|
||||
|
||||
|
||||
async def asyncio(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, UserResultsPage, Error]]:
|
||||
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """
|
||||
|
||||
|
@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users-extended?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
|
||||
|
||||
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, Extended
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ExtendedUserResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -73,11 +73,11 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ExtendedUserResultsPage, Error]]:
|
||||
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """
|
||||
|
||||
@ -90,11 +90,11 @@ def sync(
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Union[Any, ExtendedUserResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
@ -110,11 +110,11 @@ async def asyncio_detailed(
|
||||
|
||||
|
||||
async def asyncio(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[Any, ExtendedUserResultsPage, Error]]:
|
||||
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """
|
||||
|
||||
|
@ -3,10 +3,11 @@ import pytest
|
||||
import asyncio
|
||||
|
||||
from .client import ClientFromEnv
|
||||
from .models import FileConversion, FileExportFormat, FileImportFormat, User, Pong, ApiCallStatus, FileMass, FileVolume
|
||||
from .models import FileConversion, FileExportFormat, FileImportFormat, User, Pong, ApiCallStatus, FileMass, FileVolume, ApiTokenResultsPage, CreatedAtSortMode
|
||||
from .api.file import create_file_conversion_with_base64_helper, create_file_mass, create_file_volume
|
||||
from .api.meta import ping
|
||||
from .api.users import get_user_self
|
||||
from .api.api_tokens import list_api_tokens_for_user
|
||||
|
||||
|
||||
def test_get_session():
|
||||
@ -21,6 +22,20 @@ def test_get_session():
|
||||
print(f"Session: {session}")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_api_tokens_async():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
|
||||
# List API tokens.
|
||||
fc: ApiTokenResultsPage = list_api_tokens_for_user.sync(
|
||||
client=client, sort_by=CreatedAtSortMode)
|
||||
|
||||
assert fc is not None
|
||||
|
||||
print(f"fc: {fc}")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_session_async():
|
||||
# Create our client.
|
||||
|
@ -35,11 +35,14 @@ from .error import Error
|
||||
from .executor_metadata import ExecutorMetadata
|
||||
from .extended_user import ExtendedUser
|
||||
from .extended_user_results_page import ExtendedUserResultsPage
|
||||
from .file2_d_vector_conversion import File2DVectorConversion
|
||||
from .file2_d_vector_export_format import File2DVectorExportFormat
|
||||
from .file2_d_vector_import_format import File2DVectorImportFormat
|
||||
from .file3_d_conversion import File3DConversion
|
||||
from .file3_d_export_format import File3DExportFormat
|
||||
from .file3_d_import_format import File3DImportFormat
|
||||
from .file_center_of_mass import FileCenterOfMass
|
||||
from .file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
|
||||
from .file_conversion import FileConversion
|
||||
from .file_density import FileDensity
|
||||
from .file_export_format import FileExportFormat
|
||||
@ -49,6 +52,7 @@ from .file_surface_area import FileSurfaceArea
|
||||
from .file_system_metadata import FileSystemMetadata
|
||||
from .file_volume import FileVolume
|
||||
from .gateway import Gateway
|
||||
from .image_type import ImageType
|
||||
from .index_info import IndexInfo
|
||||
from .invoice import Invoice
|
||||
from .invoice_line_item import InvoiceLineItem
|
||||
@ -58,6 +62,7 @@ from .jetstream_api_stats import JetstreamApiStats
|
||||
from .jetstream_config import JetstreamConfig
|
||||
from .jetstream_stats import JetstreamStats
|
||||
from .leaf_node import LeafNode
|
||||
from .mesh import Mesh
|
||||
from .meta_cluster_info import MetaClusterInfo
|
||||
from .metadata import Metadata
|
||||
from .method import Method
|
||||
@ -73,6 +78,7 @@ from .payment_method_type import PaymentMethodType
|
||||
from .physics_constant import PhysicsConstant
|
||||
from .physics_constant_name import PhysicsConstantName
|
||||
from .plugins_info import PluginsInfo
|
||||
from .point_e_metadata import PointEMetadata
|
||||
from .pong import Pong
|
||||
from .registry_service_config import RegistryServiceConfig
|
||||
from .runtime import Runtime
|
||||
@ -123,6 +129,8 @@ from .unit_pressure_conversion import UnitPressureConversion
|
||||
from .unit_pressure_format import UnitPressureFormat
|
||||
from .unit_radiation_conversion import UnitRadiationConversion
|
||||
from .unit_radiation_format import UnitRadiationFormat
|
||||
from .unit_radioactivity_conversion import UnitRadioactivityConversion
|
||||
from .unit_radioactivity_format import UnitRadioactivityFormat
|
||||
from .unit_solid_angle_conversion import UnitSolidAngleConversion
|
||||
from .unit_solid_angle_format import UnitSolidAngleFormat
|
||||
from .unit_temperature_conversion import UnitTemperatureConversion
|
||||
|
@ -7,6 +7,7 @@ class AsyncApiCallType(str, Enum):
|
||||
FILE3_D_CONVERSION = 'File3DConversion'
|
||||
FILE_VOLUME = 'FileVolume'
|
||||
FILE_CENTER_OF_MASS = 'FileCenterOfMass'
|
||||
FILE_CENTER_OF_MASS_WITH_UNIFORM_DENSITY = 'FileCenterOfMassWithUniformDensity'
|
||||
FILE_MASS = 'FileMass'
|
||||
FILE_DENSITY = 'FileDensity'
|
||||
FILE_SURFACE_AREA = 'FileSurfaceArea'
|
||||
|
@ -28,7 +28,6 @@ class ExtendedUser:
|
||||
phone: Union[Unset, str] = UNSET
|
||||
stripe_id: Union[Unset, str] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
zendesk_id: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
@ -55,7 +54,6 @@ class ExtendedUser:
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
zendesk_id = self.zendesk_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
@ -92,8 +90,6 @@ class ExtendedUser:
|
||||
field_dict['stripe_id'] = stripe_id
|
||||
if updated_at is not UNSET:
|
||||
field_dict['updated_at'] = updated_at
|
||||
if zendesk_id is not UNSET:
|
||||
field_dict['zendesk_id'] = zendesk_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@ -147,8 +143,6 @@ class ExtendedUser:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
zendesk_id = d.pop("zendesk_id", UNSET)
|
||||
|
||||
extended_user = cls(
|
||||
company=company,
|
||||
created_at=created_at,
|
||||
@ -166,7 +160,6 @@ class ExtendedUser:
|
||||
phone=phone,
|
||||
stripe_id=stripe_id,
|
||||
updated_at=updated_at,
|
||||
zendesk_id=zendesk_id,
|
||||
)
|
||||
|
||||
extended_user.additional_properties = d
|
||||
|
179
kittycad/models/file2_d_vector_conversion.py
Normal file
179
kittycad/models/file2_d_vector_conversion.py
Normal file
@ -0,0 +1,179 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
from ..models.file2_d_vector_export_format import File2DVectorExportFormat
|
||||
from ..models.file2_d_vector_import_format import File2DVectorImportFormat
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="File2DVectorConversion")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class File2DVectorConversion:
|
||||
""" """
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
output: Union[Unset, str] = UNSET
|
||||
output_format: Union[Unset, File2DVectorExportFormat] = UNSET
|
||||
src_format: Union[Unset, File2DVectorImportFormat] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output = self.output
|
||||
output_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
output_format = self.output_format.value
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format.value
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if output is not UNSET:
|
||||
field_dict['output'] = output
|
||||
if output_format is not UNSET:
|
||||
field_dict['output_format'] = output_format
|
||||
if src_format is not UNSET:
|
||||
field_dict['src_format'] = src_format
|
||||
if started_at is not UNSET:
|
||||
field_dict['started_at'] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict['status'] = status
|
||||
if updated_at is not UNSET:
|
||||
field_dict['updated_at'] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict['user_id'] = user_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_created_at, Unset):
|
||||
created_at = UNSET
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
output = d.pop("output", UNSET)
|
||||
|
||||
_output_format = d.pop("output_format", UNSET)
|
||||
output_format: Union[Unset, File2DVectorExportFormat]
|
||||
if isinstance(_output_format, Unset):
|
||||
output_format = UNSET
|
||||
else:
|
||||
output_format = File2DVectorExportFormat(_output_format)
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, File2DVectorImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = File2DVectorImportFormat(_src_format)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = ApiCallStatus(_status)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_updated_at, Unset):
|
||||
updated_at = UNSET
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
|
||||
file2_d_vector_conversion = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
id=id,
|
||||
output=output,
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
file2_d_vector_conversion.additional_properties = d
|
||||
return file2_d_vector_conversion
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -4,6 +4,8 @@ from enum import Enum
|
||||
class File2DVectorExportFormat(str, Enum):
|
||||
DXF = 'dxf'
|
||||
JSON = 'json'
|
||||
PNG = 'png'
|
||||
PS = 'ps'
|
||||
SVG = 'svg'
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
179
kittycad/models/file3_d_conversion.py
Normal file
179
kittycad/models/file3_d_conversion.py
Normal file
@ -0,0 +1,179 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
from ..models.file3_d_export_format import File3DExportFormat
|
||||
from ..models.file3_d_import_format import File3DImportFormat
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="File3DConversion")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class File3DConversion:
|
||||
""" """
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
output: Union[Unset, str] = UNSET
|
||||
output_format: Union[Unset, File3DExportFormat] = UNSET
|
||||
src_format: Union[Unset, File3DImportFormat] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output = self.output
|
||||
output_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
output_format = self.output_format.value
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format.value
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if output is not UNSET:
|
||||
field_dict['output'] = output
|
||||
if output_format is not UNSET:
|
||||
field_dict['output_format'] = output_format
|
||||
if src_format is not UNSET:
|
||||
field_dict['src_format'] = src_format
|
||||
if started_at is not UNSET:
|
||||
field_dict['started_at'] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict['status'] = status
|
||||
if updated_at is not UNSET:
|
||||
field_dict['updated_at'] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict['user_id'] = user_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_created_at, Unset):
|
||||
created_at = UNSET
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
output = d.pop("output", UNSET)
|
||||
|
||||
_output_format = d.pop("output_format", UNSET)
|
||||
output_format: Union[Unset, File3DExportFormat]
|
||||
if isinstance(_output_format, Unset):
|
||||
output_format = UNSET
|
||||
else:
|
||||
output_format = File3DExportFormat(_output_format)
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, File3DImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = File3DImportFormat(_src_format)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = ApiCallStatus(_status)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_updated_at, Unset):
|
||||
updated_at = UNSET
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
|
||||
file3_d_conversion = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
id=id,
|
||||
output=output,
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
file3_d_conversion.additional_properties = d
|
||||
return file3_d_conversion
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -7,6 +7,7 @@ class File3DExportFormat(str, Enum):
|
||||
FBXB = 'fbxb'
|
||||
OBJ = 'obj'
|
||||
OBJ_NOMTL = 'obj_nomtl'
|
||||
PLY = 'ply'
|
||||
STEP = 'step'
|
||||
STL = 'stl'
|
||||
|
||||
|
@ -3,9 +3,12 @@ from enum import Enum
|
||||
|
||||
class File3DImportFormat(str, Enum):
|
||||
DAE = 'dae'
|
||||
DXF = 'dxf'
|
||||
FBX = 'fbx'
|
||||
OBJ_ZIP = 'obj_zip'
|
||||
OBJ = 'obj'
|
||||
OBJ_NOMTL = 'obj_nomtl'
|
||||
PLY = 'ply'
|
||||
STEP = 'step'
|
||||
STL = 'stl'
|
||||
|
||||
|
166
kittycad/models/file_center_of_mass_with_uniform_density.py
Normal file
166
kittycad/models/file_center_of_mass_with_uniform_density.py
Normal file
@ -0,0 +1,166 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
from ..models.file3_d_import_format import File3DImportFormat
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="FileCenterOfMassWithUniformDensity")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class FileCenterOfMassWithUniformDensity:
|
||||
""" """
|
||||
center_of_mass: Union[Unset, List[float]] = UNSET
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
src_format: Union[Unset, File3DImportFormat] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
center_of_mass: Union[Unset, List[float]] = UNSET
|
||||
if not isinstance(self.center_of_mass, Unset):
|
||||
center_of_mass = self.center_of_mass
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format.value
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if center_of_mass is not UNSET:
|
||||
field_dict['center_of_mass'] = center_of_mass
|
||||
if completed_at is not UNSET:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if src_format is not UNSET:
|
||||
field_dict['src_format'] = src_format
|
||||
if started_at is not UNSET:
|
||||
field_dict['started_at'] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict['status'] = status
|
||||
if updated_at is not UNSET:
|
||||
field_dict['updated_at'] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict['user_id'] = user_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
center_of_mass = cast(List[float], d.pop("center_of_mass", UNSET))
|
||||
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_created_at, Unset):
|
||||
created_at = UNSET
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, File3DImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = File3DImportFormat(_src_format)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = ApiCallStatus(_status)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_updated_at, Unset):
|
||||
updated_at = UNSET
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
|
||||
file_center_of_mass_with_uniform_density = cls(
|
||||
center_of_mass=center_of_mass,
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
id=id,
|
||||
src_format=src_format,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
file_center_of_mass_with_uniform_density.additional_properties = d
|
||||
return file_center_of_mass_with_uniform_density
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -9,6 +9,7 @@ class FileExportFormat(str, Enum):
|
||||
JSON = 'json'
|
||||
OBJ = 'obj'
|
||||
OBJ_NOMTL = 'obj_nomtl'
|
||||
PLY = 'ply'
|
||||
STEP = 'step'
|
||||
STL = 'stl'
|
||||
SVG = 'svg'
|
||||
|
@ -5,8 +5,10 @@ class FileImportFormat(str, Enum):
|
||||
DAE = 'dae'
|
||||
DXF = 'dxf'
|
||||
FBX = 'fbx'
|
||||
OBJ_ZIP = 'obj_zip'
|
||||
OBJ = 'obj'
|
||||
OBJ_NOMTL = 'obj_nomtl'
|
||||
PLY = 'ply'
|
||||
STEP = 'step'
|
||||
STL = 'stl'
|
||||
SVG = 'svg'
|
||||
|
9
kittycad/models/image_type.py
Normal file
9
kittycad/models/image_type.py
Normal file
@ -0,0 +1,9 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ImageType(str, Enum):
|
||||
PNG = 'png'
|
||||
JPG = 'jpg'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
54
kittycad/models/mesh.py
Normal file
54
kittycad/models/mesh.py
Normal file
@ -0,0 +1,54 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Mesh")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class Mesh:
|
||||
""" """
|
||||
mesh: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
mesh = self.mesh
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if mesh is not UNSET:
|
||||
field_dict['mesh'] = mesh
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
mesh = d.pop("mesh", UNSET)
|
||||
|
||||
mesh = cls(
|
||||
mesh=mesh,
|
||||
)
|
||||
|
||||
mesh.additional_properties = d
|
||||
return mesh
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -7,6 +7,7 @@ from ..models.engine_metadata import EngineMetadata
|
||||
from ..models.environment import Environment
|
||||
from ..models.executor_metadata import ExecutorMetadata
|
||||
from ..models.file_system_metadata import FileSystemMetadata
|
||||
from ..models.point_e_metadata import PointEMetadata
|
||||
from ..models.connection import Connection
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
@ -22,6 +23,7 @@ class Metadata:
|
||||
executor: Union[Unset, ExecutorMetadata] = UNSET
|
||||
fs: Union[Unset, FileSystemMetadata] = UNSET
|
||||
git_hash: Union[Unset, str] = UNSET
|
||||
point_e: Union[Unset, PointEMetadata] = UNSET
|
||||
pubsub: Union[Unset, Connection] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
@ -43,6 +45,9 @@ class Metadata:
|
||||
if not isinstance(self.fs, Unset):
|
||||
fs = self.fs.value
|
||||
git_hash = self.git_hash
|
||||
point_e: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.point_e, Unset):
|
||||
point_e = self.point_e.value
|
||||
pubsub: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.pubsub, Unset):
|
||||
pubsub = self.pubsub.value
|
||||
@ -62,6 +67,8 @@ class Metadata:
|
||||
field_dict['fs'] = fs
|
||||
if git_hash is not UNSET:
|
||||
field_dict['git_hash'] = git_hash
|
||||
if point_e is not UNSET:
|
||||
field_dict['point_e'] = point_e
|
||||
if pubsub is not UNSET:
|
||||
field_dict['pubsub'] = pubsub
|
||||
|
||||
@ -107,6 +114,13 @@ class Metadata:
|
||||
|
||||
git_hash = d.pop("git_hash", UNSET)
|
||||
|
||||
_point_e = d.pop("point_e", UNSET)
|
||||
point_e: Union[Unset, PointEMetadata]
|
||||
if isinstance(_point_e, Unset):
|
||||
point_e = UNSET
|
||||
else:
|
||||
point_e = PointEMetadata(_point_e)
|
||||
|
||||
_pubsub = d.pop("pubsub", UNSET)
|
||||
pubsub: Union[Unset, Connection]
|
||||
if isinstance(_pubsub, Unset):
|
||||
@ -121,6 +135,7 @@ class Metadata:
|
||||
executor=executor,
|
||||
fs=fs,
|
||||
git_hash=git_hash,
|
||||
point_e=point_e,
|
||||
pubsub=pubsub,
|
||||
)
|
||||
|
||||
|
54
kittycad/models/point_e_metadata.py
Normal file
54
kittycad/models/point_e_metadata.py
Normal file
@ -0,0 +1,54 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="PointEMetadata")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class PointEMetadata:
|
||||
""" """
|
||||
ok: Union[Unset, bool] = False
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
ok = self.ok
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if ok is not UNSET:
|
||||
field_dict['ok'] = ok
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
ok = d.pop("ok", UNSET)
|
||||
|
||||
point_e_metadata = cls(
|
||||
ok=ok,
|
||||
)
|
||||
|
||||
point_e_metadata.additional_properties = d
|
||||
return point_e_metadata
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -4,9 +4,12 @@ from enum import Enum
|
||||
class UnitEnergyFormat(str, Enum):
|
||||
JOULE = 'joule'
|
||||
CALORIE = 'calorie'
|
||||
KILOWATT_HOUR = 'kilowatt_hour'
|
||||
WATT_HOUR = 'watt_hour'
|
||||
BRITISH_THERMAL_UNIT = 'british_thermal_unit'
|
||||
BRITISH_THERMAL_UNIT_ISO = 'british_thermal_unit_iso'
|
||||
BRITISH_THERMAL_UNIT59 = 'british_thermal_unit59'
|
||||
THERM = 'therm'
|
||||
FOOT_POUND = 'foot_pound'
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
@ -5,7 +5,7 @@ class UnitForceFormat(str, Enum):
|
||||
NEWTON = 'newton'
|
||||
POUND = 'pound'
|
||||
DYNE = 'dyne'
|
||||
KILOPOUND = 'kilopound'
|
||||
KILOPOND = 'kilopond'
|
||||
POUNDAL = 'poundal'
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
@ -3,12 +3,18 @@ from enum import Enum
|
||||
|
||||
class UnitLengthFormat(str, Enum):
|
||||
METER = 'meter'
|
||||
MILLIMETER = 'millimeter'
|
||||
CENTIMETER = 'centimeter'
|
||||
KILOMETER = 'kilometer'
|
||||
FOOT = 'foot'
|
||||
MIL = 'mil'
|
||||
INCH = 'inch'
|
||||
MILE = 'mile'
|
||||
NAUTICAL_MILE = 'nautical_mile'
|
||||
ASTRONOMICAL_UNIT = 'astronomical_unit'
|
||||
LIGHTYEAR = 'lightyear'
|
||||
PARSEC = 'parsec'
|
||||
ANGSTROM = 'angstrom'
|
||||
CUBIT = 'cubit'
|
||||
FATHOM = 'fathom'
|
||||
CHAIN = 'chain'
|
||||
@ -17,9 +23,6 @@ class UnitLengthFormat(str, Enum):
|
||||
LEAGUE = 'league'
|
||||
NAUTICAL_LEAGUE = 'nautical_league'
|
||||
YARD = 'yard'
|
||||
MILLIMETER = 'millimeter'
|
||||
CENTIMETER = 'centimeter'
|
||||
KILOMETER = 'kilometer'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
@ -3,6 +3,7 @@ from enum import Enum
|
||||
|
||||
class UnitMassFormat(str, Enum):
|
||||
GRAM = 'gram'
|
||||
KILOGRAM = 'kilogram'
|
||||
METRIC_TON = 'metric_ton'
|
||||
POUND = 'pound'
|
||||
LONG_TON = 'long_ton'
|
||||
@ -11,7 +12,6 @@ class UnitMassFormat(str, Enum):
|
||||
OUNCE = 'ounce'
|
||||
CARAT = 'carat'
|
||||
SLUG = 'slug'
|
||||
KILOGRAM = 'kilogram'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
185
kittycad/models/unit_radioactivity_conversion.py
Normal file
185
kittycad/models/unit_radioactivity_conversion.py
Normal file
@ -0,0 +1,185 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
from ..models.unit_radioactivity_format import UnitRadioactivityFormat
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="UnitRadioactivityConversion")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class UnitRadioactivityConversion:
|
||||
""" """
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
input: Union[Unset, float] = UNSET
|
||||
output: Union[Unset, float] = UNSET
|
||||
output_format: Union[Unset, UnitRadioactivityFormat] = UNSET
|
||||
src_format: Union[Unset, UnitRadioactivityFormat] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
input = self.input
|
||||
output = self.output
|
||||
output_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
output_format = self.output_format.value
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format.value
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if input is not UNSET:
|
||||
field_dict['input'] = input
|
||||
if output is not UNSET:
|
||||
field_dict['output'] = output
|
||||
if output_format is not UNSET:
|
||||
field_dict['output_format'] = output_format
|
||||
if src_format is not UNSET:
|
||||
field_dict['src_format'] = src_format
|
||||
if started_at is not UNSET:
|
||||
field_dict['started_at'] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict['status'] = status
|
||||
if updated_at is not UNSET:
|
||||
field_dict['updated_at'] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict['user_id'] = user_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_created_at, Unset):
|
||||
created_at = UNSET
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
input = d.pop("input", UNSET)
|
||||
|
||||
output = d.pop("output", UNSET)
|
||||
|
||||
_output_format = d.pop("output_format", UNSET)
|
||||
output_format: Union[Unset, UnitRadioactivityFormat]
|
||||
if isinstance(_output_format, Unset):
|
||||
output_format = UNSET
|
||||
else:
|
||||
output_format = UnitRadioactivityFormat(_output_format)
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, UnitRadioactivityFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = UnitRadioactivityFormat(_src_format)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = ApiCallStatus(_status)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_updated_at, Unset):
|
||||
updated_at = UNSET
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
|
||||
unit_radioactivity_conversion = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
id=id,
|
||||
input=input,
|
||||
output=output,
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
unit_radioactivity_conversion.additional_properties = d
|
||||
return unit_radioactivity_conversion
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
10
kittycad/models/unit_radioactivity_format.py
Normal file
10
kittycad/models/unit_radioactivity_format.py
Normal file
@ -0,0 +1,10 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class UnitRadioactivityFormat(str, Enum):
|
||||
BECQUEREL = 'becquerel'
|
||||
CURIE = 'curie'
|
||||
RUTHERFORD = 'rutherford'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
@ -3,13 +3,35 @@ from enum import Enum
|
||||
|
||||
class UnitVolumeFormat(str, Enum):
|
||||
CUBIC_METER = 'cubic_meter'
|
||||
CUBIC_CENTIMETER = 'cubic_centimeter'
|
||||
CUBIC_MILLIMETER = 'cubic_millimeter'
|
||||
CUBIC_KILOMETER = 'cubic_kilometer'
|
||||
LITER = 'liter'
|
||||
CUBIC_INCH = 'cubic_inch'
|
||||
CUBIC_FOOT = 'cubic_foot'
|
||||
CUBIC_YARD = 'cubic_yard'
|
||||
CUBIC_MILE = 'cubic_mile'
|
||||
CUBIC_CENTIMETER = 'cubic_centimeter'
|
||||
GALLON = 'gallon'
|
||||
QUART = 'quart'
|
||||
PINT = 'pint'
|
||||
CUP = 'cup'
|
||||
FLUID_OUNCE = 'fluid_ounce'
|
||||
BARREL = 'barrel'
|
||||
BUSHEL = 'bushel'
|
||||
CORD = 'cord'
|
||||
CUBIC_FATHOM = 'cubic_fathom'
|
||||
TABLESPOON = 'tablespoon'
|
||||
TEASPOON = 'teaspoon'
|
||||
PINCH = 'pinch'
|
||||
DASH = 'dash'
|
||||
DROP = 'drop'
|
||||
FIFTH = 'fifth'
|
||||
DRAM = 'dram'
|
||||
GILL = 'gill'
|
||||
PECK = 'peck'
|
||||
SACK = 'sack'
|
||||
SHOT = 'shot'
|
||||
STRIKE = 'strike'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "kittycad"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
description = "A client library for accessing KittyCAD"
|
||||
|
||||
authors = []
|
||||
@ -28,10 +28,10 @@ toml = "^0.10.2"
|
||||
sphinx-rtd-theme = "^1.0.0"
|
||||
sphinx-automodapi = "^0.14"
|
||||
pytest-cov = "^4.0.0"
|
||||
pytest-asyncio = "^0.19.0"
|
||||
pytest-asyncio = "^0.20.3"
|
||||
openapi-parser = "^0.2.6"
|
||||
autopep8 = "^1.6.0"
|
||||
prance = "^0.21.8"
|
||||
prance = "^0.22.11"
|
||||
openapi-spec-validator = "^0.4.0"
|
||||
jsonpatch = "^1.32"
|
||||
|
||||
|
Reference in New Issue
Block a user