Update api spec (#127)

* YOYO NEW API SPEC!

* bump version

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

* updates

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

* some fixes

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

* fixes #128

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

* mypy fixes

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

* fixes

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

* fixes

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jess Frazelle
2023-08-30 15:59:51 -07:00
committed by GitHub
parent d737fb4e8f
commit 8162fa1964
154 changed files with 6664 additions and 1581 deletions

View File

@ -379,9 +379,6 @@ def generatePath(path: str, name: str, method: str, endpoint: dict, data: dict)
else:
success_type = endpoint_refs[0]
if fn_name == "get_file_conversion" or fn_name == "create_file_conversion":
fn_name += "_with_base64_helper"
example_imports = (
"""
from kittycad.client import ClientFromEnv
@ -394,15 +391,6 @@ from kittycad.types import Response
"""
)
if fn_name.endswith("_with_base64_helper"):
example_imports += (
"""from kittycad.api."""
+ tag_name
+ """ import """
+ fn_name.replace("_with_base64_helper", "")
+ "\n"
)
# Iterate over the parameters.
params_str = ""
if "parameters" in endpoint:
@ -475,15 +463,6 @@ from kittycad.types import Response
example_imports + "from typing import Union, Any, Optional, List, Tuple\n"
)
if fn_name.endswith("_with_base64_helper"):
example_variable = (
"result: "
+ response_type.replace(
"FileConversion", "Tuple[FileConversion, bytes]"
)
+ " = "
)
else:
example_variable = "result: " + response_type + " = "
example_imports = example_imports + "from kittycad.types import Response\n"
@ -516,10 +495,6 @@ from kittycad.types import Response
and success_type != ""
):
example_success_type = success_type
if fn_name.endswith("_with_base64_helper"):
example_success_type = example_success_type.replace(
"FileConversion", "Tuple[FileConversion, bytes]"
)
short_sync_example = short_sync_example + (
"""
@ -541,7 +516,7 @@ from kittycad.types import Response
# OR if you need more info (e.g. status_code)
"""
+ example_variable_response
+ fn_name.replace("_with_base64_helper", "")
+ fn_name
+ """.sync_detailed(client=client,\n"""
+ params_str
+ """)
@ -567,7 +542,7 @@ async def test_"""
"""
+ example_variable_response
+ "await "
+ fn_name.replace("_with_base64_helper", "")
+ fn_name
+ """.asyncio_detailed(client=client,\n"""
+ params_str
+ """)"""
@ -963,6 +938,13 @@ def generateTypes(cwd: str, parser: dict):
generateType(path, key, schema, data)
f.write("from ." + camel_to_snake(key) + " import " + key + "\n")
# This is a hot fix for the empty type.
# We likely need a better way to handle this.
f.write("from .empty import Empty\n")
# Add the Base64Data type.
f.write("from .base64data import Base64Data\n")
# Close the file.
f.close()
@ -994,6 +976,8 @@ def generateType(path: str, name: str, schema: dict, data: dict):
return
elif "oneOf" in schema:
generateOneOfType(file_path, name, schema, data)
elif "anyOf" in schema:
generateAnyOfType(file_path, name, schema, data)
else:
logging.error("schema: ", [schema])
logging.error("unsupported type: ", name)
@ -1099,6 +1083,123 @@ def generateEnumTypeCode(
return value
def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
logging.info("generating type: ", name, " at: ", path)
if isEnumWithDocsOneOf(schema):
additional_docs = []
enum = []
# We want to treat this as an enum with additional docs.
for any_of in schema["anyOf"]:
enum.append(any_of["enum"][0])
if "description" in any_of:
additional_docs.append(any_of["description"])
else:
additional_docs.append("")
# Write the enum.
schema["enum"] = enum
schema["type"] = "string"
generateEnumType(path, name, schema, "string", additional_docs)
# return early.
return
# Open our file.
f = open(path, "w")
# Import the refs if there are any.
all_options = []
for any_of in schema["anyOf"]:
if "allOf" in any_of:
for all_of in any_of["allOf"]:
if "$ref" in all_of:
ref = all_of["$ref"]
ref_name = ref[ref.rfind("/") + 1 :]
f.write(
"from ."
+ camel_to_snake(ref_name)
+ " import "
+ ref_name
+ "\n"
)
all_options.append(ref_name)
if "$ref" in any_of:
ref = any_of["$ref"]
ref_name = ref[ref.rfind("/") + 1 :]
f.write("from ." + camel_to_snake(ref_name) + " import " + ref_name + "\n")
all_options.append(ref_name)
if isNestedObjectOneOf(schema):
# We want to write each of the nested objects.
for any_of in schema["anyOf"]:
# Get the nested object.
if "properties" in any_of:
for prop_name in any_of["properties"]:
nested_object = any_of["properties"][prop_name]
if nested_object == {}:
f.write("from typing import Any\n")
f.write(prop_name + " = Any\n")
f.write("\n")
all_options.append(prop_name)
elif "$ref" in nested_object:
ref = nested_object["$ref"]
ref_name = ref[ref.rfind("/") + 1 :]
f.write(
"from ."
+ camel_to_snake(ref_name)
+ " import "
+ ref_name
+ "\n"
)
f.write("\n")
if prop_name != ref_name:
f.write(prop_name + " = " + ref_name + "\n")
f.write("\n")
all_options.append(prop_name)
else:
object_code = generateObjectTypeCode(
prop_name, nested_object, "object", data, None
)
f.write(object_code)
f.write("\n")
all_options.append(prop_name)
elif "type" in any_of and any_of["type"] == "string":
enum_code = generateEnumTypeCode(
any_of["enum"][0], any_of, "string", []
)
f.write(enum_code)
f.write("\n")
all_options.append(any_of["enum"][0])
# Check if each any_of has the same enum of one.
tag = getTagAnyOf(schema)
if tag is not None:
# Generate each of the options from the tag.
for any_of in schema["anyOf"]:
# Get the value of the tag.
object_name = any_of["properties"][tag]["enum"][0]
object_code = generateObjectTypeCode(
object_name, any_of, "object", data, tag
)
f.write(object_code)
f.write("\n")
all_options.append(object_name)
# Write the sum type.
f.write("from typing import Union\n")
f.write(name + " = Union[")
for num, option in enumerate(all_options, start=0):
if num == 0:
f.write(option)
else:
f.write(", " + option + "")
f.write("]\n")
# Close the file.
f.close()
def generateOneOfType(path: str, name: str, schema: dict, data: dict):
logging.info("generating type: ", name, " at: ", path)
@ -1219,8 +1320,11 @@ def generateObjectTypeCode(
f = io.StringIO()
has_date_time = hasDateTime(schema)
has_base_64 = hasBase64(schema)
if has_date_time:
f.write("import datetime\n")
if has_base_64:
f.write("from ..models.base64data import Base64Data\n")
f.write(
"from typing import Any, Dict, List, Type, TypeVar, Union, cast, deprecated\n"
)
@ -1407,6 +1511,22 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
)
# return early
return
elif property_schema["format"] == "byte":
f.write("\t\t" + property_name + ": Union[Unset, str] = UNSET\n")
f.write(
"\t\tif not isinstance(self."
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write(
"\t\t\t"
+ clean_parameter_name(property_name)
+ " = self."
+ clean_parameter_name(property_name)
+ ".get_encoded()\n"
)
# return early
return
f.write(
"\t\t"
@ -1439,6 +1559,79 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
+ clean_parameter_name(property_name)
+ "\n"
)
elif "additionalProperties" in property_schema and property_type == "object":
if "$ref" in property_schema["additionalProperties"]:
ref = property_schema["additionalProperties"]["$ref"].replace(
"#/components/schemas/", ""
)
f.write(
"\t\t" + property_name + ": Union[Unset, Dict[str, Any]] = UNSET\n"
)
f.write(
"\t\tif not isinstance(self."
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\tnew_dict: Dict[str, Any] = {}\n")
f.write(
"\t\t\tfor key, value in self."
+ clean_parameter_name(property_name)
+ ".items():\n"
)
f.write("\t\t\t\tnew_dict[key] = value.to_dict()\n")
f.write(
"\t\t\t" + clean_parameter_name(property_name) + " = new_dict\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "integer"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ " = self."
+ clean_parameter_name(property_name)
+ "\n"
)
f.write("\n")
elif (
"format" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["format"] == "byte"
):
f.write(
"\t\t" + property_name + ": Union[Unset, Dict[str, str]] = UNSET\n"
)
f.write(
"\t\tif not isinstance(self."
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\tnew_dict: Dict[str, str] = {}\n")
f.write(
"\t\t\tfor key, value in self."
+ clean_parameter_name(property_name)
+ ".items():\n"
)
f.write("\t\t\t\tnew_dict[key] = value.get_encoded()\n")
f.write(
"\t\t\t" + clean_parameter_name(property_name) + " = new_dict\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "string"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ " = self."
+ clean_parameter_name(property_name)
+ "\n"
)
f.write("\n")
else:
# Throw an error.
print("property: ", property_schema)
raise Exception("Unknown property type")
elif property_type == "array":
if "items" in property_schema:
if "$ref" in property_schema["items"]:
@ -1573,9 +1766,59 @@ def renderTypeInit(f, property_name: str, property_schema: dict, data: dict):
)
# Return early.
return
elif property_schema["format"] == "byte":
f.write(
"\t" + property_name + ": Union[Unset, Base64Data] = UNSET\n"
)
# Return early.
return
f.write("\t" + property_name + ": Union[Unset, str] = UNSET\n")
elif "additionalProperties" in property_schema and property_type == "object":
if "$ref" in property_schema["additionalProperties"]:
ref = property_schema["additionalProperties"]["$ref"].replace(
"#/components/schemas/", ""
)
# Make sure we import the model.
f.write(
"\tfrom ..models." + camel_to_snake(ref) + " import " + ref + "\n"
)
f.write(
"\t"
+ property_name
+ ": Union[Unset, Dict[str, "
+ ref
+ "]] = UNSET\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "integer"
):
f.write(
"\t" + property_name + ": Union[Unset, Dict[str, int]] = UNSET\n"
)
elif (
"format" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["format"] == "byte"
):
f.write(
"\t"
+ property_name
+ ": Union[Unset, Dict[str, Base64Data]] = UNSET\n"
)
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "string"
):
f.write(
"\t" + property_name + ": Union[Unset, Dict[str, str]] = UNSET\n"
)
else:
# Throw an error.
print("property: ", property_schema)
raise Exception("Unknown property type")
elif property_type == "object":
# TODO: we need to get the name of the object
f.write("\t" + property_name + ": Union[Unset, Any] = UNSET\n")
elif property_type == "integer":
f.write("\t" + property_name + ": Union[Unset, int] = UNSET\n")
@ -1694,6 +1937,38 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
f.write("\n")
# Return early.
return
elif property_schema["format"] == "byte":
f.write(
"\t\t_"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ ": Union[Unset, Base64Data]\n"
)
f.write(
"\t\tif isinstance(_"
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write(
"\t\t\t" + clean_parameter_name(property_name) + " = UNSET\n"
)
f.write("\t\telse:\n")
f.write(
"\t\t\t"
+ clean_parameter_name(property_name)
+ " = Base64Data(bytes(_"
+ clean_parameter_name(property_name)
+ ", 'utf-8'))\n"
)
f.write("\n")
# Return early.
return
f.write(
"\t\t"
@ -1730,6 +2005,90 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
+ '", UNSET)\n'
)
f.write("\n")
elif "additionalProperties" in property_schema and property_type == "object":
if "$ref" in property_schema["additionalProperties"]:
ref = property_schema["additionalProperties"]["$ref"].replace(
"#/components/schemas/", ""
)
f.write(
"\t\t_"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write(
"\t\tif isinstance(_"
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\t" + clean_parameter_name(property_name) + " = UNSET\n")
f.write("\t\telse:\n")
f.write(
"\t\t\tnew_map: Dict[str, "
+ ref
+ "] = {}\n\t\t\tfor k, v in _"
+ clean_parameter_name(property_name)
+ ".items():\n\t\t\t\tnew_map[k] = "
+ ref
+ ".from_dict(v) # type: ignore\n\t\t\t"
+ clean_parameter_name(property_name)
+ " = new_map # type: ignore\n"
)
f.write("\n")
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "integer"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write("\n")
elif (
"format" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["format"] == "byte"
):
f.write(
"\t\t_"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write(
"\t\tif isinstance(_"
+ clean_parameter_name(property_name)
+ ", Unset):\n"
)
f.write("\t\t\t" + clean_parameter_name(property_name) + " = UNSET\n")
f.write(
"\t\telse:\n\t\t\tnew_map: Dict[str, Base64Data] = {}\n\t\t\tfor k, v in _"
+ clean_parameter_name(property_name)
+ ".items():\n\t\t\t\tnew_map[k] = Base64Data(bytes(v, 'utf-8'))\n\t\t\t"
+ clean_parameter_name(property_name)
+ " = new_map # type: ignore\n"
)
f.write("\n")
elif (
"type" in property_schema["additionalProperties"]
and property_schema["additionalProperties"]["type"] == "string"
):
f.write(
"\t\t"
+ clean_parameter_name(property_name)
+ ' = d.pop("'
+ property_name
+ '", UNSET)\n'
)
f.write("\n")
else:
# Throw an error.
print("property: ", property_schema)
raise Exception("Unknown property type")
elif property_type == "array":
if "items" in property_schema:
if "$ref" in property_schema["items"]:
@ -1861,6 +2220,25 @@ def hasDateTime(schema: dict) -> bool:
return False
def hasBase64(schema: dict) -> bool:
# Generate the type.
if "type" in schema:
type_name = schema["type"]
if type_name == "object":
# Iternate over the properties.
if "properties" in schema:
for property_name in schema["properties"]:
property_schema = schema["properties"][property_name]
has_base64 = hasBase64(property_schema)
if has_base64:
return True
elif type_name == "string" and "format" in schema:
if schema["format"] == "byte":
return True
return False
def getRefs(schema: dict) -> List[str]:
refs = []
if "$ref" in schema:
@ -2074,7 +2452,7 @@ def camel_to_screaming_snake(name: str):
# Change `file_conversion` to `FileConversion`
def snake_to_title(name: str):
return name.title().replace("_", "")
return name.title().replace("_", "").replace("3D", "3d")
def get_function_parameters(
@ -2145,6 +2523,34 @@ def isNestedObjectOneOf(schema: dict) -> bool:
return is_nested_object
def getTagAnyOf(schema: dict) -> Optional[str]:
tag = None
for any_of in schema["anyOf"]:
has_tag = False
# Check if each are an object w 1 property in it.
if "type" in any_of and any_of["type"] == "object" and "properties" in any_of:
for prop_name in any_of["properties"]:
prop = any_of["properties"][prop_name]
if (
"type" in prop
and prop["type"] == "string"
and "enum" in prop
and len(prop["enum"]) == 1
):
if tag is not None and tag != prop_name:
has_tag = False
break
else:
has_tag = True
tag = prop_name
if has_tag is False:
tag = None
break
return tag
def getTagOneOf(schema: dict) -> Optional[str]:
tag = None
for one_of in schema["oneOf"]:

View File

@ -5,10 +5,14 @@ set -o pipefail
# Fix for ci.
git config --global --add safe.directory /home/user/src
git add kittycad/models/base64data.py
git add kittycad/models/empty.py
# Cleanup old stuff.
rm -rf kittycad/models
rm -rf kittycad/api
git checkout kittycad/api/file/*_with_base64_helper.py &>/dev/null
git checkout kittycad/models/base64data.py
git checkout kittycad/models/empty.py
# Generate new.
poetry run python generate/generate.py

File diff suppressed because one or more lines are too long

View File

@ -1,58 +0,0 @@
import base64
from typing import Any, Optional, Tuple, Union
from ...api.file.create_file_conversion import asyncio as fc_asyncio, sync as fc_sync
from ...client import Client
from ...models import Error, FileConversion, FileExportFormat, FileImportFormat
def sync(
src_format: FileImportFormat,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""
encoded = base64.b64encode(body)
fc = fc_sync(
src_format=src_format,
output_format=output_format,
body=encoded,
client=client,
)
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc
async def asyncio(
src_format: FileImportFormat,
output_format: FileExportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""
encoded = base64.b64encode(body)
fc = await fc_asyncio(
src_format=src_format,
output_format=output_format,
body=encoded,
client=client,
)
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc

View File

@ -1,47 +0,0 @@
import base64
from typing import Any, Optional, Tuple, Union
from ...api.api_calls.get_async_operation import asyncio as fc_asyncio, sync as fc_sync
from ...client import Client
from ...models import Error
from ...models.file_conversion import FileConversion
def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = fc_sync(
id=id,
client=client,
)
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc
async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, Tuple[FileConversion, bytes], Error]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
fc = await fc_asyncio(
id=id,
client=client,
)
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc

View File

@ -3,8 +3,28 @@ from typing import Any, Dict, Optional, Union
import httpx
from ...client import Client
from ...models.curve_get_control_points import CurveGetControlPoints
from ...models.curve_get_type import CurveGetType
from ...models.empty import Empty
from ...models.entity_get_all_child_uuids import EntityGetAllChildUuids
from ...models.entity_get_child_uuid import EntityGetChildUuid
from ...models.entity_get_num_children import EntityGetNumChildren
from ...models.entity_get_parent_id import EntityGetParentId
from ...models.error import Error
from ...models.export import Export
from ...models.get_entity_type import GetEntityType
from ...models.highlight_set_entity import HighlightSetEntity
from ...models.modeling_cmd_req import ModelingCmdReq
from ...models.mouse_click import MouseClick
from ...models.path_get_info import PathGetInfo
from ...models.select_get import SelectGet
from ...models.select_with_point import SelectWithPoint
from ...models.solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
from ...models.solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
from ...models.solid3d_get_next_adjacent_edge import Solid3dGetNextAdjacentEdge
from ...models.solid3d_get_opposite_edge import Solid3dGetOppositeEdge
from ...models.solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
from ...models.take_snapshot import TakeSnapshot
from ...types import Response
@ -29,10 +49,221 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]:
def _parse_response(
*, response: httpx.Response
) -> Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]:
if response.status_code == 200:
response_200 = response.json()
return response_200
data = response.json()
try:
if not isinstance(data, dict):
raise TypeError()
option_empty = Empty.from_dict(data)
return option_empty
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_export = Export.from_dict(data)
return option_export
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_select_with_point = SelectWithPoint.from_dict(data)
return option_select_with_point
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_highlight_set_entity = HighlightSetEntity.from_dict(data)
return option_highlight_set_entity
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_child_uuid = EntityGetChildUuid.from_dict(data)
return option_entity_get_child_uuid
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_num_children = EntityGetNumChildren.from_dict(data)
return option_entity_get_num_children
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_parent_id = EntityGetParentId.from_dict(data)
return option_entity_get_parent_id
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_entity_get_all_child_uuids = EntityGetAllChildUuids.from_dict(data)
return option_entity_get_all_child_uuids
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_select_get = SelectGet.from_dict(data)
return option_select_get
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_get_entity_type = GetEntityType.from_dict(data)
return option_get_entity_type
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_all_edge_faces = Solid3dGetAllEdgeFaces.from_dict(data)
return option_solid3d_get_all_edge_faces
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_all_opposite_edges = (
Solid3dGetAllOppositeEdges.from_dict(data)
)
return option_solid3d_get_all_opposite_edges
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_opposite_edge = Solid3dGetOppositeEdge.from_dict(data)
return option_solid3d_get_opposite_edge
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_prev_adjacent_edge = (
Solid3dGetPrevAdjacentEdge.from_dict(data)
)
return option_solid3d_get_prev_adjacent_edge
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_solid3d_get_next_adjacent_edge = (
Solid3dGetNextAdjacentEdge.from_dict(data)
)
return option_solid3d_get_next_adjacent_edge
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_mouse_click = MouseClick.from_dict(data)
return option_mouse_click
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_curve_get_type = CurveGetType.from_dict(data)
return option_curve_get_type
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_curve_get_control_points = CurveGetControlPoints.from_dict(data)
return option_curve_get_control_points
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_take_snapshot = TakeSnapshot.from_dict(data)
return option_take_snapshot
except ValueError:
pass
except TypeError:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option_path_get_info = PathGetInfo.from_dict(data)
return option_path_get_info
except ValueError:
raise
except TypeError:
raise
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
@ -44,7 +275,33 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[dict, Error]]]:
) -> Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
]:
return Response(
status_code=response.status_code,
content=response.content,
@ -57,7 +314,33 @@ def sync_detailed(
body: ModelingCmdReq,
*,
client: Client,
) -> Response[Optional[Union[dict, Error]]]:
) -> Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
]:
kwargs = _get_kwargs(
body=body,
client=client,
@ -75,7 +358,31 @@ def sync(
body: ModelingCmdReq,
*,
client: Client,
) -> Optional[Union[dict, Error]]:
) -> Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]:
"""Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501
return sync_detailed(
@ -88,7 +395,33 @@ async def asyncio_detailed(
body: ModelingCmdReq,
*,
client: Client,
) -> Response[Optional[Union[dict, Error]]]:
) -> Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
]:
kwargs = _get_kwargs(
body=body,
client=client,
@ -104,7 +437,31 @@ async def asyncio(
body: ModelingCmdReq,
*,
client: Client,
) -> Optional[Union[dict, Error]]:
) -> Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]:
"""Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.""" # noqa: E501
return (

View File

@ -12,6 +12,7 @@ def _get_kwargs(
unlocked_framerate: bool,
video_res_height: int,
video_res_width: int,
webrtc: bool,
*,
client: Client,
) -> Dict[str, Any]:
@ -41,6 +42,12 @@ def _get_kwargs(
else:
url = url + "?video_res_width=" + str(video_res_width)
if webrtc is not None:
if "?" in url:
url = url + "&webrtc=" + str(webrtc)
else:
url = url + "?webrtc=" + str(webrtc)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
@ -57,6 +64,7 @@ def sync(
unlocked_framerate: bool,
video_res_height: int,
video_res_width: int,
webrtc: bool,
*,
client: Client,
) -> ClientConnection:
@ -67,6 +75,7 @@ def sync(
unlocked_framerate=unlocked_framerate,
video_res_height=video_res_height,
video_res_width=video_res_width,
webrtc=webrtc,
client=client,
)
@ -85,6 +94,7 @@ async def asyncio(
unlocked_framerate: bool,
video_res_height: int,
video_res_width: int,
webrtc: bool,
*,
client: Client,
) -> WebSocketClientProtocol:
@ -95,6 +105,7 @@ async def asyncio(
unlocked_framerate=unlocked_framerate,
video_res_height=video_res_height,
video_res_width=video_res_width,
webrtc=webrtc,
client=client,
)

View File

@ -1,20 +1,17 @@
import os
from typing import Tuple, Union
from typing import Dict, Optional, Union
import pytest
from .api.api_tokens import list_api_tokens_for_user
from .api.file import (
create_file_conversion_with_base64_helper,
create_file_mass,
create_file_volume,
)
from .api.file import create_file_conversion, create_file_mass, create_file_volume
from .api.meta import ping
from .api.users import get_user_self, list_users_extended
from .client import ClientFromEnv
from .models import (
ApiCallStatus,
ApiTokenResultsPage,
Base64Data,
CreatedAtSortMode,
Error,
ExtendedUserResultsPage,
@ -29,6 +26,7 @@ from .models import (
UnitVolume,
User,
)
from .types import Unset
def test_get_session():
@ -106,19 +104,16 @@ def test_file_convert_stl():
file.close()
# Get the fc.
result: Union[
Tuple[FileConversion, bytes], Error, None
] = create_file_conversion_with_base64_helper.sync(
result: Optional[Union[FileConversion, Error]] = create_file_conversion.sync(
client=client,
body=content,
src_format=FileImportFormat.STL,
output_format=FileExportFormat.OBJ,
)
r: Tuple[FileConversion, bytes] = result # type: ignore
assert isinstance(result, FileConversion)
b: bytes = r[1]
fc: FileConversion = r[0]
fc: FileConversion = result
print(f"FileConversion: {fc}")
@ -127,8 +122,12 @@ def test_file_convert_stl():
print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
assert len(b) > 0
for key, value in outputs.items():
assert len(value.get_decoded()) > 0
@pytest.mark.asyncio
@ -142,19 +141,18 @@ async def test_file_convert_stl_async():
file.close()
# Get the fc.
result: Union[
Tuple[FileConversion, bytes], Error, None
] = await create_file_conversion_with_base64_helper.asyncio(
result: Optional[
Union[FileConversion, Error]
] = await create_file_conversion.asyncio(
client=client,
body=content,
src_format=FileImportFormat.STL,
output_format=FileExportFormat.OBJ,
)
r: Tuple[FileConversion, bytes] = result # type: ignore
assert isinstance(result, FileConversion)
b: bytes = r[1]
fc: FileConversion = r[0]
fc: FileConversion = result
print(f"FileConversion: {fc}")
@ -163,8 +161,12 @@ async def test_file_convert_stl_async():
print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
assert len(b) > 0
for key, value in outputs.items():
assert len(value.get_decoded()) > 0
@pytest.mark.asyncio
@ -178,19 +180,18 @@ async def test_file_convert_obj_async():
file.close()
# Get the fc.
result: Union[
Tuple[FileConversion, bytes], Error, None
] = await create_file_conversion_with_base64_helper.asyncio(
result: Optional[
Union[FileConversion, Error]
] = await create_file_conversion.asyncio(
client=client,
body=content,
src_format=FileImportFormat.OBJ,
output_format=FileExportFormat.STL,
)
r: Tuple[FileConversion, bytes] = result # type: ignore
assert isinstance(result, FileConversion)
b: bytes = r[1]
fc: FileConversion = r[0]
fc: FileConversion = result
print(f"FileConversion: {fc}")
@ -199,8 +200,12 @@ async def test_file_convert_obj_async():
print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset)
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty.
assert len(b) > 0
for key, value in outputs.items():
assert len(value.get_decoded()) > 0
def test_file_mass():

View File

@ -1,4 +1,4 @@
from typing import List, Optional, Tuple, Union
from typing import List, Optional, Union
import pytest
@ -28,7 +28,6 @@ from kittycad.api.executor import create_executor_term, create_file_execution
from kittycad.api.file import (
create_file_center_of_mass,
create_file_conversion,
create_file_conversion_with_base64_helper,
create_file_density,
create_file_mass,
create_file_surface_area,
@ -94,9 +93,17 @@ from kittycad.models import (
AppClientInfo,
AsyncApiCallResultsPage,
CodeOutput,
CurveGetControlPoints,
CurveGetType,
Customer,
CustomerBalance,
Empty,
EntityGetAllChildUuids,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
Error,
Export,
ExtendedUser,
ExtendedUserResultsPage,
FileCenterOfMass,
@ -105,15 +112,27 @@ from kittycad.models import (
FileMass,
FileSurfaceArea,
FileVolume,
GetEntityType,
HighlightSetEntity,
Invoice,
Mesh,
Metadata,
ModelingOutcomes,
MouseClick,
Onboarding,
PathGetInfo,
PaymentIntent,
PaymentMethod,
Pong,
SelectGet,
SelectWithPoint,
Session,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetNextAdjacentEdge,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
TakeSnapshot,
UnitAngleConversion,
UnitAreaConversion,
UnitCurrentConversion,
@ -289,7 +308,7 @@ def test_create_image_to_3d():
result: Optional[Union[Mesh, Error]] = create_image_to_3d.sync(
client=client,
input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -304,7 +323,7 @@ def test_create_image_to_3d():
response: Response[Optional[Union[Mesh, Error]]] = create_image_to_3d.sync_detailed(
client=client,
input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -319,7 +338,7 @@ async def test_create_image_to_3d_async():
result: Optional[Union[Mesh, Error]] = await create_image_to_3d.asyncio(
client=client,
input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -329,7 +348,7 @@ async def test_create_image_to_3d_async():
] = await create_image_to_3d.asyncio_detailed(
client=client,
input_format=ImageType.PNG,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -341,7 +360,7 @@ def test_create_text_to_3d():
result: Optional[Union[Mesh, Error]] = create_text_to_3d.sync(
client=client,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
prompt="<string>",
)
@ -355,7 +374,7 @@ def test_create_text_to_3d():
# OR if you need more info (e.g. status_code)
response: Response[Optional[Union[Mesh, Error]]] = create_text_to_3d.sync_detailed(
client=client,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
prompt="<string>",
)
@ -369,7 +388,7 @@ async def test_create_text_to_3d_async():
result: Optional[Union[Mesh, Error]] = await create_text_to_3d.asyncio(
client=client,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
prompt="<string>",
)
@ -378,7 +397,7 @@ async def test_create_text_to_3d_async():
Optional[Union[Mesh, Error]]
] = await create_text_to_3d.asyncio_detailed(
client=client,
output_format=FileExportFormat.GLTF,
output_format=FileExportFormat.FBX,
prompt="<string>",
)
@ -932,7 +951,7 @@ def test_create_file_center_of_mass():
result: Optional[Union[FileCenterOfMass, Error]] = create_file_center_of_mass.sync(
client=client,
output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -949,7 +968,7 @@ def test_create_file_center_of_mass():
] = create_file_center_of_mass.sync_detailed(
client=client,
output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -966,7 +985,7 @@ async def test_create_file_center_of_mass_async():
] = await create_file_center_of_mass.asyncio(
client=client,
output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -976,22 +995,20 @@ async def test_create_file_center_of_mass_async():
] = await create_file_center_of_mass.asyncio_detailed(
client=client,
output_unit=UnitLength.CM,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@pytest.mark.skip
def test_create_file_conversion_with_base64_helper():
def test_create_file_conversion():
# Create our client.
client = ClientFromEnv()
result: Optional[
Union[Tuple[FileConversion, bytes], Error]
] = create_file_conversion_with_base64_helper.sync(
result: Optional[Union[FileConversion, Error]] = create_file_conversion.sync(
client=client,
output_format=FileExportFormat.GLTF,
src_format=FileImportFormat.GLTF,
output_format=FileExportFormat.FBX,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -999,7 +1016,7 @@ def test_create_file_conversion_with_base64_helper():
print(result)
raise Exception("Error in response")
body: Tuple[FileConversion, bytes] = result
body: FileConversion = result
print(body)
# OR if you need more info (e.g. status_code)
@ -1007,8 +1024,8 @@ def test_create_file_conversion_with_base64_helper():
Optional[Union[FileConversion, Error]]
] = create_file_conversion.sync_detailed(
client=client,
output_format=FileExportFormat.GLTF,
src_format=FileImportFormat.GLTF,
output_format=FileExportFormat.FBX,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1016,16 +1033,16 @@ def test_create_file_conversion_with_base64_helper():
# OR run async
@pytest.mark.asyncio
@pytest.mark.skip
async def test_create_file_conversion_with_base64_helper_async():
async def test_create_file_conversion_async():
# Create our client.
client = ClientFromEnv()
result: Optional[
Union[Tuple[FileConversion, bytes], Error]
] = await create_file_conversion_with_base64_helper.asyncio(
Union[FileConversion, Error]
] = await create_file_conversion.asyncio(
client=client,
output_format=FileExportFormat.GLTF,
src_format=FileImportFormat.GLTF,
output_format=FileExportFormat.FBX,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1034,8 +1051,8 @@ async def test_create_file_conversion_with_base64_helper_async():
Optional[Union[FileConversion, Error]]
] = await create_file_conversion.asyncio_detailed(
client=client,
output_format=FileExportFormat.GLTF,
src_format=FileImportFormat.GLTF,
output_format=FileExportFormat.FBX,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1050,7 +1067,7 @@ def test_create_file_density():
material_mass=3.14,
material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1069,7 +1086,7 @@ def test_create_file_density():
material_mass=3.14,
material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1086,7 +1103,7 @@ async def test_create_file_density_async():
material_mass=3.14,
material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1098,7 +1115,7 @@ async def test_create_file_density_async():
material_mass=3.14,
material_mass_unit=UnitMass.G,
output_unit=UnitDensity.LB_FT3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1168,7 +1185,7 @@ def test_create_file_mass():
material_density=3.14,
material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1187,7 +1204,7 @@ def test_create_file_mass():
material_density=3.14,
material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1204,7 +1221,7 @@ async def test_create_file_mass_async():
material_density=3.14,
material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1216,7 +1233,7 @@ async def test_create_file_mass_async():
material_density=3.14,
material_density_unit=UnitDensity.LB_FT3,
output_unit=UnitMass.G,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1229,7 +1246,7 @@ def test_create_file_surface_area():
result: Optional[Union[FileSurfaceArea, Error]] = create_file_surface_area.sync(
client=client,
output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1246,7 +1263,7 @@ def test_create_file_surface_area():
] = create_file_surface_area.sync_detailed(
client=client,
output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1263,7 +1280,7 @@ async def test_create_file_surface_area_async():
] = await create_file_surface_area.asyncio(
client=client,
output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1273,7 +1290,7 @@ async def test_create_file_surface_area_async():
] = await create_file_surface_area.asyncio_detailed(
client=client,
output_unit=UnitArea.CM2,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1286,7 +1303,7 @@ def test_create_file_volume():
result: Optional[Union[FileVolume, Error]] = create_file_volume.sync(
client=client,
output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1303,7 +1320,7 @@ def test_create_file_volume():
] = create_file_volume.sync_detailed(
client=client,
output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1318,7 +1335,7 @@ async def test_create_file_volume_async():
result: Optional[Union[FileVolume, Error]] = await create_file_volume.asyncio(
client=client,
output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1328,7 +1345,7 @@ async def test_create_file_volume_async():
] = await create_file_volume.asyncio_detailed(
client=client,
output_unit=UnitVolume.CM3,
src_format=FileImportFormat.GLTF,
src_format=FileImportFormat.FBX,
body=bytes("some bytes", "utf-8"),
)
@ -1377,7 +1394,31 @@ def test_cmd():
# Create our client.
client = ClientFromEnv()
cmd.sync(
result: Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
] = cmd.sync(
client=client,
body=ModelingCmdReq(
cmd=move_path_pen(
@ -1392,8 +1433,62 @@ def test_cmd():
),
)
if isinstance(result, Error) or result is None:
print(result)
raise Exception("Error in response")
body: Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
] = result
print(body)
# OR if you need more info (e.g. status_code)
cmd.sync_detailed(
response: Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
] = cmd.sync_detailed(
client=client,
body=ModelingCmdReq(
cmd=move_path_pen(
@ -1416,7 +1511,31 @@ async def test_cmd_async():
# Create our client.
client = ClientFromEnv()
await cmd.asyncio(
result: Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
] = await cmd.asyncio(
client=client,
body=ModelingCmdReq(
cmd=move_path_pen(
@ -1432,7 +1551,33 @@ async def test_cmd_async():
)
# OR run async with more info
await cmd.asyncio_detailed(
response: Response[
Optional[
Union[
Empty,
Export,
SelectWithPoint,
HighlightSetEntity,
EntityGetChildUuid,
EntityGetNumChildren,
EntityGetParentId,
EntityGetAllChildUuids,
SelectGet,
GetEntityType,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Solid3dGetPrevAdjacentEdge,
Solid3dGetNextAdjacentEdge,
MouseClick,
CurveGetType,
CurveGetControlPoints,
TakeSnapshot,
PathGetInfo,
Error,
]
]
] = await cmd.asyncio_detailed(
client=client,
body=ModelingCmdReq(
cmd=move_path_pen(
@ -3798,6 +3943,7 @@ def test_modeling_commands_ws():
unlocked_framerate=False,
video_res_height=10,
video_res_width=10,
webrtc=False,
)
# Send a message.
@ -3822,6 +3968,7 @@ async def test_modeling_commands_ws_async():
unlocked_framerate=False,
video_res_height=10,
video_res_width=10,
webrtc=False,
)
# Send a message.

View File

@ -19,6 +19,7 @@ from .api_call_query_group_by import ApiCallQueryGroupBy
from .api_call_status import ApiCallStatus
from .api_call_with_price import ApiCallWithPrice
from .api_call_with_price_results_page import ApiCallWithPriceResultsPage
from .api_error import ApiError
from .api_token import ApiToken
from .api_token_results_page import ApiTokenResultsPage
from .app_client_info import AppClientInfo
@ -28,6 +29,7 @@ from .async_api_call_results_page import AsyncApiCallResultsPage
from .async_api_call_type import AsyncApiCallType
from .axis import Axis
from .axis_direction_pair import AxisDirectionPair
from .base64data import Base64Data
from .billing_info import BillingInfo
from .cache_metadata import CacheMetadata
from .camera_drag_interaction_type import CameraDragInteractionType
@ -42,6 +44,9 @@ from .country_code import CountryCode
from .coupon import Coupon
from .created_at_sort_mode import CreatedAtSortMode
from .currency import Currency
from .curve_get_control_points import CurveGetControlPoints
from .curve_get_type import CurveGetType
from .curve_type import CurveType
from .customer import Customer
from .customer_balance import CustomerBalance
from .device_access_token_request_form import DeviceAccessTokenRequestForm
@ -51,17 +56,23 @@ from .direction import Direction
from .discount import Discount
from .docker_system_info import DockerSystemInfo
from .email_authentication_form import EmailAuthenticationForm
from .engine_error import EngineError
from .empty import Empty
from .engine_metadata import EngineMetadata
from .entity_get_all_child_uuids import EntityGetAllChildUuids
from .entity_get_child_uuid import EntityGetChildUuid
from .entity_get_num_children import EntityGetNumChildren
from .entity_get_parent_id import EntityGetParentId
from .entity_type import EntityType
from .environment import Environment
from .error import Error
from .error_code import ErrorCode
from .error_response import ErrorResponse
from .executor_metadata import ExecutorMetadata
from .export import Export
from .export_file import ExportFile
from .extended_user import ExtendedUser
from .extended_user_results_page import ExtendedUserResultsPage
from .failure_web_socket_response import FailureWebSocketResponse
from .fbx_storage import FbxStorage
from .file_center_of_mass import FileCenterOfMass
from .file_conversion import FileConversion
from .file_density import FileDensity
@ -72,7 +83,12 @@ from .file_surface_area import FileSurfaceArea
from .file_system_metadata import FileSystemMetadata
from .file_volume import FileVolume
from .gateway import Gateway
from .get_entity_type import GetEntityType
from .gltf_presentation import GltfPresentation
from .gltf_storage import GltfStorage
from .highlight_set_entity import HighlightSetEntity
from .ice_server import IceServer
from .image_format import ImageFormat
from .image_type import ImageType
from .index_info import IndexInfo
from .input_format import InputFormat
@ -95,41 +111,53 @@ from .modeling_cmd_req_batch import ModelingCmdReqBatch
from .modeling_error import ModelingError
from .modeling_outcome import ModelingOutcome
from .modeling_outcomes import ModelingOutcomes
from .mouse_click import MouseClick
from .new_address import NewAddress
from .o_auth2_client_info import OAuth2ClientInfo
from .o_auth2_grant_type import OAuth2GrantType
from .ok_modeling_cmd_response import OkModelingCmdResponse
from .ok_web_socket_response_data import OkWebSocketResponseData
from .onboarding import Onboarding
from .output_file import OutputFile
from .output_format import OutputFormat
from .path_command import PathCommand
from .path_get_info import PathGetInfo
from .path_segment import PathSegment
from .path_segment_info import PathSegmentInfo
from .payment_intent import PaymentIntent
from .payment_method import PaymentMethod
from .payment_method_card_checks import PaymentMethodCardChecks
from .payment_method_type import PaymentMethodType
from .plugins_info import PluginsInfo
from .ply_storage import PlyStorage
from .point2d import Point2d
from .point3d import Point3d
from .point_e_metadata import PointEMetadata
from .pong import Pong
from .raw_file import RawFile
from .registry_service_config import RegistryServiceConfig
from .rtc_ice_candidate import RtcIceCandidate
from .rtc_ice_candidate_init import RtcIceCandidateInit
from .rtc_ice_candidate_type import RtcIceCandidateType
from .rtc_ice_protocol import RtcIceProtocol
from .rtc_sdp_type import RtcSdpType
from .rtc_session_description import RtcSessionDescription
from .runtime import Runtime
from .scene_selection_type import SceneSelectionType
from .scene_tool_type import SceneToolType
from .select_get import SelectGet
from .select_with_point import SelectWithPoint
from .session import Session
from .snake_case_result import SnakeCaseResult
from .storage import Storage
from .solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
from .solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
from .solid3d_get_next_adjacent_edge import Solid3dGetNextAdjacentEdge
from .solid3d_get_opposite_edge import Solid3dGetOppositeEdge
from .solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
from .stl_storage import StlStorage
from .success_web_socket_response import SuccessWebSocketResponse
from .system import System
from .system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum
from .system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum
from .system_info_default_address_pools import SystemInfoDefaultAddressPools
from .system_info_isolation_enum import SystemInfoIsolationEnum
from .take_snapshot import TakeSnapshot
from .unit_angle import UnitAngle
from .unit_angle_conversion import UnitAngleConversion
from .unit_area import UnitArea
@ -162,5 +190,5 @@ from .user import User
from .user_results_page import UserResultsPage
from .uuid import Uuid
from .verification_token import VerificationToken
from .web_socket_messages import WebSocketMessages
from .web_socket_responses import WebSocketResponses
from .web_socket_request import WebSocketRequest
from .web_socket_response import WebSocketResponse

View File

@ -5,11 +5,11 @@ import attr
from ..models.error_code import ErrorCode
from ..types import UNSET, Unset
CE = TypeVar("CE", bound="EngineError")
HX = TypeVar("HX", bound="ApiError")
@attr.s(auto_attribs=True)
class EngineError:
class ApiError:
"""An error.""" # noqa: E501
error_code: Union[Unset, ErrorCode] = UNSET
@ -33,7 +33,7 @@ class EngineError:
return field_dict
@classmethod
def from_dict(cls: Type[CE], src_dict: Dict[str, Any]) -> CE:
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX:
d = src_dict.copy()
_error_code = d.pop("error_code", UNSET)
error_code: Union[Unset, ErrorCode]
@ -44,13 +44,13 @@ class EngineError:
message = d.pop("message", UNSET)
engine_error = cls(
api_error = cls(
error_code=error_code,
message=message,
)
engine_error.additional_properties = d
return engine_error
api_error.additional_properties = d
return api_error
@property
def additional_keys(self) -> List[str]:

View File

@ -7,7 +7,7 @@ from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..types import UNSET, Unset
HX = TypeVar("HX", bound="ApiToken")
LB = TypeVar("LB", bound="ApiToken")
@attr.s(auto_attribs=True)
@ -56,7 +56,7 @@ class ApiToken:
return field_dict
@classmethod
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX:
def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB:
d = src_dict.copy()
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
LB = TypeVar("LB", bound="ApiTokenResultsPage")
NE = TypeVar("NE", bound="ApiTokenResultsPage")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class ApiTokenResultsPage:
return field_dict
@classmethod
def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB:
def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE:
d = src_dict.copy()
from ..models.api_token import ApiToken

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
NE = TypeVar("NE", bound="AppClientInfo")
TL = TypeVar("TL", bound="AppClientInfo")
@attr.s(auto_attribs=True)
@ -27,7 +27,7 @@ class AppClientInfo:
return field_dict
@classmethod
def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE:
def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL:
d = src_dict.copy()
url = d.pop("url", UNSET)

View File

@ -9,7 +9,7 @@ from ..models.async_api_call_type import AsyncApiCallType
from ..models.uuid import Uuid
from ..types import UNSET, Unset
TL = TypeVar("TL", bound="AsyncApiCall")
MN = TypeVar("MN", bound="AsyncApiCall")
@attr.s(auto_attribs=True)
@ -86,7 +86,7 @@ class AsyncApiCall:
return field_dict
@classmethod
def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL:
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]

View File

@ -5,6 +5,7 @@ import attr
from dateutil.parser import isoparse
from ..models.api_call_status import ApiCallStatus
from ..models.base64data import Base64Data
from ..models.file_export_format import FileExportFormat
from ..models.file_import_format import FileImportFormat
from ..models.input_format import InputFormat
@ -18,7 +19,7 @@ from ..models.unit_volume import UnitVolume
from ..models.uuid import Uuid
from ..types import UNSET, Unset
MN = TypeVar("MN", bound="file_conversion")
JV = TypeVar("JV", bound="file_conversion")
@attr.s(auto_attribs=True)
@ -29,10 +30,10 @@ class file_conversion:
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
output: Union[Unset, str] = UNSET
output: Union[Unset, Base64Data] = UNSET
output_format: Union[Unset, FileExportFormat] = UNSET
output_format_options: Union[Unset, OutputFormat] = UNSET
outputs: Union[Unset, Any] = UNSET
outputs: Union[Unset, Dict[str, Base64Data]] = UNSET
src_format: Union[Unset, FileImportFormat] = UNSET
src_format_options: Union[Unset, InputFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
@ -52,12 +53,19 @@ class file_conversion:
created_at = self.created_at.isoformat()
error = self.error
id = self.id
output = self.output
output: Union[Unset, str] = UNSET
if not isinstance(self.output, Unset):
output = self.output.get_encoded()
if not isinstance(self.output_format, Unset):
output_format = self.output_format
if not isinstance(self.output_format_options, Unset):
output_format_options = self.output_format_options
outputs = self.outputs
outputs: Union[Unset, Dict[str, str]] = UNSET
if not isinstance(self.outputs, Unset):
new_dict: Dict[str, str] = {}
for key, value in self.outputs.items():
new_dict[key] = value.get_encoded()
outputs = new_dict
if not isinstance(self.src_format, Unset):
src_format = self.src_format
if not isinstance(self.src_format_options, Unset):
@ -109,7 +117,7 @@ class file_conversion:
return field_dict
@classmethod
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -134,7 +142,12 @@ class file_conversion:
else:
id = _id # type: ignore[arg-type]
output = d.pop("output", UNSET)
_output = d.pop("output", UNSET)
output: Union[Unset, Base64Data]
if isinstance(_output, Unset):
output = UNSET
else:
output = Base64Data(bytes(_output, "utf-8"))
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileExportFormat]
@ -150,7 +163,15 @@ class file_conversion:
else:
output_format_options = _output_format_options # type: ignore[arg-type]
outputs = d.pop("outputs", UNSET)
_outputs = d.pop("outputs", UNSET)
if isinstance(_outputs, Unset):
outputs = UNSET
else:
new_map: Dict[str, Base64Data] = {}
for k, v in _outputs.items():
new_map[k] = Base64Data(bytes(v, "utf-8"))
outputs = new_map # type: ignore
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):
@ -228,7 +249,7 @@ class file_conversion:
return key in self.additional_properties
JV = TypeVar("JV", bound="file_center_of_mass")
IO = TypeVar("IO", bound="file_center_of_mass")
@attr.s(auto_attribs=True)
@ -306,7 +327,7 @@ class file_center_of_mass:
return field_dict
@classmethod
def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV:
def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO:
d = src_dict.copy()
_center_of_mass = d.pop("center_of_mass", UNSET)
center_of_mass: Union[Unset, Point3d]
@ -412,7 +433,7 @@ class file_center_of_mass:
return key in self.additional_properties
IO = TypeVar("IO", bound="file_mass")
FV = TypeVar("FV", bound="file_mass")
@attr.s(auto_attribs=True)
@ -498,7 +519,7 @@ class file_mass:
return field_dict
@classmethod
def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO:
def from_dict(cls: Type[FV], src_dict: Dict[str, Any]) -> FV:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -610,7 +631,7 @@ class file_mass:
return key in self.additional_properties
FV = TypeVar("FV", bound="file_volume")
LE = TypeVar("LE", bound="file_volume")
@attr.s(auto_attribs=True)
@ -687,7 +708,7 @@ class file_volume:
return field_dict
@classmethod
def from_dict(cls: Type[FV], src_dict: Dict[str, Any]) -> FV:
def from_dict(cls: Type[LE], src_dict: Dict[str, Any]) -> LE:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -788,7 +809,7 @@ class file_volume:
return key in self.additional_properties
LE = TypeVar("LE", bound="file_density")
OY = TypeVar("OY", bound="file_density")
@attr.s(auto_attribs=True)
@ -874,7 +895,7 @@ class file_density:
return field_dict
@classmethod
def from_dict(cls: Type[LE], src_dict: Dict[str, Any]) -> LE:
def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -986,7 +1007,7 @@ class file_density:
return key in self.additional_properties
OY = TypeVar("OY", bound="file_surface_area")
HO = TypeVar("HO", bound="file_surface_area")
@attr.s(auto_attribs=True)
@ -1063,7 +1084,7 @@ class file_surface_area:
return field_dict
@classmethod
def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY:
def from_dict(cls: Type[HO], src_dict: Dict[str, Any]) -> HO:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
HO = TypeVar("HO", bound="AsyncApiCallResultsPage")
TM = TypeVar("TM", bound="AsyncApiCallResultsPage")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class AsyncApiCallResultsPage:
return field_dict
@classmethod
def from_dict(cls: Type[HO], src_dict: Dict[str, Any]) -> HO:
def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM:
d = src_dict.copy()
from ..models.async_api_call import AsyncApiCall

View File

@ -6,7 +6,7 @@ from ..models.axis import Axis
from ..models.direction import Direction
from ..types import UNSET, Unset
TM = TypeVar("TM", bound="AxisDirectionPair")
BS = TypeVar("BS", bound="AxisDirectionPair")
@attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class AxisDirectionPair:
return field_dict
@classmethod
def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM:
def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS:
d = src_dict.copy()
_axis = d.pop("axis", UNSET)
axis: Union[Unset, Axis]

View File

@ -0,0 +1,35 @@
import base64
import binascii
class Base64Data:
def __init__(self, data: bytes):
"""
Initializes the object.
If the provided data is already in base64 encoded format, it will store it.
If the data is a regular byte string, it will encode and then store it.
"""
if self.is_base64(data):
self._data = str(data, "utf-8")
else:
encoded = base64.b64encode(data)
self._data = str(encoded, "utf-8")
@staticmethod
def is_base64(data: bytes) -> bool:
"""Checks if given data is base64 encoded."""
try:
str_data = str(data, "utf-8")
_ = base64.urlsafe_b64decode(str_data.strip("=") + "===")
return True
except binascii.Error:
return False
def get_encoded(self) -> str:
"""Returns the stored base64 encoded data."""
return self._data
def get_decoded(self) -> bytes:
"""Returns the decoded byte string."""
return base64.urlsafe_b64decode(self._data.strip("=") + "===")

View File

@ -5,7 +5,7 @@ import attr
from ..models.new_address import NewAddress
from ..types import UNSET, Unset
BS = TypeVar("BS", bound="BillingInfo")
AH = TypeVar("AH", bound="BillingInfo")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class BillingInfo:
return field_dict
@classmethod
def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS:
def from_dict(cls: Type[AH], src_dict: Dict[str, Any]) -> AH:
d = src_dict.copy()
_address = d.pop("address", UNSET)
address: Union[Unset, NewAddress]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
AH = TypeVar("AH", bound="CacheMetadata")
EG = TypeVar("EG", bound="CacheMetadata")
@attr.s(auto_attribs=True)
@ -29,7 +29,7 @@ class CacheMetadata:
return field_dict
@classmethod
def from_dict(cls: Type[AH], src_dict: Dict[str, Any]) -> AH:
def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG:
d = src_dict.copy()
ok = d.pop("ok", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.payment_method_card_checks import PaymentMethodCardChecks
from ..types import UNSET, Unset
EG = TypeVar("EG", bound="CardDetails")
JR = TypeVar("JR", bound="CardDetails")
@attr.s(auto_attribs=True)
@ -57,7 +57,7 @@ class CardDetails:
return field_dict
@classmethod
def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG:
def from_dict(cls: Type[JR], src_dict: Dict[str, Any]) -> JR:
d = src_dict.copy()
brand = d.pop("brand", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
JR = TypeVar("JR", bound="Cluster")
LY = TypeVar("LY", bound="Cluster")
@attr.s(auto_attribs=True)
@ -49,7 +49,7 @@ class Cluster:
return field_dict
@classmethod
def from_dict(cls: Type[JR], src_dict: Dict[str, Any]) -> JR:
def from_dict(cls: Type[LY], src_dict: Dict[str, Any]) -> LY:
d = src_dict.copy()
addr = d.pop("addr", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
LY = TypeVar("LY", bound="CodeOutput")
HK = TypeVar("HK", bound="CodeOutput")
@attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class CodeOutput:
return field_dict
@classmethod
def from_dict(cls: Type[LY], src_dict: Dict[str, Any]) -> LY:
def from_dict(cls: Type[HK], src_dict: Dict[str, Any]) -> HK:
d = src_dict.copy()
from ..models.output_file import OutputFile

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
HK = TypeVar("HK", bound="Color")
VR = TypeVar("VR", bound="Color")
@attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class Color:
return field_dict
@classmethod
def from_dict(cls: Type[HK], src_dict: Dict[str, Any]) -> HK:
def from_dict(cls: Type[VR], src_dict: Dict[str, Any]) -> VR:
d = src_dict.copy()
a = d.pop("a", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
VR = TypeVar("VR", bound="Commit")
ON = TypeVar("ON", bound="Commit")
@attr.s(auto_attribs=True)
@ -31,7 +31,7 @@ class Commit:
return field_dict
@classmethod
def from_dict(cls: Type[VR], src_dict: Dict[str, Any]) -> VR:
def from_dict(cls: Type[ON], src_dict: Dict[str, Any]) -> ON:
d = src_dict.copy()
expected = d.pop("expected", UNSET)

View File

@ -10,7 +10,7 @@ from ..models.jetstream import Jetstream
from ..models.leaf_node import LeafNode
from ..types import UNSET, Unset
ON = TypeVar("ON", bound="Connection")
PC = TypeVar("PC", bound="Connection")
@attr.s(auto_attribs=True)
@ -33,7 +33,7 @@ class Connection:
http_base_path: Union[Unset, str] = UNSET
http_host: Union[Unset, str] = UNSET
http_port: Union[Unset, int] = UNSET
http_req_stats: Union[Unset, Any] = UNSET
http_req_stats: Union[Unset, Dict[str, int]] = UNSET
https_port: Union[Unset, int] = UNSET
in_bytes: Union[Unset, int] = UNSET
in_msgs: Union[Unset, int] = UNSET
@ -88,6 +88,7 @@ class Connection:
http_host = self.http_host
http_port = self.http_port
http_req_stats = self.http_req_stats
https_port = self.https_port
in_bytes = self.in_bytes
in_msgs = self.in_msgs
@ -225,7 +226,7 @@ class Connection:
return field_dict
@classmethod
def from_dict(cls: Type[ON], src_dict: Dict[str, Any]) -> ON:
def from_dict(cls: Type[PC], src_dict: Dict[str, Any]) -> PC:
d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET)
@ -271,6 +272,7 @@ class Connection:
http_port = d.pop("http_port", UNSET)
http_req_stats = d.pop("http_req_stats", UNSET)
https_port = d.pop("https_port", UNSET)
in_bytes = d.pop("in_bytes", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
PC = TypeVar("PC", bound="Coupon")
US = TypeVar("US", bound="Coupon")
@attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class Coupon:
return field_dict
@classmethod
def from_dict(cls: Type[PC], src_dict: Dict[str, Any]) -> PC:
def from_dict(cls: Type[US], src_dict: Dict[str, Any]) -> US:
d = src_dict.copy()
amount_off = d.pop("amount_off", UNSET)

View File

@ -0,0 +1,63 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
KQ = TypeVar("KQ", bound="CurveGetControlPoints")
@attr.s(auto_attribs=True)
class CurveGetControlPoints:
"""The response from the `CurveGetControlPoints` command.""" # noqa: E501
from ..models.point3d import Point3d
control_points: Union[Unset, List[Point3d]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.point3d import Point3d
control_points: Union[Unset, List[Point3d]] = UNSET
if not isinstance(self.control_points, Unset):
control_points = self.control_points
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if control_points is not UNSET:
field_dict["control_points"] = control_points
return field_dict
@classmethod
def from_dict(cls: Type[KQ], src_dict: Dict[str, Any]) -> KQ:
d = src_dict.copy()
from ..models.point3d import Point3d
control_points = cast(List[Point3d], d.pop("control_points", UNSET))
curve_get_control_points = cls(
control_points=control_points,
)
curve_get_control_points.additional_properties = d
return curve_get_control_points
@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

View File

@ -0,0 +1,62 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.curve_type import CurveType
from ..types import UNSET, Unset
FH = TypeVar("FH", bound="CurveGetType")
@attr.s(auto_attribs=True)
class CurveGetType:
"""The response from the `CurveGetType` command.""" # noqa: E501
curve_type: Union[Unset, CurveType] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.curve_type, Unset):
curve_type = self.curve_type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if curve_type is not UNSET:
field_dict["curve_type"] = curve_type
return field_dict
@classmethod
def from_dict(cls: Type[FH], src_dict: Dict[str, Any]) -> FH:
d = src_dict.copy()
_curve_type = d.pop("curve_type", UNSET)
curve_type: Union[Unset, CurveType]
if isinstance(_curve_type, Unset):
curve_type = UNSET
else:
curve_type = _curve_type # type: ignore[arg-type]
curve_get_type = cls(
curve_type=curve_type,
)
curve_get_type.additional_properties = d
return curve_get_type
@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

View File

@ -0,0 +1,11 @@
from enum import Enum
class CurveType(str, Enum):
"""The type of Curve (embedded within path)""" # noqa: E501
LINE = "line"
NURBS = "nurbs"
def __str__(self) -> str:
return str(self.value)

View File

@ -8,7 +8,7 @@ from ..models.currency import Currency
from ..models.new_address import NewAddress
from ..types import UNSET, Unset
US = TypeVar("US", bound="Customer")
NH = TypeVar("NH", bound="Customer")
@attr.s(auto_attribs=True)
@ -22,7 +22,7 @@ class Customer:
delinquent: Union[Unset, bool] = False
email: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
metadata: Union[Unset, Any] = UNSET
metadata: Union[Unset, Dict[str, str]] = UNSET
name: Union[Unset, str] = UNSET
phone: Union[Unset, str] = UNSET
@ -41,6 +41,7 @@ class Customer:
email = self.email
id = self.id
metadata = self.metadata
name = self.name
phone = self.phone
@ -71,7 +72,7 @@ class Customer:
return field_dict
@classmethod
def from_dict(cls: Type[US], src_dict: Dict[str, Any]) -> US:
def from_dict(cls: Type[NH], src_dict: Dict[str, Any]) -> NH:
d = src_dict.copy()
_address = d.pop("address", UNSET)
address: Union[Unset, NewAddress]
@ -103,6 +104,7 @@ class Customer:
id = d.pop("id", UNSET)
metadata = d.pop("metadata", UNSET)
name = d.pop("name", UNSET)
phone = d.pop("phone", UNSET)

View File

@ -7,7 +7,7 @@ from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..types import UNSET, Unset
KQ = TypeVar("KQ", bound="CustomerBalance")
BB = TypeVar("BB", bound="CustomerBalance")
@attr.s(auto_attribs=True)
@ -64,7 +64,7 @@ class CustomerBalance:
return field_dict
@classmethod
def from_dict(cls: Type[KQ], src_dict: Dict[str, Any]) -> KQ:
def from_dict(cls: Type[BB], src_dict: Dict[str, Any]) -> BB:
d = src_dict.copy()
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]

View File

@ -5,7 +5,7 @@ import attr
from ..models.o_auth2_grant_type import OAuth2GrantType
from ..types import UNSET, Unset
FH = TypeVar("FH", bound="DeviceAccessTokenRequestForm")
PJ = TypeVar("PJ", bound="DeviceAccessTokenRequestForm")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class DeviceAccessTokenRequestForm:
return field_dict
@classmethod
def from_dict(cls: Type[FH], src_dict: Dict[str, Any]) -> FH:
def from_dict(cls: Type[PJ], src_dict: Dict[str, Any]) -> PJ:
d = src_dict.copy()
client_id = d.pop("client_id", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
NH = TypeVar("NH", bound="DeviceAuthRequestForm")
TV = TypeVar("TV", bound="DeviceAuthRequestForm")
@attr.s(auto_attribs=True)
@ -27,7 +27,7 @@ class DeviceAuthRequestForm:
return field_dict
@classmethod
def from_dict(cls: Type[NH], src_dict: Dict[str, Any]) -> NH:
def from_dict(cls: Type[TV], src_dict: Dict[str, Any]) -> TV:
d = src_dict.copy()
client_id = d.pop("client_id", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
BB = TypeVar("BB", bound="DeviceAuthVerifyParams")
CR = TypeVar("CR", bound="DeviceAuthVerifyParams")
@attr.s(auto_attribs=True)
@ -27,7 +27,7 @@ class DeviceAuthVerifyParams:
return field_dict
@classmethod
def from_dict(cls: Type[BB], src_dict: Dict[str, Any]) -> BB:
def from_dict(cls: Type[CR], src_dict: Dict[str, Any]) -> CR:
d = src_dict.copy()
user_code = d.pop("user_code", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.coupon import Coupon
from ..types import UNSET, Unset
PJ = TypeVar("PJ", bound="Discount")
CE = TypeVar("CE", bound="Discount")
@attr.s(auto_attribs=True)
@ -29,7 +29,7 @@ class Discount:
return field_dict
@classmethod
def from_dict(cls: Type[PJ], src_dict: Dict[str, Any]) -> PJ:
def from_dict(cls: Type[CE], src_dict: Dict[str, Any]) -> CE:
d = src_dict.copy()
_coupon = d.pop("coupon", UNSET)
coupon: Union[Unset, Coupon]

View File

@ -5,12 +5,13 @@ import attr
from ..models.commit import Commit
from ..models.plugins_info import PluginsInfo
from ..models.registry_service_config import RegistryServiceConfig
from ..models.runtime import Runtime
from ..models.system_info_cgroup_driver_enum import SystemInfoCgroupDriverEnum
from ..models.system_info_cgroup_version_enum import SystemInfoCgroupVersionEnum
from ..models.system_info_isolation_enum import SystemInfoIsolationEnum
from ..types import UNSET, Unset
TV = TypeVar("TV", bound="DockerSystemInfo")
MS = TypeVar("MS", bound="DockerSystemInfo")
@attr.s(auto_attribs=True)
@ -73,7 +74,9 @@ class DockerSystemInfo:
product_license: Union[Unset, str] = UNSET
registry_config: Union[Unset, RegistryServiceConfig] = UNSET
runc_commit: Union[Unset, Commit] = UNSET
runtimes: Union[Unset, Any] = UNSET
from ..models.runtime import Runtime
runtimes: Union[Unset, Dict[str, Runtime]] = UNSET
security_options: Union[Unset, List[str]] = UNSET
server_version: Union[Unset, str] = UNSET
swap_limit: Union[Unset, bool] = False
@ -155,7 +158,12 @@ class DockerSystemInfo:
registry_config = self.registry_config
if not isinstance(self.runc_commit, Unset):
runc_commit = self.runc_commit
runtimes = self.runtimes
runtimes: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.runtimes, Unset):
new_dict: Dict[str, Any] = {}
for key, value in self.runtimes.items():
new_dict[key] = value.to_dict()
runtimes = new_dict
security_options: Union[Unset, List[str]] = UNSET
if not isinstance(self.security_options, Unset):
security_options = self.security_options
@ -293,7 +301,7 @@ class DockerSystemInfo:
return field_dict
@classmethod
def from_dict(cls: Type[TV], src_dict: Dict[str, Any]) -> TV:
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
d = src_dict.copy()
architecture = d.pop("architecture", UNSET)
@ -449,7 +457,15 @@ class DockerSystemInfo:
else:
runc_commit = _runc_commit # type: ignore[arg-type]
runtimes = d.pop("runtimes", UNSET)
_runtimes = d.pop("runtimes", UNSET)
if isinstance(_runtimes, Unset):
runtimes = UNSET
else:
new_map: Dict[str, Runtime] = {}
for k, v in _runtimes.items():
new_map[k] = Runtime.from_dict(v) # type: ignore
runtimes = new_map # type: ignore
security_options = cast(List[str], d.pop("security_options", UNSET))
server_version = d.pop("server_version", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
CR = TypeVar("CR", bound="EmailAuthenticationForm")
LT = TypeVar("LT", bound="EmailAuthenticationForm")
@attr.s(auto_attribs=True)
@ -31,7 +31,7 @@ class EmailAuthenticationForm:
return field_dict
@classmethod
def from_dict(cls: Type[CR], src_dict: Dict[str, Any]) -> CR:
def from_dict(cls: Type[LT], src_dict: Dict[str, Any]) -> LT:
d = src_dict.copy()
callback_url = d.pop("callback_url", UNSET)

15
kittycad/models/empty.py Normal file
View File

@ -0,0 +1,15 @@
from typing import Any, Dict, Type, TypeVar
import attr
VI = TypeVar("VI", bound="Empty")
@attr.s(auto_attribs=True)
class Empty:
def __str__(self) -> str:
return ""
@classmethod
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> Any:
return {}

View File

@ -8,7 +8,7 @@ from ..models.environment import Environment
from ..models.file_system_metadata import FileSystemMetadata
from ..types import UNSET, Unset
MS = TypeVar("MS", bound="EngineMetadata")
ED = TypeVar("ED", bound="EngineMetadata")
@attr.s(auto_attribs=True)
@ -57,7 +57,7 @@ class EngineMetadata:
return field_dict
@classmethod
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
def from_dict(cls: Type[ED], src_dict: Dict[str, Any]) -> ED:
d = src_dict.copy()
async_jobs_running = d.pop("async_jobs_running", UNSET)

View File

@ -0,0 +1,57 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
YY = TypeVar("YY", bound="EntityGetAllChildUuids")
@attr.s(auto_attribs=True)
class EntityGetAllChildUuids:
"""The response from the `EntityGetAllChildUuids` command.""" # noqa: E501
entity_ids: Union[Unset, List[str]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_ids: Union[Unset, List[str]] = UNSET
if not isinstance(self.entity_ids, Unset):
entity_ids = self.entity_ids
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_ids is not UNSET:
field_dict["entity_ids"] = entity_ids
return field_dict
@classmethod
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY:
d = src_dict.copy()
entity_ids = cast(List[str], d.pop("entity_ids", UNSET))
entity_get_all_child_uuids = cls(
entity_ids=entity_ids,
)
entity_get_all_child_uuids.additional_properties = d
return entity_get_all_child_uuids
@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

View File

@ -0,0 +1,55 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
DO = TypeVar("DO", bound="EntityGetChildUuid")
@attr.s(auto_attribs=True)
class EntityGetChildUuid:
"""The response from the `EntityGetChildUuid` command.""" # noqa: E501
entity_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_id = self.entity_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_id is not UNSET:
field_dict["entity_id"] = entity_id
return field_dict
@classmethod
def from_dict(cls: Type[DO], src_dict: Dict[str, Any]) -> DO:
d = src_dict.copy()
entity_id = d.pop("entity_id", UNSET)
entity_get_child_uuid = cls(
entity_id=entity_id,
)
entity_get_child_uuid.additional_properties = d
return entity_get_child_uuid
@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

View File

@ -0,0 +1,55 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
FZ = TypeVar("FZ", bound="EntityGetNumChildren")
@attr.s(auto_attribs=True)
class EntityGetNumChildren:
"""The response from the `EntityGetNumChildren` command.""" # noqa: E501
num: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
num = self.num
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if num is not UNSET:
field_dict["num"] = num
return field_dict
@classmethod
def from_dict(cls: Type[FZ], src_dict: Dict[str, Any]) -> FZ:
d = src_dict.copy()
num = d.pop("num", UNSET)
entity_get_num_children = cls(
num=num,
)
entity_get_num_children.additional_properties = d
return entity_get_num_children
@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

View File

@ -0,0 +1,55 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
GL = TypeVar("GL", bound="EntityGetParentId")
@attr.s(auto_attribs=True)
class EntityGetParentId:
"""The response from the `EntityGetParentId` command.""" # noqa: E501
entity_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_id = self.entity_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_id is not UNSET:
field_dict["entity_id"] = entity_id
return field_dict
@classmethod
def from_dict(cls: Type[GL], src_dict: Dict[str, Any]) -> GL:
d = src_dict.copy()
entity_id = d.pop("entity_id", UNSET)
entity_get_parent_id = cls(
entity_id=entity_id,
)
entity_get_parent_id.additional_properties = d
return entity_get_parent_id
@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

View File

@ -12,6 +12,7 @@ class EntityType(str, Enum):
SOLID3D = "solid3d"
EDGE = "edge"
FACE = "face"
PLANE = "plane"
def __str__(self) -> str:
return str(self.value)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
LT = TypeVar("LT", bound="Error")
NN = TypeVar("NN", bound="Error")
@attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class Error:
return field_dict
@classmethod
def from_dict(cls: Type[LT], src_dict: Dict[str, Any]) -> LT:
def from_dict(cls: Type[NN], src_dict: Dict[str, Any]) -> NN:
d = src_dict.copy()
error_code = d.pop("error_code", UNSET)

View File

@ -2,12 +2,22 @@ from enum import Enum
class ErrorCode(str, Enum):
"""The type of errorcode.""" # noqa: E501
"""The type of error sent by the KittyCAD API.""" # noqa: E501
"""# User requested something impossible or invalid """ # noqa: E501
BAD_REQUEST = "bad_request"
"""# Engine failed to complete request, consider retrying """ # noqa: E501
"""# Graphics engine failed to complete request, consider retrying """ # noqa: E501
INTERNAL_ENGINE = "internal_engine"
"""# API failed to complete request, consider retrying """ # noqa: E501
INTERNAL_API = "internal_api"
"""# User requested something geometrically or graphically impossible. Don't retry this request, as it's inherently impossible. Instead, read the error message and change your request. """ # noqa: E501
BAD_REQUEST = "bad_request"
"""# Client sent invalid JSON. """ # noqa: E501
INVALID_JSON = "invalid_json"
"""# Problem sending data between client and KittyCAD API. """ # noqa: E501
CONNECTION_PROBLEM = "connection_problem"
"""# Client sent a Websocket message type which the KittyCAD API does not handle. """ # noqa: E501
MESSAGE_TYPE_NOT_ACCEPTED = "message_type_not_accepted"
"""# Client sent a Websocket message intended for WebRTC but it was configured as a WebRTC connection. """ # noqa: E501
MESSAGE_TYPE_NOT_ACCEPTED_FOR_WEB_R_T_C = "message_type_not_accepted_for_web_r_t_c"
def __str__(self) -> str:
return str(self.value)

View File

@ -6,7 +6,7 @@ from ..models.docker_system_info import DockerSystemInfo
from ..models.environment import Environment
from ..types import UNSET, Unset
YY = TypeVar("YY", bound="ExecutorMetadata")
OH = TypeVar("OH", bound="ExecutorMetadata")
@attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class ExecutorMetadata:
return field_dict
@classmethod
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY:
def from_dict(cls: Type[OH], src_dict: Dict[str, Any]) -> OH:
d = src_dict.copy()
_docker_info = d.pop("docker_info", UNSET)
docker_info: Union[Unset, DockerSystemInfo]

View File

@ -4,47 +4,47 @@ import attr
from ..types import UNSET, Unset
ED = TypeVar("ED", bound="ErrorResponse")
VI = TypeVar("VI", bound="Export")
@attr.s(auto_attribs=True)
class ErrorResponse:
"""The error response.""" # noqa: E501
class Export:
"""The response from the `Export` endpoint.""" # noqa: E501
from ..models.engine_error import EngineError
from ..models.export_file import ExportFile
errors: Union[Unset, List[EngineError]] = UNSET
files: Union[Unset, List[ExportFile]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.engine_error import EngineError
from ..models.export_file import ExportFile
errors: Union[Unset, List[EngineError]] = UNSET
if not isinstance(self.errors, Unset):
errors = self.errors
files: Union[Unset, List[ExportFile]] = UNSET
if not isinstance(self.files, Unset):
files = self.files
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if errors is not UNSET:
field_dict["errors"] = errors
if files is not UNSET:
field_dict["files"] = files
return field_dict
@classmethod
def from_dict(cls: Type[ED], src_dict: Dict[str, Any]) -> ED:
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> VI:
d = src_dict.copy()
from ..models.engine_error import EngineError
from ..models.export_file import ExportFile
errors = cast(List[EngineError], d.pop("errors", UNSET))
files = cast(List[ExportFile], d.pop("files", UNSET))
error_response = cls(
errors=errors,
export = cls(
files=files,
)
error_response.additional_properties = d
return error_response
export.additional_properties = d
return export
@property
def additional_keys(self) -> List[str]:

View File

@ -2,22 +2,25 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.base64data import Base64Data
from ..types import UNSET, Unset
DO = TypeVar("DO", bound="ExportFile")
ET = TypeVar("ET", bound="ExportFile")
@attr.s(auto_attribs=True)
class ExportFile:
"""A file to be exported to the client.""" # noqa: E501
contents: Union[Unset, str] = UNSET
contents: Union[Unset, Base64Data] = UNSET
name: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
contents = self.contents
contents: Union[Unset, str] = UNSET
if not isinstance(self.contents, Unset):
contents = self.contents.get_encoded()
name = self.name
field_dict: Dict[str, Any] = {}
@ -31,9 +34,14 @@ class ExportFile:
return field_dict
@classmethod
def from_dict(cls: Type[DO], src_dict: Dict[str, Any]) -> DO:
def from_dict(cls: Type[ET], src_dict: Dict[str, Any]) -> ET:
d = src_dict.copy()
contents = d.pop("contents", UNSET)
_contents = d.pop("contents", UNSET)
contents: Union[Unset, Base64Data]
if isinstance(_contents, Unset):
contents = UNSET
else:
contents = Base64Data(bytes(_contents, "utf-8"))
name = d.pop("name", UNSET)

View File

@ -6,7 +6,7 @@ from dateutil.parser import isoparse
from ..types import UNSET, Unset
FZ = TypeVar("FZ", bound="ExtendedUser")
QF = TypeVar("QF", bound="ExtendedUser")
@attr.s(auto_attribs=True)
@ -98,7 +98,7 @@ class ExtendedUser:
return field_dict
@classmethod
def from_dict(cls: Type[FZ], src_dict: Dict[str, Any]) -> FZ:
def from_dict(cls: Type[QF], src_dict: Dict[str, Any]) -> QF:
d = src_dict.copy()
company = d.pop("company", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
GL = TypeVar("GL", bound="ExtendedUserResultsPage")
DI = TypeVar("DI", bound="ExtendedUserResultsPage")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class ExtendedUserResultsPage:
return field_dict
@classmethod
def from_dict(cls: Type[GL], src_dict: Dict[str, Any]) -> GL:
def from_dict(cls: Type[DI], src_dict: Dict[str, Any]) -> DI:
d = src_dict.copy()
from ..models.extended_user import ExtendedUser

View File

@ -0,0 +1,77 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
OJ = TypeVar("OJ", bound="FailureWebSocketResponse")
@attr.s(auto_attribs=True)
class FailureWebSocketResponse:
"""Unsuccessful Websocket response.""" # noqa: E501
from ..models.api_error import ApiError
errors: Union[Unset, List[ApiError]] = UNSET
request_id: Union[Unset, str] = UNSET
success: Union[Unset, bool] = False
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.api_error import ApiError
errors: Union[Unset, List[ApiError]] = UNSET
if not isinstance(self.errors, Unset):
errors = self.errors
request_id = self.request_id
success = self.success
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if errors is not UNSET:
field_dict["errors"] = errors
if request_id is not UNSET:
field_dict["request_id"] = request_id
if success is not UNSET:
field_dict["success"] = success
return field_dict
@classmethod
def from_dict(cls: Type[OJ], src_dict: Dict[str, Any]) -> OJ:
d = src_dict.copy()
from ..models.api_error import ApiError
errors = cast(List[ApiError], d.pop("errors", UNSET))
request_id = d.pop("request_id", UNSET)
success = d.pop("success", UNSET)
failure_web_socket_response = cls(
errors=errors,
request_id=request_id,
success=success,
)
failure_web_socket_response.additional_properties = d
return failure_web_socket_response
@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

View File

@ -0,0 +1,13 @@
from enum import Enum
class FbxStorage(str, Enum):
"""Describes the storage format of an FBX file.""" # noqa: E501
"""# ASCII FBX encoding. """ # noqa: E501
ASCII = "ascii"
"""# Binary FBX encoding. """ # noqa: E501
BINARY = "binary"
def __str__(self) -> str:
return str(self.value)

View File

@ -11,7 +11,7 @@ from ..models.unit_length import UnitLength
from ..models.uuid import Uuid
from ..types import UNSET, Unset
NN = TypeVar("NN", bound="FileCenterOfMass")
UF = TypeVar("UF", bound="FileCenterOfMass")
@attr.s(auto_attribs=True)
@ -86,7 +86,7 @@ class FileCenterOfMass:
return field_dict
@classmethod
def from_dict(cls: Type[NN], src_dict: Dict[str, Any]) -> NN:
def from_dict(cls: Type[UF], src_dict: Dict[str, Any]) -> UF:
d = src_dict.copy()
_center_of_mass = d.pop("center_of_mass", UNSET)
center_of_mass: Union[Unset, Point3d]

View File

@ -5,6 +5,7 @@ import attr
from dateutil.parser import isoparse
from ..models.api_call_status import ApiCallStatus
from ..models.base64data import Base64Data
from ..models.file_export_format import FileExportFormat
from ..models.file_import_format import FileImportFormat
from ..models.input_format import InputFormat
@ -12,7 +13,7 @@ from ..models.output_format import OutputFormat
from ..models.uuid import Uuid
from ..types import UNSET, Unset
OH = TypeVar("OH", bound="FileConversion")
YF = TypeVar("YF", bound="FileConversion")
@attr.s(auto_attribs=True)
@ -23,10 +24,10 @@ class FileConversion:
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
output: Union[Unset, str] = UNSET
output: Union[Unset, Base64Data] = UNSET
output_format: Union[Unset, FileExportFormat] = UNSET
output_format_options: Union[Unset, OutputFormat] = UNSET
outputs: Union[Unset, Any] = UNSET
outputs: Union[Unset, Dict[str, Base64Data]] = UNSET
src_format: Union[Unset, FileImportFormat] = UNSET
src_format_options: Union[Unset, InputFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
@ -45,12 +46,19 @@ class FileConversion:
created_at = self.created_at.isoformat()
error = self.error
id = self.id
output = self.output
output: Union[Unset, str] = UNSET
if not isinstance(self.output, Unset):
output = self.output.get_encoded()
if not isinstance(self.output_format, Unset):
output_format = self.output_format
if not isinstance(self.output_format_options, Unset):
output_format_options = self.output_format_options
outputs = self.outputs
outputs: Union[Unset, Dict[str, str]] = UNSET
if not isinstance(self.outputs, Unset):
new_dict: Dict[str, str] = {}
for key, value in self.outputs.items():
new_dict[key] = value.get_encoded()
outputs = new_dict
if not isinstance(self.src_format, Unset):
src_format = self.src_format
if not isinstance(self.src_format_options, Unset):
@ -100,7 +108,7 @@ class FileConversion:
return field_dict
@classmethod
def from_dict(cls: Type[OH], src_dict: Dict[str, Any]) -> OH:
def from_dict(cls: Type[YF], src_dict: Dict[str, Any]) -> YF:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
@ -125,7 +133,12 @@ class FileConversion:
else:
id = _id # type: ignore[arg-type]
output = d.pop("output", UNSET)
_output = d.pop("output", UNSET)
output: Union[Unset, Base64Data]
if isinstance(_output, Unset):
output = UNSET
else:
output = Base64Data(bytes(_output, "utf-8"))
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, FileExportFormat]
@ -141,7 +154,15 @@ class FileConversion:
else:
output_format_options = _output_format_options # type: ignore[arg-type]
outputs = d.pop("outputs", UNSET)
_outputs = d.pop("outputs", UNSET)
if isinstance(_outputs, Unset):
outputs = UNSET
else:
new_map: Dict[str, Base64Data] = {}
for k, v in _outputs.items():
new_map[k] = Base64Data(bytes(v, "utf-8"))
outputs = new_map # type: ignore
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, FileImportFormat]
if isinstance(_src_format, Unset):

View File

@ -11,7 +11,7 @@ from ..models.unit_mass import UnitMass
from ..models.uuid import Uuid
from ..types import UNSET, Unset
VI = TypeVar("VI", bound="FileDensity")
PY = TypeVar("PY", bound="FileDensity")
@attr.s(auto_attribs=True)
@ -94,7 +94,7 @@ class FileDensity:
return field_dict
@classmethod
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> VI:
def from_dict(cls: Type[PY], src_dict: Dict[str, Any]) -> PY:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,21 @@ from enum import Enum
class FileExportFormat(str, Enum):
"""The valid types of output file formats.""" # noqa: E501
"""# glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). """ # noqa: E501
"""# Autodesk Filmbox (FBX) format. <https://en.wikipedia.org/wiki/FBX> """ # noqa: E501
FBX = "fbx"
"""# Binary glTF 2.0.
This is a single binary with .glb extension.
This is better if you want a compressed format as opposed to the human readable glTF that lacks compression. """ # noqa: E501
GLB = "glb"
"""# glTF 2.0. Embedded glTF 2.0 (pretty printed).
Single JSON file with .gltf extension binary data encoded as base64 data URIs.
The JSON contents are pretty printed.
It is human readable, single file, and you can view the diff easily in a git commit. """ # noqa: E501
GLTF = "gltf"
"""# The OBJ file format. <https://en.wikipedia.org/wiki/Wavefront_.obj_file> It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. """ # noqa: E501
OBJ = "obj"

View File

@ -4,6 +4,8 @@ from enum import Enum
class FileImportFormat(str, Enum):
"""The valid types of source file formats.""" # noqa: E501
"""# Autodesk Filmbox (FBX) format. <https://en.wikipedia.org/wiki/FBX> """ # noqa: E501
FBX = "fbx"
"""# glTF 2.0. """ # noqa: E501
GLTF = "gltf"
"""# The OBJ file format. <https://en.wikipedia.org/wiki/Wavefront_.obj_file> It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. """ # noqa: E501

View File

@ -11,7 +11,7 @@ from ..models.unit_mass import UnitMass
from ..models.uuid import Uuid
from ..types import UNSET, Unset
ET = TypeVar("ET", bound="FileMass")
LK = TypeVar("LK", bound="FileMass")
@attr.s(auto_attribs=True)
@ -94,7 +94,7 @@ class FileMass:
return field_dict
@classmethod
def from_dict(cls: Type[ET], src_dict: Dict[str, Any]) -> ET:
def from_dict(cls: Type[LK], src_dict: Dict[str, Any]) -> LK:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]

View File

@ -10,7 +10,7 @@ from ..models.unit_area import UnitArea
from ..models.uuid import Uuid
from ..types import UNSET, Unset
QF = TypeVar("QF", bound="FileSurfaceArea")
AR = TypeVar("AR", bound="FileSurfaceArea")
@attr.s(auto_attribs=True)
@ -84,7 +84,7 @@ class FileSurfaceArea:
return field_dict
@classmethod
def from_dict(cls: Type[QF], src_dict: Dict[str, Any]) -> QF:
def from_dict(cls: Type[AR], src_dict: Dict[str, Any]) -> AR:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
DI = TypeVar("DI", bound="FileSystemMetadata")
WB = TypeVar("WB", bound="FileSystemMetadata")
@attr.s(auto_attribs=True)
@ -29,7 +29,7 @@ class FileSystemMetadata:
return field_dict
@classmethod
def from_dict(cls: Type[DI], src_dict: Dict[str, Any]) -> DI:
def from_dict(cls: Type[WB], src_dict: Dict[str, Any]) -> WB:
d = src_dict.copy()
ok = d.pop("ok", UNSET)

View File

@ -10,7 +10,7 @@ from ..models.unit_volume import UnitVolume
from ..models.uuid import Uuid
from ..types import UNSET, Unset
OJ = TypeVar("OJ", bound="FileVolume")
KK = TypeVar("KK", bound="FileVolume")
@attr.s(auto_attribs=True)
@ -84,7 +84,7 @@ class FileVolume:
return field_dict
@classmethod
def from_dict(cls: Type[OJ], src_dict: Dict[str, Any]) -> OJ:
def from_dict(cls: Type[KK], src_dict: Dict[str, Any]) -> KK:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
UF = TypeVar("UF", bound="Gateway")
HC = TypeVar("HC", bound="Gateway")
@attr.s(auto_attribs=True)
@ -43,7 +43,7 @@ class Gateway:
return field_dict
@classmethod
def from_dict(cls: Type[UF], src_dict: Dict[str, Any]) -> UF:
def from_dict(cls: Type[HC], src_dict: Dict[str, Any]) -> HC:
d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET)

View File

@ -0,0 +1,62 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.entity_type import EntityType
from ..types import UNSET, Unset
FM = TypeVar("FM", bound="GetEntityType")
@attr.s(auto_attribs=True)
class GetEntityType:
"""The response from the `GetEntityType` command.""" # noqa: E501
entity_type: Union[Unset, EntityType] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.entity_type, Unset):
entity_type = self.entity_type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_type is not UNSET:
field_dict["entity_type"] = entity_type
return field_dict
@classmethod
def from_dict(cls: Type[FM], src_dict: Dict[str, Any]) -> FM:
d = src_dict.copy()
_entity_type = d.pop("entity_type", UNSET)
entity_type: Union[Unset, EntityType]
if isinstance(_entity_type, Unset):
entity_type = UNSET
else:
entity_type = _entity_type # type: ignore[arg-type]
get_entity_type = cls(
entity_type=entity_type,
)
get_entity_type.additional_properties = d
return get_entity_type
@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

View File

@ -0,0 +1,15 @@
from enum import Enum
class GltfPresentation(str, Enum):
"""Describes the presentation style of the glTF JSON.""" # noqa: E501
"""# Condense the JSON into the smallest possible size. """ # noqa: E501
COMPACT = "compact"
"""# Expand the JSON into a more human readable format.
This is the default setting. """ # noqa: E501
PRETTY = "pretty"
def __str__(self) -> str:
return str(self.value)

View File

@ -1,14 +1,12 @@
from enum import Enum
class Storage(str, Enum):
class GltfStorage(str, Enum):
"""Describes the storage format of a glTF 2.0 scene.""" # noqa: E501
"""# Binary glTF 2.0.
This is a single binary with .glb extension.
This is the default setting. """ # noqa: E501
This is a single binary with .glb extension. """ # noqa: E501
BINARY = "binary"
"""# Standard glTF 2.0.
@ -16,7 +14,9 @@ This is a JSON file with .gltf extension paired with a separate binary blob file
STANDARD = "standard"
"""# Embedded glTF 2.0.
Single JSON file with .gltf extension binary data encoded as base64 data URIs. """ # noqa: E501
Single JSON file with .gltf extension binary data encoded as base64 data URIs.
This is the default setting. """ # noqa: E501
EMBEDDED = "embedded"
def __str__(self) -> str:

View File

@ -0,0 +1,62 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
PV = TypeVar("PV", bound="HighlightSetEntity")
@attr.s(auto_attribs=True)
class HighlightSetEntity:
"""The response from the `HighlightSetEntity` command.""" # noqa: E501
entity_id: Union[Unset, str] = UNSET
sequence: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entity_id = self.entity_id
sequence = self.sequence
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entity_id is not UNSET:
field_dict["entity_id"] = entity_id
if sequence is not UNSET:
field_dict["sequence"] = sequence
return field_dict
@classmethod
def from_dict(cls: Type[PV], src_dict: Dict[str, Any]) -> PV:
d = src_dict.copy()
entity_id = d.pop("entity_id", UNSET)
sequence = d.pop("sequence", UNSET)
highlight_set_entity = cls(
entity_id=entity_id,
sequence=sequence,
)
highlight_set_entity.additional_properties = d
return highlight_set_entity
@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

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
YF = TypeVar("YF", bound="IceServer")
QI = TypeVar("QI", bound="IceServer")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class IceServer:
return field_dict
@classmethod
def from_dict(cls: Type[YF], src_dict: Dict[str, Any]) -> YF:
def from_dict(cls: Type[QI], src_dict: Dict[str, Any]) -> QI:
d = src_dict.copy()
credential = d.pop("credential", UNSET)

View File

@ -0,0 +1,13 @@
from enum import Enum
class ImageFormat(str, Enum):
"""Enum containing the variety of image formats snapshots may be exported to.""" # noqa: E501
"""# .png format """ # noqa: E501
PNG = "png"
"""# .jpeg format """ # noqa: E501
JPEG = "jpeg"
def __str__(self) -> str:
return str(self.value)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
PY = TypeVar("PY", bound="IndexInfo")
TP = TypeVar("TP", bound="IndexInfo")
@attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class IndexInfo:
return field_dict
@classmethod
def from_dict(cls: Type[PY], src_dict: Dict[str, Any]) -> PY:
def from_dict(cls: Type[TP], src_dict: Dict[str, Any]) -> TP:
d = src_dict.copy()
mirrors = cast(List[str], d.pop("mirrors", UNSET))

View File

@ -6,7 +6,57 @@ from ..models.system import System
from ..models.unit_length import UnitLength
from ..types import UNSET, Unset
LK = TypeVar("LK", bound="gltf")
CF = TypeVar("CF", bound="fbx")
@attr.s(auto_attribs=True)
class fbx:
"""Autodesk Filmbox (FBX) format.""" # noqa: E501
type: str = "fbx"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[CF], src_dict: Dict[str, Any]) -> CF:
d = src_dict.copy()
type = d.pop("type", UNSET)
fbx = cls(
type=type,
)
fbx.additional_properties = d
return fbx
@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
OM = TypeVar("OM", bound="gltf")
@attr.s(auto_attribs=True)
@ -28,7 +78,7 @@ class gltf:
return field_dict
@classmethod
def from_dict(cls: Type[LK], src_dict: Dict[str, Any]) -> LK:
def from_dict(cls: Type[OM], src_dict: Dict[str, Any]) -> OM:
d = src_dict.copy()
type = d.pop("type", UNSET)
@ -56,7 +106,7 @@ class gltf:
return key in self.additional_properties
AR = TypeVar("AR", bound="step")
EN = TypeVar("EN", bound="step")
@attr.s(auto_attribs=True)
@ -78,7 +128,7 @@ class step:
return field_dict
@classmethod
def from_dict(cls: Type[AR], src_dict: Dict[str, Any]) -> AR:
def from_dict(cls: Type[EN], src_dict: Dict[str, Any]) -> EN:
d = src_dict.copy()
type = d.pop("type", UNSET)
@ -106,7 +156,7 @@ class step:
return key in self.additional_properties
WB = TypeVar("WB", bound="obj")
RS = TypeVar("RS", bound="obj")
@attr.s(auto_attribs=True)
@ -138,7 +188,7 @@ class obj:
return field_dict
@classmethod
def from_dict(cls: Type[WB], src_dict: Dict[str, Any]) -> WB:
def from_dict(cls: Type[RS], src_dict: Dict[str, Any]) -> RS:
d = src_dict.copy()
_coords = d.pop("coords", UNSET)
coords: Union[Unset, System]
@ -182,7 +232,7 @@ class obj:
return key in self.additional_properties
KK = TypeVar("KK", bound="ply")
LR = TypeVar("LR", bound="ply")
@attr.s(auto_attribs=True)
@ -214,7 +264,7 @@ class ply:
return field_dict
@classmethod
def from_dict(cls: Type[KK], src_dict: Dict[str, Any]) -> KK:
def from_dict(cls: Type[LR], src_dict: Dict[str, Any]) -> LR:
d = src_dict.copy()
_coords = d.pop("coords", UNSET)
coords: Union[Unset, System]
@ -258,7 +308,7 @@ class ply:
return key in self.additional_properties
HC = TypeVar("HC", bound="stl")
MP = TypeVar("MP", bound="stl")
@attr.s(auto_attribs=True)
@ -290,7 +340,7 @@ class stl:
return field_dict
@classmethod
def from_dict(cls: Type[HC], src_dict: Dict[str, Any]) -> HC:
def from_dict(cls: Type[MP], src_dict: Dict[str, Any]) -> MP:
d = src_dict.copy()
_coords = d.pop("coords", UNSET)
coords: Union[Unset, System]
@ -334,4 +384,4 @@ class stl:
return key in self.additional_properties
InputFormat = Union[gltf, step, obj, ply, stl]
InputFormat = Union[fbx, gltf, step, obj, ply, stl]

View File

@ -8,7 +8,7 @@ from ..models.currency import Currency
from ..models.invoice_status import InvoiceStatus
from ..types import UNSET, Unset
FM = TypeVar("FM", bound="Invoice")
WF = TypeVar("WF", bound="Invoice")
@attr.s(auto_attribs=True)
@ -33,7 +33,7 @@ class Invoice:
from ..models.invoice_line_item import InvoiceLineItem
lines: Union[Unset, List[InvoiceLineItem]] = UNSET
metadata: Union[Unset, Any] = UNSET
metadata: Union[Unset, Dict[str, str]] = UNSET
number: Union[Unset, str] = UNSET
paid: Union[Unset, bool] = False
pdf: Union[Unset, str] = UNSET
@ -74,6 +74,7 @@ class Invoice:
if not isinstance(self.lines, Unset):
lines = self.lines
metadata = self.metadata
number = self.number
paid = self.paid
pdf = self.pdf
@ -143,7 +144,7 @@ class Invoice:
return field_dict
@classmethod
def from_dict(cls: Type[FM], src_dict: Dict[str, Any]) -> FM:
def from_dict(cls: Type[WF], src_dict: Dict[str, Any]) -> WF:
d = src_dict.copy()
amount_due = d.pop("amount_due", UNSET)
@ -188,6 +189,7 @@ class Invoice:
lines = cast(List[InvoiceLineItem], d.pop("lines", UNSET))
metadata = d.pop("metadata", UNSET)
number = d.pop("number", UNSET)
paid = d.pop("paid", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.currency import Currency
from ..types import UNSET, Unset
PV = TypeVar("PV", bound="InvoiceLineItem")
RO = TypeVar("RO", bound="InvoiceLineItem")
@attr.s(auto_attribs=True)
@ -17,7 +17,7 @@ class InvoiceLineItem:
description: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
invoice_item: Union[Unset, str] = UNSET
metadata: Union[Unset, Any] = UNSET
metadata: Union[Unset, Dict[str, str]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -49,7 +49,7 @@ class InvoiceLineItem:
return field_dict
@classmethod
def from_dict(cls: Type[PV], src_dict: Dict[str, Any]) -> PV:
def from_dict(cls: Type[RO], src_dict: Dict[str, Any]) -> RO:
d = src_dict.copy()
amount = d.pop("amount", UNSET)

View File

@ -7,7 +7,7 @@ from ..models.jetstream_stats import JetstreamStats
from ..models.meta_cluster_info import MetaClusterInfo
from ..types import UNSET, Unset
QI = TypeVar("QI", bound="Jetstream")
DN = TypeVar("DN", bound="Jetstream")
@attr.s(auto_attribs=True)
@ -41,7 +41,7 @@ class Jetstream:
return field_dict
@classmethod
def from_dict(cls: Type[QI], src_dict: Dict[str, Any]) -> QI:
def from_dict(cls: Type[DN], src_dict: Dict[str, Any]) -> DN:
d = src_dict.copy()
_config = d.pop("config", UNSET)
config: Union[Unset, JetstreamConfig]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
TP = TypeVar("TP", bound="JetstreamApiStats")
BA = TypeVar("BA", bound="JetstreamApiStats")
@attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class JetstreamApiStats:
return field_dict
@classmethod
def from_dict(cls: Type[TP], src_dict: Dict[str, Any]) -> TP:
def from_dict(cls: Type[BA], src_dict: Dict[str, Any]) -> BA:
d = src_dict.copy()
errors = d.pop("errors", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
CF = TypeVar("CF", bound="JetstreamConfig")
OR = TypeVar("OR", bound="JetstreamConfig")
@attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class JetstreamConfig:
return field_dict
@classmethod
def from_dict(cls: Type[CF], src_dict: Dict[str, Any]) -> CF:
def from_dict(cls: Type[OR], src_dict: Dict[str, Any]) -> OR:
d = src_dict.copy()
domain = d.pop("domain", UNSET)

View File

@ -5,7 +5,7 @@ import attr
from ..models.jetstream_api_stats import JetstreamApiStats
from ..types import UNSET, Unset
OM = TypeVar("OM", bound="JetstreamStats")
CB = TypeVar("CB", bound="JetstreamStats")
@attr.s(auto_attribs=True)
@ -53,7 +53,7 @@ class JetstreamStats:
return field_dict
@classmethod
def from_dict(cls: Type[OM], src_dict: Dict[str, Any]) -> OM:
def from_dict(cls: Type[CB], src_dict: Dict[str, Any]) -> CB:
d = src_dict.copy()
accounts = d.pop("accounts", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
EN = TypeVar("EN", bound="LeafNode")
LC = TypeVar("LC", bound="LeafNode")
@attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class LeafNode:
return field_dict
@classmethod
def from_dict(cls: Type[EN], src_dict: Dict[str, Any]) -> EN:
def from_dict(cls: Type[LC], src_dict: Dict[str, Any]) -> LC:
d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
RS = TypeVar("RS", bound="Mesh")
TO = TypeVar("TO", bound="Mesh")
@attr.s(auto_attribs=True)
@ -25,7 +25,7 @@ class Mesh:
return field_dict
@classmethod
def from_dict(cls: Type[RS], src_dict: Dict[str, Any]) -> RS:
def from_dict(cls: Type[TO], src_dict: Dict[str, Any]) -> TO:
d = src_dict.copy()
mesh = d.pop("mesh", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
LR = TypeVar("LR", bound="MetaClusterInfo")
ZP = TypeVar("ZP", bound="MetaClusterInfo")
@attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class MetaClusterInfo:
return field_dict
@classmethod
def from_dict(cls: Type[LR], src_dict: Dict[str, Any]) -> LR:
def from_dict(cls: Type[ZP], src_dict: Dict[str, Any]) -> ZP:
d = src_dict.copy()
cluster_size = d.pop("cluster_size", UNSET)

View File

@ -11,7 +11,7 @@ from ..models.file_system_metadata import FileSystemMetadata
from ..models.point_e_metadata import PointEMetadata
from ..types import UNSET, Unset
MP = TypeVar("MP", bound="Metadata")
EO = TypeVar("EO", bound="Metadata")
@attr.s(auto_attribs=True)
@ -71,7 +71,7 @@ class Metadata:
return field_dict
@classmethod
def from_dict(cls: Type[MP], src_dict: Dict[str, Any]) -> MP:
def from_dict(cls: Type[EO], src_dict: Dict[str, Any]) -> EO:
d = src_dict.copy()
_cache = d.pop("cache", UNSET)
cache: Union[Unset, CacheMetadata]

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ from ..models.modeling_cmd import ModelingCmd
from ..models.modeling_cmd_id import ModelingCmdId
from ..types import UNSET, Unset
GN = TypeVar("GN", bound="ModelingCmdReq")
WR = TypeVar("WR", bound="ModelingCmdReq")
@attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class ModelingCmdReq:
return field_dict
@classmethod
def from_dict(cls: Type[GN], src_dict: Dict[str, Any]) -> GN:
def from_dict(cls: Type[WR], src_dict: Dict[str, Any]) -> WR:
d = src_dict.copy()
_cmd = d.pop("cmd", UNSET)
cmd: Union[Unset, ModelingCmd]

View File

@ -2,21 +2,29 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.modeling_cmd_req import ModelingCmdReq
from ..types import UNSET, Unset
GD = TypeVar("GD", bound="ModelingCmdReqBatch")
XL = TypeVar("XL", bound="ModelingCmdReqBatch")
@attr.s(auto_attribs=True)
class ModelingCmdReqBatch:
"""A batch set of graphics commands submitted to the KittyCAD engine via the Modeling API.""" # noqa: E501
cmds: Union[Unset, Any] = UNSET
from ..models.modeling_cmd_req import ModelingCmdReq
cmds: Union[Unset, Dict[str, ModelingCmdReq]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
cmds = self.cmds
cmds: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.cmds, Unset):
new_dict: Dict[str, Any] = {}
for key, value in self.cmds.items():
new_dict[key] = value.to_dict()
cmds = new_dict
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
@ -27,9 +35,16 @@ class ModelingCmdReqBatch:
return field_dict
@classmethod
def from_dict(cls: Type[GD], src_dict: Dict[str, Any]) -> GD:
def from_dict(cls: Type[XL], src_dict: Dict[str, Any]) -> XL:
d = src_dict.copy()
cmds = d.pop("cmds", UNSET)
_cmds = d.pop("cmds", UNSET)
if isinstance(_cmds, Unset):
cmds = UNSET
else:
new_map: Dict[str, ModelingCmdReq] = {}
for k, v in _cmds.items():
new_map[k] = ModelingCmdReq.from_dict(v) # type: ignore
cmds = new_map # type: ignore
modeling_cmd_req_batch = cls(
cmds=cmds,

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
VJ = TypeVar("VJ", bound="ModelingError")
ZX = TypeVar("ZX", bound="ModelingError")
@attr.s(auto_attribs=True)
@ -39,7 +39,7 @@ class ModelingError:
return field_dict
@classmethod
def from_dict(cls: Type[VJ], src_dict: Dict[str, Any]) -> VJ:
def from_dict(cls: Type[ZX], src_dict: Dict[str, Any]) -> ZX:
d = src_dict.copy()
error_code = d.pop("error_code", UNSET)

View File

@ -13,7 +13,7 @@ success = OkModelingCmdResponse
error = ModelingError
OX = TypeVar("OX", bound="cancelled")
FT = TypeVar("FT", bound="cancelled")
@attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class cancelled:
return field_dict
@classmethod
def from_dict(cls: Type[OX], src_dict: Dict[str, Any]) -> OX:
def from_dict(cls: Type[FT], src_dict: Dict[str, Any]) -> FT:
d = src_dict.copy()
_what_failed = d.pop("what_failed", UNSET)
what_failed: Union[Unset, ModelingCmdId]

View File

@ -2,21 +2,29 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.modeling_outcome import ModelingOutcome
from ..types import UNSET, Unset
YW = TypeVar("YW", bound="ModelingOutcomes")
NX = TypeVar("NX", bound="ModelingOutcomes")
@attr.s(auto_attribs=True)
class ModelingOutcomes:
"""The result from a batch of modeling commands.""" # noqa: E501
outcomes: Union[Unset, Any] = UNSET
from ..models.modeling_outcome import ModelingOutcome
outcomes: Union[Unset, Dict[str, ModelingOutcome]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
outcomes = self.outcomes
outcomes: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.outcomes, Unset):
new_dict: Dict[str, Any] = {}
for key, value in self.outcomes.items():
new_dict[key] = value.to_dict()
outcomes = new_dict
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
@ -27,9 +35,16 @@ class ModelingOutcomes:
return field_dict
@classmethod
def from_dict(cls: Type[YW], src_dict: Dict[str, Any]) -> YW:
def from_dict(cls: Type[NX], src_dict: Dict[str, Any]) -> NX:
d = src_dict.copy()
outcomes = d.pop("outcomes", UNSET)
_outcomes = d.pop("outcomes", UNSET)
if isinstance(_outcomes, Unset):
outcomes = UNSET
else:
new_map: Dict[str, ModelingOutcome] = {}
for k, v in _outcomes.items():
new_map[k] = ModelingOutcome.from_dict(v) # type: ignore
outcomes = new_map # type: ignore
modeling_outcomes = cls(
outcomes=outcomes,

View File

@ -0,0 +1,66 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
SC = TypeVar("SC", bound="MouseClick")
@attr.s(auto_attribs=True)
class MouseClick:
"""The response from the `MouseClick` command.""" # noqa: E501
entities_modified: Union[Unset, List[str]] = UNSET
entities_selected: Union[Unset, List[str]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
entities_modified: Union[Unset, List[str]] = UNSET
if not isinstance(self.entities_modified, Unset):
entities_modified = self.entities_modified
entities_selected: Union[Unset, List[str]] = UNSET
if not isinstance(self.entities_selected, Unset):
entities_selected = self.entities_selected
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if entities_modified is not UNSET:
field_dict["entities_modified"] = entities_modified
if entities_selected is not UNSET:
field_dict["entities_selected"] = entities_selected
return field_dict
@classmethod
def from_dict(cls: Type[SC], src_dict: Dict[str, Any]) -> SC:
d = src_dict.copy()
entities_modified = cast(List[str], d.pop("entities_modified", UNSET))
entities_selected = cast(List[str], d.pop("entities_selected", UNSET))
mouse_click = cls(
entities_modified=entities_modified,
entities_selected=entities_selected,
)
mouse_click.additional_properties = d
return mouse_click
@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

View File

@ -5,7 +5,7 @@ import attr
from ..models.country_code import CountryCode
from ..types import UNSET, Unset
QX = TypeVar("QX", bound="NewAddress")
TX = TypeVar("TX", bound="NewAddress")
@attr.s(auto_attribs=True)
@ -53,7 +53,7 @@ class NewAddress:
return field_dict
@classmethod
def from_dict(cls: Type[QX], src_dict: Dict[str, Any]) -> QX:
def from_dict(cls: Type[TX], src_dict: Dict[str, Any]) -> TX:
d = src_dict.copy()
city = d.pop("city", UNSET)

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
NO = TypeVar("NO", bound="OAuth2ClientInfo")
JA = TypeVar("JA", bound="OAuth2ClientInfo")
@attr.s(auto_attribs=True)
@ -35,7 +35,7 @@ class OAuth2ClientInfo:
return field_dict
@classmethod
def from_dict(cls: Type[NO], src_dict: Dict[str, Any]) -> NO:
def from_dict(cls: Type[JA], src_dict: Dict[str, Any]) -> JA:
d = src_dict.copy()
csrf_token = d.pop("csrf_token", UNSET)

File diff suppressed because it is too large Load Diff

View File

@ -1,181 +1,42 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.modeling_cmd_id import ModelingCmdId
from ..models.rtc_ice_candidate import RtcIceCandidate
from ..models.rtc_session_description import RtcSessionDescription
from ..models.snake_case_result import SnakeCaseResult
from ..types import UNSET, Unset
OS = TypeVar("OS", bound="trickle_ice")
@attr.s(auto_attribs=True)
class trickle_ice:
"""The trickle ICE candidate response.""" # noqa: E501
candidate: Union[Unset, RtcIceCandidate] = UNSET
type: str = "trickle_ice"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.candidate, Unset):
candidate = self.candidate
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if candidate is not UNSET:
field_dict["candidate"] = candidate
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[OS], src_dict: Dict[str, Any]) -> OS:
d = src_dict.copy()
_candidate = d.pop("candidate", UNSET)
candidate: Union[Unset, RtcIceCandidate]
if isinstance(_candidate, Unset):
candidate = UNSET
else:
candidate = _candidate # type: ignore[arg-type]
type = d.pop("type", UNSET)
trickle_ice = cls(
candidate=candidate,
type=type,
)
trickle_ice.additional_properties = d
return trickle_ice
@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
WP = TypeVar("WP", bound="sdp_answer")
@attr.s(auto_attribs=True)
class sdp_answer:
"""The SDP answer response.""" # noqa: E501
answer: Union[Unset, RtcSessionDescription] = UNSET
type: str = "sdp_answer"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.answer, Unset):
answer = self.answer
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if answer is not UNSET:
field_dict["answer"] = answer
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[WP], src_dict: Dict[str, Any]) -> WP:
d = src_dict.copy()
_answer = d.pop("answer", UNSET)
answer: Union[Unset, RtcSessionDescription]
if isinstance(_answer, Unset):
answer = UNSET
else:
answer = _answer # type: ignore[arg-type]
type = d.pop("type", UNSET)
sdp_answer = cls(
answer=answer,
type=type,
)
sdp_answer.additional_properties = d
return sdp_answer
@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
XO = TypeVar("XO", bound="ice_server_info")
YK = TypeVar("YK", bound="ice_server_info")
@attr.s(auto_attribs=True)
class ice_server_info:
"""The ICE server info response.""" # noqa: E501
"""Information about the ICE servers.""" # noqa: E501
from ..models.ice_server import IceServer
ice_servers: Union[Unset, List[IceServer]] = UNSET
data: Union[Unset, Any] = UNSET
type: str = "ice_server_info"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.ice_server import IceServer
ice_servers: Union[Unset, List[IceServer]] = UNSET
if not isinstance(self.ice_servers, Unset):
ice_servers = self.ice_servers
data = self.data
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if ice_servers is not UNSET:
field_dict["ice_servers"] = ice_servers
if data is not UNSET:
field_dict["data"] = data
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[XO], src_dict: Dict[str, Any]) -> XO:
def from_dict(cls: Type[YK], src_dict: Dict[str, Any]) -> YK:
d = src_dict.copy()
from ..models.ice_server import IceServer
ice_servers = cast(List[IceServer], d.pop("ice_servers", UNSET))
data = d.pop("data", UNSET)
type = d.pop("type", UNSET)
ice_server_info = cls(
ice_servers=ice_servers,
data=data,
type=type,
)
@ -199,59 +60,151 @@ class ice_server_info:
return key in self.additional_properties
LN = TypeVar("LN", bound="modeling")
WS = TypeVar("WS", bound="trickle_ice")
@attr.s(auto_attribs=True)
class trickle_ice:
"""The trickle ICE candidate response.""" # noqa: E501
data: Union[Unset, Any] = UNSET
type: str = "trickle_ice"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
data = self.data
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if data is not UNSET:
field_dict["data"] = data
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[WS], src_dict: Dict[str, Any]) -> WS:
d = src_dict.copy()
data = d.pop("data", UNSET)
type = d.pop("type", UNSET)
trickle_ice = cls(
data=data,
type=type,
)
trickle_ice.additional_properties = d
return trickle_ice
@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
SL = TypeVar("SL", bound="sdp_answer")
@attr.s(auto_attribs=True)
class sdp_answer:
"""The SDP answer response.""" # noqa: E501
data: Union[Unset, Any] = UNSET
type: str = "sdp_answer"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
data = self.data
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if data is not UNSET:
field_dict["data"] = data
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[SL], src_dict: Dict[str, Any]) -> SL:
d = src_dict.copy()
data = d.pop("data", UNSET)
type = d.pop("type", UNSET)
sdp_answer = cls(
data=data,
type=type,
)
sdp_answer.additional_properties = d
return sdp_answer
@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
MK = TypeVar("MK", bound="modeling")
@attr.s(auto_attribs=True)
class modeling:
"""The modeling command response.""" # noqa: E501
cmd_id: Union[Unset, ModelingCmdId] = UNSET
result: Union[Unset, SnakeCaseResult] = UNSET
data: Union[Unset, Any] = UNSET
type: str = "modeling"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.cmd_id, Unset):
cmd_id = self.cmd_id
if not isinstance(self.result, Unset):
result = self.result
data = self.data
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if cmd_id is not UNSET:
field_dict["cmd_id"] = cmd_id
if result is not UNSET:
field_dict["result"] = result
if data is not UNSET:
field_dict["data"] = data
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[LN], src_dict: Dict[str, Any]) -> LN:
def from_dict(cls: Type[MK], src_dict: Dict[str, Any]) -> MK:
d = src_dict.copy()
_cmd_id = d.pop("cmd_id", UNSET)
cmd_id: Union[Unset, ModelingCmdId]
if isinstance(_cmd_id, Unset):
cmd_id = UNSET
else:
cmd_id = _cmd_id # type: ignore[arg-type]
_result = d.pop("result", UNSET)
result: Union[Unset, SnakeCaseResult]
if isinstance(_result, Unset):
result = UNSET
else:
result = _result # type: ignore[arg-type]
data = d.pop("data", UNSET)
type = d.pop("type", UNSET)
modeling = cls(
cmd_id=cmd_id,
result=result,
data=data,
type=type,
)
@ -275,48 +228,39 @@ class modeling:
return key in self.additional_properties
KR = TypeVar("KR", bound="export")
TU = TypeVar("TU", bound="export")
@attr.s(auto_attribs=True)
class export:
"""The export command response, this is sent as binary.""" # noqa: E501
"""The exported files.""" # noqa: E501
from ..models.raw_file import RawFile
files: Union[Unset, List[RawFile]] = UNSET
data: Union[Unset, Any] = UNSET
type: str = "export"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.raw_file import RawFile
files: Union[Unset, List[RawFile]] = UNSET
if not isinstance(self.files, Unset):
files = self.files
data = self.data
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if files is not UNSET:
field_dict["files"] = files
if data is not UNSET:
field_dict["data"] = data
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[KR], src_dict: Dict[str, Any]) -> KR:
def from_dict(cls: Type[TU], src_dict: Dict[str, Any]) -> TU:
d = src_dict.copy()
from ..models.raw_file import RawFile
files = cast(List[RawFile], d.pop("files", UNSET))
data = d.pop("data", UNSET)
type = d.pop("type", UNSET)
export = cls(
files=files,
data=data,
type=type,
)
@ -340,4 +284,6 @@ class export:
return key in self.additional_properties
WebSocketResponses = Union[trickle_ice, sdp_answer, ice_server_info, modeling, export]
OkWebSocketResponseData = Union[
ice_server_info, trickle_ice, sdp_answer, modeling, export
]

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
PQ = TypeVar("PQ", bound="Onboarding")
FY = TypeVar("FY", bound="Onboarding")
@attr.s(auto_attribs=True)
@ -37,7 +37,7 @@ class Onboarding:
return field_dict
@classmethod
def from_dict(cls: Type[PQ], src_dict: Dict[str, Any]) -> PQ:
def from_dict(cls: Type[FY], src_dict: Dict[str, Any]) -> FY:
d = src_dict.copy()
first_call_from__their_machine_date = d.pop(
"first_call_from_their_machine_date", UNSET

View File

@ -4,7 +4,7 @@ import attr
from ..types import UNSET, Unset
IM = TypeVar("IM", bound="OutputFile")
FD = TypeVar("FD", bound="OutputFile")
@attr.s(auto_attribs=True)
@ -31,7 +31,7 @@ class OutputFile:
return field_dict
@classmethod
def from_dict(cls: Type[IM], src_dict: Dict[str, Any]) -> IM:
def from_dict(cls: Type[FD], src_dict: Dict[str, Any]) -> FD:
d = src_dict.copy()
contents = d.pop("contents", UNSET)

View File

@ -2,19 +2,23 @@ from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.storage import Storage
from ..models.fbx_storage import FbxStorage
from ..models.gltf_presentation import GltfPresentation
from ..models.gltf_storage import GltfStorage
from ..models.ply_storage import PlyStorage
from ..models.stl_storage import StlStorage
from ..models.system import System
from ..types import UNSET, Unset
OU = TypeVar("OU", bound="gltf")
TZ = TypeVar("TZ", bound="fbx")
@attr.s(auto_attribs=True)
class gltf:
"""glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). If you prefer ascii output, you can set that option for the export.""" # noqa: E501
class fbx:
"""Autodesk Filmbox (FBX) format.""" # noqa: E501
storage: Union[Unset, Storage] = UNSET
type: str = "gltf"
storage: Union[Unset, FbxStorage] = UNSET
type: str = "fbx"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -33,10 +37,85 @@ class gltf:
return field_dict
@classmethod
def from_dict(cls: Type[OU], src_dict: Dict[str, Any]) -> OU:
def from_dict(cls: Type[TZ], src_dict: Dict[str, Any]) -> TZ:
d = src_dict.copy()
_storage = d.pop("storage", UNSET)
storage: Union[Unset, Storage]
storage: Union[Unset, FbxStorage]
if isinstance(_storage, Unset):
storage = UNSET
else:
storage = _storage # type: ignore[arg-type]
type = d.pop("type", UNSET)
fbx = cls(
storage=storage,
type=type,
)
fbx.additional_properties = d
return fbx
@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
AX = TypeVar("AX", bound="gltf")
@attr.s(auto_attribs=True)
class gltf:
"""glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). If you prefer ascii output, you can set that option for the export.""" # noqa: E501
presentation: Union[Unset, GltfPresentation] = UNSET
storage: Union[Unset, GltfStorage] = UNSET
type: str = "gltf"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
if not isinstance(self.presentation, Unset):
presentation = self.presentation
if not isinstance(self.storage, Unset):
storage = self.storage
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if presentation is not UNSET:
field_dict["presentation"] = presentation
if storage is not UNSET:
field_dict["storage"] = storage
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[AX], src_dict: Dict[str, Any]) -> AX:
d = src_dict.copy()
_presentation = d.pop("presentation", UNSET)
presentation: Union[Unset, GltfPresentation]
if isinstance(_presentation, Unset):
presentation = UNSET
else:
presentation = _presentation # type: ignore[arg-type]
_storage = d.pop("storage", UNSET)
storage: Union[Unset, GltfStorage]
if isinstance(_storage, Unset):
storage = UNSET
else:
@ -45,6 +124,7 @@ class gltf:
type = d.pop("type", UNSET)
gltf = cls(
presentation=presentation,
storage=storage,
type=type,
)
@ -69,7 +149,7 @@ class gltf:
return key in self.additional_properties
KL = TypeVar("KL", bound="obj")
RQ = TypeVar("RQ", bound="obj")
@attr.s(auto_attribs=True)
@ -96,7 +176,7 @@ class obj:
return field_dict
@classmethod
def from_dict(cls: Type[KL], src_dict: Dict[str, Any]) -> KL:
def from_dict(cls: Type[RQ], src_dict: Dict[str, Any]) -> RQ:
d = src_dict.copy()
_coords = d.pop("coords", UNSET)
coords: Union[Unset, System]
@ -132,7 +212,7 @@ class obj:
return key in self.additional_properties
XI = TypeVar("XI", bound="ply")
ZL = TypeVar("ZL", bound="ply")
@attr.s(auto_attribs=True)
@ -140,7 +220,7 @@ class ply:
"""The PLY Polygon File Format.""" # noqa: E501
coords: Union[Unset, System] = UNSET
storage: Union[Unset, Storage] = UNSET
storage: Union[Unset, PlyStorage] = UNSET
type: str = "ply"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -164,7 +244,7 @@ class ply:
return field_dict
@classmethod
def from_dict(cls: Type[XI], src_dict: Dict[str, Any]) -> XI:
def from_dict(cls: Type[ZL], src_dict: Dict[str, Any]) -> ZL:
d = src_dict.copy()
_coords = d.pop("coords", UNSET)
coords: Union[Unset, System]
@ -174,7 +254,7 @@ class ply:
coords = _coords # type: ignore[arg-type]
_storage = d.pop("storage", UNSET)
storage: Union[Unset, Storage]
storage: Union[Unset, PlyStorage]
if isinstance(_storage, Unset):
storage = UNSET
else:
@ -208,7 +288,7 @@ class ply:
return key in self.additional_properties
PO = TypeVar("PO", bound="step")
CM = TypeVar("CM", bound="step")
@attr.s(auto_attribs=True)
@ -235,7 +315,7 @@ class step:
return field_dict
@classmethod
def from_dict(cls: Type[PO], src_dict: Dict[str, Any]) -> PO:
def from_dict(cls: Type[CM], src_dict: Dict[str, Any]) -> CM:
d = src_dict.copy()
_coords = d.pop("coords", UNSET)
coords: Union[Unset, System]
@ -271,7 +351,7 @@ class step:
return key in self.additional_properties
PS = TypeVar("PS", bound="stl")
OS = TypeVar("OS", bound="stl")
@attr.s(auto_attribs=True)
@ -279,7 +359,7 @@ class stl:
"""*ST**ereo**L**ithography format.""" # noqa: E501
coords: Union[Unset, System] = UNSET
storage: Union[Unset, Storage] = UNSET
storage: Union[Unset, StlStorage] = UNSET
type: str = "stl"
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -303,7 +383,7 @@ class stl:
return field_dict
@classmethod
def from_dict(cls: Type[PS], src_dict: Dict[str, Any]) -> PS:
def from_dict(cls: Type[OS], src_dict: Dict[str, Any]) -> OS:
d = src_dict.copy()
_coords = d.pop("coords", UNSET)
coords: Union[Unset, System]
@ -313,7 +393,7 @@ class stl:
coords = _coords # type: ignore[arg-type]
_storage = d.pop("storage", UNSET)
storage: Union[Unset, Storage]
storage: Union[Unset, StlStorage]
if isinstance(_storage, Unset):
storage = UNSET
else:
@ -347,4 +427,4 @@ class stl:
return key in self.additional_properties
OutputFormat = Union[gltf, obj, ply, step, stl]
OutputFormat = Union[fbx, gltf, obj, ply, step, stl]

View File

@ -0,0 +1,14 @@
from enum import Enum
class PathCommand(str, Enum):
"""The path component command type (within a Path)""" # noqa: E501
MOVE_TO = "move_to"
LINE_TO = "line_to"
BEZ_CURVE_TO = "bez_curve_to"
NURBS_CURVE_TO = "nurbs_curve_to"
ADD_ARC = "add_arc"
def __str__(self) -> str:
return str(self.value)

View File

@ -0,0 +1,63 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
WP = TypeVar("WP", bound="PathGetInfo")
@attr.s(auto_attribs=True)
class PathGetInfo:
"""The response from the `PathGetInfo` command.""" # noqa: E501
from ..models.path_segment_info import PathSegmentInfo
segments: Union[Unset, List[PathSegmentInfo]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.path_segment_info import PathSegmentInfo
segments: Union[Unset, List[PathSegmentInfo]] = UNSET
if not isinstance(self.segments, Unset):
segments = self.segments
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if segments is not UNSET:
field_dict["segments"] = segments
return field_dict
@classmethod
def from_dict(cls: Type[WP], src_dict: Dict[str, Any]) -> WP:
d = src_dict.copy()
from ..models.path_segment_info import PathSegmentInfo
segments = cast(List[PathSegmentInfo], d.pop("segments", UNSET))
path_get_info = cls(
segments=segments,
)
path_get_info.additional_properties = d
return path_get_info
@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

View File

@ -6,7 +6,7 @@ from ..models.point2d import Point2d
from ..models.point3d import Point3d
from ..types import UNSET, Unset
WR = TypeVar("WR", bound="line")
XO = TypeVar("XO", bound="line")
@attr.s(auto_attribs=True)
@ -33,7 +33,7 @@ class line:
return field_dict
@classmethod
def from_dict(cls: Type[WR], src_dict: Dict[str, Any]) -> WR:
def from_dict(cls: Type[XO], src_dict: Dict[str, Any]) -> XO:
d = src_dict.copy()
_end = d.pop("end", UNSET)
end: Union[Unset, Point3d]
@ -69,7 +69,7 @@ class line:
return key in self.additional_properties
XL = TypeVar("XL", bound="arc")
LN = TypeVar("LN", bound="arc")
@attr.s(auto_attribs=True)
@ -108,7 +108,7 @@ class arc:
return field_dict
@classmethod
def from_dict(cls: Type[XL], src_dict: Dict[str, Any]) -> XL:
def from_dict(cls: Type[LN], src_dict: Dict[str, Any]) -> LN:
d = src_dict.copy()
angle_end = d.pop("angle_end", UNSET)
@ -153,7 +153,7 @@ class arc:
return key in self.additional_properties
ZX = TypeVar("ZX", bound="bezier")
KR = TypeVar("KR", bound="bezier")
@attr.s(auto_attribs=True)
@ -190,7 +190,7 @@ class bezier:
return field_dict
@classmethod
def from_dict(cls: Type[ZX], src_dict: Dict[str, Any]) -> ZX:
def from_dict(cls: Type[KR], src_dict: Dict[str, Any]) -> KR:
d = src_dict.copy()
_control1 = d.pop("control1", UNSET)
control1: Union[Unset, Point3d]

Some files were not shown because too many files have changed in this diff Show More