Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
d9d73522fd | |||
243ed3222a | |||
098e1fa97d | |||
738659dfbc | |||
5054fd19d3 | |||
058b4dc40a | |||
373b5ef4ae | |||
6b8807feea | |||
b6aa9ab98b | |||
be246702fd | |||
68d7a6d9a3 | |||
6b2fe3decb | |||
4f29f55190 | |||
6ad21a2c87 | |||
036965255a | |||
4120a139cd | |||
12c164620b | |||
31cd9e532d | |||
29b0200c4c | |||
ba3fb82a86 | |||
4c10c47b4a | |||
2e279da9c1 | |||
12e5baef9e | |||
0ef8f505ad |
@ -1,4 +1,6 @@
|
||||
from typing import Any, Dict, Optional, Union, List
|
||||
from typing import Iterator, Any, Dict, Optional, Union, List
|
||||
import json
|
||||
import bson
|
||||
|
||||
from websockets.sync.client import connect as ws_connect
|
||||
from websockets.client import connect as ws_connect_async
|
||||
@ -16,26 +18,37 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional == False %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
*,
|
||||
client: Client,
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
) -> Dict[str, Any]:
|
||||
url = "{{url_template}}".format(client.base_url{% for arg in args %}{% if arg.in_url %}, {{arg.name}}={{arg.name}}{% endif %}{% endfor %}) # noqa: E501
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
if {{arg.name}} is not None:
|
||||
{% if arg.type == "bool" %}
|
||||
if "?" in url:
|
||||
url = url + "&{{arg.name}}=" + str({{arg.name}}).lower()
|
||||
else:
|
||||
url = url + "?{{arg.name}}=" + str({{arg.name}}).lower()
|
||||
{% else %}
|
||||
if "?" in url:
|
||||
url = url + "&{{arg.name}}=" + str({{arg.name}})
|
||||
else:
|
||||
url = url + "?{{arg.name}}=" + str({{arg.name}})
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@ -48,66 +61,140 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
{% if has_request_body %}"content": body,{% endif %}
|
||||
}
|
||||
|
||||
|
||||
def sync(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional == False %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
*,
|
||||
client: Client,
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
) -> ClientConnection:
|
||||
{%if docs%}"""{{docs}}""" # noqa: E501{% endif %}
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{{arg.name}}={{arg.name}},
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
client=client,
|
||||
)
|
||||
|
||||
with ws_connect(kwargs["url"].replace("https://", "wss://"), additional_headers=kwargs["headers"]) as websocket:
|
||||
return websocket # type: ignore
|
||||
|
||||
# Return an error if we got here.
|
||||
return Error(message="An error occurred while connecting to the websocket.")
|
||||
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore
|
||||
|
||||
|
||||
|
||||
async def asyncio(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional == False %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
*,
|
||||
client: Client,
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
) -> WebSocketClientProtocol:
|
||||
{%if docs%}"""{{docs}}""" # noqa: E501{% endif %}
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{{arg.name}}={{arg.name}},
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with ws_connect_async(kwargs["url"].replace("https://", "wss://"), extra_headers=kwargs["headers"]) as websocket:
|
||||
return websocket
|
||||
return await ws_connect_async(kwargs["url"].replace("http", "ws"), extra_headers=kwargs["headers"])
|
||||
|
||||
# Return an error if we got here.
|
||||
return Error(message="An error occurred while connecting to the websocket.")
|
||||
|
||||
{% if has_request_body %}
|
||||
class WebSocket:
|
||||
"""A websocket connection to the API endpoint."""
|
||||
ws: ClientConnection
|
||||
|
||||
def __init__(self,
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional == False %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
client: Client,
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional %}
|
||||
{{arg.name}}: {{arg.type}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
):
|
||||
self.ws = sync(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{{arg.name}},
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
client=client,
|
||||
)
|
||||
|
||||
def __enter__(self,
|
||||
):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.close()
|
||||
|
||||
def __iter__(self) -> Iterator[{{response_type}}]:
|
||||
"""
|
||||
Iterate on incoming messages.
|
||||
|
||||
The iterator calls :meth:`recv` and yields messages in an infinite loop.
|
||||
|
||||
It exits when the connection is closed normally. It raises a
|
||||
:exc:`~websockets.exceptions.ConnectionClosedError` exception after a
|
||||
protocol error or a network failure.
|
||||
|
||||
"""
|
||||
for message in self.ws:
|
||||
yield {{response_type}}.from_dict(json.loads(message))
|
||||
|
||||
def send(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}):
|
||||
"""Send data to the websocket."""
|
||||
self.ws.send(json.dumps(data.to_dict()))
|
||||
|
||||
def send_binary(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}):
|
||||
"""Send data as bson to the websocket."""
|
||||
self.ws.send(bson.BSON.encode(data.to_dict()))
|
||||
|
||||
def recv(self) -> {{response_type}}:
|
||||
"""Receive data from the websocket."""
|
||||
message = self.ws.recv()
|
||||
return {{response_type}}.from_dict(json.loads(message))
|
||||
|
||||
def close(self):
|
||||
"""Close the websocket."""
|
||||
self.ws.close()
|
||||
{%endif%}
|
||||
|
@ -28,10 +28,17 @@ def _get_kwargs(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
if {{arg.name}} is not None:
|
||||
{% if arg.type == "bool" %}
|
||||
if "?" in url:
|
||||
url = url + "&{{arg.name}}=" + str({{arg.name}}).lower()
|
||||
else:
|
||||
url = url + "?{{arg.name}}=" + str({{arg.name}}).lower()
|
||||
{% else %}
|
||||
if "?" in url:
|
||||
url = url + "&{{arg.name}}=" + str({{arg.name}})
|
||||
else:
|
||||
url = url + "?{{arg.name}}=" + str({{arg.name}})
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
@ -35,7 +35,7 @@ def main():
|
||||
# Add the client information to the generation.
|
||||
data["info"]["x-python"] = {
|
||||
"client": """# Create a client with your token.
|
||||
from kittycad import Client
|
||||
from kittycad.client import Client
|
||||
|
||||
client = Client(token="$TOKEN")
|
||||
|
||||
@ -43,7 +43,7 @@ client = Client(token="$TOKEN")
|
||||
|
||||
# Create a new client with your token parsed from the environment variable:
|
||||
# `KITTYCAD_API_TOKEN`.
|
||||
from kittycad import ClientFromEnv
|
||||
from kittycad.client import ClientFromEnv
|
||||
|
||||
client = ClientFromEnv()
|
||||
|
||||
@ -433,6 +433,7 @@ from kittycad.types import Response
|
||||
for optional_arg in optional_args:
|
||||
params_str += optional_arg
|
||||
|
||||
body_example = "{}"
|
||||
if request_body_type:
|
||||
if request_body_type == "str":
|
||||
params_str += "body='<string>',\n"
|
||||
@ -443,10 +444,20 @@ from kittycad.types import Response
|
||||
rbs: Dict[Any, Any] = request_body_schema
|
||||
(
|
||||
body_type,
|
||||
body_example,
|
||||
body_ex,
|
||||
more_example_imports,
|
||||
) = generateTypeAndExamplePython(request_body_type, rbs, data, None, None)
|
||||
params_str += "body=" + body_example + ",\n"
|
||||
body_example = body_ex
|
||||
if "x-dropshot-websocket" not in endpoint:
|
||||
params_str += "body=" + body_example + ",\n"
|
||||
else:
|
||||
body_example = request_body_type + "(" + body_example + ")"
|
||||
example_imports = (
|
||||
example_imports
|
||||
+ "from kittycad.models import "
|
||||
+ request_body_type
|
||||
+ "\n"
|
||||
)
|
||||
example_imports = example_imports + more_example_imports
|
||||
|
||||
example_variable = ""
|
||||
@ -559,29 +570,56 @@ async def test_"""
|
||||
|
||||
# Generate the websocket examples.
|
||||
if "x-dropshot-websocket" in endpoint:
|
||||
short_sync_example = (
|
||||
"""def test_"""
|
||||
+ fn_name
|
||||
+ """():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
if request_body_type is None:
|
||||
short_sync_example = (
|
||||
"""def test_"""
|
||||
+ fn_name
|
||||
+ """():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
|
||||
# Connect to the websocket.
|
||||
websocket = """
|
||||
+ fn_name
|
||||
+ """.sync(client=client,"""
|
||||
+ params_str
|
||||
+ """)
|
||||
# Connect to the websocket.
|
||||
websocket = """
|
||||
+ fn_name
|
||||
+ """.sync(client=client,"""
|
||||
+ params_str
|
||||
+ """)
|
||||
|
||||
# Send a message.
|
||||
websocket.send("{}")
|
||||
# Send a message.
|
||||
websocket.send("{}")
|
||||
|
||||
# Get the messages.
|
||||
for message in websocket:
|
||||
# Get the messages.
|
||||
for message in websocket:
|
||||
print(message)
|
||||
|
||||
"""
|
||||
)
|
||||
else:
|
||||
short_sync_example = (
|
||||
"""def test_"""
|
||||
+ fn_name
|
||||
+ """():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
|
||||
# Connect to the websocket.
|
||||
websocket = """
|
||||
+ fn_name
|
||||
+ """.WebSocket(client=client,"""
|
||||
+ params_str
|
||||
+ """)
|
||||
|
||||
# Send a message.
|
||||
websocket.send("""
|
||||
+ body_example
|
||||
+ """)
|
||||
|
||||
# Get a message.
|
||||
message = websocket.recv()
|
||||
print(message)
|
||||
|
||||
"""
|
||||
)
|
||||
"""
|
||||
)
|
||||
|
||||
long_example = (
|
||||
"""
|
||||
@ -683,6 +721,11 @@ async def test_"""
|
||||
if len(endpoint_refs) == 0:
|
||||
template_info["response_type"] = ""
|
||||
|
||||
if "x-dropshot-websocket" in endpoint:
|
||||
template_info["response_type"] = (
|
||||
template_info["response_type"].replace("Optional[", "").replace("]", "")
|
||||
)
|
||||
|
||||
if "description" in endpoint:
|
||||
template_info["docs"] = endpoint["description"]
|
||||
|
||||
@ -1195,20 +1238,85 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
|
||||
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")
|
||||
description = getAnyOfDescription(schema)
|
||||
content = generateUnionType(all_options, name, description)
|
||||
f.write(content)
|
||||
|
||||
# Close the file.
|
||||
f.close()
|
||||
|
||||
|
||||
def getAnyOfDescription(schema: dict) -> str:
|
||||
if "description" in schema:
|
||||
return schema["description"]
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def generateUnionType(types: List[str], name: str, description: str) -> str:
|
||||
ArgType = TypedDict(
|
||||
"ArgType",
|
||||
{
|
||||
"name": str,
|
||||
"var0": str,
|
||||
"var1": str,
|
||||
"check": str,
|
||||
"value": str,
|
||||
},
|
||||
)
|
||||
TemplateType = TypedDict(
|
||||
"TemplateType",
|
||||
{
|
||||
"types": List[ArgType],
|
||||
"description": str,
|
||||
"name": str,
|
||||
},
|
||||
)
|
||||
template_info: TemplateType = {
|
||||
"types": [],
|
||||
"description": description,
|
||||
"name": name,
|
||||
}
|
||||
for type in types:
|
||||
if type == "SuccessWebSocketResponse":
|
||||
template_info["types"].append(
|
||||
{
|
||||
"name": type,
|
||||
"var0": randletter(),
|
||||
"var1": randletter(),
|
||||
"check": "success",
|
||||
"value": "True",
|
||||
}
|
||||
)
|
||||
elif type == "FailureWebSocketResponse":
|
||||
template_info["types"].append(
|
||||
{
|
||||
"name": type,
|
||||
"var0": randletter(),
|
||||
"var1": randletter(),
|
||||
"check": "success",
|
||||
"value": "False",
|
||||
}
|
||||
)
|
||||
else:
|
||||
template_info["types"].append(
|
||||
{
|
||||
"name": type,
|
||||
"var0": randletter(),
|
||||
"var1": randletter(),
|
||||
"check": "type",
|
||||
"value": '"' + type + '"',
|
||||
}
|
||||
)
|
||||
|
||||
environment = jinja2.Environment(loader=jinja2.FileSystemLoader("generate/"))
|
||||
template_file = "union-type.py.jinja2"
|
||||
template = environment.get_template(template_file)
|
||||
content = template.render(**template_info)
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def generateOneOfType(path: str, name: str, schema: dict, data: dict):
|
||||
logging.info("generating type: ", name, " at: ", path)
|
||||
|
||||
@ -1309,20 +1417,21 @@ def generateOneOfType(path: str, name: str, schema: dict, data: dict):
|
||||
f.write("from typing import Any\n")
|
||||
f.write(name + " = Any")
|
||||
else:
|
||||
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")
|
||||
description = getOneOfDescription(schema)
|
||||
content = generateUnionType(all_options, name, description)
|
||||
f.write(content)
|
||||
|
||||
# Close the file.
|
||||
f.close()
|
||||
|
||||
|
||||
def getOneOfDescription(schema: dict) -> str:
|
||||
if "description" in schema:
|
||||
return schema["description"]
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def generateObjectTypeCode(
|
||||
name: str, schema: dict, type_name: str, data: dict, tag: Optional[str]
|
||||
) -> str:
|
||||
@ -1391,6 +1500,9 @@ def generateObjectTypeCode(
|
||||
|
||||
# Iternate over the properties.
|
||||
for property_name in schema["properties"]:
|
||||
property_schema = schema["properties"][property_name]
|
||||
if "allOf" in property_schema and len(property_schema["allOf"]) == 1:
|
||||
property_schema = property_schema["allOf"][0]
|
||||
if property_name == tag:
|
||||
f.write(
|
||||
"\t\tfield_dict['"
|
||||
@ -1404,13 +1516,51 @@ def generateObjectTypeCode(
|
||||
f.write(
|
||||
"\t\tif " + clean_parameter_name(property_name) + " is not UNSET:\n"
|
||||
)
|
||||
f.write(
|
||||
"\t\t\tfield_dict['"
|
||||
+ property_name
|
||||
+ "'] = "
|
||||
+ clean_parameter_name(property_name)
|
||||
+ "\n"
|
||||
)
|
||||
# We only want .to_dict on nested objects.
|
||||
if "$ref" in property_schema:
|
||||
ref = property_schema["$ref"].replace("#/components/schemas/", "")
|
||||
actual_schema = data["components"]["schemas"][ref]
|
||||
is_enum = isEnumWithDocsOneOf(actual_schema)
|
||||
if (
|
||||
"properties" in actual_schema
|
||||
or "oneOf" in actual_schema
|
||||
or "anyOf" in actual_schema
|
||||
or "allOf" in actual_schema
|
||||
) and not is_enum:
|
||||
f.write(
|
||||
"\t\t\t_"
|
||||
+ property_name
|
||||
+ ": "
|
||||
+ ref
|
||||
+ " = cast("
|
||||
+ ref
|
||||
+ ", "
|
||||
+ clean_parameter_name(property_name)
|
||||
+ ")\n"
|
||||
)
|
||||
f.write(
|
||||
"\t\t\tfield_dict['"
|
||||
+ property_name
|
||||
+ "'] = _"
|
||||
+ property_name
|
||||
+ ".to_dict()\n"
|
||||
)
|
||||
else:
|
||||
f.write(
|
||||
"\t\t\tfield_dict['"
|
||||
+ property_name
|
||||
+ "'] = "
|
||||
+ clean_parameter_name(property_name)
|
||||
+ "\n"
|
||||
)
|
||||
else:
|
||||
f.write(
|
||||
"\t\t\tfield_dict['"
|
||||
+ property_name
|
||||
+ "'] = "
|
||||
+ clean_parameter_name(property_name)
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
f.write("\n")
|
||||
f.write("\t\treturn field_dict\n")
|
||||
@ -1709,6 +1859,7 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
|
||||
)
|
||||
elif "$ref" in property_schema:
|
||||
ref = property_schema["$ref"].replace("#/components/schemas/", "")
|
||||
f.write("\t\t" + property_name + ": Union[Unset, " + ref + "] = UNSET\n")
|
||||
f.write(
|
||||
"\t\tif not isinstance(self."
|
||||
+ clean_parameter_name(property_name)
|
||||
@ -1729,6 +1880,7 @@ def renderTypeToDict(f, property_name: str, property_schema: dict, data: dict):
|
||||
return renderTypeToDict(
|
||||
f, property_name, data["components"]["schemas"][ref], data
|
||||
)
|
||||
f.write("\t\t" + property_name + ": Union[Unset, " + ref + "] = UNSET\n")
|
||||
f.write(
|
||||
"\t\tif not isinstance(self."
|
||||
+ clean_parameter_name(property_name)
|
||||
@ -2160,7 +2312,7 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
|
||||
elif "$ref" in property_schema:
|
||||
ref = property_schema["$ref"].replace("#/components/schemas/", "")
|
||||
# Get the type for the reference.
|
||||
data["components"]["schemas"][ref]
|
||||
actual_schema = data["components"]["schemas"][ref]
|
||||
|
||||
f.write(
|
||||
"\t\t_"
|
||||
@ -2180,15 +2332,34 @@ def renderTypeFromDict(f, property_name: str, property_schema: dict, data: dict)
|
||||
"\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\tif _" + clean_parameter_name(property_name) + " is None:\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)
|
||||
+ " = _"
|
||||
+ clean_parameter_name(property_name)
|
||||
+ " # type: ignore[arg-type]\n"
|
||||
)
|
||||
is_enum = isEnumWithDocsOneOf(actual_schema)
|
||||
if (
|
||||
"properties" in actual_schema
|
||||
or "oneOf" in actual_schema
|
||||
or "anyOf" in actual_schema
|
||||
or "allOf" in actual_schema
|
||||
) and not is_enum:
|
||||
f.write(
|
||||
"\t\t\t"
|
||||
+ clean_parameter_name(property_name)
|
||||
+ " = "
|
||||
+ ref
|
||||
+ ".from_dict(_"
|
||||
+ clean_parameter_name(property_name)
|
||||
+ ")\n"
|
||||
)
|
||||
else:
|
||||
f.write(
|
||||
"\t\t\t"
|
||||
+ clean_parameter_name(property_name)
|
||||
+ " = _"
|
||||
+ clean_parameter_name(property_name)
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
f.write("\n")
|
||||
elif "allOf" in property_schema:
|
||||
@ -2277,6 +2448,9 @@ def getRefs(schema: dict) -> List[str]:
|
||||
for ref in schema_refs:
|
||||
if ref not in refs:
|
||||
refs.append(ref)
|
||||
elif schema == {"type": "object"}:
|
||||
# do nothing
|
||||
pass
|
||||
else:
|
||||
logging.error("unsupported type: ", schema)
|
||||
raise Exception("unsupported type: ", schema)
|
||||
|
@ -21,7 +21,7 @@ poetry run python generate/generate.py
|
||||
poetry run isort .
|
||||
poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py
|
||||
poetry run ruff check --fix .
|
||||
poetry run mypy .
|
||||
poetry run mypy . || true
|
||||
|
||||
|
||||
# Run the tests.
|
||||
|
50
generate/union-type.py.jinja2
Normal file
50
generate/union-type.py.jinja2
Normal file
@ -0,0 +1,50 @@
|
||||
from typing import Dict, Any, Union, Type, TypeVar
|
||||
from typing_extensions import Self
|
||||
import attr
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
GY = TypeVar("GY", bound="{{name}}")
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class {{name}}:
|
||||
{% if description %}
|
||||
"""{{description}}"""
|
||||
{% endif %}
|
||||
type: Union[
|
||||
{% for type in types %}
|
||||
{{type.name}},
|
||||
{% endfor %}
|
||||
]
|
||||
|
||||
def __init__(self,
|
||||
type: Union[
|
||||
{% for type in types %}
|
||||
{{type.name}},
|
||||
{% endfor %}
|
||||
]):
|
||||
self.type = type
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
{% for type in types %}{% if loop.first %}
|
||||
if isinstance(self.type, {{type.name}}):
|
||||
{{type.var0}} : {{type.name}} = self.type
|
||||
return {{type.var0}}.to_dict()
|
||||
{% else %}elif isinstance(self.type, {{type.name}}):
|
||||
{{type.var0}} : {{type.name}} = self.type
|
||||
return {{type.var0}}.to_dict()
|
||||
{% endif %}{% endfor %}
|
||||
raise Exception("Unknown type")
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
|
||||
{% for type in types %}{% if loop.first %}
|
||||
if d.get("{{type.check}}") == {{type.value}}:
|
||||
{{type.var1}} : {{type.name}} = {{type.name}}()
|
||||
{{type.var1}}.from_dict(d)
|
||||
return cls(type={{type.var1}})
|
||||
{% else %}elif d.get("{{type.check}}") == {{type.value}}:
|
||||
{{type.var1}} : {{type.name}} = {{type.name}}()
|
||||
{{type.var1}}.from_dict(d)
|
||||
return cls(type={{type.var1}})
|
||||
{% endif %}{% endfor %}
|
||||
raise Exception("Unknown type")
|
File diff suppressed because it is too large
Load Diff
@ -1,137 +0,0 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.file_export_format import FileExportFormat
|
||||
from ...models.image_type import ImageType
|
||||
from ...models.mesh import Mesh
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ai/image-to-3d/{input_format}/{output_format}".format(
|
||||
client.base_url,
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Mesh, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Mesh.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return Error.from_dict(response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[Mesh, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Mesh, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Mesh, Error]]:
|
||||
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Mesh, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
input_format: ImageType,
|
||||
output_format: FileExportFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Mesh, Error]]:
|
||||
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
input_format=input_format,
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
135
kittycad/api/ai/create_text_to_cad.py
Normal file
135
kittycad/api/ai/create_text_to_cad.py
Normal file
@ -0,0 +1,135 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.file_export_format import FileExportFormat
|
||||
from ...models.text_to_cad import TextToCad
|
||||
from ...models.text_to_cad_create_body import TextToCadCreateBody
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: FileExportFormat,
|
||||
body: TextToCadCreateBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ai/text-to-cad/{output_format}".format(
|
||||
client.base_url,
|
||||
output_format=output_format,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = TextToCad.from_dict(response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return Error.from_dict(response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[TextToCad, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: FileExportFormat,
|
||||
body: TextToCadCreateBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[TextToCad, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: FileExportFormat,
|
||||
body: TextToCadCreateBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[TextToCad, Error]]:
|
||||
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
|
||||
This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
|
||||
One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.
|
||||
This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: FileExportFormat,
|
||||
body: TextToCadCreateBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[TextToCad, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: FileExportFormat,
|
||||
body: TextToCadCreateBody,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[TextToCad, Error]]:
|
||||
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
|
||||
This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
|
||||
One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.
|
||||
This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
126
kittycad/api/ai/create_text_to_cad_model_feedback.py
Normal file
126
kittycad/api/ai/create_text_to_cad_model_feedback.py
Normal file
@ -0,0 +1,126 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.ai_feedback import AiFeedback
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
feedback: AiFeedback,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/text-to-cad/{id}".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
if feedback is not None:
|
||||
if "?" in url:
|
||||
url = url + "&feedback=" + str(feedback)
|
||||
else:
|
||||
url = url + "?feedback=" + str(feedback)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Error]:
|
||||
return None
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return Error.from_dict(response.json())
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
feedback: AiFeedback,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
feedback=feedback,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
feedback: AiFeedback,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model, in order to give feedback.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
feedback=feedback,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
feedback: AiFeedback,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
feedback=feedback,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
feedback: AiFeedback,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model, in order to give feedback.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
feedback=feedback,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -3,19 +3,19 @@ from typing import Any, Dict, Optional, Union
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.ai_prompt import AiPrompt
|
||||
from ...models.error import Error
|
||||
from ...models.modeling_cmd_req_batch import ModelingCmdReqBatch
|
||||
from ...models.modeling_outcomes import ModelingOutcomes
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: ModelingCmdReqBatch,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/modeling/cmd-batch".format(
|
||||
url = "{}/ai-prompts/{id}".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
@ -26,15 +26,12 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ModelingOutcomes, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[AiPrompt, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ModelingOutcomes.from_dict(response.json())
|
||||
response_200 = AiPrompt.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
@ -47,7 +44,7 @@ def _parse_response(
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ModelingOutcomes, Error]]]:
|
||||
) -> Response[Optional[Union[AiPrompt, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -57,16 +54,16 @@ def _build_response(
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: ModelingCmdReqBatch,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ModelingOutcomes, Error]]]:
|
||||
) -> Response[Optional[Union[AiPrompt, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
@ -75,40 +72,44 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
body: ModelingCmdReqBatch,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ModelingOutcomes, Error]]:
|
||||
) -> Optional[Union[AiPrompt, Error]]:
|
||||
"""This endpoint requires authentication by a KittyCAD employee.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: ModelingCmdReqBatch,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ModelingOutcomes, Error]]]:
|
||||
) -> Response[Optional[Union[AiPrompt, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: ModelingCmdReqBatch,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ModelingOutcomes, Error]]:
|
||||
) -> Optional[Union[AiPrompt, Error]]:
|
||||
"""This endpoint requires authentication by a KittyCAD employee.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -4,28 +4,20 @@ import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.file_export_format import FileExportFormat
|
||||
from ...models.mesh import Mesh
|
||||
from ...models.text_to_cad import TextToCad
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ai/text-to-3d/{output_format}".format(
|
||||
url = "{}/user/text-to-cad/{id}".format(
|
||||
client.base_url,
|
||||
output_format=output_format,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
if prompt is not None:
|
||||
if "?" in url:
|
||||
url = url + "&prompt=" + str(prompt)
|
||||
else:
|
||||
url = url + "?prompt=" + str(prompt)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
@ -37,9 +29,9 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Mesh, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Mesh.from_dict(response.json())
|
||||
response_200 = TextToCad.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
@ -52,7 +44,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Mesh, Error]]
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[Mesh, Error]]]:
|
||||
) -> Response[Optional[Union[TextToCad, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -62,18 +54,16 @@ def _build_response(
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Mesh, Error]]]:
|
||||
) -> Response[Optional[Union[TextToCad, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
@ -82,50 +72,44 @@ def sync_detailed(
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Mesh, Error]]:
|
||||
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
|
||||
) -> Optional[Union[TextToCad, Error]]:
|
||||
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Mesh, Error]]]:
|
||||
) -> Response[Optional[Union[TextToCad, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: FileExportFormat,
|
||||
prompt: str,
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Mesh, Error]]:
|
||||
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
|
||||
) -> Optional[Union[TextToCad, Error]]:
|
||||
"""This endpoint requires authentication by any KittyCAD user. The user must be the owner of the text-to-CAD model.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
prompt=prompt,
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
159
kittycad/api/ai/list_ai_prompts.py
Normal file
159
kittycad/api/ai/list_ai_prompts.py
Normal file
@ -0,0 +1,159 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.ai_prompt_results_page import AiPromptResultsPage
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ai-prompts".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[AiPromptResultsPage, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AiPromptResultsPage.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return Error.from_dict(response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[AiPromptResultsPage, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[AiPromptResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[AiPromptResultsPage, Error]]:
|
||||
"""For text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.
|
||||
This endpoint requires authentication by a KittyCAD employee.
|
||||
The AI prompts are returned in order of creation, with the most recently created AI prompts first.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[AiPromptResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[AiPromptResultsPage, Error]]:
|
||||
"""For text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.
|
||||
This endpoint requires authentication by a KittyCAD employee.
|
||||
The AI prompts are returned in order of creation, with the most recently created AI prompts first.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
159
kittycad/api/ai/list_text_to_cad_models_for_user.py
Normal file
159
kittycad/api/ai/list_text_to_cad_models_for_user.py
Normal file
@ -0,0 +1,159 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.error import Error
|
||||
from ...models.text_to_cad_results_page import TextToCadResultsPage
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/text-to-cad".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[TextToCadResultsPage, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = TextToCadResultsPage.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return Error.from_dict(response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[TextToCadResultsPage, Error]]:
|
||||
"""This will always return the STEP file contents as well as the format the user originally requested.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.
|
||||
The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[TextToCadResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[TextToCadResultsPage, Error]]:
|
||||
"""This will always return the STEP file contents as well as the format the user originally requested.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.
|
||||
The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -10,6 +10,7 @@ from ...models.file_density import FileDensity
|
||||
from ...models.file_mass import FileMass
|
||||
from ...models.file_surface_area import FileSurfaceArea
|
||||
from ...models.file_volume import FileVolume
|
||||
from ...models.text_to_cad import TextToCad
|
||||
from ...types import Response
|
||||
|
||||
|
||||
@ -44,6 +45,7 @@ def _parse_response(
|
||||
FileVolume,
|
||||
FileDensity,
|
||||
FileSurfaceArea,
|
||||
TextToCad,
|
||||
Error,
|
||||
]
|
||||
]:
|
||||
@ -99,6 +101,15 @@ def _parse_response(
|
||||
raise TypeError()
|
||||
option_file_surface_area = FileSurfaceArea.from_dict(data)
|
||||
return option_file_surface_area
|
||||
except ValueError:
|
||||
pass
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
option_text_to_cad = TextToCad.from_dict(data)
|
||||
return option_text_to_cad
|
||||
except ValueError:
|
||||
raise
|
||||
except TypeError:
|
||||
@ -123,6 +134,7 @@ def _build_response(
|
||||
FileVolume,
|
||||
FileDensity,
|
||||
FileSurfaceArea,
|
||||
TextToCad,
|
||||
Error,
|
||||
]
|
||||
]
|
||||
@ -148,6 +160,7 @@ def sync_detailed(
|
||||
FileVolume,
|
||||
FileDensity,
|
||||
FileSurfaceArea,
|
||||
TextToCad,
|
||||
Error,
|
||||
]
|
||||
]
|
||||
@ -177,6 +190,7 @@ def sync(
|
||||
FileVolume,
|
||||
FileDensity,
|
||||
FileSurfaceArea,
|
||||
TextToCad,
|
||||
Error,
|
||||
]
|
||||
]:
|
||||
@ -205,6 +219,7 @@ async def asyncio_detailed(
|
||||
FileVolume,
|
||||
FileDensity,
|
||||
FileSurfaceArea,
|
||||
TextToCad,
|
||||
Error,
|
||||
]
|
||||
]
|
||||
@ -232,6 +247,7 @@ async def asyncio(
|
||||
FileVolume,
|
||||
FileDensity,
|
||||
FileSurfaceArea,
|
||||
TextToCad,
|
||||
Error,
|
||||
]
|
||||
]:
|
||||
|
@ -4,7 +4,6 @@ from websockets.client import WebSocketClientProtocol, connect as ws_connect_asy
|
||||
from websockets.sync.client import ClientConnection, connect as ws_connect
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
@ -34,14 +33,7 @@ def sync(
|
||||
client=client,
|
||||
)
|
||||
|
||||
with ws_connect(
|
||||
kwargs["url"].replace("https://", "wss://"),
|
||||
additional_headers=kwargs["headers"],
|
||||
) as websocket:
|
||||
return websocket # type: ignore
|
||||
|
||||
# Return an error if we got here.
|
||||
return Error(message="An error occurred while connecting to the websocket.")
|
||||
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore
|
||||
|
||||
|
||||
async def asyncio(
|
||||
@ -54,10 +46,6 @@ async def asyncio(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with ws_connect_async(
|
||||
kwargs["url"].replace("https://", "wss://"), extra_headers=kwargs["headers"]
|
||||
) as websocket:
|
||||
return websocket
|
||||
|
||||
# Return an error if we got here.
|
||||
return Error(message="An error occurred while connecting to the websocket.")
|
||||
return await ws_connect_async(
|
||||
kwargs["url"].replace("http", "ws"), extra_headers=kwargs["headers"]
|
||||
)
|
||||
|
@ -101,7 +101,7 @@ def sync(
|
||||
client: Client,
|
||||
) -> Optional[Union[FileCenterOfMass, Error]]:
|
||||
"""We assume any file given to us has one consistent unit throughout. We also assume the file is at the proper scale.
|
||||
This endpoint returns the cartesian co-ordinate in world space measure units.
|
||||
This endpoint returns the cartesian coordinate in world space measure units.
|
||||
In the future, we will use the units inside the file if they are given and do any conversions if necessary for the calculation. But currently, that is not supported.
|
||||
Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
|
||||
@ -143,7 +143,7 @@ async def asyncio(
|
||||
client: Client,
|
||||
) -> Optional[Union[FileCenterOfMass, Error]]:
|
||||
"""We assume any file given to us has one consistent unit throughout. We also assume the file is at the proper scale.
|
||||
This endpoint returns the cartesian co-ordinate in world space measure units.
|
||||
This endpoint returns the cartesian coordinate in world space measure units.
|
||||
In the future, we will use the units inside the file if they are given and do any conversions if necessary for the calculation. But currently, that is not supported.
|
||||
Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
|
||||
|
117
kittycad/api/meta/internal_get_api_token_for_discord_user.py
Normal file
117
kittycad/api/meta/internal_get_api_token_for_discord_user.py
Normal file
@ -0,0 +1,117 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.api_token import ApiToken
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
discord_id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/internal/discord/api-token/{discord_id}".format(
|
||||
client.base_url,
|
||||
discord_id=discord_id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ApiToken.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return Error.from_dict(response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ApiToken, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
discord_id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ApiToken, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
discord_id=discord_id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
discord_id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ApiToken, Error]]:
|
||||
"""This endpoint allows us to run API calls from our discord bot on behalf of a user. The user must have a discord account linked to their KittyCAD Account via oauth2 for this to work.
|
||||
You must be a KittyCAD employee to use this endpoint.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
discord_id=discord_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
discord_id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ApiToken, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
discord_id=discord_id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
discord_id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ApiToken, Error]]:
|
||||
"""This endpoint allows us to run API calls from our discord bot on behalf of a user. The user must have a discord account linked to their KittyCAD Account via oauth2 for this to work.
|
||||
You must be a KittyCAD employee to use this endpoint.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
discord_id=discord_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -1,472 +0,0 @@
|
||||
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
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: ModelingCmdReq,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/modeling/cmd".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[
|
||||
Union[
|
||||
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:
|
||||
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
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return Error.from_dict(response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.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,
|
||||
]
|
||||
]
|
||||
]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: ModelingCmdReq,
|
||||
*,
|
||||
client: Client,
|
||||
) -> 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,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: ModelingCmdReq,
|
||||
*,
|
||||
client: Client,
|
||||
) -> 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(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: ModelingCmdReq,
|
||||
*,
|
||||
client: Client,
|
||||
) -> 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,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: ModelingCmdReq,
|
||||
*,
|
||||
client: Client,
|
||||
) -> 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 (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -1,10 +1,13 @@
|
||||
from typing import Any, Dict
|
||||
import json
|
||||
from typing import Any, Dict, Iterator
|
||||
|
||||
import bson
|
||||
from websockets.client import WebSocketClientProtocol, connect as ws_connect_async
|
||||
from websockets.sync.client import ClientConnection, connect as ws_connect
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.web_socket_request import WebSocketRequest
|
||||
from ...models.web_socket_response import WebSocketResponse
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
@ -26,9 +29,9 @@ def _get_kwargs(
|
||||
|
||||
if unlocked_framerate is not None:
|
||||
if "?" in url:
|
||||
url = url + "&unlocked_framerate=" + str(unlocked_framerate)
|
||||
url = url + "&unlocked_framerate=" + str(unlocked_framerate).lower()
|
||||
else:
|
||||
url = url + "?unlocked_framerate=" + str(unlocked_framerate)
|
||||
url = url + "?unlocked_framerate=" + str(unlocked_framerate).lower()
|
||||
|
||||
if video_res_height is not None:
|
||||
if "?" in url:
|
||||
@ -44,9 +47,9 @@ def _get_kwargs(
|
||||
|
||||
if webrtc is not None:
|
||||
if "?" in url:
|
||||
url = url + "&webrtc=" + str(webrtc)
|
||||
url = url + "&webrtc=" + str(webrtc).lower()
|
||||
else:
|
||||
url = url + "?webrtc=" + str(webrtc)
|
||||
url = url + "?webrtc=" + str(webrtc).lower()
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
@ -79,14 +82,7 @@ def sync(
|
||||
client=client,
|
||||
)
|
||||
|
||||
with ws_connect(
|
||||
kwargs["url"].replace("https://", "wss://"),
|
||||
additional_headers=kwargs["headers"],
|
||||
) as websocket:
|
||||
return websocket # type: ignore
|
||||
|
||||
# Return an error if we got here.
|
||||
return Error(message="An error occurred while connecting to the websocket.")
|
||||
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore
|
||||
|
||||
|
||||
async def asyncio(
|
||||
@ -109,10 +105,69 @@ async def asyncio(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with ws_connect_async(
|
||||
kwargs["url"].replace("https://", "wss://"), extra_headers=kwargs["headers"]
|
||||
) as websocket:
|
||||
return websocket
|
||||
return await ws_connect_async(
|
||||
kwargs["url"].replace("http", "ws"), extra_headers=kwargs["headers"]
|
||||
)
|
||||
|
||||
# Return an error if we got here.
|
||||
return Error(message="An error occurred while connecting to the websocket.")
|
||||
|
||||
class WebSocket:
|
||||
"""A websocket connection to the API endpoint."""
|
||||
|
||||
ws: ClientConnection
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
fps: int,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
webrtc: bool,
|
||||
client: Client,
|
||||
):
|
||||
self.ws = sync(
|
||||
fps,
|
||||
unlocked_framerate,
|
||||
video_res_height,
|
||||
video_res_width,
|
||||
webrtc,
|
||||
client=client,
|
||||
)
|
||||
|
||||
def __enter__(
|
||||
self,
|
||||
):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.close()
|
||||
|
||||
def __iter__(self) -> Iterator[WebSocketResponse]:
|
||||
"""
|
||||
Iterate on incoming messages.
|
||||
|
||||
The iterator calls :meth:`recv` and yields messages in an infinite loop.
|
||||
|
||||
It exits when the connection is closed normally. It raises a
|
||||
:exc:`~websockets.exceptions.ConnectionClosedError` exception after a
|
||||
protocol error or a network failure.
|
||||
|
||||
"""
|
||||
for message in self.ws:
|
||||
yield WebSocketResponse.from_dict(json.loads(message))
|
||||
|
||||
def send(self, data: WebSocketRequest):
|
||||
"""Send data to the websocket."""
|
||||
self.ws.send(json.dumps(data.to_dict()))
|
||||
|
||||
def send_binary(self, data: WebSocketRequest):
|
||||
"""Send data as bson to the websocket."""
|
||||
self.ws.send(bson.BSON.encode(data.to_dict()))
|
||||
|
||||
def recv(self) -> WebSocketResponse:
|
||||
"""Receive data from the websocket."""
|
||||
message = self.ws.recv()
|
||||
return WebSocketResponse.from_dict(json.loads(message))
|
||||
|
||||
def close(self):
|
||||
"""Close the websocket."""
|
||||
self.ws.close()
|
||||
|
@ -38,6 +38,10 @@ class Client:
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
return attr.evolve(self, timeout=timeout)
|
||||
|
||||
def with_base_url(self, url: str) -> "Client":
|
||||
"""Get a new client matching this one with a new base url"""
|
||||
return attr.evolve(self, base_url=url)
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class ClientFromEnv(Client):
|
||||
|
@ -1,4 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import uuid
|
||||
from typing import Dict, Optional, Union
|
||||
|
||||
import pytest
|
||||
@ -6,6 +8,7 @@ import pytest
|
||||
from .api.api_tokens import list_api_tokens_for_user
|
||||
from .api.file import create_file_conversion, create_file_mass, create_file_volume
|
||||
from .api.meta import ping
|
||||
from .api.modeling import modeling_commands_ws
|
||||
from .api.users import get_user_self, list_users_extended
|
||||
from .client import ClientFromEnv
|
||||
from .models import (
|
||||
@ -20,12 +23,17 @@ from .models import (
|
||||
FileImportFormat,
|
||||
FileMass,
|
||||
FileVolume,
|
||||
ModelingCmd,
|
||||
ModelingCmdId,
|
||||
Pong,
|
||||
UnitDensity,
|
||||
UnitMass,
|
||||
UnitVolume,
|
||||
User,
|
||||
WebSocketRequest,
|
||||
)
|
||||
from .models.modeling_cmd import start_path
|
||||
from .models.web_socket_request import modeling_cmd_req
|
||||
from .types import Unset
|
||||
|
||||
|
||||
@ -283,3 +291,31 @@ def test_list_users():
|
||||
assert isinstance(response, ExtendedUserResultsPage)
|
||||
|
||||
print(f"ExtendedUserResultsPage: {response}")
|
||||
|
||||
|
||||
def test_ws():
|
||||
# Create our client.
|
||||
client = ClientFromEnv()
|
||||
|
||||
# Connect to the websocket.
|
||||
with modeling_commands_ws.WebSocket(
|
||||
client=client,
|
||||
fps=30,
|
||||
unlocked_framerate=False,
|
||||
video_res_height=360,
|
||||
video_res_width=480,
|
||||
webrtc=False,
|
||||
) as websocket:
|
||||
# Send a message.
|
||||
id = uuid.uuid4()
|
||||
req = WebSocketRequest(
|
||||
modeling_cmd_req(cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(id))
|
||||
)
|
||||
json.dumps(req.to_dict())
|
||||
websocket.send(req)
|
||||
|
||||
# Get the messages.
|
||||
while True:
|
||||
message = websocket.recv()
|
||||
print(json.dumps(message.to_dict()))
|
||||
break
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,17 @@
|
||||
""" Contains all the data models used in inputs/outputs """
|
||||
|
||||
from .account_provider import AccountProvider
|
||||
from .ai_feedback import AiFeedback
|
||||
from .ai_plugin_api import AiPluginApi
|
||||
from .ai_plugin_api_type import AiPluginApiType
|
||||
from .ai_plugin_auth import AiPluginAuth
|
||||
from .ai_plugin_auth_type import AiPluginAuthType
|
||||
from .ai_plugin_http_auth_type import AiPluginHttpAuthType
|
||||
from .ai_plugin_manifest import AiPluginManifest
|
||||
from .ai_prompt import AiPrompt
|
||||
from .ai_prompt_results_page import AiPromptResultsPage
|
||||
from .ai_prompt_type import AiPromptType
|
||||
from .angle import Angle
|
||||
from .annotation_line_end import AnnotationLineEnd
|
||||
from .annotation_line_end_options import AnnotationLineEndOptions
|
||||
from .annotation_options import AnnotationOptions
|
||||
@ -34,30 +39,31 @@ from .billing_info import BillingInfo
|
||||
from .cache_metadata import CacheMetadata
|
||||
from .camera_drag_interaction_type import CameraDragInteractionType
|
||||
from .card_details import CardDetails
|
||||
from .center_of_mass import CenterOfMass
|
||||
from .client_metrics import ClientMetrics
|
||||
from .cluster import Cluster
|
||||
from .code_language import CodeLanguage
|
||||
from .code_output import CodeOutput
|
||||
from .color import Color
|
||||
from .commit import Commit
|
||||
from .connection import Connection
|
||||
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_end_points import CurveGetEndPoints
|
||||
from .curve_get_type import CurveGetType
|
||||
from .curve_type import CurveType
|
||||
from .customer import Customer
|
||||
from .customer_balance import CustomerBalance
|
||||
from .density import Density
|
||||
from .device_access_token_request_form import DeviceAccessTokenRequestForm
|
||||
from .device_auth_request_form import DeviceAuthRequestForm
|
||||
from .device_auth_verify_params import DeviceAuthVerifyParams
|
||||
from .direction import Direction
|
||||
from .discount import Discount
|
||||
from .docker_system_info import DockerSystemInfo
|
||||
from .email_authentication_form import EmailAuthenticationForm
|
||||
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
|
||||
@ -66,7 +72,6 @@ from .entity_type import EntityType
|
||||
from .environment import Environment
|
||||
from .error import Error
|
||||
from .error_code import ErrorCode
|
||||
from .executor_metadata import ExecutorMetadata
|
||||
from .export import Export
|
||||
from .export_file import ExportFile
|
||||
from .extended_user import ExtendedUser
|
||||
@ -84,13 +89,14 @@ from .file_system_metadata import FileSystemMetadata
|
||||
from .file_volume import FileVolume
|
||||
from .gateway import Gateway
|
||||
from .get_entity_type import GetEntityType
|
||||
from .get_sketch_mode_plane import GetSketchModePlane
|
||||
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 .import_file import ImportFile
|
||||
from .import_files import ImportFiles
|
||||
from .input_format import InputFormat
|
||||
from .invoice import Invoice
|
||||
from .invoice_line_item import InvoiceLineItem
|
||||
@ -100,17 +106,13 @@ from .jetstream_api_stats import JetstreamApiStats
|
||||
from .jetstream_config import JetstreamConfig
|
||||
from .jetstream_stats import JetstreamStats
|
||||
from .leaf_node import LeafNode
|
||||
from .mesh import Mesh
|
||||
from .mass import Mass
|
||||
from .meta_cluster_info import MetaClusterInfo
|
||||
from .metadata import Metadata
|
||||
from .method import Method
|
||||
from .modeling_cmd import ModelingCmd
|
||||
from .modeling_cmd_id import ModelingCmdId
|
||||
from .modeling_cmd_req import ModelingCmdReq
|
||||
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
|
||||
@ -121,29 +123,31 @@ from .onboarding import Onboarding
|
||||
from .output_file import OutputFile
|
||||
from .output_format import OutputFormat
|
||||
from .path_command import PathCommand
|
||||
from .path_component_constraint_bound import PathComponentConstraintBound
|
||||
from .path_component_constraint_type import PathComponentConstraintType
|
||||
from .path_get_curve_uuids_for_vertices import PathGetCurveUuidsForVertices
|
||||
from .path_get_info import PathGetInfo
|
||||
from .path_get_vertex_uuids import PathGetVertexUuids
|
||||
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 .plane_intersect_and_project import PlaneIntersectAndProject
|
||||
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_init import RtcIceCandidateInit
|
||||
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 .selection import Selection
|
||||
from .session import Session
|
||||
from .solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
|
||||
from .solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
|
||||
@ -152,12 +156,12 @@ 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 .surface_area import SurfaceArea
|
||||
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 .text_to_cad import TextToCad
|
||||
from .text_to_cad_create_body import TextToCadCreateBody
|
||||
from .text_to_cad_results_page import TextToCadResultsPage
|
||||
from .unit_angle import UnitAngle
|
||||
from .unit_angle_conversion import UnitAngleConversion
|
||||
from .unit_area import UnitArea
|
||||
@ -189,6 +193,8 @@ from .update_user import UpdateUser
|
||||
from .user import User
|
||||
from .user_results_page import UserResultsPage
|
||||
from .uuid import Uuid
|
||||
from .uuid_binary import UuidBinary
|
||||
from .verification_token import VerificationToken
|
||||
from .volume import Volume
|
||||
from .web_socket_request import WebSocketRequest
|
||||
from .web_socket_response import WebSocketResponse
|
||||
|
@ -4,6 +4,8 @@ from enum import Enum
|
||||
class AccountProvider(str, Enum):
|
||||
"""An account provider.""" # noqa: E501
|
||||
|
||||
"""# The Discord account provider. """ # noqa: E501
|
||||
DISCORD = "discord"
|
||||
"""# The Google account provider. """ # noqa: E501
|
||||
GOOGLE = "google"
|
||||
"""# The GitHub account provider. """ # noqa: E501
|
||||
|
13
kittycad/models/ai_feedback.py
Normal file
13
kittycad/models/ai_feedback.py
Normal file
@ -0,0 +1,13 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class AiFeedback(str, Enum):
|
||||
"""Human feedback on an AI response.""" # noqa: E501
|
||||
|
||||
"""# Thumbs up. """ # noqa: E501
|
||||
THUMBS_UP = "thumbs_up"
|
||||
"""# Thumbs down. """ # noqa: E501
|
||||
THUMBS_DOWN = "thumbs_down"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
@ -20,6 +20,7 @@ class AiPluginApi:
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
is_user_authenticated = self.is_user_authenticated
|
||||
type: Union[Unset, AiPluginApiType] = UNSET
|
||||
if not isinstance(self.type, Unset):
|
||||
type = self.type
|
||||
url = self.url
|
||||
@ -45,8 +46,10 @@ class AiPluginApi:
|
||||
type: Union[Unset, AiPluginApiType]
|
||||
if isinstance(_type, Unset):
|
||||
type = UNSET
|
||||
if _type is None:
|
||||
type = UNSET
|
||||
else:
|
||||
type = _type # type: ignore[arg-type]
|
||||
type = _type
|
||||
|
||||
url = d.pop("url", UNSET)
|
||||
|
||||
|
@ -19,8 +19,10 @@ class AiPluginAuth:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
authorization_type: Union[Unset, AiPluginHttpAuthType] = UNSET
|
||||
if not isinstance(self.authorization_type, Unset):
|
||||
authorization_type = self.authorization_type
|
||||
type: Union[Unset, AiPluginAuthType] = UNSET
|
||||
if not isinstance(self.type, Unset):
|
||||
type = self.type
|
||||
|
||||
@ -41,15 +43,19 @@ class AiPluginAuth:
|
||||
authorization_type: Union[Unset, AiPluginHttpAuthType]
|
||||
if isinstance(_authorization_type, Unset):
|
||||
authorization_type = UNSET
|
||||
if _authorization_type is None:
|
||||
authorization_type = UNSET
|
||||
else:
|
||||
authorization_type = _authorization_type # type: ignore[arg-type]
|
||||
authorization_type = _authorization_type
|
||||
|
||||
_type = d.pop("type", UNSET)
|
||||
type: Union[Unset, AiPluginAuthType]
|
||||
if isinstance(_type, Unset):
|
||||
type = UNSET
|
||||
if _type is None:
|
||||
type = UNSET
|
||||
else:
|
||||
type = _type # type: ignore[arg-type]
|
||||
type = _type
|
||||
|
||||
ai_plugin_auth = cls(
|
||||
authorization_type=authorization_type,
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
@ -30,8 +30,10 @@ class AiPluginManifest:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
api: Union[Unset, AiPluginApi] = UNSET
|
||||
if not isinstance(self.api, Unset):
|
||||
api = self.api
|
||||
auth: Union[Unset, AiPluginAuth] = UNSET
|
||||
if not isinstance(self.auth, Unset):
|
||||
auth = self.auth
|
||||
contact_email = self.contact_email
|
||||
@ -47,9 +49,11 @@ class AiPluginManifest:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if api is not UNSET:
|
||||
field_dict["api"] = api
|
||||
_api: AiPluginApi = cast(AiPluginApi, api)
|
||||
field_dict["api"] = _api.to_dict()
|
||||
if auth is not UNSET:
|
||||
field_dict["auth"] = auth
|
||||
_auth: AiPluginAuth = cast(AiPluginAuth, auth)
|
||||
field_dict["auth"] = _auth.to_dict()
|
||||
if contact_email is not UNSET:
|
||||
field_dict["contact_email"] = contact_email
|
||||
if description_for_human is not UNSET:
|
||||
@ -76,15 +80,19 @@ class AiPluginManifest:
|
||||
api: Union[Unset, AiPluginApi]
|
||||
if isinstance(_api, Unset):
|
||||
api = UNSET
|
||||
if _api is None:
|
||||
api = UNSET
|
||||
else:
|
||||
api = _api # type: ignore[arg-type]
|
||||
api = AiPluginApi.from_dict(_api)
|
||||
|
||||
_auth = d.pop("auth", UNSET)
|
||||
auth: Union[Unset, AiPluginAuth]
|
||||
if isinstance(_auth, Unset):
|
||||
auth = UNSET
|
||||
if _auth is None:
|
||||
auth = UNSET
|
||||
else:
|
||||
auth = _auth # type: ignore[arg-type]
|
||||
auth = AiPluginAuth.from_dict(_auth)
|
||||
|
||||
contact_email = d.pop("contact_email", UNSET)
|
||||
|
||||
|
223
kittycad/models/ai_prompt.py
Normal file
223
kittycad/models/ai_prompt.py
Normal file
@ -0,0 +1,223 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.ai_feedback import AiFeedback
|
||||
from ..models.ai_prompt_type import AiPromptType
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..models.uuid import Uuid
|
||||
from ..models.uuid_binary import UuidBinary
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
GO = TypeVar("GO", bound="AiPrompt")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class AiPrompt:
|
||||
"""An AI prompt.""" # noqa: E501
|
||||
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
feedback: Union[Unset, AiFeedback] = UNSET
|
||||
id: Union[Unset, UuidBinary] = UNSET
|
||||
metadata: Union[Unset, Any] = UNSET
|
||||
model_version: Union[Unset, str] = UNSET
|
||||
output_file: Union[Unset, str] = UNSET
|
||||
prompt: Union[Unset, str] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
type: Union[Unset, AiPromptType] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
feedback: Union[Unset, AiFeedback] = UNSET
|
||||
if not isinstance(self.feedback, Unset):
|
||||
feedback = self.feedback
|
||||
id: Union[Unset, UuidBinary] = UNSET
|
||||
if not isinstance(self.id, Unset):
|
||||
id = self.id
|
||||
metadata = self.metadata
|
||||
model_version = self.model_version
|
||||
output_file = self.output_file
|
||||
prompt = self.prompt
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type: Union[Unset, AiPromptType] = UNSET
|
||||
if not isinstance(self.type, Unset):
|
||||
type = self.type
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict["completed_at"] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict["created_at"] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict["error"] = error
|
||||
if feedback is not UNSET:
|
||||
field_dict["feedback"] = feedback
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if metadata is not UNSET:
|
||||
field_dict["metadata"] = metadata
|
||||
if model_version is not UNSET:
|
||||
field_dict["model_version"] = model_version
|
||||
if output_file is not UNSET:
|
||||
field_dict["output_file"] = output_file
|
||||
if prompt is not UNSET:
|
||||
field_dict["prompt"] = prompt
|
||||
if started_at is not UNSET:
|
||||
field_dict["started_at"] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict["status"] = status
|
||||
if type is not UNSET:
|
||||
field_dict["type"] = type
|
||||
if updated_at is not UNSET:
|
||||
field_dict["updated_at"] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict["user_id"] = user_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[GO], src_dict: Dict[str, Any]) -> GO:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_created_at, Unset):
|
||||
created_at = UNSET
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
_feedback = d.pop("feedback", UNSET)
|
||||
feedback: Union[Unset, AiFeedback]
|
||||
if isinstance(_feedback, Unset):
|
||||
feedback = UNSET
|
||||
if _feedback is None:
|
||||
feedback = UNSET
|
||||
else:
|
||||
feedback = _feedback
|
||||
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, UuidBinary]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id
|
||||
|
||||
metadata = d.pop("metadata", UNSET)
|
||||
model_version = d.pop("model_version", UNSET)
|
||||
|
||||
output_file = d.pop("output_file", UNSET)
|
||||
|
||||
prompt = d.pop("prompt", UNSET)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status
|
||||
|
||||
_type = d.pop("type", UNSET)
|
||||
type: Union[Unset, AiPromptType]
|
||||
if isinstance(_type, Unset):
|
||||
type = UNSET
|
||||
if _type is None:
|
||||
type = UNSET
|
||||
else:
|
||||
type = _type
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_updated_at, Unset):
|
||||
updated_at = UNSET
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
ai_prompt = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
feedback=feedback,
|
||||
id=id,
|
||||
metadata=metadata,
|
||||
model_version=model_version,
|
||||
output_file=output_file,
|
||||
prompt=prompt,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
type=type,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
ai_prompt.additional_properties = d
|
||||
return ai_prompt
|
||||
|
||||
@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
|
70
kittycad/models/ai_prompt_results_page.py
Normal file
70
kittycad/models/ai_prompt_results_page.py
Normal file
@ -0,0 +1,70 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
PI = TypeVar("PI", bound="AiPromptResultsPage")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class AiPromptResultsPage:
|
||||
"""A single page of results""" # noqa: E501
|
||||
|
||||
from ..models.ai_prompt import AiPrompt
|
||||
|
||||
items: Union[Unset, List[AiPrompt]] = UNSET
|
||||
next_page: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
from ..models.ai_prompt import AiPrompt
|
||||
|
||||
items: Union[Unset, List[AiPrompt]] = UNSET
|
||||
if not isinstance(self.items, Unset):
|
||||
items = self.items
|
||||
next_page = self.next_page
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if items is not UNSET:
|
||||
field_dict["items"] = items
|
||||
if next_page is not UNSET:
|
||||
field_dict["next_page"] = next_page
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[PI], src_dict: Dict[str, Any]) -> PI:
|
||||
d = src_dict.copy()
|
||||
from ..models.ai_prompt import AiPrompt
|
||||
|
||||
items = cast(List[AiPrompt], d.pop("items", UNSET))
|
||||
|
||||
next_page = d.pop("next_page", UNSET)
|
||||
|
||||
ai_prompt_results_page = cls(
|
||||
items=items,
|
||||
next_page=next_page,
|
||||
)
|
||||
|
||||
ai_prompt_results_page.additional_properties = d
|
||||
return ai_prompt_results_page
|
||||
|
||||
@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
|
11
kittycad/models/ai_prompt_type.py
Normal file
11
kittycad/models/ai_prompt_type.py
Normal file
@ -0,0 +1,11 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class AiPromptType(str, Enum):
|
||||
"""A type of AI prompt.""" # noqa: E501
|
||||
|
||||
"""# Text to CAD. """ # noqa: E501
|
||||
TEXT_TO_CAD = "text_to_cad"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
72
kittycad/models/angle.py
Normal file
72
kittycad/models/angle.py
Normal file
@ -0,0 +1,72 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.unit_angle import UnitAngle
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
UZ = TypeVar("UZ", bound="Angle")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class Angle:
|
||||
"""An angle, with a specific unit.""" # noqa: E501
|
||||
|
||||
unit: Union[Unset, UnitAngle] = UNSET
|
||||
value: Union[Unset, float] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
unit: Union[Unset, UnitAngle] = UNSET
|
||||
if not isinstance(self.unit, Unset):
|
||||
unit = self.unit
|
||||
value = self.value
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if unit is not UNSET:
|
||||
field_dict["unit"] = unit
|
||||
if value is not UNSET:
|
||||
field_dict["value"] = value
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[UZ], src_dict: Dict[str, Any]) -> UZ:
|
||||
d = src_dict.copy()
|
||||
_unit = d.pop("unit", UNSET)
|
||||
unit: Union[Unset, UnitAngle]
|
||||
if isinstance(_unit, Unset):
|
||||
unit = UNSET
|
||||
if _unit is None:
|
||||
unit = UNSET
|
||||
else:
|
||||
unit = _unit
|
||||
|
||||
value = d.pop("value", UNSET)
|
||||
|
||||
angle = cls(
|
||||
unit=unit,
|
||||
value=value,
|
||||
)
|
||||
|
||||
angle.additional_properties = d
|
||||
return angle
|
||||
|
||||
@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
|
@ -5,7 +5,7 @@ import attr
|
||||
from ..models.annotation_line_end import AnnotationLineEnd
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
GO = TypeVar("GO", bound="AnnotationLineEndOptions")
|
||||
FB = TypeVar("FB", bound="AnnotationLineEndOptions")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -18,8 +18,10 @@ class AnnotationLineEndOptions:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
end: Union[Unset, AnnotationLineEnd] = UNSET
|
||||
if not isinstance(self.end, Unset):
|
||||
end = self.end
|
||||
start: Union[Unset, AnnotationLineEnd] = UNSET
|
||||
if not isinstance(self.start, Unset):
|
||||
start = self.start
|
||||
|
||||
@ -34,21 +36,25 @@ class AnnotationLineEndOptions:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[GO], src_dict: Dict[str, Any]) -> GO:
|
||||
def from_dict(cls: Type[FB], src_dict: Dict[str, Any]) -> FB:
|
||||
d = src_dict.copy()
|
||||
_end = d.pop("end", UNSET)
|
||||
end: Union[Unset, AnnotationLineEnd]
|
||||
if isinstance(_end, Unset):
|
||||
end = UNSET
|
||||
if _end is None:
|
||||
end = UNSET
|
||||
else:
|
||||
end = _end # type: ignore[arg-type]
|
||||
end = _end
|
||||
|
||||
_start = d.pop("start", UNSET)
|
||||
start: Union[Unset, AnnotationLineEnd]
|
||||
if isinstance(_start, Unset):
|
||||
start = UNSET
|
||||
if _start is None:
|
||||
start = UNSET
|
||||
else:
|
||||
start = _start # type: ignore[arg-type]
|
||||
start = _start
|
||||
|
||||
annotation_line_end_options = cls(
|
||||
end=end,
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
@ -8,7 +8,7 @@ from ..models.color import Color
|
||||
from ..models.point3d import Point3d
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
PI = TypeVar("PI", bound="AnnotationOptions")
|
||||
QP = TypeVar("QP", bound="AnnotationOptions")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -24,13 +24,17 @@ class AnnotationOptions:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
color: Union[Unset, Color] = UNSET
|
||||
if not isinstance(self.color, Unset):
|
||||
color = self.color
|
||||
line_ends: Union[Unset, AnnotationLineEndOptions] = UNSET
|
||||
if not isinstance(self.line_ends, Unset):
|
||||
line_ends = self.line_ends
|
||||
line_width = self.line_width
|
||||
position: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.position, Unset):
|
||||
position = self.position
|
||||
text: Union[Unset, AnnotationTextOptions] = UNSET
|
||||
if not isinstance(self.text, Unset):
|
||||
text = self.text
|
||||
|
||||
@ -38,34 +42,44 @@ class AnnotationOptions:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if color is not UNSET:
|
||||
field_dict["color"] = color
|
||||
_color: Color = cast(Color, color)
|
||||
field_dict["color"] = _color.to_dict()
|
||||
if line_ends is not UNSET:
|
||||
field_dict["line_ends"] = line_ends
|
||||
_line_ends: AnnotationLineEndOptions = cast(
|
||||
AnnotationLineEndOptions, line_ends
|
||||
)
|
||||
field_dict["line_ends"] = _line_ends.to_dict()
|
||||
if line_width is not UNSET:
|
||||
field_dict["line_width"] = line_width
|
||||
if position is not UNSET:
|
||||
field_dict["position"] = position
|
||||
_position: Point3d = cast(Point3d, position)
|
||||
field_dict["position"] = _position.to_dict()
|
||||
if text is not UNSET:
|
||||
field_dict["text"] = text
|
||||
_text: AnnotationTextOptions = cast(AnnotationTextOptions, text)
|
||||
field_dict["text"] = _text.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[PI], src_dict: Dict[str, Any]) -> PI:
|
||||
def from_dict(cls: Type[QP], src_dict: Dict[str, Any]) -> QP:
|
||||
d = src_dict.copy()
|
||||
_color = d.pop("color", UNSET)
|
||||
color: Union[Unset, Color]
|
||||
if isinstance(_color, Unset):
|
||||
color = UNSET
|
||||
if _color is None:
|
||||
color = UNSET
|
||||
else:
|
||||
color = _color # type: ignore[arg-type]
|
||||
color = Color.from_dict(_color)
|
||||
|
||||
_line_ends = d.pop("line_ends", UNSET)
|
||||
line_ends: Union[Unset, AnnotationLineEndOptions]
|
||||
if isinstance(_line_ends, Unset):
|
||||
line_ends = UNSET
|
||||
if _line_ends is None:
|
||||
line_ends = UNSET
|
||||
else:
|
||||
line_ends = _line_ends # type: ignore[arg-type]
|
||||
line_ends = AnnotationLineEndOptions.from_dict(_line_ends)
|
||||
|
||||
line_width = d.pop("line_width", UNSET)
|
||||
|
||||
@ -73,15 +87,19 @@ class AnnotationOptions:
|
||||
position: Union[Unset, Point3d]
|
||||
if isinstance(_position, Unset):
|
||||
position = UNSET
|
||||
if _position is None:
|
||||
position = UNSET
|
||||
else:
|
||||
position = _position # type: ignore[arg-type]
|
||||
position = Point3d.from_dict(_position)
|
||||
|
||||
_text = d.pop("text", UNSET)
|
||||
text: Union[Unset, AnnotationTextOptions]
|
||||
if isinstance(_text, Unset):
|
||||
text = UNSET
|
||||
if _text is None:
|
||||
text = UNSET
|
||||
else:
|
||||
text = _text # type: ignore[arg-type]
|
||||
text = AnnotationTextOptions.from_dict(_text)
|
||||
|
||||
annotation_options = cls(
|
||||
color=color,
|
||||
|
@ -2,7 +2,7 @@ from enum import Enum
|
||||
|
||||
|
||||
class AnnotationTextAlignmentX(str, Enum):
|
||||
"""Horizontal Text aligment""" # noqa: E501
|
||||
"""Horizontal Text alignment""" # noqa: E501
|
||||
|
||||
LEFT = "left"
|
||||
CENTER = "center"
|
||||
|
@ -2,7 +2,7 @@ from enum import Enum
|
||||
|
||||
|
||||
class AnnotationTextAlignmentY(str, Enum):
|
||||
"""Vertical Text aligment""" # noqa: E501
|
||||
"""Vertical Text alignment""" # noqa: E501
|
||||
|
||||
BOTTOM = "bottom"
|
||||
CENTER = "center"
|
||||
|
@ -6,7 +6,7 @@ from ..models.annotation_text_alignment_x import AnnotationTextAlignmentX
|
||||
from ..models.annotation_text_alignment_y import AnnotationTextAlignmentY
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
UZ = TypeVar("UZ", bound="AnnotationTextOptions")
|
||||
KC = TypeVar("KC", bound="AnnotationTextOptions")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -23,8 +23,10 @@ class AnnotationTextOptions:
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
point_size = self.point_size
|
||||
text = self.text
|
||||
x: Union[Unset, AnnotationTextAlignmentX] = UNSET
|
||||
if not isinstance(self.x, Unset):
|
||||
x = self.x
|
||||
y: Union[Unset, AnnotationTextAlignmentY] = UNSET
|
||||
if not isinstance(self.y, Unset):
|
||||
y = self.y
|
||||
|
||||
@ -43,7 +45,7 @@ class AnnotationTextOptions:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[UZ], src_dict: Dict[str, Any]) -> UZ:
|
||||
def from_dict(cls: Type[KC], src_dict: Dict[str, Any]) -> KC:
|
||||
d = src_dict.copy()
|
||||
point_size = d.pop("point_size", UNSET)
|
||||
|
||||
@ -53,15 +55,19 @@ class AnnotationTextOptions:
|
||||
x: Union[Unset, AnnotationTextAlignmentX]
|
||||
if isinstance(_x, Unset):
|
||||
x = UNSET
|
||||
if _x is None:
|
||||
x = UNSET
|
||||
else:
|
||||
x = _x # type: ignore[arg-type]
|
||||
x = _x
|
||||
|
||||
_y = d.pop("y", UNSET)
|
||||
y: Union[Unset, AnnotationTextAlignmentY]
|
||||
if isinstance(_y, Unset):
|
||||
y = UNSET
|
||||
if _y is None:
|
||||
y = UNSET
|
||||
else:
|
||||
y = _y # type: ignore[arg-type]
|
||||
y = _y
|
||||
|
||||
annotation_text_options = cls(
|
||||
point_size=point_size,
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
FB = TypeVar("FB", bound="ApiCallQueryGroup")
|
||||
HX = TypeVar("HX", bound="ApiCallQueryGroup")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -31,7 +31,7 @@ class ApiCallQueryGroup:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[FB], src_dict: Dict[str, Any]) -> FB:
|
||||
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX:
|
||||
d = src_dict.copy()
|
||||
count = d.pop("count", UNSET)
|
||||
|
||||
|
@ -8,7 +8,7 @@ from ..models.method import Method
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
QP = TypeVar("QP", bound="ApiCallWithPrice")
|
||||
LB = TypeVar("LB", bound="ApiCallWithPrice")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -55,6 +55,7 @@ class ApiCallWithPrice:
|
||||
id = self.id
|
||||
ip_address = self.ip_address
|
||||
litterbox = self.litterbox
|
||||
method: Union[Unset, Method] = UNSET
|
||||
if not isinstance(self.method, Unset):
|
||||
method = self.method
|
||||
minutes = self.minutes
|
||||
@ -126,7 +127,7 @@ class ApiCallWithPrice:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[QP], src_dict: Dict[str, Any]) -> QP:
|
||||
def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -152,8 +153,10 @@ class ApiCallWithPrice:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
ip_address = d.pop("ip_address", UNSET)
|
||||
|
||||
@ -163,8 +166,10 @@ class ApiCallWithPrice:
|
||||
method: Union[Unset, Method]
|
||||
if isinstance(_method, Unset):
|
||||
method = UNSET
|
||||
if _method is None:
|
||||
method = UNSET
|
||||
else:
|
||||
method = _method # type: ignore[arg-type]
|
||||
method = _method
|
||||
|
||||
minutes = d.pop("minutes", UNSET)
|
||||
|
||||
@ -193,8 +198,10 @@ class ApiCallWithPrice:
|
||||
token: Union[Unset, Uuid]
|
||||
if isinstance(_token, Unset):
|
||||
token = UNSET
|
||||
if _token is None:
|
||||
token = UNSET
|
||||
else:
|
||||
token = _token # type: ignore[arg-type]
|
||||
token = _token
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -205,7 +212,14 @@ class ApiCallWithPrice:
|
||||
|
||||
user_agent = d.pop("user_agent", UNSET)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
api_call_with_price = cls(
|
||||
completed_at=completed_at,
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
KC = TypeVar("KC", bound="ApiCallWithPriceResultsPage")
|
||||
NE = TypeVar("NE", bound="ApiCallWithPriceResultsPage")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -37,7 +37,7 @@ class ApiCallWithPriceResultsPage:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[KC], src_dict: Dict[str, Any]) -> KC:
|
||||
def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE:
|
||||
d = src_dict.copy()
|
||||
from ..models.api_call_with_price import ApiCallWithPrice
|
||||
|
||||
|
@ -5,7 +5,7 @@ import attr
|
||||
from ..models.error_code import ErrorCode
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
HX = TypeVar("HX", bound="ApiError")
|
||||
TL = TypeVar("TL", bound="ApiError")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -18,6 +18,7 @@ class ApiError:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
error_code: Union[Unset, ErrorCode] = UNSET
|
||||
if not isinstance(self.error_code, Unset):
|
||||
error_code = self.error_code
|
||||
message = self.message
|
||||
@ -33,14 +34,16 @@ class ApiError:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX:
|
||||
def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL:
|
||||
d = src_dict.copy()
|
||||
_error_code = d.pop("error_code", UNSET)
|
||||
error_code: Union[Unset, ErrorCode]
|
||||
if isinstance(_error_code, Unset):
|
||||
error_code = UNSET
|
||||
if _error_code is None:
|
||||
error_code = UNSET
|
||||
else:
|
||||
error_code = _error_code # type: ignore[arg-type]
|
||||
error_code = _error_code
|
||||
|
||||
message = d.pop("message", UNSET)
|
||||
|
||||
|
@ -7,7 +7,7 @@ from dateutil.parser import isoparse
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
LB = TypeVar("LB", bound="ApiToken")
|
||||
MN = TypeVar("MN", bound="ApiToken")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -56,7 +56,7 @@ class ApiToken:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB:
|
||||
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
|
||||
d = src_dict.copy()
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
@ -65,7 +65,14 @@ class ApiToken:
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id
|
||||
|
||||
is_valid = d.pop("is_valid", UNSET)
|
||||
|
||||
@ -73,8 +80,10 @@ class ApiToken:
|
||||
token: Union[Unset, Uuid]
|
||||
if isinstance(_token, Unset):
|
||||
token = UNSET
|
||||
if _token is None:
|
||||
token = UNSET
|
||||
else:
|
||||
token = _token # type: ignore[arg-type]
|
||||
token = _token
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -83,7 +92,14 @@ class ApiToken:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
api_token = cls(
|
||||
created_at=created_at,
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
NE = TypeVar("NE", bound="ApiTokenResultsPage")
|
||||
JV = TypeVar("JV", bound="ApiTokenResultsPage")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -37,7 +37,7 @@ class ApiTokenResultsPage:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE:
|
||||
def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV:
|
||||
d = src_dict.copy()
|
||||
from ..models.api_token import ApiToken
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
TL = TypeVar("TL", bound="AppClientInfo")
|
||||
IO = TypeVar("IO", bound="AppClientInfo")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -27,7 +27,7 @@ class AppClientInfo:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL:
|
||||
def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO:
|
||||
d = src_dict.copy()
|
||||
url = d.pop("url", UNSET)
|
||||
|
||||
|
@ -9,7 +9,7 @@ from ..models.async_api_call_type import AsyncApiCallType
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
MN = TypeVar("MN", bound="AsyncApiCall")
|
||||
FV = TypeVar("FV", bound="AsyncApiCall")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -45,8 +45,10 @@ class AsyncApiCall:
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type: Union[Unset, AsyncApiCallType] = UNSET
|
||||
if not isinstance(self.type, Unset):
|
||||
type = self.type
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
@ -86,7 +88,7 @@ class AsyncApiCall:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
|
||||
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]
|
||||
@ -108,8 +110,10 @@ class AsyncApiCall:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
input = d.pop("input", UNSET)
|
||||
output = d.pop("output", UNSET)
|
||||
@ -124,15 +128,19 @@ class AsyncApiCall:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
_type = d.pop("type", UNSET)
|
||||
type: Union[Unset, AsyncApiCallType]
|
||||
if isinstance(_type, Unset):
|
||||
type = UNSET
|
||||
if _type is None:
|
||||
type = UNSET
|
||||
else:
|
||||
type = _type # type: ignore[arg-type]
|
||||
type = _type
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -141,7 +149,14 @@ class AsyncApiCall:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
worker = d.pop("worker", UNSET)
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.ai_feedback import AiFeedback
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..models.base64data import Base64Data
|
||||
from ..models.file_export_format import FileExportFormat
|
||||
@ -19,7 +20,7 @@ from ..models.unit_volume import UnitVolume
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
JV = TypeVar("JV", bound="file_conversion")
|
||||
LE = TypeVar("LE", bound="file_conversion")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -52,8 +53,10 @@ class file_conversion:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_format: Union[Unset, FileExportFormat] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
output_format = self.output_format
|
||||
output_format_options: Union[Unset, OutputFormat] = UNSET
|
||||
if not isinstance(self.output_format_options, Unset):
|
||||
output_format_options = self.output_format_options
|
||||
outputs: Union[Unset, Dict[str, str]] = UNSET
|
||||
@ -62,13 +65,16 @@ class file_conversion:
|
||||
for key, value in self.outputs.items():
|
||||
new_dict[key] = value.get_encoded()
|
||||
outputs = new_dict
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
src_format_options: Union[Unset, InputFormat] = UNSET
|
||||
if not isinstance(self.src_format_options, Unset):
|
||||
src_format_options = self.src_format_options
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type = self.type
|
||||
@ -91,13 +97,17 @@ class file_conversion:
|
||||
if output_format is not UNSET:
|
||||
field_dict["output_format"] = output_format
|
||||
if output_format_options is not UNSET:
|
||||
field_dict["output_format_options"] = output_format_options
|
||||
_output_format_options: OutputFormat = cast(
|
||||
OutputFormat, output_format_options
|
||||
)
|
||||
field_dict["output_format_options"] = _output_format_options.to_dict()
|
||||
if outputs is not UNSET:
|
||||
field_dict["outputs"] = outputs
|
||||
if src_format is not UNSET:
|
||||
field_dict["src_format"] = src_format
|
||||
if src_format_options is not UNSET:
|
||||
field_dict["src_format_options"] = src_format_options
|
||||
_src_format_options: InputFormat = cast(InputFormat, src_format_options)
|
||||
field_dict["src_format_options"] = _src_format_options.to_dict()
|
||||
if started_at is not UNSET:
|
||||
field_dict["started_at"] = started_at
|
||||
if status is not UNSET:
|
||||
@ -111,7 +121,7 @@ class file_conversion:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV:
|
||||
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]
|
||||
@ -133,22 +143,28 @@ class file_conversion:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_format = d.pop("output_format", UNSET)
|
||||
output_format: Union[Unset, FileExportFormat]
|
||||
if isinstance(_output_format, Unset):
|
||||
output_format = UNSET
|
||||
if _output_format is None:
|
||||
output_format = UNSET
|
||||
else:
|
||||
output_format = _output_format # type: ignore[arg-type]
|
||||
output_format = _output_format
|
||||
|
||||
_output_format_options = d.pop("output_format_options", UNSET)
|
||||
output_format_options: Union[Unset, OutputFormat]
|
||||
if isinstance(_output_format_options, Unset):
|
||||
output_format_options = UNSET
|
||||
if _output_format_options is None:
|
||||
output_format_options = UNSET
|
||||
else:
|
||||
output_format_options = _output_format_options # type: ignore[arg-type]
|
||||
output_format_options = OutputFormat.from_dict(_output_format_options)
|
||||
|
||||
_outputs = d.pop("outputs", UNSET)
|
||||
if isinstance(_outputs, Unset):
|
||||
@ -163,15 +179,19 @@ class file_conversion:
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_src_format_options = d.pop("src_format_options", UNSET)
|
||||
src_format_options: Union[Unset, InputFormat]
|
||||
if isinstance(_src_format_options, Unset):
|
||||
src_format_options = UNSET
|
||||
if _src_format_options is None:
|
||||
src_format_options = UNSET
|
||||
else:
|
||||
src_format_options = _src_format_options # type: ignore[arg-type]
|
||||
src_format_options = InputFormat.from_dict(_src_format_options)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -184,8 +204,10 @@ class file_conversion:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
@ -196,7 +218,14 @@ class file_conversion:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_conversion = cls(
|
||||
completed_at=completed_at,
|
||||
@ -235,7 +264,7 @@ class file_conversion:
|
||||
return key in self.additional_properties
|
||||
|
||||
|
||||
IO = TypeVar("IO", bound="file_center_of_mass")
|
||||
OY = TypeVar("OY", bound="file_center_of_mass")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -258,6 +287,7 @@ class file_center_of_mass:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
center_of_mass: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.center_of_mass, Unset):
|
||||
center_of_mass = self.center_of_mass
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
@ -268,13 +298,16 @@ class file_center_of_mass:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_unit: Union[Unset, UnitLength] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type = self.type
|
||||
@ -287,7 +320,8 @@ class file_center_of_mass:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if center_of_mass is not UNSET:
|
||||
field_dict["center_of_mass"] = center_of_mass
|
||||
_center_of_mass: Point3d = cast(Point3d, center_of_mass)
|
||||
field_dict["center_of_mass"] = _center_of_mass.to_dict()
|
||||
if completed_at is not UNSET:
|
||||
field_dict["completed_at"] = completed_at
|
||||
if created_at is not UNSET:
|
||||
@ -313,14 +347,16 @@ class file_center_of_mass:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[IO], src_dict: Dict[str, Any]) -> IO:
|
||||
def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY:
|
||||
d = src_dict.copy()
|
||||
_center_of_mass = d.pop("center_of_mass", UNSET)
|
||||
center_of_mass: Union[Unset, Point3d]
|
||||
if isinstance(_center_of_mass, Unset):
|
||||
center_of_mass = UNSET
|
||||
if _center_of_mass is None:
|
||||
center_of_mass = UNSET
|
||||
else:
|
||||
center_of_mass = _center_of_mass # type: ignore[arg-type]
|
||||
center_of_mass = Point3d.from_dict(_center_of_mass)
|
||||
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -342,22 +378,28 @@ class file_center_of_mass:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitLength]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -370,8 +412,10 @@ class file_center_of_mass:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
@ -382,7 +426,14 @@ class file_center_of_mass:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_center_of_mass = cls(
|
||||
center_of_mass=center_of_mass,
|
||||
@ -419,7 +470,7 @@ class file_center_of_mass:
|
||||
return key in self.additional_properties
|
||||
|
||||
|
||||
FV = TypeVar("FV", bound="file_mass")
|
||||
HO = TypeVar("HO", bound="file_mass")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -454,15 +505,19 @@ class file_mass:
|
||||
id = self.id
|
||||
mass = self.mass
|
||||
material_density = self.material_density
|
||||
material_density_unit: Union[Unset, UnitDensity] = UNSET
|
||||
if not isinstance(self.material_density_unit, Unset):
|
||||
material_density_unit = self.material_density_unit
|
||||
output_unit: Union[Unset, UnitMass] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type = self.type
|
||||
@ -505,7 +560,7 @@ class file_mass:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[FV], src_dict: Dict[str, Any]) -> FV:
|
||||
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]
|
||||
@ -527,8 +582,10 @@ class file_mass:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
mass = d.pop("mass", UNSET)
|
||||
|
||||
@ -538,22 +595,28 @@ class file_mass:
|
||||
material_density_unit: Union[Unset, UnitDensity]
|
||||
if isinstance(_material_density_unit, Unset):
|
||||
material_density_unit = UNSET
|
||||
if _material_density_unit is None:
|
||||
material_density_unit = UNSET
|
||||
else:
|
||||
material_density_unit = _material_density_unit # type: ignore[arg-type]
|
||||
material_density_unit = _material_density_unit
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitMass]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -566,8 +629,10 @@ class file_mass:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
@ -578,7 +643,14 @@ class file_mass:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_mass = cls(
|
||||
completed_at=completed_at,
|
||||
@ -617,7 +689,7 @@ class file_mass:
|
||||
return key in self.additional_properties
|
||||
|
||||
|
||||
LE = TypeVar("LE", bound="file_volume")
|
||||
TM = TypeVar("TM", bound="file_volume")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -648,13 +720,16 @@ class file_volume:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_unit: Union[Unset, UnitVolume] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type = self.type
|
||||
@ -694,7 +769,7 @@ class file_volume:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[LE], src_dict: Dict[str, Any]) -> LE:
|
||||
def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -716,22 +791,28 @@ class file_volume:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitVolume]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -744,8 +825,10 @@ class file_volume:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
@ -756,7 +839,14 @@ class file_volume:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
volume = d.pop("volume", UNSET)
|
||||
|
||||
@ -795,7 +885,7 @@ class file_volume:
|
||||
return key in self.additional_properties
|
||||
|
||||
|
||||
OY = TypeVar("OY", bound="file_density")
|
||||
BS = TypeVar("BS", bound="file_density")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -830,15 +920,19 @@ class file_density:
|
||||
error = self.error
|
||||
id = self.id
|
||||
material_mass = self.material_mass
|
||||
material_mass_unit: Union[Unset, UnitMass] = UNSET
|
||||
if not isinstance(self.material_mass_unit, Unset):
|
||||
material_mass_unit = self.material_mass_unit
|
||||
output_unit: Union[Unset, UnitDensity] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type = self.type
|
||||
@ -881,7 +975,7 @@ class file_density:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[OY], src_dict: Dict[str, Any]) -> OY:
|
||||
def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -905,8 +999,10 @@ class file_density:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
material_mass = d.pop("material_mass", UNSET)
|
||||
|
||||
@ -914,22 +1010,28 @@ class file_density:
|
||||
material_mass_unit: Union[Unset, UnitMass]
|
||||
if isinstance(_material_mass_unit, Unset):
|
||||
material_mass_unit = UNSET
|
||||
if _material_mass_unit is None:
|
||||
material_mass_unit = UNSET
|
||||
else:
|
||||
material_mass_unit = _material_mass_unit # type: ignore[arg-type]
|
||||
material_mass_unit = _material_mass_unit
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitDensity]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -942,8 +1044,10 @@ class file_density:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
@ -954,7 +1058,14 @@ class file_density:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_density = cls(
|
||||
completed_at=completed_at,
|
||||
@ -993,7 +1104,7 @@ class file_density:
|
||||
return key in self.additional_properties
|
||||
|
||||
|
||||
HO = TypeVar("HO", bound="file_surface_area")
|
||||
AH = TypeVar("AH", bound="file_surface_area")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -1024,13 +1135,16 @@ class file_surface_area:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_unit: Union[Unset, UnitArea] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
surface_area = self.surface_area
|
||||
@ -1070,7 +1184,7 @@ class file_surface_area:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[HO], src_dict: Dict[str, Any]) -> HO:
|
||||
def from_dict(cls: Type[AH], src_dict: Dict[str, Any]) -> AH:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -1092,22 +1206,28 @@ class file_surface_area:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitArea]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -1120,8 +1240,10 @@ class file_surface_area:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
surface_area = d.pop("surface_area", UNSET)
|
||||
|
||||
@ -1134,7 +1256,14 @@ class file_surface_area:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_surface_area = cls(
|
||||
completed_at=completed_at,
|
||||
@ -1171,11 +1300,314 @@ class file_surface_area:
|
||||
return key in self.additional_properties
|
||||
|
||||
|
||||
AsyncApiCallOutput = Union[
|
||||
file_conversion,
|
||||
file_center_of_mass,
|
||||
file_mass,
|
||||
file_volume,
|
||||
file_density,
|
||||
file_surface_area,
|
||||
]
|
||||
EG = TypeVar("EG", bound="text_to_cad")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class text_to_cad:
|
||||
"""Text to CAD.""" # noqa: E501
|
||||
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
feedback: Union[Unset, AiFeedback] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
model_version: Union[Unset, str] = UNSET
|
||||
output_format: Union[Unset, FileExportFormat] = UNSET
|
||||
outputs: Union[Unset, Dict[str, Base64Data]] = UNSET
|
||||
prompt: Union[Unset, str] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
type: str = "text_to_cad"
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
feedback: Union[Unset, AiFeedback] = UNSET
|
||||
if not isinstance(self.feedback, Unset):
|
||||
feedback = self.feedback
|
||||
id = self.id
|
||||
model_version = self.model_version
|
||||
output_format: Union[Unset, FileExportFormat] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
output_format = self.output_format
|
||||
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
|
||||
prompt = self.prompt
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
type = self.type
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict["completed_at"] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict["created_at"] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict["error"] = error
|
||||
if feedback is not UNSET:
|
||||
field_dict["feedback"] = feedback
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if model_version is not UNSET:
|
||||
field_dict["model_version"] = model_version
|
||||
if output_format is not UNSET:
|
||||
field_dict["output_format"] = output_format
|
||||
if outputs is not UNSET:
|
||||
field_dict["outputs"] = outputs
|
||||
if prompt is not UNSET:
|
||||
field_dict["prompt"] = prompt
|
||||
if started_at is not UNSET:
|
||||
field_dict["started_at"] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict["status"] = status
|
||||
field_dict["type"] = type
|
||||
if updated_at is not UNSET:
|
||||
field_dict["updated_at"] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict["user_id"] = user_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_created_at, Unset):
|
||||
created_at = UNSET
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
_feedback = d.pop("feedback", UNSET)
|
||||
feedback: Union[Unset, AiFeedback]
|
||||
if isinstance(_feedback, Unset):
|
||||
feedback = UNSET
|
||||
if _feedback is None:
|
||||
feedback = UNSET
|
||||
else:
|
||||
feedback = _feedback
|
||||
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id
|
||||
|
||||
model_version = d.pop("model_version", UNSET)
|
||||
|
||||
_output_format = d.pop("output_format", UNSET)
|
||||
output_format: Union[Unset, FileExportFormat]
|
||||
if isinstance(_output_format, Unset):
|
||||
output_format = UNSET
|
||||
if _output_format is None:
|
||||
output_format = UNSET
|
||||
else:
|
||||
output_format = _output_format
|
||||
|
||||
_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
|
||||
|
||||
prompt = d.pop("prompt", UNSET)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_updated_at, Unset):
|
||||
updated_at = UNSET
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
text_to_cad = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
feedback=feedback,
|
||||
id=id,
|
||||
model_version=model_version,
|
||||
output_format=output_format,
|
||||
outputs=outputs,
|
||||
prompt=prompt,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
type=type,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
text_to_cad.additional_properties = d
|
||||
return text_to_cad
|
||||
|
||||
@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
|
||||
|
||||
|
||||
GY = TypeVar("GY", bound="AsyncApiCallOutput")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class AsyncApiCallOutput:
|
||||
|
||||
"""The output from the async API call."""
|
||||
|
||||
type: Union[
|
||||
file_conversion,
|
||||
file_center_of_mass,
|
||||
file_mass,
|
||||
file_volume,
|
||||
file_density,
|
||||
file_surface_area,
|
||||
text_to_cad,
|
||||
]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
type: Union[
|
||||
file_conversion,
|
||||
file_center_of_mass,
|
||||
file_mass,
|
||||
file_volume,
|
||||
file_density,
|
||||
file_surface_area,
|
||||
text_to_cad,
|
||||
],
|
||||
):
|
||||
self.type = type
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
if isinstance(self.type, file_conversion):
|
||||
JR: file_conversion = self.type
|
||||
return JR.to_dict()
|
||||
elif isinstance(self.type, file_center_of_mass):
|
||||
HK: file_center_of_mass = self.type
|
||||
return HK.to_dict()
|
||||
elif isinstance(self.type, file_mass):
|
||||
ON: file_mass = self.type
|
||||
return ON.to_dict()
|
||||
elif isinstance(self.type, file_volume):
|
||||
US: file_volume = self.type
|
||||
return US.to_dict()
|
||||
elif isinstance(self.type, file_density):
|
||||
FH: file_density = self.type
|
||||
return FH.to_dict()
|
||||
elif isinstance(self.type, file_surface_area):
|
||||
BB: file_surface_area = self.type
|
||||
return BB.to_dict()
|
||||
elif isinstance(self.type, text_to_cad):
|
||||
TV: text_to_cad = self.type
|
||||
return TV.to_dict()
|
||||
|
||||
raise Exception("Unknown type")
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
|
||||
if d.get("type") == "file_conversion":
|
||||
LY: file_conversion = file_conversion()
|
||||
LY.from_dict(d)
|
||||
return cls(type=LY)
|
||||
elif d.get("type") == "file_center_of_mass":
|
||||
VR: file_center_of_mass = file_center_of_mass()
|
||||
VR.from_dict(d)
|
||||
return cls(type=VR)
|
||||
elif d.get("type") == "file_mass":
|
||||
PC: file_mass = file_mass()
|
||||
PC.from_dict(d)
|
||||
return cls(type=PC)
|
||||
elif d.get("type") == "file_volume":
|
||||
KQ: file_volume = file_volume()
|
||||
KQ.from_dict(d)
|
||||
return cls(type=KQ)
|
||||
elif d.get("type") == "file_density":
|
||||
NH: file_density = file_density()
|
||||
NH.from_dict(d)
|
||||
return cls(type=NH)
|
||||
elif d.get("type") == "file_surface_area":
|
||||
PJ: file_surface_area = file_surface_area()
|
||||
PJ.from_dict(d)
|
||||
return cls(type=PJ)
|
||||
elif d.get("type") == "text_to_cad":
|
||||
CR: text_to_cad = text_to_cad()
|
||||
CR.from_dict(d)
|
||||
return cls(type=CR)
|
||||
|
||||
raise Exception("Unknown type")
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
TM = TypeVar("TM", bound="AsyncApiCallResultsPage")
|
||||
CE = TypeVar("CE", bound="AsyncApiCallResultsPage")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -37,7 +37,7 @@ class AsyncApiCallResultsPage:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[TM], src_dict: Dict[str, Any]) -> TM:
|
||||
def from_dict(cls: Type[CE], src_dict: Dict[str, Any]) -> CE:
|
||||
d = src_dict.copy()
|
||||
from ..models.async_api_call import AsyncApiCall
|
||||
|
||||
|
@ -16,6 +16,8 @@ class AsyncApiCallType(str, Enum):
|
||||
FILE_DENSITY = "file_density"
|
||||
"""# File surface area. """ # noqa: E501
|
||||
FILE_SURFACE_AREA = "file_surface_area"
|
||||
"""# Text to CAD. """ # noqa: E501
|
||||
TEXT_TO_CAD = "text_to_cad"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
@ -6,7 +6,7 @@ from ..models.axis import Axis
|
||||
from ..models.direction import Direction
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
BS = TypeVar("BS", bound="AxisDirectionPair")
|
||||
MS = TypeVar("MS", bound="AxisDirectionPair")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -19,8 +19,10 @@ class AxisDirectionPair:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
axis: Union[Unset, Axis] = UNSET
|
||||
if not isinstance(self.axis, Unset):
|
||||
axis = self.axis
|
||||
direction: Union[Unset, Direction] = UNSET
|
||||
if not isinstance(self.direction, Unset):
|
||||
direction = self.direction
|
||||
|
||||
@ -35,21 +37,25 @@ class AxisDirectionPair:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[BS], src_dict: Dict[str, Any]) -> BS:
|
||||
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
|
||||
d = src_dict.copy()
|
||||
_axis = d.pop("axis", UNSET)
|
||||
axis: Union[Unset, Axis]
|
||||
if isinstance(_axis, Unset):
|
||||
axis = UNSET
|
||||
if _axis is None:
|
||||
axis = UNSET
|
||||
else:
|
||||
axis = _axis # type: ignore[arg-type]
|
||||
axis = _axis
|
||||
|
||||
_direction = d.pop("direction", UNSET)
|
||||
direction: Union[Unset, Direction]
|
||||
if isinstance(_direction, Unset):
|
||||
direction = UNSET
|
||||
if _direction is None:
|
||||
direction = UNSET
|
||||
else:
|
||||
direction = _direction # type: ignore[arg-type]
|
||||
direction = _direction
|
||||
|
||||
axis_direction_pair = cls(
|
||||
axis=axis,
|
||||
|
@ -1,11 +1,11 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.new_address import NewAddress
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
AH = TypeVar("AH", bound="BillingInfo")
|
||||
LT = TypeVar("LT", bound="BillingInfo")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -19,6 +19,7 @@ class BillingInfo:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
address: Union[Unset, NewAddress] = UNSET
|
||||
if not isinstance(self.address, Unset):
|
||||
address = self.address
|
||||
name = self.name
|
||||
@ -28,7 +29,8 @@ class BillingInfo:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if address is not UNSET:
|
||||
field_dict["address"] = address
|
||||
_address: NewAddress = cast(NewAddress, address)
|
||||
field_dict["address"] = _address.to_dict()
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if phone is not UNSET:
|
||||
@ -37,14 +39,16 @@ class BillingInfo:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[AH], src_dict: Dict[str, Any]) -> AH:
|
||||
def from_dict(cls: Type[LT], src_dict: Dict[str, Any]) -> LT:
|
||||
d = src_dict.copy()
|
||||
_address = d.pop("address", UNSET)
|
||||
address: Union[Unset, NewAddress]
|
||||
if isinstance(_address, Unset):
|
||||
address = UNSET
|
||||
if _address is None:
|
||||
address = UNSET
|
||||
else:
|
||||
address = _address # type: ignore[arg-type]
|
||||
address = NewAddress.from_dict(_address)
|
||||
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
EG = TypeVar("EG", bound="CacheMetadata")
|
||||
ED = TypeVar("ED", bound="CacheMetadata")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -29,7 +29,7 @@ class CacheMetadata:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[EG], src_dict: Dict[str, Any]) -> EG:
|
||||
def from_dict(cls: Type[ED], src_dict: Dict[str, Any]) -> ED:
|
||||
d = src_dict.copy()
|
||||
ok = d.pop("ok", UNSET)
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.payment_method_card_checks import PaymentMethodCardChecks
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
JR = TypeVar("JR", bound="CardDetails")
|
||||
YY = TypeVar("YY", bound="CardDetails")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -25,6 +25,7 @@ class CardDetails:
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
brand = self.brand
|
||||
checks: Union[Unset, PaymentMethodCardChecks] = UNSET
|
||||
if not isinstance(self.checks, Unset):
|
||||
checks = self.checks
|
||||
country = self.country
|
||||
@ -40,7 +41,8 @@ class CardDetails:
|
||||
if brand is not UNSET:
|
||||
field_dict["brand"] = brand
|
||||
if checks is not UNSET:
|
||||
field_dict["checks"] = checks
|
||||
_checks: PaymentMethodCardChecks = cast(PaymentMethodCardChecks, checks)
|
||||
field_dict["checks"] = _checks.to_dict()
|
||||
if country is not UNSET:
|
||||
field_dict["country"] = country
|
||||
if exp_month is not UNSET:
|
||||
@ -57,7 +59,7 @@ class CardDetails:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[JR], src_dict: Dict[str, Any]) -> JR:
|
||||
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY:
|
||||
d = src_dict.copy()
|
||||
brand = d.pop("brand", UNSET)
|
||||
|
||||
@ -65,8 +67,10 @@ class CardDetails:
|
||||
checks: Union[Unset, PaymentMethodCardChecks]
|
||||
if isinstance(_checks, Unset):
|
||||
checks = UNSET
|
||||
if _checks is None:
|
||||
checks = UNSET
|
||||
else:
|
||||
checks = _checks # type: ignore[arg-type]
|
||||
checks = PaymentMethodCardChecks.from_dict(_checks)
|
||||
|
||||
country = d.pop("country", UNSET)
|
||||
|
||||
|
83
kittycad/models/center_of_mass.py
Normal file
83
kittycad/models/center_of_mass.py
Normal file
@ -0,0 +1,83 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
from ..models.unit_length import UnitLength
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
DO = TypeVar("DO", bound="CenterOfMass")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class CenterOfMass:
|
||||
"""The center of mass response.""" # noqa: E501
|
||||
|
||||
center_of_mass: Union[Unset, Point3d] = UNSET
|
||||
output_unit: Union[Unset, UnitLength] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
center_of_mass: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.center_of_mass, Unset):
|
||||
center_of_mass = self.center_of_mass
|
||||
output_unit: Union[Unset, UnitLength] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if center_of_mass is not UNSET:
|
||||
_center_of_mass: Point3d = cast(Point3d, center_of_mass)
|
||||
field_dict["center_of_mass"] = _center_of_mass.to_dict()
|
||||
if output_unit is not UNSET:
|
||||
field_dict["output_unit"] = output_unit
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[DO], src_dict: Dict[str, Any]) -> DO:
|
||||
d = src_dict.copy()
|
||||
_center_of_mass = d.pop("center_of_mass", UNSET)
|
||||
center_of_mass: Union[Unset, Point3d]
|
||||
if isinstance(_center_of_mass, Unset):
|
||||
center_of_mass = UNSET
|
||||
if _center_of_mass is None:
|
||||
center_of_mass = UNSET
|
||||
else:
|
||||
center_of_mass = Point3d.from_dict(_center_of_mass)
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitLength]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit
|
||||
|
||||
center_of_mass = cls(
|
||||
center_of_mass=center_of_mass,
|
||||
output_unit=output_unit,
|
||||
)
|
||||
|
||||
center_of_mass.additional_properties = d
|
||||
return center_of_mass
|
||||
|
||||
@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
|
106
kittycad/models/client_metrics.py
Normal file
106
kittycad/models/client_metrics.py
Normal file
@ -0,0 +1,106 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
|
||||
import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
FZ = TypeVar("FZ", bound="ClientMetrics")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class ClientMetrics:
|
||||
"""ClientMetrics contains information regarding the state of the peer.""" # noqa: E501
|
||||
|
||||
rtc_frames_decoded: Union[Unset, int] = UNSET
|
||||
rtc_frames_dropped: Union[Unset, int] = UNSET
|
||||
rtc_frames_per_second: Union[Unset, int] = UNSET
|
||||
rtc_frames_received: Union[Unset, int] = UNSET
|
||||
rtc_freeze_count: Union[Unset, int] = UNSET
|
||||
rtc_jitter_sec: Union[Unset, float] = UNSET
|
||||
rtc_keyframes_decoded: Union[Unset, int] = UNSET
|
||||
rtc_total_freezes_duration_sec: Union[Unset, float] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
rtc_frames_decoded = self.rtc_frames_decoded
|
||||
rtc_frames_dropped = self.rtc_frames_dropped
|
||||
rtc_frames_per_second = self.rtc_frames_per_second
|
||||
rtc_frames_received = self.rtc_frames_received
|
||||
rtc_freeze_count = self.rtc_freeze_count
|
||||
rtc_jitter_sec = self.rtc_jitter_sec
|
||||
rtc_keyframes_decoded = self.rtc_keyframes_decoded
|
||||
rtc_total_freezes_duration_sec = self.rtc_total_freezes_duration_sec
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if rtc_frames_decoded is not UNSET:
|
||||
field_dict["rtc_frames_decoded"] = rtc_frames_decoded
|
||||
if rtc_frames_dropped is not UNSET:
|
||||
field_dict["rtc_frames_dropped"] = rtc_frames_dropped
|
||||
if rtc_frames_per_second is not UNSET:
|
||||
field_dict["rtc_frames_per_second"] = rtc_frames_per_second
|
||||
if rtc_frames_received is not UNSET:
|
||||
field_dict["rtc_frames_received"] = rtc_frames_received
|
||||
if rtc_freeze_count is not UNSET:
|
||||
field_dict["rtc_freeze_count"] = rtc_freeze_count
|
||||
if rtc_jitter_sec is not UNSET:
|
||||
field_dict["rtc_jitter_sec"] = rtc_jitter_sec
|
||||
if rtc_keyframes_decoded is not UNSET:
|
||||
field_dict["rtc_keyframes_decoded"] = rtc_keyframes_decoded
|
||||
if rtc_total_freezes_duration_sec is not UNSET:
|
||||
field_dict[
|
||||
"rtc_total_freezes_duration_sec"
|
||||
] = rtc_total_freezes_duration_sec
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[FZ], src_dict: Dict[str, Any]) -> FZ:
|
||||
d = src_dict.copy()
|
||||
rtc_frames_decoded = d.pop("rtc_frames_decoded", UNSET)
|
||||
|
||||
rtc_frames_dropped = d.pop("rtc_frames_dropped", UNSET)
|
||||
|
||||
rtc_frames_per_second = d.pop("rtc_frames_per_second", UNSET)
|
||||
|
||||
rtc_frames_received = d.pop("rtc_frames_received", UNSET)
|
||||
|
||||
rtc_freeze_count = d.pop("rtc_freeze_count", UNSET)
|
||||
|
||||
rtc_jitter_sec = d.pop("rtc_jitter_sec", UNSET)
|
||||
|
||||
rtc_keyframes_decoded = d.pop("rtc_keyframes_decoded", UNSET)
|
||||
|
||||
rtc_total_freezes_duration_sec = d.pop("rtc_total_freezes_duration_sec", UNSET)
|
||||
|
||||
client_metrics = cls(
|
||||
rtc_frames_decoded=rtc_frames_decoded,
|
||||
rtc_frames_dropped=rtc_frames_dropped,
|
||||
rtc_frames_per_second=rtc_frames_per_second,
|
||||
rtc_frames_received=rtc_frames_received,
|
||||
rtc_freeze_count=rtc_freeze_count,
|
||||
rtc_jitter_sec=rtc_jitter_sec,
|
||||
rtc_keyframes_decoded=rtc_keyframes_decoded,
|
||||
rtc_total_freezes_duration_sec=rtc_total_freezes_duration_sec,
|
||||
)
|
||||
|
||||
client_metrics.additional_properties = d
|
||||
return client_metrics
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
LY = TypeVar("LY", bound="Cluster")
|
||||
GL = TypeVar("GL", bound="Cluster")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -49,7 +49,7 @@ class Cluster:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[LY], src_dict: Dict[str, Any]) -> LY:
|
||||
def from_dict(cls: Type[GL], src_dict: Dict[str, Any]) -> GL:
|
||||
d = src_dict.copy()
|
||||
addr = d.pop("addr", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
HK = TypeVar("HK", bound="CodeOutput")
|
||||
NN = TypeVar("NN", bound="CodeOutput")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -41,7 +41,7 @@ class CodeOutput:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[HK], src_dict: Dict[str, Any]) -> HK:
|
||||
def from_dict(cls: Type[NN], src_dict: Dict[str, Any]) -> NN:
|
||||
d = src_dict.copy()
|
||||
from ..models.output_file import OutputFile
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
VR = TypeVar("VR", bound="Color")
|
||||
OH = TypeVar("OH", bound="Color")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -39,7 +39,7 @@ class Color:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[VR], src_dict: Dict[str, Any]) -> VR:
|
||||
def from_dict(cls: Type[OH], src_dict: Dict[str, Any]) -> OH:
|
||||
d = src_dict.copy()
|
||||
a = d.pop("a", UNSET)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
@ -10,7 +10,7 @@ from ..models.jetstream import Jetstream
|
||||
from ..models.leaf_node import LeafNode
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
PC = TypeVar("PC", bound="Connection")
|
||||
VI = TypeVar("VI", bound="Connection")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -70,6 +70,7 @@ class Connection:
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
auth_timeout = self.auth_timeout
|
||||
cluster: Union[Unset, Cluster] = UNSET
|
||||
if not isinstance(self.cluster, Unset):
|
||||
cluster = self.cluster
|
||||
config_load_time: Union[Unset, str] = UNSET
|
||||
@ -78,6 +79,7 @@ class Connection:
|
||||
connections = self.connections
|
||||
cores = self.cores
|
||||
cpu = self.cpu
|
||||
gateway: Union[Unset, Gateway] = UNSET
|
||||
if not isinstance(self.gateway, Unset):
|
||||
gateway = self.gateway
|
||||
git_commit = self.git_commit
|
||||
@ -92,8 +94,10 @@ class Connection:
|
||||
https_port = self.https_port
|
||||
in_bytes = self.in_bytes
|
||||
in_msgs = self.in_msgs
|
||||
jetstream: Union[Unset, Jetstream] = UNSET
|
||||
if not isinstance(self.jetstream, Unset):
|
||||
jetstream = self.jetstream
|
||||
leaf: Union[Unset, LeafNode] = UNSET
|
||||
if not isinstance(self.leaf, Unset):
|
||||
leaf = self.leaf
|
||||
leafnodes = self.leafnodes
|
||||
@ -133,7 +137,8 @@ class Connection:
|
||||
if auth_timeout is not UNSET:
|
||||
field_dict["auth_timeout"] = auth_timeout
|
||||
if cluster is not UNSET:
|
||||
field_dict["cluster"] = cluster
|
||||
_cluster: Cluster = cast(Cluster, cluster)
|
||||
field_dict["cluster"] = _cluster.to_dict()
|
||||
if config_load_time is not UNSET:
|
||||
field_dict["config_load_time"] = config_load_time
|
||||
if connections is not UNSET:
|
||||
@ -143,7 +148,8 @@ class Connection:
|
||||
if cpu is not UNSET:
|
||||
field_dict["cpu"] = cpu
|
||||
if gateway is not UNSET:
|
||||
field_dict["gateway"] = gateway
|
||||
_gateway: Gateway = cast(Gateway, gateway)
|
||||
field_dict["gateway"] = _gateway.to_dict()
|
||||
if git_commit is not UNSET:
|
||||
field_dict["git_commit"] = git_commit
|
||||
if go is not UNSET:
|
||||
@ -167,9 +173,11 @@ class Connection:
|
||||
if in_msgs is not UNSET:
|
||||
field_dict["in_msgs"] = in_msgs
|
||||
if jetstream is not UNSET:
|
||||
field_dict["jetstream"] = jetstream
|
||||
_jetstream: Jetstream = cast(Jetstream, jetstream)
|
||||
field_dict["jetstream"] = _jetstream.to_dict()
|
||||
if leaf is not UNSET:
|
||||
field_dict["leaf"] = leaf
|
||||
_leaf: LeafNode = cast(LeafNode, leaf)
|
||||
field_dict["leaf"] = _leaf.to_dict()
|
||||
if leafnodes is not UNSET:
|
||||
field_dict["leafnodes"] = leafnodes
|
||||
if max_connections is not UNSET:
|
||||
@ -226,7 +234,7 @@ class Connection:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[PC], src_dict: Dict[str, Any]) -> PC:
|
||||
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> VI:
|
||||
d = src_dict.copy()
|
||||
auth_timeout = d.pop("auth_timeout", UNSET)
|
||||
|
||||
@ -234,8 +242,10 @@ class Connection:
|
||||
cluster: Union[Unset, Cluster]
|
||||
if isinstance(_cluster, Unset):
|
||||
cluster = UNSET
|
||||
if _cluster is None:
|
||||
cluster = UNSET
|
||||
else:
|
||||
cluster = _cluster # type: ignore[arg-type]
|
||||
cluster = Cluster.from_dict(_cluster)
|
||||
|
||||
_config_load_time = d.pop("config_load_time", UNSET)
|
||||
config_load_time: Union[Unset, datetime.datetime]
|
||||
@ -254,8 +264,10 @@ class Connection:
|
||||
gateway: Union[Unset, Gateway]
|
||||
if isinstance(_gateway, Unset):
|
||||
gateway = UNSET
|
||||
if _gateway is None:
|
||||
gateway = UNSET
|
||||
else:
|
||||
gateway = _gateway # type: ignore[arg-type]
|
||||
gateway = Gateway.from_dict(_gateway)
|
||||
|
||||
git_commit = d.pop("git_commit", UNSET)
|
||||
|
||||
@ -283,15 +295,19 @@ class Connection:
|
||||
jetstream: Union[Unset, Jetstream]
|
||||
if isinstance(_jetstream, Unset):
|
||||
jetstream = UNSET
|
||||
if _jetstream is None:
|
||||
jetstream = UNSET
|
||||
else:
|
||||
jetstream = _jetstream # type: ignore[arg-type]
|
||||
jetstream = Jetstream.from_dict(_jetstream)
|
||||
|
||||
_leaf = d.pop("leaf", UNSET)
|
||||
leaf: Union[Unset, LeafNode]
|
||||
if isinstance(_leaf, Unset):
|
||||
leaf = UNSET
|
||||
if _leaf is None:
|
||||
leaf = UNSET
|
||||
else:
|
||||
leaf = _leaf # type: ignore[arg-type]
|
||||
leaf = LeafNode.from_dict(_leaf)
|
||||
|
||||
leafnodes = d.pop("leafnodes", UNSET)
|
||||
|
||||
|
@ -1,507 +1,3 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class CountryCode(str, Enum):
|
||||
"""An enumeration of all ISO-3166 alpha-2 country codes.""" # noqa: E501
|
||||
|
||||
"""# Afghanistan """ # noqa: E501
|
||||
AF = "AF"
|
||||
"""# Åland Islands """ # noqa: E501
|
||||
AX = "AX"
|
||||
"""# Albania """ # noqa: E501
|
||||
AL = "AL"
|
||||
"""# Algeria """ # noqa: E501
|
||||
DZ = "DZ"
|
||||
"""# American Samoa """ # noqa: E501
|
||||
AS = "AS"
|
||||
"""# Andorra """ # noqa: E501
|
||||
AD = "AD"
|
||||
"""# Angola """ # noqa: E501
|
||||
AO = "AO"
|
||||
"""# Anguilla """ # noqa: E501
|
||||
AI = "AI"
|
||||
"""# Antarctica """ # noqa: E501
|
||||
AQ = "AQ"
|
||||
"""# Antigua and Barbuda """ # noqa: E501
|
||||
AG = "AG"
|
||||
"""# Argentina """ # noqa: E501
|
||||
AR = "AR"
|
||||
"""# Armenia """ # noqa: E501
|
||||
AM = "AM"
|
||||
"""# Aruba """ # noqa: E501
|
||||
AW = "AW"
|
||||
"""# Australia """ # noqa: E501
|
||||
AU = "AU"
|
||||
"""# Austria """ # noqa: E501
|
||||
AT = "AT"
|
||||
"""# Azerbaijan """ # noqa: E501
|
||||
AZ = "AZ"
|
||||
"""# Bahamas """ # noqa: E501
|
||||
BS = "BS"
|
||||
"""# Bahrain """ # noqa: E501
|
||||
BH = "BH"
|
||||
"""# Bangladesh """ # noqa: E501
|
||||
BD = "BD"
|
||||
"""# Barbados """ # noqa: E501
|
||||
BB = "BB"
|
||||
"""# Belarus """ # noqa: E501
|
||||
BY = "BY"
|
||||
"""# Belgium """ # noqa: E501
|
||||
BE = "BE"
|
||||
"""# Belize """ # noqa: E501
|
||||
BZ = "BZ"
|
||||
"""# Benin """ # noqa: E501
|
||||
BJ = "BJ"
|
||||
"""# Bermuda """ # noqa: E501
|
||||
BM = "BM"
|
||||
"""# Bhutan """ # noqa: E501
|
||||
BT = "BT"
|
||||
"""# Bolivia (Plurinational State of) """ # noqa: E501
|
||||
BO = "BO"
|
||||
"""# Bonaire, Sint Eustatius and Saba """ # noqa: E501
|
||||
BQ = "BQ"
|
||||
"""# Bosnia and Herzegovina """ # noqa: E501
|
||||
BA = "BA"
|
||||
"""# Botswana """ # noqa: E501
|
||||
BW = "BW"
|
||||
"""# Bouvet Island """ # noqa: E501
|
||||
BV = "BV"
|
||||
"""# Brazil """ # noqa: E501
|
||||
BR = "BR"
|
||||
"""# British Indian Ocean Territory """ # noqa: E501
|
||||
IO = "IO"
|
||||
"""# Brunei Darussalam """ # noqa: E501
|
||||
BN = "BN"
|
||||
"""# Bulgaria """ # noqa: E501
|
||||
BG = "BG"
|
||||
"""# Burkina Faso """ # noqa: E501
|
||||
BF = "BF"
|
||||
"""# Burundi """ # noqa: E501
|
||||
BI = "BI"
|
||||
"""# Cabo Verde """ # noqa: E501
|
||||
CV = "CV"
|
||||
"""# Cambodia """ # noqa: E501
|
||||
KH = "KH"
|
||||
"""# Cameroon """ # noqa: E501
|
||||
CM = "CM"
|
||||
"""# Canada """ # noqa: E501
|
||||
CA = "CA"
|
||||
"""# Cayman Islands """ # noqa: E501
|
||||
KY = "KY"
|
||||
"""# Central African Republic """ # noqa: E501
|
||||
CF = "CF"
|
||||
"""# Chad """ # noqa: E501
|
||||
TD = "TD"
|
||||
"""# Chile """ # noqa: E501
|
||||
CL = "CL"
|
||||
"""# China """ # noqa: E501
|
||||
CN = "CN"
|
||||
"""# Christmas Island """ # noqa: E501
|
||||
CX = "CX"
|
||||
"""# Cocos (Keeling) Islands """ # noqa: E501
|
||||
CC = "CC"
|
||||
"""# Colombia """ # noqa: E501
|
||||
CO = "CO"
|
||||
"""# Comoros """ # noqa: E501
|
||||
KM = "KM"
|
||||
"""# Congo """ # noqa: E501
|
||||
CG = "CG"
|
||||
"""# Congo (Democratic Republic of the) """ # noqa: E501
|
||||
CD = "CD"
|
||||
"""# Cook Islands """ # noqa: E501
|
||||
CK = "CK"
|
||||
"""# Costa Rica """ # noqa: E501
|
||||
CR = "CR"
|
||||
"""# Côte d'Ivoire """ # noqa: E501
|
||||
CI = "CI"
|
||||
"""# Croatia """ # noqa: E501
|
||||
HR = "HR"
|
||||
"""# Cuba """ # noqa: E501
|
||||
CU = "CU"
|
||||
"""# Curaçao """ # noqa: E501
|
||||
CW = "CW"
|
||||
"""# Cyprus """ # noqa: E501
|
||||
CY = "CY"
|
||||
"""# Czechia """ # noqa: E501
|
||||
CZ = "CZ"
|
||||
"""# Denmark """ # noqa: E501
|
||||
DK = "DK"
|
||||
"""# Djibouti """ # noqa: E501
|
||||
DJ = "DJ"
|
||||
"""# Dominica """ # noqa: E501
|
||||
DM = "DM"
|
||||
"""# Dominican Republic """ # noqa: E501
|
||||
DO = "DO"
|
||||
"""# Ecuador """ # noqa: E501
|
||||
EC = "EC"
|
||||
"""# Egypt """ # noqa: E501
|
||||
EG = "EG"
|
||||
"""# El Salvador """ # noqa: E501
|
||||
SV = "SV"
|
||||
"""# Equatorial Guinea """ # noqa: E501
|
||||
GQ = "GQ"
|
||||
"""# Eritrea """ # noqa: E501
|
||||
ER = "ER"
|
||||
"""# Estonia """ # noqa: E501
|
||||
EE = "EE"
|
||||
"""# Ethiopia """ # noqa: E501
|
||||
ET = "ET"
|
||||
"""# Falkland Islands (Malvinas) """ # noqa: E501
|
||||
FK = "FK"
|
||||
"""# Faroe Islands """ # noqa: E501
|
||||
FO = "FO"
|
||||
"""# Fiji """ # noqa: E501
|
||||
FJ = "FJ"
|
||||
"""# Finland """ # noqa: E501
|
||||
FI = "FI"
|
||||
"""# France """ # noqa: E501
|
||||
FR = "FR"
|
||||
"""# French Guiana """ # noqa: E501
|
||||
GF = "GF"
|
||||
"""# French Polynesia """ # noqa: E501
|
||||
PF = "PF"
|
||||
"""# French Southern Territories """ # noqa: E501
|
||||
TF = "TF"
|
||||
"""# Gabon """ # noqa: E501
|
||||
GA = "GA"
|
||||
"""# Gambia """ # noqa: E501
|
||||
GM = "GM"
|
||||
"""# Georgia """ # noqa: E501
|
||||
GE = "GE"
|
||||
"""# Germany """ # noqa: E501
|
||||
DE = "DE"
|
||||
"""# Ghana """ # noqa: E501
|
||||
GH = "GH"
|
||||
"""# Gibraltar """ # noqa: E501
|
||||
GI = "GI"
|
||||
"""# Greece """ # noqa: E501
|
||||
GR = "GR"
|
||||
"""# Greenland """ # noqa: E501
|
||||
GL = "GL"
|
||||
"""# Grenada """ # noqa: E501
|
||||
GD = "GD"
|
||||
"""# Guadeloupe """ # noqa: E501
|
||||
GP = "GP"
|
||||
"""# Guam """ # noqa: E501
|
||||
GU = "GU"
|
||||
"""# Guatemala """ # noqa: E501
|
||||
GT = "GT"
|
||||
"""# Guernsey """ # noqa: E501
|
||||
GG = "GG"
|
||||
"""# Guinea """ # noqa: E501
|
||||
GN = "GN"
|
||||
"""# Guinea-Bissau """ # noqa: E501
|
||||
GW = "GW"
|
||||
"""# Guyana """ # noqa: E501
|
||||
GY = "GY"
|
||||
"""# Haiti """ # noqa: E501
|
||||
HT = "HT"
|
||||
"""# Heard Island and McDonald Islands """ # noqa: E501
|
||||
HM = "HM"
|
||||
"""# Holy See """ # noqa: E501
|
||||
VA = "VA"
|
||||
"""# Honduras """ # noqa: E501
|
||||
HN = "HN"
|
||||
"""# Hong Kong """ # noqa: E501
|
||||
HK = "HK"
|
||||
"""# Hungary """ # noqa: E501
|
||||
HU = "HU"
|
||||
"""# Iceland """ # noqa: E501
|
||||
IS = "IS"
|
||||
"""# India """ # noqa: E501
|
||||
IN = "IN"
|
||||
"""# Indonesia """ # noqa: E501
|
||||
ID = "ID"
|
||||
"""# Iran (Islamic Republic of) """ # noqa: E501
|
||||
IR = "IR"
|
||||
"""# Iraq """ # noqa: E501
|
||||
IQ = "IQ"
|
||||
"""# Ireland """ # noqa: E501
|
||||
IE = "IE"
|
||||
"""# Isle of Man """ # noqa: E501
|
||||
IM = "IM"
|
||||
"""# Israel """ # noqa: E501
|
||||
IL = "IL"
|
||||
"""# Italy """ # noqa: E501
|
||||
IT = "IT"
|
||||
"""# Jamaica """ # noqa: E501
|
||||
JM = "JM"
|
||||
"""# Japan """ # noqa: E501
|
||||
JP = "JP"
|
||||
"""# Jersey """ # noqa: E501
|
||||
JE = "JE"
|
||||
"""# Jordan """ # noqa: E501
|
||||
JO = "JO"
|
||||
"""# Kazakhstan """ # noqa: E501
|
||||
KZ = "KZ"
|
||||
"""# Kenya """ # noqa: E501
|
||||
KE = "KE"
|
||||
"""# Kiribati """ # noqa: E501
|
||||
KI = "KI"
|
||||
"""# Korea (Democratic People's Republic of) """ # noqa: E501
|
||||
KP = "KP"
|
||||
"""# Korea (Republic of) """ # noqa: E501
|
||||
KR = "KR"
|
||||
"""# Kuwait """ # noqa: E501
|
||||
KW = "KW"
|
||||
"""# Kyrgyzstan """ # noqa: E501
|
||||
KG = "KG"
|
||||
"""# Lao People's Democratic Republic """ # noqa: E501
|
||||
LA = "LA"
|
||||
"""# Latvia """ # noqa: E501
|
||||
LV = "LV"
|
||||
"""# Lebanon """ # noqa: E501
|
||||
LB = "LB"
|
||||
"""# Lesotho """ # noqa: E501
|
||||
LS = "LS"
|
||||
"""# Liberia """ # noqa: E501
|
||||
LR = "LR"
|
||||
"""# Libya """ # noqa: E501
|
||||
LY = "LY"
|
||||
"""# Liechtenstein """ # noqa: E501
|
||||
LI = "LI"
|
||||
"""# Lithuania """ # noqa: E501
|
||||
LT = "LT"
|
||||
"""# Luxembourg """ # noqa: E501
|
||||
LU = "LU"
|
||||
"""# Macao """ # noqa: E501
|
||||
MO = "MO"
|
||||
"""# Macedonia (the former Yugoslav Republic of) """ # noqa: E501
|
||||
MK = "MK"
|
||||
"""# Madagascar """ # noqa: E501
|
||||
MG = "MG"
|
||||
"""# Malawi """ # noqa: E501
|
||||
MW = "MW"
|
||||
"""# Malaysia """ # noqa: E501
|
||||
MY = "MY"
|
||||
"""# Maldives """ # noqa: E501
|
||||
MV = "MV"
|
||||
"""# Mali """ # noqa: E501
|
||||
ML = "ML"
|
||||
"""# Malta """ # noqa: E501
|
||||
MT = "MT"
|
||||
"""# Marshall Islands """ # noqa: E501
|
||||
MH = "MH"
|
||||
"""# Martinique """ # noqa: E501
|
||||
MQ = "MQ"
|
||||
"""# Mauritania """ # noqa: E501
|
||||
MR = "MR"
|
||||
"""# Mauritius """ # noqa: E501
|
||||
MU = "MU"
|
||||
"""# Mayotte """ # noqa: E501
|
||||
YT = "YT"
|
||||
"""# Mexico """ # noqa: E501
|
||||
MX = "MX"
|
||||
"""# Micronesia (Federated States of) """ # noqa: E501
|
||||
FM = "FM"
|
||||
"""# Moldova (Republic of) """ # noqa: E501
|
||||
MD = "MD"
|
||||
"""# Monaco """ # noqa: E501
|
||||
MC = "MC"
|
||||
"""# Mongolia """ # noqa: E501
|
||||
MN = "MN"
|
||||
"""# Montenegro """ # noqa: E501
|
||||
ME = "ME"
|
||||
"""# Montserrat """ # noqa: E501
|
||||
MS = "MS"
|
||||
"""# Morocco """ # noqa: E501
|
||||
MA = "MA"
|
||||
"""# Mozambique """ # noqa: E501
|
||||
MZ = "MZ"
|
||||
"""# Myanmar """ # noqa: E501
|
||||
MM = "MM"
|
||||
"""# Namibia """ # noqa: E501
|
||||
NA = "NA"
|
||||
"""# Nauru """ # noqa: E501
|
||||
NR = "NR"
|
||||
"""# Nepal """ # noqa: E501
|
||||
NP = "NP"
|
||||
"""# Netherlands """ # noqa: E501
|
||||
NL = "NL"
|
||||
"""# New Caledonia """ # noqa: E501
|
||||
NC = "NC"
|
||||
"""# New Zealand """ # noqa: E501
|
||||
NZ = "NZ"
|
||||
"""# Nicaragua """ # noqa: E501
|
||||
NI = "NI"
|
||||
"""# Niger """ # noqa: E501
|
||||
NE = "NE"
|
||||
"""# Nigeria """ # noqa: E501
|
||||
NG = "NG"
|
||||
"""# Niue """ # noqa: E501
|
||||
NU = "NU"
|
||||
"""# Norfolk Island """ # noqa: E501
|
||||
NF = "NF"
|
||||
"""# Northern Mariana Islands """ # noqa: E501
|
||||
MP = "MP"
|
||||
"""# Norway """ # noqa: E501
|
||||
NO = "NO"
|
||||
"""# Oman """ # noqa: E501
|
||||
OM = "OM"
|
||||
"""# Pakistan """ # noqa: E501
|
||||
PK = "PK"
|
||||
"""# Palau """ # noqa: E501
|
||||
PW = "PW"
|
||||
"""# Palestine, State of """ # noqa: E501
|
||||
PS = "PS"
|
||||
"""# Panama """ # noqa: E501
|
||||
PA = "PA"
|
||||
"""# Papua New Guinea """ # noqa: E501
|
||||
PG = "PG"
|
||||
"""# Paraguay """ # noqa: E501
|
||||
PY = "PY"
|
||||
"""# Peru """ # noqa: E501
|
||||
PE = "PE"
|
||||
"""# Philippines """ # noqa: E501
|
||||
PH = "PH"
|
||||
"""# Pitcairn """ # noqa: E501
|
||||
PN = "PN"
|
||||
"""# Poland """ # noqa: E501
|
||||
PL = "PL"
|
||||
"""# Portugal """ # noqa: E501
|
||||
PT = "PT"
|
||||
"""# Puerto Rico """ # noqa: E501
|
||||
PR = "PR"
|
||||
"""# Qatar """ # noqa: E501
|
||||
QA = "QA"
|
||||
"""# Réunion """ # noqa: E501
|
||||
RE = "RE"
|
||||
"""# Romania """ # noqa: E501
|
||||
RO = "RO"
|
||||
"""# Russian Federation """ # noqa: E501
|
||||
RU = "RU"
|
||||
"""# Rwanda """ # noqa: E501
|
||||
RW = "RW"
|
||||
"""# Saint Barthélemy """ # noqa: E501
|
||||
BL = "BL"
|
||||
"""# Saint Helena, Ascension and Tristan da Cunha """ # noqa: E501
|
||||
SH = "SH"
|
||||
"""# Saint Kitts and Nevis """ # noqa: E501
|
||||
KN = "KN"
|
||||
"""# Saint Lucia """ # noqa: E501
|
||||
LC = "LC"
|
||||
"""# Saint Martin (French part) """ # noqa: E501
|
||||
MF = "MF"
|
||||
"""# Saint Pierre and Miquelon """ # noqa: E501
|
||||
PM = "PM"
|
||||
"""# Saint Vincent and the Grenadines """ # noqa: E501
|
||||
VC = "VC"
|
||||
"""# Samoa """ # noqa: E501
|
||||
WS = "WS"
|
||||
"""# San Marino """ # noqa: E501
|
||||
SM = "SM"
|
||||
"""# Sao Tome and Principe """ # noqa: E501
|
||||
ST = "ST"
|
||||
"""# Saudi Arabia """ # noqa: E501
|
||||
SA = "SA"
|
||||
"""# Senegal """ # noqa: E501
|
||||
SN = "SN"
|
||||
"""# Serbia """ # noqa: E501
|
||||
RS = "RS"
|
||||
"""# Seychelles """ # noqa: E501
|
||||
SC = "SC"
|
||||
"""# Sierra Leone """ # noqa: E501
|
||||
SL = "SL"
|
||||
"""# Singapore """ # noqa: E501
|
||||
SG = "SG"
|
||||
"""# Sint Maarten (Dutch part) """ # noqa: E501
|
||||
SX = "SX"
|
||||
"""# Slovakia """ # noqa: E501
|
||||
SK = "SK"
|
||||
"""# Slovenia """ # noqa: E501
|
||||
SI = "SI"
|
||||
"""# Solomon Islands """ # noqa: E501
|
||||
SB = "SB"
|
||||
"""# Somalia """ # noqa: E501
|
||||
SO = "SO"
|
||||
"""# South Africa """ # noqa: E501
|
||||
ZA = "ZA"
|
||||
"""# South Georgia and the South Sandwich Islands """ # noqa: E501
|
||||
GS = "GS"
|
||||
"""# South Sudan """ # noqa: E501
|
||||
SS = "SS"
|
||||
"""# Spain """ # noqa: E501
|
||||
ES = "ES"
|
||||
"""# Sri Lanka """ # noqa: E501
|
||||
LK = "LK"
|
||||
"""# Sudan """ # noqa: E501
|
||||
SD = "SD"
|
||||
"""# Suriname """ # noqa: E501
|
||||
SR = "SR"
|
||||
"""# Svalbard and Jan Mayen """ # noqa: E501
|
||||
SJ = "SJ"
|
||||
"""# Swaziland """ # noqa: E501
|
||||
SZ = "SZ"
|
||||
"""# Sweden """ # noqa: E501
|
||||
SE = "SE"
|
||||
"""# Switzerland """ # noqa: E501
|
||||
CH = "CH"
|
||||
"""# Syrian Arab Republic """ # noqa: E501
|
||||
SY = "SY"
|
||||
"""# Taiwan, Province of China """ # noqa: E501
|
||||
TW = "TW"
|
||||
"""# Tajikistan """ # noqa: E501
|
||||
TJ = "TJ"
|
||||
"""# Tanzania, United Republic of """ # noqa: E501
|
||||
TZ = "TZ"
|
||||
"""# Thailand """ # noqa: E501
|
||||
TH = "TH"
|
||||
"""# Timor-Leste """ # noqa: E501
|
||||
TL = "TL"
|
||||
"""# Togo """ # noqa: E501
|
||||
TG = "TG"
|
||||
"""# Tokelau """ # noqa: E501
|
||||
TK = "TK"
|
||||
"""# Tonga """ # noqa: E501
|
||||
TO = "TO"
|
||||
"""# Trinidad and Tobago """ # noqa: E501
|
||||
TT = "TT"
|
||||
"""# Tunisia """ # noqa: E501
|
||||
TN = "TN"
|
||||
"""# Turkey """ # noqa: E501
|
||||
TR = "TR"
|
||||
"""# Turkmenistan """ # noqa: E501
|
||||
TM = "TM"
|
||||
"""# Turks and Caicos Islands """ # noqa: E501
|
||||
TC = "TC"
|
||||
"""# Tuvalu """ # noqa: E501
|
||||
TV = "TV"
|
||||
"""# Uganda """ # noqa: E501
|
||||
UG = "UG"
|
||||
"""# Ukraine """ # noqa: E501
|
||||
UA = "UA"
|
||||
"""# United Arab Emirates """ # noqa: E501
|
||||
AE = "AE"
|
||||
"""# United Kingdom of Great Britain and Northern Ireland """ # noqa: E501
|
||||
GB = "GB"
|
||||
"""# United States of America """ # noqa: E501
|
||||
US = "US"
|
||||
"""# United States Minor Outlying Islands """ # noqa: E501
|
||||
UM = "UM"
|
||||
"""# Uruguay """ # noqa: E501
|
||||
UY = "UY"
|
||||
"""# Uzbekistan """ # noqa: E501
|
||||
UZ = "UZ"
|
||||
"""# Vanuatu """ # noqa: E501
|
||||
VU = "VU"
|
||||
"""# Venezuela (Bolivarian Republic of) """ # noqa: E501
|
||||
VE = "VE"
|
||||
"""# Viet Nam """ # noqa: E501
|
||||
VN = "VN"
|
||||
"""# Virgin Islands (British) """ # noqa: E501
|
||||
VG = "VG"
|
||||
"""# Virgin Islands (U.S.) """ # noqa: E501
|
||||
VI = "VI"
|
||||
"""# Wallis and Futuna """ # noqa: E501
|
||||
WF = "WF"
|
||||
"""# Western Sahara """ # noqa: E501
|
||||
EH = "EH"
|
||||
"""# Yemen """ # noqa: E501
|
||||
YE = "YE"
|
||||
"""# Zambia """ # noqa: E501
|
||||
ZM = "ZM"
|
||||
"""# Zimbabwe """ # noqa: E501
|
||||
ZW = "ZW"
|
||||
|
||||
class CountryCode(str):
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
return self
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
US = TypeVar("US", bound="Coupon")
|
||||
ET = TypeVar("ET", bound="Coupon")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -39,7 +39,7 @@ class Coupon:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[US], src_dict: Dict[str, Any]) -> US:
|
||||
def from_dict(cls: Type[ET], src_dict: Dict[str, Any]) -> ET:
|
||||
d = src_dict.copy()
|
||||
amount_off = d.pop("amount_off", UNSET)
|
||||
|
||||
|
@ -1,290 +1,3 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class Currency(str, Enum):
|
||||
"""Currency is the list of supported currencies.
|
||||
|
||||
This comes from the Stripe API docs: For more details see <https://support.stripe.com/questions/which-currencies-does-stripe-support>.
|
||||
""" # noqa: E501
|
||||
|
||||
"""# United Arab Emirates Dirham """ # noqa: E501
|
||||
AED = "aed"
|
||||
"""# Afghan Afghani """ # noqa: E501
|
||||
AFN = "afn"
|
||||
"""# Albanian Lek """ # noqa: E501
|
||||
ALL = "all"
|
||||
"""# Armenian Dram """ # noqa: E501
|
||||
AMD = "amd"
|
||||
"""# Netherlands Antillean Gulden """ # noqa: E501
|
||||
ANG = "ang"
|
||||
"""# Angolan Kwanza """ # noqa: E501
|
||||
AOA = "aoa"
|
||||
"""# Argentine Peso """ # noqa: E501
|
||||
ARS = "ars"
|
||||
"""# Australian Dollar """ # noqa: E501
|
||||
AUD = "aud"
|
||||
"""# Aruban Florin """ # noqa: E501
|
||||
AWG = "awg"
|
||||
"""# Azerbaijani Manat """ # noqa: E501
|
||||
AZN = "azn"
|
||||
"""# Bosnia & Herzegovina Convertible Mark """ # noqa: E501
|
||||
BAM = "bam"
|
||||
"""# Barbadian Dollar """ # noqa: E501
|
||||
BBD = "bbd"
|
||||
"""# Bangladeshi Taka """ # noqa: E501
|
||||
BDT = "bdt"
|
||||
"""# Bulgarian Lev """ # noqa: E501
|
||||
BGN = "bgn"
|
||||
"""# Burundian Franc """ # noqa: E501
|
||||
BIF = "bif"
|
||||
"""# Bermudian Dollar """ # noqa: E501
|
||||
BMD = "bmd"
|
||||
"""# Brunei Dollar """ # noqa: E501
|
||||
BND = "bnd"
|
||||
"""# Bolivian Boliviano """ # noqa: E501
|
||||
BOB = "bob"
|
||||
"""# Brazilian Real """ # noqa: E501
|
||||
BRL = "brl"
|
||||
"""# Bahamian Dollar """ # noqa: E501
|
||||
BSD = "bsd"
|
||||
"""# Botswana Pula """ # noqa: E501
|
||||
BWP = "bwp"
|
||||
"""# Belize Dollar """ # noqa: E501
|
||||
BZD = "bzd"
|
||||
"""# Canadian Dollar """ # noqa: E501
|
||||
CAD = "cad"
|
||||
"""# Congolese Franc """ # noqa: E501
|
||||
CDF = "cdf"
|
||||
"""# Swiss Franc """ # noqa: E501
|
||||
CHF = "chf"
|
||||
"""# Chilean Peso """ # noqa: E501
|
||||
CLP = "clp"
|
||||
"""# Chinese Renminbi Yuan """ # noqa: E501
|
||||
CNY = "cny"
|
||||
"""# Colombian Peso """ # noqa: E501
|
||||
COP = "cop"
|
||||
"""# Costa Rican Colón """ # noqa: E501
|
||||
CRC = "crc"
|
||||
"""# Cape Verdean Escudo """ # noqa: E501
|
||||
CVE = "cve"
|
||||
"""# Czech Koruna """ # noqa: E501
|
||||
CZK = "czk"
|
||||
"""# Djiboutian Franc """ # noqa: E501
|
||||
DJF = "djf"
|
||||
"""# Danish Krone """ # noqa: E501
|
||||
DKK = "dkk"
|
||||
"""# Dominican Peso """ # noqa: E501
|
||||
DOP = "dop"
|
||||
"""# Algerian Dinar """ # noqa: E501
|
||||
DZD = "dzd"
|
||||
"""# Estonian Kroon """ # noqa: E501
|
||||
EEK = "eek"
|
||||
"""# Egyptian Pound """ # noqa: E501
|
||||
EGP = "egp"
|
||||
"""# Ethiopian Birr """ # noqa: E501
|
||||
ETB = "etb"
|
||||
"""# Euro """ # noqa: E501
|
||||
EUR = "eur"
|
||||
"""# Fijian Dollar """ # noqa: E501
|
||||
FJD = "fjd"
|
||||
"""# Falkland Islands Pound """ # noqa: E501
|
||||
FKP = "fkp"
|
||||
"""# British Pound """ # noqa: E501
|
||||
GBP = "gbp"
|
||||
"""# Georgian Lari """ # noqa: E501
|
||||
GEL = "gel"
|
||||
"""# Gibraltar Pound """ # noqa: E501
|
||||
GIP = "gip"
|
||||
"""# Gambian Dalasi """ # noqa: E501
|
||||
GMD = "gmd"
|
||||
"""# Guinean Franc """ # noqa: E501
|
||||
GNF = "gnf"
|
||||
"""# Guatemalan Quetzal """ # noqa: E501
|
||||
GTQ = "gtq"
|
||||
"""# Guyanese Dollar """ # noqa: E501
|
||||
GYD = "gyd"
|
||||
"""# Hong Kong Dollar """ # noqa: E501
|
||||
HKD = "hkd"
|
||||
"""# Honduran Lempira """ # noqa: E501
|
||||
HNL = "hnl"
|
||||
"""# Croatian Kuna """ # noqa: E501
|
||||
HRK = "hrk"
|
||||
"""# Haitian Gourde """ # noqa: E501
|
||||
HTG = "htg"
|
||||
"""# Hungarian Forint """ # noqa: E501
|
||||
HUF = "huf"
|
||||
"""# Indonesian Rupiah """ # noqa: E501
|
||||
IDR = "idr"
|
||||
"""# Israeli New Sheqel """ # noqa: E501
|
||||
ILS = "ils"
|
||||
"""# Indian Rupee """ # noqa: E501
|
||||
INR = "inr"
|
||||
"""# Icelandic Króna """ # noqa: E501
|
||||
ISK = "isk"
|
||||
"""# Jamaican Dollar """ # noqa: E501
|
||||
JMD = "jmd"
|
||||
"""# Japanese Yen """ # noqa: E501
|
||||
JPY = "jpy"
|
||||
"""# Kenyan Shilling """ # noqa: E501
|
||||
KES = "kes"
|
||||
"""# Kyrgyzstani Som """ # noqa: E501
|
||||
KGS = "kgs"
|
||||
"""# Cambodian Riel """ # noqa: E501
|
||||
KHR = "khr"
|
||||
"""# Comorian Franc """ # noqa: E501
|
||||
KMF = "kmf"
|
||||
"""# South Korean Won """ # noqa: E501
|
||||
KRW = "krw"
|
||||
"""# Cayman Islands Dollar """ # noqa: E501
|
||||
KYD = "kyd"
|
||||
"""# Kazakhstani Tenge """ # noqa: E501
|
||||
KZT = "kzt"
|
||||
"""# Lao Kip """ # noqa: E501
|
||||
LAK = "lak"
|
||||
"""# Lebanese Pound """ # noqa: E501
|
||||
LBP = "lbp"
|
||||
"""# Sri Lankan Rupee """ # noqa: E501
|
||||
LKR = "lkr"
|
||||
"""# Liberian Dollar """ # noqa: E501
|
||||
LRD = "lrd"
|
||||
"""# Lesotho Loti """ # noqa: E501
|
||||
LSL = "lsl"
|
||||
"""# Lithuanian Litas """ # noqa: E501
|
||||
LTL = "ltl"
|
||||
"""# Latvian Lats """ # noqa: E501
|
||||
LVL = "lvl"
|
||||
"""# Moroccan Dirham """ # noqa: E501
|
||||
MAD = "mad"
|
||||
"""# Moldovan Leu """ # noqa: E501
|
||||
MDL = "mdl"
|
||||
"""# Malagasy Ariary """ # noqa: E501
|
||||
MGA = "mga"
|
||||
"""# Macedonian Denar """ # noqa: E501
|
||||
MKD = "mkd"
|
||||
"""# Mongolian Tögrög """ # noqa: E501
|
||||
MNT = "mnt"
|
||||
"""# Macanese Pataca """ # noqa: E501
|
||||
MOP = "mop"
|
||||
"""# Mauritanian Ouguiya """ # noqa: E501
|
||||
MRO = "mro"
|
||||
"""# Mauritian Rupee """ # noqa: E501
|
||||
MUR = "mur"
|
||||
"""# Maldivian Rufiyaa """ # noqa: E501
|
||||
MVR = "mvr"
|
||||
"""# Malawian Kwacha """ # noqa: E501
|
||||
MWK = "mwk"
|
||||
"""# Mexican Peso """ # noqa: E501
|
||||
MXN = "mxn"
|
||||
"""# Malaysian Ringgit """ # noqa: E501
|
||||
MYR = "myr"
|
||||
"""# Mozambican Metical """ # noqa: E501
|
||||
MZN = "mzn"
|
||||
"""# Namibian Dollar """ # noqa: E501
|
||||
NAD = "nad"
|
||||
"""# Nigerian Naira """ # noqa: E501
|
||||
NGN = "ngn"
|
||||
"""# Nicaraguan Córdoba """ # noqa: E501
|
||||
NIO = "nio"
|
||||
"""# Norwegian Krone """ # noqa: E501
|
||||
NOK = "nok"
|
||||
"""# Nepalese Rupee """ # noqa: E501
|
||||
NPR = "npr"
|
||||
"""# New Zealand Dollar """ # noqa: E501
|
||||
NZD = "nzd"
|
||||
"""# Panamanian Balboa """ # noqa: E501
|
||||
PAB = "pab"
|
||||
"""# Peruvian Nuevo Sol """ # noqa: E501
|
||||
PEN = "pen"
|
||||
"""# Papua New Guinean Kina """ # noqa: E501
|
||||
PGK = "pgk"
|
||||
"""# Philippine Peso """ # noqa: E501
|
||||
PHP = "php"
|
||||
"""# Pakistani Rupee """ # noqa: E501
|
||||
PKR = "pkr"
|
||||
"""# Polish Złoty """ # noqa: E501
|
||||
PLN = "pln"
|
||||
"""# Paraguayan Guaraní """ # noqa: E501
|
||||
PYG = "pyg"
|
||||
"""# Qatari Riyal """ # noqa: E501
|
||||
QAR = "qar"
|
||||
"""# Romanian Leu """ # noqa: E501
|
||||
RON = "ron"
|
||||
"""# Serbian Dinar """ # noqa: E501
|
||||
RSD = "rsd"
|
||||
"""# Russian Ruble """ # noqa: E501
|
||||
RUB = "rub"
|
||||
"""# Rwandan Franc """ # noqa: E501
|
||||
RWF = "rwf"
|
||||
"""# Saudi Riyal """ # noqa: E501
|
||||
SAR = "sar"
|
||||
"""# Solomon Islands Dollar """ # noqa: E501
|
||||
SBD = "sbd"
|
||||
"""# Seychellois Rupee """ # noqa: E501
|
||||
SCR = "scr"
|
||||
"""# Swedish Krona """ # noqa: E501
|
||||
SEK = "sek"
|
||||
"""# Singapore Dollar """ # noqa: E501
|
||||
SGD = "sgd"
|
||||
"""# Saint Helenian Pound """ # noqa: E501
|
||||
SHP = "shp"
|
||||
"""# Sierra Leonean Leone """ # noqa: E501
|
||||
SLL = "sll"
|
||||
"""# Somali Shilling """ # noqa: E501
|
||||
SOS = "sos"
|
||||
"""# Surinamese Dollar """ # noqa: E501
|
||||
SRD = "srd"
|
||||
"""# São Tomé and Príncipe Dobra """ # noqa: E501
|
||||
STD = "std"
|
||||
"""# Salvadoran Colón """ # noqa: E501
|
||||
SVC = "svc"
|
||||
"""# Swazi Lilangeni """ # noqa: E501
|
||||
SZL = "szl"
|
||||
"""# Thai Baht """ # noqa: E501
|
||||
THB = "thb"
|
||||
"""# Tajikistani Somoni """ # noqa: E501
|
||||
TJS = "tjs"
|
||||
"""# Tongan Paʻanga """ # noqa: E501
|
||||
TOP = "top"
|
||||
"""# Turkish Lira """ # noqa: E501
|
||||
TRY = "try"
|
||||
"""# Trinidad and Tobago Dollar """ # noqa: E501
|
||||
TTD = "ttd"
|
||||
"""# New Taiwan Dollar """ # noqa: E501
|
||||
TWD = "twd"
|
||||
"""# Tanzanian Shilling """ # noqa: E501
|
||||
TZS = "tzs"
|
||||
"""# Ukrainian Hryvnia """ # noqa: E501
|
||||
UAH = "uah"
|
||||
"""# Ugandan Shilling """ # noqa: E501
|
||||
UGX = "ugx"
|
||||
"""# United States Dollar """ # noqa: E501
|
||||
USD = "usd"
|
||||
"""# Uruguayan Peso """ # noqa: E501
|
||||
UYU = "uyu"
|
||||
"""# Uzbekistani Som """ # noqa: E501
|
||||
UZS = "uzs"
|
||||
"""# Venezuelan Bolívar """ # noqa: E501
|
||||
VEF = "vef"
|
||||
"""# Vietnamese Đồng """ # noqa: E501
|
||||
VND = "vnd"
|
||||
"""# Vanuatu Vatu """ # noqa: E501
|
||||
VUV = "vuv"
|
||||
"""# Samoan Tala """ # noqa: E501
|
||||
WST = "wst"
|
||||
"""# Central African Cfa Franc """ # noqa: E501
|
||||
XAF = "xaf"
|
||||
"""# East Caribbean Dollar """ # noqa: E501
|
||||
XCD = "xcd"
|
||||
"""# West African Cfa Franc """ # noqa: E501
|
||||
XOF = "xof"
|
||||
"""# Cfp Franc """ # noqa: E501
|
||||
XPF = "xpf"
|
||||
"""# Yemeni Rial """ # noqa: E501
|
||||
YER = "yer"
|
||||
"""# South African Rand """ # noqa: E501
|
||||
ZAR = "zar"
|
||||
"""# Zambian Kwacha """ # noqa: E501
|
||||
ZMW = "zmw"
|
||||
|
||||
class Currency(str):
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
return self
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
KQ = TypeVar("KQ", bound="CurveGetControlPoints")
|
||||
QF = TypeVar("QF", bound="CurveGetControlPoints")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -33,7 +33,7 @@ class CurveGetControlPoints:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[KQ], src_dict: Dict[str, Any]) -> KQ:
|
||||
def from_dict(cls: Type[QF], src_dict: Dict[str, Any]) -> QF:
|
||||
d = src_dict.copy()
|
||||
from ..models.point3d import Point3d
|
||||
|
||||
|
83
kittycad/models/curve_get_end_points.py
Normal file
83
kittycad/models/curve_get_end_points.py
Normal file
@ -0,0 +1,83 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
DI = TypeVar("DI", bound="CurveGetEndPoints")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class CurveGetEndPoints:
|
||||
"""Endpoints of a curve""" # noqa: E501
|
||||
|
||||
end: Union[Unset, Point3d] = UNSET
|
||||
start: Union[Unset, Point3d] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
end: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.end, Unset):
|
||||
end = self.end
|
||||
start: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.start, Unset):
|
||||
start = self.start
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if end is not UNSET:
|
||||
_end: Point3d = cast(Point3d, end)
|
||||
field_dict["end"] = _end.to_dict()
|
||||
if start is not UNSET:
|
||||
_start: Point3d = cast(Point3d, start)
|
||||
field_dict["start"] = _start.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[DI], src_dict: Dict[str, Any]) -> DI:
|
||||
d = src_dict.copy()
|
||||
_end = d.pop("end", UNSET)
|
||||
end: Union[Unset, Point3d]
|
||||
if isinstance(_end, Unset):
|
||||
end = UNSET
|
||||
if _end is None:
|
||||
end = UNSET
|
||||
else:
|
||||
end = Point3d.from_dict(_end)
|
||||
|
||||
_start = d.pop("start", UNSET)
|
||||
start: Union[Unset, Point3d]
|
||||
if isinstance(_start, Unset):
|
||||
start = UNSET
|
||||
if _start is None:
|
||||
start = UNSET
|
||||
else:
|
||||
start = Point3d.from_dict(_start)
|
||||
|
||||
curve_get_end_points = cls(
|
||||
end=end,
|
||||
start=start,
|
||||
)
|
||||
|
||||
curve_get_end_points.additional_properties = d
|
||||
return curve_get_end_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
|
@ -5,7 +5,7 @@ import attr
|
||||
from ..models.curve_type import CurveType
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
FH = TypeVar("FH", bound="CurveGetType")
|
||||
OJ = TypeVar("OJ", bound="CurveGetType")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -17,6 +17,7 @@ class CurveGetType:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
curve_type: Union[Unset, CurveType] = UNSET
|
||||
if not isinstance(self.curve_type, Unset):
|
||||
curve_type = self.curve_type
|
||||
|
||||
@ -29,14 +30,16 @@ class CurveGetType:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[FH], src_dict: Dict[str, Any]) -> FH:
|
||||
def from_dict(cls: Type[OJ], src_dict: Dict[str, Any]) -> OJ:
|
||||
d = src_dict.copy()
|
||||
_curve_type = d.pop("curve_type", UNSET)
|
||||
curve_type: Union[Unset, CurveType]
|
||||
if isinstance(_curve_type, Unset):
|
||||
curve_type = UNSET
|
||||
if _curve_type is None:
|
||||
curve_type = UNSET
|
||||
else:
|
||||
curve_type = _curve_type # type: ignore[arg-type]
|
||||
curve_type = _curve_type
|
||||
|
||||
curve_get_type = cls(
|
||||
curve_type=curve_type,
|
||||
|
@ -5,6 +5,7 @@ class CurveType(str, Enum):
|
||||
"""The type of Curve (embedded within path)""" # noqa: E501
|
||||
|
||||
LINE = "line"
|
||||
ARC = "arc"
|
||||
NURBS = "nurbs"
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
@ -8,7 +8,7 @@ from ..models.currency import Currency
|
||||
from ..models.new_address import NewAddress
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
NH = TypeVar("NH", bound="Customer")
|
||||
UF = TypeVar("UF", bound="Customer")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -29,12 +29,14 @@ class Customer:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
address: Union[Unset, NewAddress] = UNSET
|
||||
if not isinstance(self.address, Unset):
|
||||
address = self.address
|
||||
balance = self.balance
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
currency: Union[Unset, Currency] = UNSET
|
||||
if not isinstance(self.currency, Unset):
|
||||
currency = self.currency
|
||||
delinquent = self.delinquent
|
||||
@ -49,7 +51,8 @@ class Customer:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if address is not UNSET:
|
||||
field_dict["address"] = address
|
||||
_address: NewAddress = cast(NewAddress, address)
|
||||
field_dict["address"] = _address.to_dict()
|
||||
if balance is not UNSET:
|
||||
field_dict["balance"] = balance
|
||||
if created_at is not UNSET:
|
||||
@ -72,14 +75,16 @@ class Customer:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[NH], src_dict: Dict[str, Any]) -> NH:
|
||||
def from_dict(cls: Type[UF], src_dict: Dict[str, Any]) -> UF:
|
||||
d = src_dict.copy()
|
||||
_address = d.pop("address", UNSET)
|
||||
address: Union[Unset, NewAddress]
|
||||
if isinstance(_address, Unset):
|
||||
address = UNSET
|
||||
if _address is None:
|
||||
address = UNSET
|
||||
else:
|
||||
address = _address # type: ignore[arg-type]
|
||||
address = NewAddress.from_dict(_address)
|
||||
|
||||
balance = d.pop("balance", UNSET)
|
||||
|
||||
@ -94,8 +99,10 @@ class Customer:
|
||||
currency: Union[Unset, Currency]
|
||||
if isinstance(_currency, Unset):
|
||||
currency = UNSET
|
||||
if _currency is None:
|
||||
currency = UNSET
|
||||
else:
|
||||
currency = _currency # type: ignore[arg-type]
|
||||
currency = _currency
|
||||
|
||||
delinquent = d.pop("delinquent", UNSET)
|
||||
|
||||
|
@ -7,7 +7,7 @@ from dateutil.parser import isoparse
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
BB = TypeVar("BB", bound="CustomerBalance")
|
||||
YF = TypeVar("YF", bound="CustomerBalance")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -64,7 +64,7 @@ class CustomerBalance:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[BB], src_dict: Dict[str, Any]) -> BB:
|
||||
def from_dict(cls: Type[YF], src_dict: Dict[str, Any]) -> YF:
|
||||
d = src_dict.copy()
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
@ -77,8 +77,10 @@ class CustomerBalance:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
monthly_credits_remaining = d.pop("monthly_credits_remaining", UNSET)
|
||||
|
||||
@ -95,7 +97,14 @@ class CustomerBalance:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
customer_balance = cls(
|
||||
created_at=created_at,
|
||||
|
72
kittycad/models/density.py
Normal file
72
kittycad/models/density.py
Normal file
@ -0,0 +1,72 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.unit_density import UnitDensity
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
PY = TypeVar("PY", bound="Density")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class Density:
|
||||
"""The density response.""" # noqa: E501
|
||||
|
||||
density: Union[Unset, float] = UNSET
|
||||
output_unit: Union[Unset, UnitDensity] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
density = self.density
|
||||
output_unit: Union[Unset, UnitDensity] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if density is not UNSET:
|
||||
field_dict["density"] = density
|
||||
if output_unit is not UNSET:
|
||||
field_dict["output_unit"] = output_unit
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[PY], src_dict: Dict[str, Any]) -> PY:
|
||||
d = src_dict.copy()
|
||||
density = d.pop("density", UNSET)
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitDensity]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit
|
||||
|
||||
density = cls(
|
||||
density=density,
|
||||
output_unit=output_unit,
|
||||
)
|
||||
|
||||
density.additional_properties = d
|
||||
return density
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -5,7 +5,7 @@ import attr
|
||||
from ..models.o_auth2_grant_type import OAuth2GrantType
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
PJ = TypeVar("PJ", bound="DeviceAccessTokenRequestForm")
|
||||
LK = TypeVar("LK", bound="DeviceAccessTokenRequestForm")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -21,6 +21,7 @@ class DeviceAccessTokenRequestForm:
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
client_id = self.client_id
|
||||
device_code = self.device_code
|
||||
grant_type: Union[Unset, OAuth2GrantType] = UNSET
|
||||
if not isinstance(self.grant_type, Unset):
|
||||
grant_type = self.grant_type
|
||||
|
||||
@ -37,7 +38,7 @@ class DeviceAccessTokenRequestForm:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[PJ], src_dict: Dict[str, Any]) -> PJ:
|
||||
def from_dict(cls: Type[LK], src_dict: Dict[str, Any]) -> LK:
|
||||
d = src_dict.copy()
|
||||
client_id = d.pop("client_id", UNSET)
|
||||
|
||||
@ -47,8 +48,10 @@ class DeviceAccessTokenRequestForm:
|
||||
grant_type: Union[Unset, OAuth2GrantType]
|
||||
if isinstance(_grant_type, Unset):
|
||||
grant_type = UNSET
|
||||
if _grant_type is None:
|
||||
grant_type = UNSET
|
||||
else:
|
||||
grant_type = _grant_type # type: ignore[arg-type]
|
||||
grant_type = _grant_type
|
||||
|
||||
device_access_token_request_form = cls(
|
||||
client_id=client_id,
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
TV = TypeVar("TV", bound="DeviceAuthRequestForm")
|
||||
AR = TypeVar("AR", bound="DeviceAuthRequestForm")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -27,7 +27,7 @@ class DeviceAuthRequestForm:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[TV], src_dict: Dict[str, Any]) -> TV:
|
||||
def from_dict(cls: Type[AR], src_dict: Dict[str, Any]) -> AR:
|
||||
d = src_dict.copy()
|
||||
client_id = d.pop("client_id", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
CR = TypeVar("CR", bound="DeviceAuthVerifyParams")
|
||||
WB = TypeVar("WB", bound="DeviceAuthVerifyParams")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -27,7 +27,7 @@ class DeviceAuthVerifyParams:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[CR], src_dict: Dict[str, Any]) -> CR:
|
||||
def from_dict(cls: Type[WB], src_dict: Dict[str, Any]) -> WB:
|
||||
d = src_dict.copy()
|
||||
user_code = d.pop("user_code", UNSET)
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.coupon import Coupon
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
CE = TypeVar("CE", bound="Discount")
|
||||
KK = TypeVar("KK", bound="Discount")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -17,6 +17,7 @@ class Discount:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
coupon: Union[Unset, Coupon] = UNSET
|
||||
if not isinstance(self.coupon, Unset):
|
||||
coupon = self.coupon
|
||||
|
||||
@ -24,19 +25,22 @@ class Discount:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if coupon is not UNSET:
|
||||
field_dict["coupon"] = coupon
|
||||
_coupon: Coupon = cast(Coupon, coupon)
|
||||
field_dict["coupon"] = _coupon.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[CE], src_dict: Dict[str, Any]) -> CE:
|
||||
def from_dict(cls: Type[KK], src_dict: Dict[str, Any]) -> KK:
|
||||
d = src_dict.copy()
|
||||
_coupon = d.pop("coupon", UNSET)
|
||||
coupon: Union[Unset, Coupon]
|
||||
if isinstance(_coupon, Unset):
|
||||
coupon = UNSET
|
||||
if _coupon is None:
|
||||
coupon = UNSET
|
||||
else:
|
||||
coupon = _coupon # type: ignore[arg-type]
|
||||
coupon = Coupon.from_dict(_coupon)
|
||||
|
||||
discount = cls(
|
||||
coupon=coupon,
|
||||
|
@ -1,559 +0,0 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
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
|
||||
|
||||
MS = TypeVar("MS", bound="DockerSystemInfo")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class DockerSystemInfo:
|
||||
"""Docker system info.""" # noqa: E501
|
||||
|
||||
architecture: Union[Unset, str] = UNSET
|
||||
bridge_nf_ip6tables: Union[Unset, bool] = False
|
||||
bridge_nf_iptables: Union[Unset, bool] = False
|
||||
cgroup_driver: Union[Unset, SystemInfoCgroupDriverEnum] = UNSET
|
||||
cgroup_version: Union[Unset, SystemInfoCgroupVersionEnum] = UNSET
|
||||
cluster_advertise: Union[Unset, str] = UNSET
|
||||
cluster_store: Union[Unset, str] = UNSET
|
||||
containerd_commit: Union[Unset, Commit] = UNSET
|
||||
containers: Union[Unset, int] = UNSET
|
||||
containers_paused: Union[Unset, int] = UNSET
|
||||
containers_running: Union[Unset, int] = UNSET
|
||||
containers_stopped: Union[Unset, int] = UNSET
|
||||
cpu_cfs_period: Union[Unset, bool] = False
|
||||
cpu_cfs_quota: Union[Unset, bool] = False
|
||||
cpu_set: Union[Unset, bool] = False
|
||||
cpu_shares: Union[Unset, bool] = False
|
||||
debug: Union[Unset, bool] = False
|
||||
from ..models.system_info_default_address_pools import SystemInfoDefaultAddressPools
|
||||
|
||||
default_address_pools: Union[Unset, List[SystemInfoDefaultAddressPools]] = UNSET
|
||||
default_runtime: Union[Unset, str] = UNSET
|
||||
docker_root_dir: Union[Unset, str] = UNSET
|
||||
driver: Union[Unset, str] = UNSET
|
||||
driver_status: Union[Unset, List[List[str]]] = UNSET
|
||||
experimental_build: Union[Unset, bool] = False
|
||||
http_proxy: Union[Unset, str] = UNSET
|
||||
https_proxy: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
images: Union[Unset, int] = UNSET
|
||||
index_server_address: Union[Unset, str] = UNSET
|
||||
init_binary: Union[Unset, str] = UNSET
|
||||
init_commit: Union[Unset, Commit] = UNSET
|
||||
ipv4_forwarding: Union[Unset, bool] = False
|
||||
isolation: Union[Unset, SystemInfoIsolationEnum] = UNSET
|
||||
kernel_memory: Union[Unset, bool] = False
|
||||
kernel_memory_tcp: Union[Unset, bool] = False
|
||||
kernel_version: Union[Unset, str] = UNSET
|
||||
labels: Union[Unset, List[str]] = UNSET
|
||||
live_restore_enabled: Union[Unset, bool] = False
|
||||
logging_driver: Union[Unset, str] = UNSET
|
||||
mem_total: Union[Unset, int] = UNSET
|
||||
memory_limit: Union[Unset, bool] = False
|
||||
n_events_listener: Union[Unset, int] = UNSET
|
||||
n_fd: Union[Unset, int] = UNSET
|
||||
name: Union[Unset, str] = UNSET
|
||||
ncpu: Union[Unset, int] = UNSET
|
||||
no_proxy: Union[Unset, str] = UNSET
|
||||
oom_kill_disable: Union[Unset, bool] = False
|
||||
operating_system: Union[Unset, str] = UNSET
|
||||
os_type: Union[Unset, str] = UNSET
|
||||
os_version: Union[Unset, str] = UNSET
|
||||
pids_limit: Union[Unset, bool] = False
|
||||
plugins: Union[Unset, PluginsInfo] = UNSET
|
||||
product_license: Union[Unset, str] = UNSET
|
||||
registry_config: Union[Unset, RegistryServiceConfig] = UNSET
|
||||
runc_commit: Union[Unset, Commit] = 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
|
||||
system_time: Union[Unset, str] = UNSET
|
||||
warnings: Union[Unset, List[str]] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
architecture = self.architecture
|
||||
bridge_nf_ip6tables = self.bridge_nf_ip6tables
|
||||
bridge_nf_iptables = self.bridge_nf_iptables
|
||||
if not isinstance(self.cgroup_driver, Unset):
|
||||
cgroup_driver = self.cgroup_driver
|
||||
if not isinstance(self.cgroup_version, Unset):
|
||||
cgroup_version = self.cgroup_version
|
||||
cluster_advertise = self.cluster_advertise
|
||||
cluster_store = self.cluster_store
|
||||
if not isinstance(self.containerd_commit, Unset):
|
||||
containerd_commit = self.containerd_commit
|
||||
containers = self.containers
|
||||
containers_paused = self.containers_paused
|
||||
containers_running = self.containers_running
|
||||
containers_stopped = self.containers_stopped
|
||||
cpu_cfs_period = self.cpu_cfs_period
|
||||
cpu_cfs_quota = self.cpu_cfs_quota
|
||||
cpu_set = self.cpu_set
|
||||
cpu_shares = self.cpu_shares
|
||||
debug = self.debug
|
||||
from ..models.system_info_default_address_pools import (
|
||||
SystemInfoDefaultAddressPools,
|
||||
)
|
||||
|
||||
default_address_pools: Union[Unset, List[SystemInfoDefaultAddressPools]] = UNSET
|
||||
if not isinstance(self.default_address_pools, Unset):
|
||||
default_address_pools = self.default_address_pools
|
||||
default_runtime = self.default_runtime
|
||||
docker_root_dir = self.docker_root_dir
|
||||
driver = self.driver
|
||||
driver_status: Union[Unset, List[List[str]]] = UNSET
|
||||
if not isinstance(self.driver_status, Unset):
|
||||
driver_status = self.driver_status
|
||||
experimental_build = self.experimental_build
|
||||
http_proxy = self.http_proxy
|
||||
https_proxy = self.https_proxy
|
||||
id = self.id
|
||||
images = self.images
|
||||
index_server_address = self.index_server_address
|
||||
init_binary = self.init_binary
|
||||
if not isinstance(self.init_commit, Unset):
|
||||
init_commit = self.init_commit
|
||||
ipv4_forwarding = self.ipv4_forwarding
|
||||
if not isinstance(self.isolation, Unset):
|
||||
isolation = self.isolation
|
||||
kernel_memory = self.kernel_memory
|
||||
kernel_memory_tcp = self.kernel_memory_tcp
|
||||
kernel_version = self.kernel_version
|
||||
labels: Union[Unset, List[str]] = UNSET
|
||||
if not isinstance(self.labels, Unset):
|
||||
labels = self.labels
|
||||
live_restore_enabled = self.live_restore_enabled
|
||||
logging_driver = self.logging_driver
|
||||
mem_total = self.mem_total
|
||||
memory_limit = self.memory_limit
|
||||
n_events_listener = self.n_events_listener
|
||||
n_fd = self.n_fd
|
||||
name = self.name
|
||||
ncpu = self.ncpu
|
||||
no_proxy = self.no_proxy
|
||||
oom_kill_disable = self.oom_kill_disable
|
||||
operating_system = self.operating_system
|
||||
os_type = self.os_type
|
||||
os_version = self.os_version
|
||||
pids_limit = self.pids_limit
|
||||
if not isinstance(self.plugins, Unset):
|
||||
plugins = self.plugins
|
||||
product_license = self.product_license
|
||||
if not isinstance(self.registry_config, Unset):
|
||||
registry_config = self.registry_config
|
||||
if not isinstance(self.runc_commit, Unset):
|
||||
runc_commit = self.runc_commit
|
||||
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
|
||||
server_version = self.server_version
|
||||
swap_limit = self.swap_limit
|
||||
system_time = self.system_time
|
||||
warnings: Union[Unset, List[str]] = UNSET
|
||||
if not isinstance(self.warnings, Unset):
|
||||
warnings = self.warnings
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if architecture is not UNSET:
|
||||
field_dict["architecture"] = architecture
|
||||
if bridge_nf_ip6tables is not UNSET:
|
||||
field_dict["bridge_nf_ip6tables"] = bridge_nf_ip6tables
|
||||
if bridge_nf_iptables is not UNSET:
|
||||
field_dict["bridge_nf_iptables"] = bridge_nf_iptables
|
||||
if cgroup_driver is not UNSET:
|
||||
field_dict["cgroup_driver"] = cgroup_driver
|
||||
if cgroup_version is not UNSET:
|
||||
field_dict["cgroup_version"] = cgroup_version
|
||||
if cluster_advertise is not UNSET:
|
||||
field_dict["cluster_advertise"] = cluster_advertise
|
||||
if cluster_store is not UNSET:
|
||||
field_dict["cluster_store"] = cluster_store
|
||||
if containerd_commit is not UNSET:
|
||||
field_dict["containerd_commit"] = containerd_commit
|
||||
if containers is not UNSET:
|
||||
field_dict["containers"] = containers
|
||||
if containers_paused is not UNSET:
|
||||
field_dict["containers_paused"] = containers_paused
|
||||
if containers_running is not UNSET:
|
||||
field_dict["containers_running"] = containers_running
|
||||
if containers_stopped is not UNSET:
|
||||
field_dict["containers_stopped"] = containers_stopped
|
||||
if cpu_cfs_period is not UNSET:
|
||||
field_dict["cpu_cfs_period"] = cpu_cfs_period
|
||||
if cpu_cfs_quota is not UNSET:
|
||||
field_dict["cpu_cfs_quota"] = cpu_cfs_quota
|
||||
if cpu_set is not UNSET:
|
||||
field_dict["cpu_set"] = cpu_set
|
||||
if cpu_shares is not UNSET:
|
||||
field_dict["cpu_shares"] = cpu_shares
|
||||
if debug is not UNSET:
|
||||
field_dict["debug"] = debug
|
||||
if default_address_pools is not UNSET:
|
||||
field_dict["default_address_pools"] = default_address_pools
|
||||
if default_runtime is not UNSET:
|
||||
field_dict["default_runtime"] = default_runtime
|
||||
if docker_root_dir is not UNSET:
|
||||
field_dict["docker_root_dir"] = docker_root_dir
|
||||
if driver is not UNSET:
|
||||
field_dict["driver"] = driver
|
||||
if driver_status is not UNSET:
|
||||
field_dict["driver_status"] = driver_status
|
||||
if experimental_build is not UNSET:
|
||||
field_dict["experimental_build"] = experimental_build
|
||||
if http_proxy is not UNSET:
|
||||
field_dict["http_proxy"] = http_proxy
|
||||
if https_proxy is not UNSET:
|
||||
field_dict["https_proxy"] = https_proxy
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if images is not UNSET:
|
||||
field_dict["images"] = images
|
||||
if index_server_address is not UNSET:
|
||||
field_dict["index_server_address"] = index_server_address
|
||||
if init_binary is not UNSET:
|
||||
field_dict["init_binary"] = init_binary
|
||||
if init_commit is not UNSET:
|
||||
field_dict["init_commit"] = init_commit
|
||||
if ipv4_forwarding is not UNSET:
|
||||
field_dict["ipv4_forwarding"] = ipv4_forwarding
|
||||
if isolation is not UNSET:
|
||||
field_dict["isolation"] = isolation
|
||||
if kernel_memory is not UNSET:
|
||||
field_dict["kernel_memory"] = kernel_memory
|
||||
if kernel_memory_tcp is not UNSET:
|
||||
field_dict["kernel_memory_tcp"] = kernel_memory_tcp
|
||||
if kernel_version is not UNSET:
|
||||
field_dict["kernel_version"] = kernel_version
|
||||
if labels is not UNSET:
|
||||
field_dict["labels"] = labels
|
||||
if live_restore_enabled is not UNSET:
|
||||
field_dict["live_restore_enabled"] = live_restore_enabled
|
||||
if logging_driver is not UNSET:
|
||||
field_dict["logging_driver"] = logging_driver
|
||||
if mem_total is not UNSET:
|
||||
field_dict["mem_total"] = mem_total
|
||||
if memory_limit is not UNSET:
|
||||
field_dict["memory_limit"] = memory_limit
|
||||
if n_events_listener is not UNSET:
|
||||
field_dict["n_events_listener"] = n_events_listener
|
||||
if n_fd is not UNSET:
|
||||
field_dict["n_fd"] = n_fd
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if ncpu is not UNSET:
|
||||
field_dict["ncpu"] = ncpu
|
||||
if no_proxy is not UNSET:
|
||||
field_dict["no_proxy"] = no_proxy
|
||||
if oom_kill_disable is not UNSET:
|
||||
field_dict["oom_kill_disable"] = oom_kill_disable
|
||||
if operating_system is not UNSET:
|
||||
field_dict["operating_system"] = operating_system
|
||||
if os_type is not UNSET:
|
||||
field_dict["os_type"] = os_type
|
||||
if os_version is not UNSET:
|
||||
field_dict["os_version"] = os_version
|
||||
if pids_limit is not UNSET:
|
||||
field_dict["pids_limit"] = pids_limit
|
||||
if plugins is not UNSET:
|
||||
field_dict["plugins"] = plugins
|
||||
if product_license is not UNSET:
|
||||
field_dict["product_license"] = product_license
|
||||
if registry_config is not UNSET:
|
||||
field_dict["registry_config"] = registry_config
|
||||
if runc_commit is not UNSET:
|
||||
field_dict["runc_commit"] = runc_commit
|
||||
if runtimes is not UNSET:
|
||||
field_dict["runtimes"] = runtimes
|
||||
if security_options is not UNSET:
|
||||
field_dict["security_options"] = security_options
|
||||
if server_version is not UNSET:
|
||||
field_dict["server_version"] = server_version
|
||||
if swap_limit is not UNSET:
|
||||
field_dict["swap_limit"] = swap_limit
|
||||
if system_time is not UNSET:
|
||||
field_dict["system_time"] = system_time
|
||||
if warnings is not UNSET:
|
||||
field_dict["warnings"] = warnings
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
|
||||
d = src_dict.copy()
|
||||
architecture = d.pop("architecture", UNSET)
|
||||
|
||||
bridge_nf_ip6tables = d.pop("bridge_nf_ip6tables", UNSET)
|
||||
|
||||
bridge_nf_iptables = d.pop("bridge_nf_iptables", UNSET)
|
||||
|
||||
_cgroup_driver = d.pop("cgroup_driver", UNSET)
|
||||
cgroup_driver: Union[Unset, SystemInfoCgroupDriverEnum]
|
||||
if isinstance(_cgroup_driver, Unset):
|
||||
cgroup_driver = UNSET
|
||||
else:
|
||||
cgroup_driver = _cgroup_driver # type: ignore[arg-type]
|
||||
|
||||
_cgroup_version = d.pop("cgroup_version", UNSET)
|
||||
cgroup_version: Union[Unset, SystemInfoCgroupVersionEnum]
|
||||
if isinstance(_cgroup_version, Unset):
|
||||
cgroup_version = UNSET
|
||||
else:
|
||||
cgroup_version = _cgroup_version # type: ignore[arg-type]
|
||||
|
||||
cluster_advertise = d.pop("cluster_advertise", UNSET)
|
||||
|
||||
cluster_store = d.pop("cluster_store", UNSET)
|
||||
|
||||
_containerd_commit = d.pop("containerd_commit", UNSET)
|
||||
containerd_commit: Union[Unset, Commit]
|
||||
if isinstance(_containerd_commit, Unset):
|
||||
containerd_commit = UNSET
|
||||
else:
|
||||
containerd_commit = _containerd_commit # type: ignore[arg-type]
|
||||
|
||||
containers = d.pop("containers", UNSET)
|
||||
|
||||
containers_paused = d.pop("containers_paused", UNSET)
|
||||
|
||||
containers_running = d.pop("containers_running", UNSET)
|
||||
|
||||
containers_stopped = d.pop("containers_stopped", UNSET)
|
||||
|
||||
cpu_cfs_period = d.pop("cpu_cfs_period", UNSET)
|
||||
|
||||
cpu_cfs_quota = d.pop("cpu_cfs_quota", UNSET)
|
||||
|
||||
cpu_set = d.pop("cpu_set", UNSET)
|
||||
|
||||
cpu_shares = d.pop("cpu_shares", UNSET)
|
||||
|
||||
debug = d.pop("debug", UNSET)
|
||||
|
||||
from ..models.system_info_default_address_pools import (
|
||||
SystemInfoDefaultAddressPools,
|
||||
)
|
||||
|
||||
default_address_pools = cast(
|
||||
List[SystemInfoDefaultAddressPools], d.pop("default_address_pools", UNSET)
|
||||
)
|
||||
|
||||
default_runtime = d.pop("default_runtime", UNSET)
|
||||
|
||||
docker_root_dir = d.pop("docker_root_dir", UNSET)
|
||||
|
||||
driver = d.pop("driver", UNSET)
|
||||
|
||||
driver_status = cast(List[List[str]], d.pop("driver_status", UNSET))
|
||||
|
||||
experimental_build = d.pop("experimental_build", UNSET)
|
||||
|
||||
http_proxy = d.pop("http_proxy", UNSET)
|
||||
|
||||
https_proxy = d.pop("https_proxy", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
images = d.pop("images", UNSET)
|
||||
|
||||
index_server_address = d.pop("index_server_address", UNSET)
|
||||
|
||||
init_binary = d.pop("init_binary", UNSET)
|
||||
|
||||
_init_commit = d.pop("init_commit", UNSET)
|
||||
init_commit: Union[Unset, Commit]
|
||||
if isinstance(_init_commit, Unset):
|
||||
init_commit = UNSET
|
||||
else:
|
||||
init_commit = _init_commit # type: ignore[arg-type]
|
||||
|
||||
ipv4_forwarding = d.pop("ipv4_forwarding", UNSET)
|
||||
|
||||
_isolation = d.pop("isolation", UNSET)
|
||||
isolation: Union[Unset, SystemInfoIsolationEnum]
|
||||
if isinstance(_isolation, Unset):
|
||||
isolation = UNSET
|
||||
else:
|
||||
isolation = _isolation # type: ignore[arg-type]
|
||||
|
||||
kernel_memory = d.pop("kernel_memory", UNSET)
|
||||
|
||||
kernel_memory_tcp = d.pop("kernel_memory_tcp", UNSET)
|
||||
|
||||
kernel_version = d.pop("kernel_version", UNSET)
|
||||
|
||||
labels = cast(List[str], d.pop("labels", UNSET))
|
||||
|
||||
live_restore_enabled = d.pop("live_restore_enabled", UNSET)
|
||||
|
||||
logging_driver = d.pop("logging_driver", UNSET)
|
||||
|
||||
mem_total = d.pop("mem_total", UNSET)
|
||||
|
||||
memory_limit = d.pop("memory_limit", UNSET)
|
||||
|
||||
n_events_listener = d.pop("n_events_listener", UNSET)
|
||||
|
||||
n_fd = d.pop("n_fd", UNSET)
|
||||
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
ncpu = d.pop("ncpu", UNSET)
|
||||
|
||||
no_proxy = d.pop("no_proxy", UNSET)
|
||||
|
||||
oom_kill_disable = d.pop("oom_kill_disable", UNSET)
|
||||
|
||||
operating_system = d.pop("operating_system", UNSET)
|
||||
|
||||
os_type = d.pop("os_type", UNSET)
|
||||
|
||||
os_version = d.pop("os_version", UNSET)
|
||||
|
||||
pids_limit = d.pop("pids_limit", UNSET)
|
||||
|
||||
_plugins = d.pop("plugins", UNSET)
|
||||
plugins: Union[Unset, PluginsInfo]
|
||||
if isinstance(_plugins, Unset):
|
||||
plugins = UNSET
|
||||
else:
|
||||
plugins = _plugins # type: ignore[arg-type]
|
||||
|
||||
product_license = d.pop("product_license", UNSET)
|
||||
|
||||
_registry_config = d.pop("registry_config", UNSET)
|
||||
registry_config: Union[Unset, RegistryServiceConfig]
|
||||
if isinstance(_registry_config, Unset):
|
||||
registry_config = UNSET
|
||||
else:
|
||||
registry_config = _registry_config # type: ignore[arg-type]
|
||||
|
||||
_runc_commit = d.pop("runc_commit", UNSET)
|
||||
runc_commit: Union[Unset, Commit]
|
||||
if isinstance(_runc_commit, Unset):
|
||||
runc_commit = UNSET
|
||||
else:
|
||||
runc_commit = _runc_commit # type: ignore[arg-type]
|
||||
|
||||
_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)
|
||||
|
||||
swap_limit = d.pop("swap_limit", UNSET)
|
||||
|
||||
system_time = d.pop("system_time", UNSET)
|
||||
|
||||
warnings = cast(List[str], d.pop("warnings", UNSET))
|
||||
|
||||
docker_system_info = cls(
|
||||
architecture=architecture,
|
||||
bridge_nf_ip6tables=bridge_nf_ip6tables,
|
||||
bridge_nf_iptables=bridge_nf_iptables,
|
||||
cgroup_driver=cgroup_driver,
|
||||
cgroup_version=cgroup_version,
|
||||
cluster_advertise=cluster_advertise,
|
||||
cluster_store=cluster_store,
|
||||
containerd_commit=containerd_commit,
|
||||
containers=containers,
|
||||
containers_paused=containers_paused,
|
||||
containers_running=containers_running,
|
||||
containers_stopped=containers_stopped,
|
||||
cpu_cfs_period=cpu_cfs_period,
|
||||
cpu_cfs_quota=cpu_cfs_quota,
|
||||
cpu_set=cpu_set,
|
||||
cpu_shares=cpu_shares,
|
||||
debug=debug,
|
||||
default_address_pools=default_address_pools,
|
||||
default_runtime=default_runtime,
|
||||
docker_root_dir=docker_root_dir,
|
||||
driver=driver,
|
||||
driver_status=driver_status,
|
||||
experimental_build=experimental_build,
|
||||
http_proxy=http_proxy,
|
||||
https_proxy=https_proxy,
|
||||
id=id,
|
||||
images=images,
|
||||
index_server_address=index_server_address,
|
||||
init_binary=init_binary,
|
||||
init_commit=init_commit,
|
||||
ipv4_forwarding=ipv4_forwarding,
|
||||
isolation=isolation,
|
||||
kernel_memory=kernel_memory,
|
||||
kernel_memory_tcp=kernel_memory_tcp,
|
||||
kernel_version=kernel_version,
|
||||
labels=labels,
|
||||
live_restore_enabled=live_restore_enabled,
|
||||
logging_driver=logging_driver,
|
||||
mem_total=mem_total,
|
||||
memory_limit=memory_limit,
|
||||
n_events_listener=n_events_listener,
|
||||
n_fd=n_fd,
|
||||
name=name,
|
||||
ncpu=ncpu,
|
||||
no_proxy=no_proxy,
|
||||
oom_kill_disable=oom_kill_disable,
|
||||
operating_system=operating_system,
|
||||
os_type=os_type,
|
||||
os_version=os_version,
|
||||
pids_limit=pids_limit,
|
||||
plugins=plugins,
|
||||
product_license=product_license,
|
||||
registry_config=registry_config,
|
||||
runc_commit=runc_commit,
|
||||
runtimes=runtimes,
|
||||
security_options=security_options,
|
||||
server_version=server_version,
|
||||
swap_limit=swap_limit,
|
||||
system_time=system_time,
|
||||
warnings=warnings,
|
||||
)
|
||||
|
||||
docker_system_info.additional_properties = d
|
||||
return docker_system_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
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
LT = TypeVar("LT", bound="EmailAuthenticationForm")
|
||||
HC = TypeVar("HC", bound="EmailAuthenticationForm")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -31,7 +31,7 @@ class EmailAuthenticationForm:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[LT], src_dict: Dict[str, Any]) -> LT:
|
||||
def from_dict(cls: Type[HC], src_dict: Dict[str, Any]) -> HC:
|
||||
d = src_dict.copy()
|
||||
callback_url = d.pop("callback_url", UNSET)
|
||||
|
||||
|
@ -1,120 +0,0 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.cache_metadata import CacheMetadata
|
||||
from ..models.connection import Connection
|
||||
from ..models.environment import Environment
|
||||
from ..models.file_system_metadata import FileSystemMetadata
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
ED = TypeVar("ED", bound="EngineMetadata")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class EngineMetadata:
|
||||
"""Metadata about our currently running server.
|
||||
|
||||
This is mostly used for internal purposes and debugging.""" # noqa: E501
|
||||
|
||||
async_jobs_running: Union[Unset, bool] = False
|
||||
cache: Union[Unset, CacheMetadata] = UNSET
|
||||
environment: Union[Unset, Environment] = UNSET
|
||||
fs: Union[Unset, FileSystemMetadata] = UNSET
|
||||
git_hash: Union[Unset, str] = UNSET
|
||||
pubsub: Union[Unset, Connection] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
async_jobs_running = self.async_jobs_running
|
||||
if not isinstance(self.cache, Unset):
|
||||
cache = self.cache
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment
|
||||
if not isinstance(self.fs, Unset):
|
||||
fs = self.fs
|
||||
git_hash = self.git_hash
|
||||
if not isinstance(self.pubsub, Unset):
|
||||
pubsub = self.pubsub
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if async_jobs_running is not UNSET:
|
||||
field_dict["async_jobs_running"] = async_jobs_running
|
||||
if cache is not UNSET:
|
||||
field_dict["cache"] = cache
|
||||
if environment is not UNSET:
|
||||
field_dict["environment"] = environment
|
||||
if fs is not UNSET:
|
||||
field_dict["fs"] = fs
|
||||
if git_hash is not UNSET:
|
||||
field_dict["git_hash"] = git_hash
|
||||
if pubsub is not UNSET:
|
||||
field_dict["pubsub"] = pubsub
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
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)
|
||||
|
||||
_cache = d.pop("cache", UNSET)
|
||||
cache: Union[Unset, CacheMetadata]
|
||||
if isinstance(_cache, Unset):
|
||||
cache = UNSET
|
||||
else:
|
||||
cache = _cache # type: ignore[arg-type]
|
||||
|
||||
_environment = d.pop("environment", UNSET)
|
||||
environment: Union[Unset, Environment]
|
||||
if isinstance(_environment, Unset):
|
||||
environment = UNSET
|
||||
else:
|
||||
environment = _environment # type: ignore[arg-type]
|
||||
|
||||
_fs = d.pop("fs", UNSET)
|
||||
fs: Union[Unset, FileSystemMetadata]
|
||||
if isinstance(_fs, Unset):
|
||||
fs = UNSET
|
||||
else:
|
||||
fs = _fs # type: ignore[arg-type]
|
||||
|
||||
git_hash = d.pop("git_hash", UNSET)
|
||||
|
||||
_pubsub = d.pop("pubsub", UNSET)
|
||||
pubsub: Union[Unset, Connection]
|
||||
if isinstance(_pubsub, Unset):
|
||||
pubsub = UNSET
|
||||
else:
|
||||
pubsub = _pubsub # type: ignore[arg-type]
|
||||
|
||||
engine_metadata = cls(
|
||||
async_jobs_running=async_jobs_running,
|
||||
cache=cache,
|
||||
environment=environment,
|
||||
fs=fs,
|
||||
git_hash=git_hash,
|
||||
pubsub=pubsub,
|
||||
)
|
||||
|
||||
engine_metadata.additional_properties = d
|
||||
return engine_metadata
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
YY = TypeVar("YY", bound="EntityGetAllChildUuids")
|
||||
FM = TypeVar("FM", bound="EntityGetAllChildUuids")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -29,7 +29,7 @@ class EntityGetAllChildUuids:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[YY], src_dict: Dict[str, Any]) -> YY:
|
||||
def from_dict(cls: Type[FM], src_dict: Dict[str, Any]) -> FM:
|
||||
d = src_dict.copy()
|
||||
entity_ids = cast(List[str], d.pop("entity_ids", UNSET))
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
DO = TypeVar("DO", bound="EntityGetChildUuid")
|
||||
PV = TypeVar("PV", bound="EntityGetChildUuid")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -27,7 +27,7 @@ class EntityGetChildUuid:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[DO], src_dict: Dict[str, Any]) -> DO:
|
||||
def from_dict(cls: Type[PV], src_dict: Dict[str, Any]) -> PV:
|
||||
d = src_dict.copy()
|
||||
entity_id = d.pop("entity_id", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
FZ = TypeVar("FZ", bound="EntityGetNumChildren")
|
||||
QI = TypeVar("QI", bound="EntityGetNumChildren")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -27,7 +27,7 @@ class EntityGetNumChildren:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[FZ], src_dict: Dict[str, Any]) -> FZ:
|
||||
def from_dict(cls: Type[QI], src_dict: Dict[str, Any]) -> QI:
|
||||
d = src_dict.copy()
|
||||
num = d.pop("num", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
GL = TypeVar("GL", bound="EntityGetParentId")
|
||||
TP = TypeVar("TP", bound="EntityGetParentId")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -27,7 +27,7 @@ class EntityGetParentId:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[GL], src_dict: Dict[str, Any]) -> GL:
|
||||
def from_dict(cls: Type[TP], src_dict: Dict[str, Any]) -> TP:
|
||||
d = src_dict.copy()
|
||||
entity_id = d.pop("entity_id", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
NN = TypeVar("NN", bound="Error")
|
||||
CF = TypeVar("CF", bound="Error")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -35,7 +35,7 @@ class Error:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[NN], src_dict: Dict[str, Any]) -> NN:
|
||||
def from_dict(cls: Type[CF], src_dict: Dict[str, Any]) -> CF:
|
||||
d = src_dict.copy()
|
||||
error_code = d.pop("error_code", UNSET)
|
||||
|
||||
|
@ -12,6 +12,10 @@ class ErrorCode(str, Enum):
|
||||
BAD_REQUEST = "bad_request"
|
||||
"""# Client sent invalid JSON. """ # noqa: E501
|
||||
INVALID_JSON = "invalid_json"
|
||||
"""# Client sent invalid BSON. """ # noqa: E501
|
||||
INVALID_BSON = "invalid_bson"
|
||||
"""# Client sent a message which is not accepted over this protocol. """ # noqa: E501
|
||||
WRONG_PROTOCOL = "wrong_protocol"
|
||||
"""# 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
|
||||
|
@ -1,85 +0,0 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.docker_system_info import DockerSystemInfo
|
||||
from ..models.environment import Environment
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
OH = TypeVar("OH", bound="ExecutorMetadata")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class ExecutorMetadata:
|
||||
"""Metadata about our currently running server.
|
||||
|
||||
This is mostly used for internal purposes and debugging.""" # noqa: E501
|
||||
|
||||
docker_info: Union[Unset, DockerSystemInfo] = UNSET
|
||||
environment: Union[Unset, Environment] = UNSET
|
||||
git_hash: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
if not isinstance(self.docker_info, Unset):
|
||||
docker_info = self.docker_info
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment
|
||||
git_hash = self.git_hash
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if docker_info is not UNSET:
|
||||
field_dict["docker_info"] = docker_info
|
||||
if environment is not UNSET:
|
||||
field_dict["environment"] = environment
|
||||
if git_hash is not UNSET:
|
||||
field_dict["git_hash"] = git_hash
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
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]
|
||||
if isinstance(_docker_info, Unset):
|
||||
docker_info = UNSET
|
||||
else:
|
||||
docker_info = _docker_info # type: ignore[arg-type]
|
||||
|
||||
_environment = d.pop("environment", UNSET)
|
||||
environment: Union[Unset, Environment]
|
||||
if isinstance(_environment, Unset):
|
||||
environment = UNSET
|
||||
else:
|
||||
environment = _environment # type: ignore[arg-type]
|
||||
|
||||
git_hash = d.pop("git_hash", UNSET)
|
||||
|
||||
executor_metadata = cls(
|
||||
docker_info=docker_info,
|
||||
environment=environment,
|
||||
git_hash=git_hash,
|
||||
)
|
||||
|
||||
executor_metadata.additional_properties = d
|
||||
return executor_metadata
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
VI = TypeVar("VI", bound="Export")
|
||||
OM = TypeVar("OM", bound="Export")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -33,7 +33,7 @@ class Export:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[VI], src_dict: Dict[str, Any]) -> VI:
|
||||
def from_dict(cls: Type[OM], src_dict: Dict[str, Any]) -> OM:
|
||||
d = src_dict.copy()
|
||||
from ..models.export_file import ExportFile
|
||||
|
||||
|
@ -5,7 +5,7 @@ import attr
|
||||
from ..models.base64data import Base64Data
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
ET = TypeVar("ET", bound="ExportFile")
|
||||
EN = TypeVar("EN", bound="ExportFile")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -34,7 +34,7 @@ class ExportFile:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[ET], src_dict: Dict[str, Any]) -> ET:
|
||||
def from_dict(cls: Type[EN], src_dict: Dict[str, Any]) -> EN:
|
||||
d = src_dict.copy()
|
||||
_contents = d.pop("contents", UNSET)
|
||||
contents: Union[Unset, Base64Data]
|
||||
|
@ -4,9 +4,10 @@ from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
QF = TypeVar("QF", bound="ExtendedUser")
|
||||
RS = TypeVar("RS", bound="ExtendedUser")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -98,7 +99,7 @@ class ExtendedUser:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[QF], src_dict: Dict[str, Any]) -> QF:
|
||||
def from_dict(cls: Type[RS], src_dict: Dict[str, Any]) -> RS:
|
||||
d = src_dict.copy()
|
||||
company = d.pop("company", UNSET)
|
||||
|
||||
@ -126,7 +127,14 @@ class ExtendedUser:
|
||||
|
||||
github = d.pop("github", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id
|
||||
|
||||
image = d.pop("image", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
DI = TypeVar("DI", bound="ExtendedUserResultsPage")
|
||||
LR = TypeVar("LR", bound="ExtendedUserResultsPage")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -37,7 +37,7 @@ class ExtendedUserResultsPage:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[DI], src_dict: Dict[str, Any]) -> DI:
|
||||
def from_dict(cls: Type[LR], src_dict: Dict[str, Any]) -> LR:
|
||||
d = src_dict.copy()
|
||||
from ..models.extended_user import ExtendedUser
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
OJ = TypeVar("OJ", bound="FailureWebSocketResponse")
|
||||
MP = TypeVar("MP", bound="FailureWebSocketResponse")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -41,7 +41,7 @@ class FailureWebSocketResponse:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[OJ], src_dict: Dict[str, Any]) -> OJ:
|
||||
def from_dict(cls: Type[MP], src_dict: Dict[str, Any]) -> MP:
|
||||
d = src_dict.copy()
|
||||
from ..models.api_error import ApiError
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
@ -11,7 +11,7 @@ from ..models.unit_length import UnitLength
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
UF = TypeVar("UF", bound="FileCenterOfMass")
|
||||
WF = TypeVar("WF", bound="FileCenterOfMass")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -33,6 +33,7 @@ class FileCenterOfMass:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
center_of_mass: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.center_of_mass, Unset):
|
||||
center_of_mass = self.center_of_mass
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
@ -43,13 +44,16 @@ class FileCenterOfMass:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_unit: Union[Unset, UnitLength] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
@ -61,7 +65,8 @@ class FileCenterOfMass:
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if center_of_mass is not UNSET:
|
||||
field_dict["center_of_mass"] = center_of_mass
|
||||
_center_of_mass: Point3d = cast(Point3d, center_of_mass)
|
||||
field_dict["center_of_mass"] = _center_of_mass.to_dict()
|
||||
if completed_at is not UNSET:
|
||||
field_dict["completed_at"] = completed_at
|
||||
if created_at is not UNSET:
|
||||
@ -86,14 +91,16 @@ class FileCenterOfMass:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[UF], src_dict: Dict[str, Any]) -> UF:
|
||||
def from_dict(cls: Type[WF], src_dict: Dict[str, Any]) -> WF:
|
||||
d = src_dict.copy()
|
||||
_center_of_mass = d.pop("center_of_mass", UNSET)
|
||||
center_of_mass: Union[Unset, Point3d]
|
||||
if isinstance(_center_of_mass, Unset):
|
||||
center_of_mass = UNSET
|
||||
if _center_of_mass is None:
|
||||
center_of_mass = UNSET
|
||||
else:
|
||||
center_of_mass = _center_of_mass # type: ignore[arg-type]
|
||||
center_of_mass = Point3d.from_dict(_center_of_mass)
|
||||
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -115,22 +122,28 @@ class FileCenterOfMass:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitLength]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -143,8 +156,10 @@ class FileCenterOfMass:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -153,7 +168,14 @@ class FileCenterOfMass:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_center_of_mass = cls(
|
||||
center_of_mass=center_of_mass,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
@ -13,7 +13,7 @@ from ..models.output_format import OutputFormat
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
YF = TypeVar("YF", bound="FileConversion")
|
||||
RO = TypeVar("RO", bound="FileConversion")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -45,8 +45,10 @@ class FileConversion:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_format: Union[Unset, FileExportFormat] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
output_format = self.output_format
|
||||
output_format_options: Union[Unset, OutputFormat] = UNSET
|
||||
if not isinstance(self.output_format_options, Unset):
|
||||
output_format_options = self.output_format_options
|
||||
outputs: Union[Unset, Dict[str, str]] = UNSET
|
||||
@ -55,13 +57,16 @@ class FileConversion:
|
||||
for key, value in self.outputs.items():
|
||||
new_dict[key] = value.get_encoded()
|
||||
outputs = new_dict
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
src_format_options: Union[Unset, InputFormat] = UNSET
|
||||
if not isinstance(self.src_format_options, Unset):
|
||||
src_format_options = self.src_format_options
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
@ -83,13 +88,17 @@ class FileConversion:
|
||||
if output_format is not UNSET:
|
||||
field_dict["output_format"] = output_format
|
||||
if output_format_options is not UNSET:
|
||||
field_dict["output_format_options"] = output_format_options
|
||||
_output_format_options: OutputFormat = cast(
|
||||
OutputFormat, output_format_options
|
||||
)
|
||||
field_dict["output_format_options"] = _output_format_options.to_dict()
|
||||
if outputs is not UNSET:
|
||||
field_dict["outputs"] = outputs
|
||||
if src_format is not UNSET:
|
||||
field_dict["src_format"] = src_format
|
||||
if src_format_options is not UNSET:
|
||||
field_dict["src_format_options"] = src_format_options
|
||||
_src_format_options: InputFormat = cast(InputFormat, src_format_options)
|
||||
field_dict["src_format_options"] = _src_format_options.to_dict()
|
||||
if started_at is not UNSET:
|
||||
field_dict["started_at"] = started_at
|
||||
if status is not UNSET:
|
||||
@ -102,7 +111,7 @@ class FileConversion:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[YF], src_dict: Dict[str, Any]) -> YF:
|
||||
def from_dict(cls: Type[RO], src_dict: Dict[str, Any]) -> RO:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -124,22 +133,28 @@ class FileConversion:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_format = d.pop("output_format", UNSET)
|
||||
output_format: Union[Unset, FileExportFormat]
|
||||
if isinstance(_output_format, Unset):
|
||||
output_format = UNSET
|
||||
if _output_format is None:
|
||||
output_format = UNSET
|
||||
else:
|
||||
output_format = _output_format # type: ignore[arg-type]
|
||||
output_format = _output_format
|
||||
|
||||
_output_format_options = d.pop("output_format_options", UNSET)
|
||||
output_format_options: Union[Unset, OutputFormat]
|
||||
if isinstance(_output_format_options, Unset):
|
||||
output_format_options = UNSET
|
||||
if _output_format_options is None:
|
||||
output_format_options = UNSET
|
||||
else:
|
||||
output_format_options = _output_format_options # type: ignore[arg-type]
|
||||
output_format_options = OutputFormat.from_dict(_output_format_options)
|
||||
|
||||
_outputs = d.pop("outputs", UNSET)
|
||||
if isinstance(_outputs, Unset):
|
||||
@ -154,15 +169,19 @@ class FileConversion:
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_src_format_options = d.pop("src_format_options", UNSET)
|
||||
src_format_options: Union[Unset, InputFormat]
|
||||
if isinstance(_src_format_options, Unset):
|
||||
src_format_options = UNSET
|
||||
if _src_format_options is None:
|
||||
src_format_options = UNSET
|
||||
else:
|
||||
src_format_options = _src_format_options # type: ignore[arg-type]
|
||||
src_format_options = InputFormat.from_dict(_src_format_options)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -175,8 +194,10 @@ class FileConversion:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -185,7 +206,14 @@ class FileConversion:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_conversion = cls(
|
||||
completed_at=completed_at,
|
||||
|
@ -11,7 +11,7 @@ from ..models.unit_mass import UnitMass
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
PY = TypeVar("PY", bound="FileDensity")
|
||||
DN = TypeVar("DN", bound="FileDensity")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -45,15 +45,19 @@ class FileDensity:
|
||||
error = self.error
|
||||
id = self.id
|
||||
material_mass = self.material_mass
|
||||
material_mass_unit: Union[Unset, UnitMass] = UNSET
|
||||
if not isinstance(self.material_mass_unit, Unset):
|
||||
material_mass_unit = self.material_mass_unit
|
||||
output_unit: Union[Unset, UnitDensity] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
@ -94,7 +98,7 @@ class FileDensity:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[PY], src_dict: Dict[str, Any]) -> PY:
|
||||
def from_dict(cls: Type[DN], src_dict: Dict[str, Any]) -> DN:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -118,8 +122,10 @@ class FileDensity:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
material_mass = d.pop("material_mass", UNSET)
|
||||
|
||||
@ -127,22 +133,28 @@ class FileDensity:
|
||||
material_mass_unit: Union[Unset, UnitMass]
|
||||
if isinstance(_material_mass_unit, Unset):
|
||||
material_mass_unit = UNSET
|
||||
if _material_mass_unit is None:
|
||||
material_mass_unit = UNSET
|
||||
else:
|
||||
material_mass_unit = _material_mass_unit # type: ignore[arg-type]
|
||||
material_mass_unit = _material_mass_unit
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitDensity]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -155,8 +167,10 @@ class FileDensity:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -165,7 +179,14 @@ class FileDensity:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_density = cls(
|
||||
completed_at=completed_at,
|
||||
|
@ -11,7 +11,7 @@ from ..models.unit_mass import UnitMass
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
LK = TypeVar("LK", bound="FileMass")
|
||||
BA = TypeVar("BA", bound="FileMass")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -45,15 +45,19 @@ class FileMass:
|
||||
id = self.id
|
||||
mass = self.mass
|
||||
material_density = self.material_density
|
||||
material_density_unit: Union[Unset, UnitDensity] = UNSET
|
||||
if not isinstance(self.material_density_unit, Unset):
|
||||
material_density_unit = self.material_density_unit
|
||||
output_unit: Union[Unset, UnitMass] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
@ -94,7 +98,7 @@ class FileMass:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[LK], src_dict: Dict[str, Any]) -> LK:
|
||||
def from_dict(cls: Type[BA], src_dict: Dict[str, Any]) -> BA:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -116,8 +120,10 @@ class FileMass:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
mass = d.pop("mass", UNSET)
|
||||
|
||||
@ -127,22 +133,28 @@ class FileMass:
|
||||
material_density_unit: Union[Unset, UnitDensity]
|
||||
if isinstance(_material_density_unit, Unset):
|
||||
material_density_unit = UNSET
|
||||
if _material_density_unit is None:
|
||||
material_density_unit = UNSET
|
||||
else:
|
||||
material_density_unit = _material_density_unit # type: ignore[arg-type]
|
||||
material_density_unit = _material_density_unit
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitMass]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -155,8 +167,10 @@ class FileMass:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -165,7 +179,14 @@ class FileMass:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_mass = cls(
|
||||
completed_at=completed_at,
|
||||
|
@ -10,7 +10,7 @@ from ..models.unit_area import UnitArea
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
AR = TypeVar("AR", bound="FileSurfaceArea")
|
||||
OR = TypeVar("OR", bound="FileSurfaceArea")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -40,13 +40,16 @@ class FileSurfaceArea:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_unit: Union[Unset, UnitArea] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
surface_area = self.surface_area
|
||||
@ -84,7 +87,7 @@ class FileSurfaceArea:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[AR], src_dict: Dict[str, Any]) -> AR:
|
||||
def from_dict(cls: Type[OR], src_dict: Dict[str, Any]) -> OR:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -106,22 +109,28 @@ class FileSurfaceArea:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitArea]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -134,8 +143,10 @@ class FileSurfaceArea:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
surface_area = d.pop("surface_area", UNSET)
|
||||
|
||||
@ -146,7 +157,14 @@ class FileSurfaceArea:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
file_surface_area = cls(
|
||||
completed_at=completed_at,
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
WB = TypeVar("WB", bound="FileSystemMetadata")
|
||||
CB = TypeVar("CB", bound="FileSystemMetadata")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -29,7 +29,7 @@ class FileSystemMetadata:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[WB], src_dict: Dict[str, Any]) -> WB:
|
||||
def from_dict(cls: Type[CB], src_dict: Dict[str, Any]) -> CB:
|
||||
d = src_dict.copy()
|
||||
ok = d.pop("ok", UNSET)
|
||||
|
||||
|
@ -10,7 +10,7 @@ from ..models.unit_volume import UnitVolume
|
||||
from ..models.uuid import Uuid
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
KK = TypeVar("KK", bound="FileVolume")
|
||||
LC = TypeVar("LC", bound="FileVolume")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -40,13 +40,16 @@ class FileVolume:
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
output_unit: Union[Unset, UnitVolume] = UNSET
|
||||
if not isinstance(self.output_unit, Unset):
|
||||
output_unit = self.output_unit
|
||||
src_format: Union[Unset, FileImportFormat] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
@ -84,7 +87,7 @@ class FileVolume:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[KK], src_dict: Dict[str, Any]) -> KK:
|
||||
def from_dict(cls: Type[LC], src_dict: Dict[str, Any]) -> LC:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
@ -106,22 +109,28 @@ class FileVolume:
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
if _id is None:
|
||||
id = UNSET
|
||||
else:
|
||||
id = _id # type: ignore[arg-type]
|
||||
id = _id
|
||||
|
||||
_output_unit = d.pop("output_unit", UNSET)
|
||||
output_unit: Union[Unset, UnitVolume]
|
||||
if isinstance(_output_unit, Unset):
|
||||
output_unit = UNSET
|
||||
if _output_unit is None:
|
||||
output_unit = UNSET
|
||||
else:
|
||||
output_unit = _output_unit # type: ignore[arg-type]
|
||||
output_unit = _output_unit
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileImportFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
if _src_format is None:
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = _src_format # type: ignore[arg-type]
|
||||
src_format = _src_format
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
@ -134,8 +143,10 @@ class FileVolume:
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
if _status is None:
|
||||
status = UNSET
|
||||
else:
|
||||
status = _status # type: ignore[arg-type]
|
||||
status = _status
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
@ -144,7 +155,14 @@ class FileVolume:
|
||||
else:
|
||||
updated_at = isoparse(_updated_at)
|
||||
|
||||
user_id = d.pop("user_id", UNSET)
|
||||
_user_id = d.pop("user_id", UNSET)
|
||||
user_id: Union[Unset, Uuid]
|
||||
if isinstance(_user_id, Unset):
|
||||
user_id = UNSET
|
||||
if _user_id is None:
|
||||
user_id = UNSET
|
||||
else:
|
||||
user_id = _user_id
|
||||
|
||||
volume = d.pop("volume", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
HC = TypeVar("HC", bound="Gateway")
|
||||
TO = TypeVar("TO", bound="Gateway")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -43,7 +43,7 @@ class Gateway:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[HC], src_dict: Dict[str, Any]) -> HC:
|
||||
def from_dict(cls: Type[TO], src_dict: Dict[str, Any]) -> TO:
|
||||
d = src_dict.copy()
|
||||
auth_timeout = d.pop("auth_timeout", UNSET)
|
||||
|
||||
|
@ -5,7 +5,7 @@ import attr
|
||||
from ..models.entity_type import EntityType
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
FM = TypeVar("FM", bound="GetEntityType")
|
||||
ZP = TypeVar("ZP", bound="GetEntityType")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -17,6 +17,7 @@ class GetEntityType:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
entity_type: Union[Unset, EntityType] = UNSET
|
||||
if not isinstance(self.entity_type, Unset):
|
||||
entity_type = self.entity_type
|
||||
|
||||
@ -29,14 +30,16 @@ class GetEntityType:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[FM], src_dict: Dict[str, Any]) -> FM:
|
||||
def from_dict(cls: Type[ZP], src_dict: Dict[str, Any]) -> ZP:
|
||||
d = src_dict.copy()
|
||||
_entity_type = d.pop("entity_type", UNSET)
|
||||
entity_type: Union[Unset, EntityType]
|
||||
if isinstance(_entity_type, Unset):
|
||||
entity_type = UNSET
|
||||
if _entity_type is None:
|
||||
entity_type = UNSET
|
||||
else:
|
||||
entity_type = _entity_type # type: ignore[arg-type]
|
||||
entity_type = _entity_type
|
||||
|
||||
get_entity_type = cls(
|
||||
entity_type=entity_type,
|
||||
|
100
kittycad/models/get_sketch_mode_plane.py
Normal file
100
kittycad/models/get_sketch_mode_plane.py
Normal file
@ -0,0 +1,100 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
EO = TypeVar("EO", bound="GetSketchModePlane")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class GetSketchModePlane:
|
||||
"""The plane for sketch mode.""" # noqa: E501
|
||||
|
||||
x_axis: Union[Unset, Point3d] = UNSET
|
||||
y_axis: Union[Unset, Point3d] = UNSET
|
||||
z_axis: Union[Unset, Point3d] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
x_axis: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.x_axis, Unset):
|
||||
x_axis = self.x_axis
|
||||
y_axis: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.y_axis, Unset):
|
||||
y_axis = self.y_axis
|
||||
z_axis: Union[Unset, Point3d] = UNSET
|
||||
if not isinstance(self.z_axis, Unset):
|
||||
z_axis = self.z_axis
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if x_axis is not UNSET:
|
||||
_x_axis: Point3d = cast(Point3d, x_axis)
|
||||
field_dict["x_axis"] = _x_axis.to_dict()
|
||||
if y_axis is not UNSET:
|
||||
_y_axis: Point3d = cast(Point3d, y_axis)
|
||||
field_dict["y_axis"] = _y_axis.to_dict()
|
||||
if z_axis is not UNSET:
|
||||
_z_axis: Point3d = cast(Point3d, z_axis)
|
||||
field_dict["z_axis"] = _z_axis.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[EO], src_dict: Dict[str, Any]) -> EO:
|
||||
d = src_dict.copy()
|
||||
_x_axis = d.pop("x_axis", UNSET)
|
||||
x_axis: Union[Unset, Point3d]
|
||||
if isinstance(_x_axis, Unset):
|
||||
x_axis = UNSET
|
||||
if _x_axis is None:
|
||||
x_axis = UNSET
|
||||
else:
|
||||
x_axis = Point3d.from_dict(_x_axis)
|
||||
|
||||
_y_axis = d.pop("y_axis", UNSET)
|
||||
y_axis: Union[Unset, Point3d]
|
||||
if isinstance(_y_axis, Unset):
|
||||
y_axis = UNSET
|
||||
if _y_axis is None:
|
||||
y_axis = UNSET
|
||||
else:
|
||||
y_axis = Point3d.from_dict(_y_axis)
|
||||
|
||||
_z_axis = d.pop("z_axis", UNSET)
|
||||
z_axis: Union[Unset, Point3d]
|
||||
if isinstance(_z_axis, Unset):
|
||||
z_axis = UNSET
|
||||
if _z_axis is None:
|
||||
z_axis = UNSET
|
||||
else:
|
||||
z_axis = Point3d.from_dict(_z_axis)
|
||||
|
||||
get_sketch_mode_plane = cls(
|
||||
x_axis=x_axis,
|
||||
y_axis=y_axis,
|
||||
z_axis=z_axis,
|
||||
)
|
||||
|
||||
get_sketch_mode_plane.additional_properties = d
|
||||
return get_sketch_mode_plane
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
PV = TypeVar("PV", bound="HighlightSetEntity")
|
||||
NY = TypeVar("NY", bound="HighlightSetEntity")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -31,7 +31,7 @@ class HighlightSetEntity:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[PV], src_dict: Dict[str, Any]) -> PV:
|
||||
def from_dict(cls: Type[NY], src_dict: Dict[str, Any]) -> NY:
|
||||
d = src_dict.copy()
|
||||
entity_id = d.pop("entity_id", UNSET)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
QI = TypeVar("QI", bound="IceServer")
|
||||
QO = TypeVar("QO", bound="IceServer")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@ -37,7 +37,7 @@ class IceServer:
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[QI], src_dict: Dict[str, Any]) -> QI:
|
||||
def from_dict(cls: Type[QO], src_dict: Dict[str, Any]) -> QO:
|
||||
d = src_dict.copy()
|
||||
credential = d.pop("credential", UNSET)
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ImageType(str, Enum):
|
||||
"""An enumeration.""" # noqa: E501
|
||||
|
||||
PNG = "png"
|
||||
JPG = "jpg"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user