diff --git a/generate/functions-ws.py.jinja2 b/generate/functions-ws.py.jinja2 index e685a45d5..4eb578808 100644 --- a/generate/functions-ws.py.jinja2 +++ b/generate/functions-ws.py.jinja2 @@ -179,4 +179,8 @@ class WebSocket: """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%} diff --git a/generate/generate.py b/generate/generate.py index 2fb1d06b6..ad659f388 100755 --- a/generate/generate.py +++ b/generate/generate.py @@ -683,6 +683,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 +1200,52 @@ 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, + }, + ) + TemplateType = TypedDict( + "TemplateType", + { + "types": List[ArgType], + "description": str, + "name": str, + }, + ) + template_info: TemplateType = { + "types": [], + "description": description, + "name": name, + } + for type in types: + template_info["types"].append({"name": 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 +1346,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: diff --git a/generate/union-type.py.jinja2 b/generate/union-type.py.jinja2 new file mode 100644 index 000000000..c10f00380 --- /dev/null +++ b/generate/union-type.py.jinja2 @@ -0,0 +1,46 @@ +from typing import Dict, Any, Union +from typing_extensions import Self + +class {{name}}: + {% if description %} + """{{description}}""" + {% endif %} + type: Union[ + {% for type in types %} + {{type.name}}, + {% endfor %} + ] = None + + def __init__(self, + type: Union[ + {% for type in types %} + type({{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}}): + n : {{type.name}} = self.type + return n.to_dict() + {% else %}elif isinstance(self.type, {{type.name}}): + n : {{type.name}} = self.type + return n.to_dict() + {% endif %}{% endfor %} + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + {% for type in types %}{% if loop.first %} + if d.get("type") == "{{type.name}}": + n : {{type.name}} = {{type.name}}() + n.from_dict(d) + self.type = n + return Self + {% else %}elif d.get("type") == "{{type.name}}": + n : {{type.name}} = {{type.name}}() + n.from_dict(d) + self.type = n + return self + {% endif %}{% endfor %} + raise Exception("Unknown type") diff --git a/kittycad.py.patch.json b/kittycad.py.patch.json index 760e48915..ccfb913c0 100644 --- a/kittycad.py.patch.json +++ b/kittycad.py.patch.json @@ -1,362 +1,10 @@ [ { "op": "add", - "path": "/paths/~1file~1volume/post/x-python", + "path": "/info/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_volume\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileVolume\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_volume import UnitVolume\nfrom kittycad.types import Response\n\n\ndef example_create_file_volume():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileVolume, Error]] = create_file_volume.sync(\n client=client,\n output_unit=UnitVolume.CM3,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileVolume = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_volume.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment~1invoices/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import list_invoices_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Invoice\nfrom kittycad.types import Response\n\n\ndef example_list_invoices_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[List[Invoice], Error]] = list_invoices_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: List[Invoice] = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.list_invoices_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1async~1operations~1{id}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_async_operation\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import (\n Error,\n FileCenterOfMass,\n FileConversion,\n FileDensity,\n FileMass,\n FileSurfaceArea,\n FileVolume,\n TextToCad,\n)\nfrom kittycad.types import Response\n\n\ndef example_get_async_operation():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[\n FileConversion,\n FileCenterOfMass,\n FileMass,\n FileVolume,\n FileDensity,\n FileSurfaceArea,\n TextToCad,\n Error,\n ]\n ] = get_async_operation.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Union[\n FileConversion,\n FileCenterOfMass,\n FileMass,\n FileVolume,\n FileDensity,\n FileSurfaceArea,\n TextToCad,\n ] = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_async_operation.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1text-to-cad/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import list_text_to_cad_models_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, TextToCadResultsPage\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_text_to_cad_models_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[TextToCadResultsPage, Error]\n ] = list_text_to_cad_models_for_user.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: TextToCadResultsPage = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.list_text_to_cad_models_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1users/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import list_users\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UserResultsPage\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_users():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[UserResultsPage, Error]] = list_users.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UserResultsPage = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.list_users.html" - } - }, - { - "op": "add", - "path": "/paths/~1users~1{id}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, User\nfrom kittycad.types import Response\n\n\ndef example_get_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[User, Error]] = get_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: User = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1.well-known~1ai-plugin.json/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import get_ai_plugin_manifest\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AiPluginManifest, Error\nfrom kittycad.types import Response\n\n\ndef example_get_ai_plugin_manifest():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[AiPluginManifest, Error]\n ] = get_ai_plugin_manifest.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AiPluginManifest = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_ai_plugin_manifest.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment~1methods/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import list_payment_methods_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, PaymentMethod\nfrom kittycad.types import Response\n\n\ndef example_list_payment_methods_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[List[PaymentMethod], Error]\n ] = list_payment_methods_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: List[PaymentMethod] = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.list_payment_methods_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, User\nfrom kittycad.types import Response\n\n\ndef example_get_user_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[User, Error]] = get_user_self.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: User = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_self.html" - } - }, - { - "op": "add", - "path": "/paths/~1user/delete/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import delete_user_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_user_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_user_self.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.delete_user_self.html" - } - }, - { - "op": "add", - "path": "/paths/~1user/put/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import update_user_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, User\nfrom kittycad.models.update_user import UpdateUser\nfrom kittycad.types import Response\n\n\ndef example_update_user_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[User, Error]] = update_user_self.sync(\n client=client,\n body=UpdateUser(\n company=\"\",\n discord=\"\",\n first_name=\"\",\n github=\"\",\n last_name=\"\",\n phone=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: User = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.update_user_self.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1pressure~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_pressure_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitPressureConversion\nfrom kittycad.models.unit_pressure import UnitPressure\nfrom kittycad.types import Response\n\n\ndef example_get_pressure_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitPressureConversion, Error]\n ] = get_pressure_unit_conversion.sync(\n client=client,\n input_unit=UnitPressure.ATMOSPHERES,\n output_unit=UnitPressure.ATMOSPHERES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitPressureConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_pressure_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1logout/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.hidden import logout\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_logout():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = logout.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.logout.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1force~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_force_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitForceConversion\nfrom kittycad.models.unit_force import UnitForce\nfrom kittycad.types import Response\n\n\ndef example_get_force_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitForceConversion, Error]\n ] = get_force_unit_conversion.sync(\n client=client,\n input_unit=UnitForce.DYNES,\n output_unit=UnitForce.DYNES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitForceConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_force_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1auth~1email/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.hidden import auth_email\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, VerificationToken\nfrom kittycad.models.email_authentication_form import EmailAuthenticationForm\nfrom kittycad.types import Response\n\n\ndef example_auth_email():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[VerificationToken, Error]] = auth_email.sync(\n client=client,\n body=EmailAuthenticationForm(\n email=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: VerificationToken = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.auth_email.html" - } - }, - { - "op": "add", - "path": "/paths/~1/get/x-python", - "value": { - "example": "from kittycad.api.meta import get_schema\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_get_schema():\n # Create our client.\n client = ClientFromEnv()\n\n get_schema.sync(\n client=client,\n )\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_schema.html" - } - }, - { - "op": "add", - "path": "/paths/~1ai-prompts~1{id}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import get_ai_prompt\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AiPrompt, Error\nfrom kittycad.types import Response\n\n\ndef example_get_ai_prompt():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[AiPrompt, Error]] = get_ai_prompt.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AiPrompt = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.get_ai_prompt.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1length~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_length_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitLengthConversion\nfrom kittycad.models.unit_length import UnitLength\nfrom kittycad.types import Response\n\n\ndef example_get_length_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitLengthConversion, Error]\n ] = get_length_unit_conversion.sync(\n client=client,\n input_unit=UnitLength.CM,\n output_unit=UnitLength.CM,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitLengthConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_length_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1file~1density/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_density\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileDensity\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_density import UnitDensity\nfrom kittycad.models.unit_mass import UnitMass\nfrom kittycad.types import Response\n\n\ndef example_create_file_density():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileDensity, Error]] = create_file_density.sync(\n client=client,\n material_mass=3.14,\n material_mass_unit=UnitMass.G,\n output_unit=UnitDensity.LB_FT3,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileDensity = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_density.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1api-tokens~1{token}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import get_api_token_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiToken, Error\nfrom kittycad.types import Response\n\n\ndef example_get_api_token_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiToken, Error]] = get_api_token_for_user.sync(\n client=client,\n token=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiToken = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.get_api_token_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1api-tokens~1{token}/delete/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import delete_api_token_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_api_token_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_api_token_for_user.sync(\n client=client,\n token=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.delete_api_token_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1apps~1github~1consent/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.apps import apps_github_consent\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AppClientInfo, Error\nfrom kittycad.types import Response\n\n\ndef example_apps_github_consent():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[AppClientInfo, Error]] = apps_github_consent.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AppClientInfo = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.apps.apps_github_consent.html" - } - }, - { - "op": "add", - "path": "/paths/~1file~1conversion~1{src_format}~1{output_format}/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileConversion\nfrom kittycad.models.file_export_format import FileExportFormat\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.types import Response\n\n\ndef example_create_file_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileConversion, Error]] = create_file_conversion.sync(\n client=client,\n output_format=FileExportFormat.FBX,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1users-extended~1{id}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_extended\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, ExtendedUser\nfrom kittycad.types import Response\n\n\ndef example_get_user_extended():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ExtendedUser, Error]] = get_user_extended.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ExtendedUser = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_extended.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1onboarding/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_onboarding_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Onboarding\nfrom kittycad.types import Response\n\n\ndef example_get_user_onboarding_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Onboarding, Error]] = get_user_onboarding_self.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Onboarding = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_onboarding_self.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1current~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_current_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitCurrentConversion\nfrom kittycad.models.unit_current import UnitCurrent\nfrom kittycad.types import Response\n\n\ndef example_get_current_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitCurrentConversion, Error]\n ] = get_current_unit_conversion.sync(\n client=client,\n input_unit=UnitCurrent.AMPERES,\n output_unit=UnitCurrent.AMPERES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitCurrentConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_current_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1api-calls~1{id}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_api_call\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPrice, Error\nfrom kittycad.types import Response\n\n\ndef example_get_api_call():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiCallWithPrice, Error]] = get_api_call.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPrice = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_api_call.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment~1intent/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import create_payment_intent_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, PaymentIntent\nfrom kittycad.types import Response\n\n\ndef example_create_payment_intent_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[PaymentIntent, Error]\n ] = create_payment_intent_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: PaymentIntent = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.create_payment_intent_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1ping/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import ping\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Pong\nfrom kittycad.types import Response\n\n\ndef example_ping():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Pong, Error]] = ping.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Pong = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.ping.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1area~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_area_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitAreaConversion\nfrom kittycad.models.unit_area import UnitArea\nfrom kittycad.types import Response\n\n\ndef example_get_area_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitAreaConversion, Error]\n ] = get_area_unit_conversion.sync(\n client=client,\n input_unit=UnitArea.CM2,\n output_unit=UnitArea.CM2,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitAreaConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_area_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1volume~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_volume_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitVolumeConversion\nfrom kittycad.models.unit_volume import UnitVolume\nfrom kittycad.types import Response\n\n\ndef example_get_volume_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitVolumeConversion, Error]\n ] = get_volume_unit_conversion.sync(\n client=client,\n input_unit=UnitVolume.CM3,\n output_unit=UnitVolume.CM3,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitVolumeConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_volume_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1api-calls/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import user_list_api_calls\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPriceResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_user_list_api_calls():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiCallWithPriceResultsPage, Error]\n ] = user_list_api_calls.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPriceResultsPage = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.user_list_api_calls.html" - } - }, - { - "op": "add", - "path": "/paths/~1file~1center-of-mass/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_center_of_mass\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileCenterOfMass\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_length import UnitLength\nfrom kittycad.types import Response\n\n\ndef example_create_file_center_of_mass():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[FileCenterOfMass, Error]\n ] = create_file_center_of_mass.sync(\n client=client,\n output_unit=UnitLength.CM,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileCenterOfMass = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_center_of_mass.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1extended/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_self_extended\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, ExtendedUser\nfrom kittycad.types import Response\n\n\ndef example_get_user_self_extended():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ExtendedUser, Error]] = get_user_self_extended.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ExtendedUser = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_self_extended.html" - } - }, - { - "op": "add", - "path": "/paths/~1file~1mass/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_mass\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileMass\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_density import UnitDensity\nfrom kittycad.models.unit_mass import UnitMass\nfrom kittycad.types import Response\n\n\ndef example_create_file_mass():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileMass, Error]] = create_file_mass.sync(\n client=client,\n material_density=3.14,\n material_density_unit=UnitDensity.LB_FT3,\n output_unit=UnitMass.G,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileMass = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_mass.html" - } - }, - { - "op": "add", - "path": "/paths/~1ws~1executor~1term/get/x-python", - "value": { - "example": "from kittycad.api.executor import create_executor_term\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_create_executor_term():\n # Create our client.\n client = ClientFromEnv()\n\n # Connect to the websocket.\n websocket = create_executor_term.sync(\n client=client,\n )\n\n # Send a message.\n websocket.send(\"{}\")\n\n # Get the messages.\n for message in websocket:\n print(message)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.executor.create_executor_term.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1energy~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_energy_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitEnergyConversion\nfrom kittycad.models.unit_energy import UnitEnergy\nfrom kittycad.types import Response\n\n\ndef example_get_energy_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitEnergyConversion, Error]\n ] = get_energy_unit_conversion.sync(\n client=client,\n input_unit=UnitEnergy.BTU,\n output_unit=UnitEnergy.BTU,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitEnergyConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_energy_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1frequency~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_frequency_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitFrequencyConversion\nfrom kittycad.models.unit_frequency import UnitFrequency\nfrom kittycad.types import Response\n\n\ndef example_get_frequency_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitFrequencyConversion, Error]\n ] = get_frequency_unit_conversion.sync(\n client=client,\n input_unit=UnitFrequency.GIGAHERTZ,\n output_unit=UnitFrequency.GIGAHERTZ,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitFrequencyConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_frequency_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1ai~1text-to-cad~1{output_format}/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import create_text_to_cad\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, TextToCad\nfrom kittycad.models.file_export_format import FileExportFormat\nfrom kittycad.models.text_to_cad_create_body import TextToCadCreateBody\nfrom kittycad.types import Response\n\n\ndef example_create_text_to_cad():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[TextToCad, Error]] = create_text_to_cad.sync(\n client=client,\n output_format=FileExportFormat.FBX,\n body=TextToCadCreateBody(\n prompt=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: TextToCad = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.create_text_to_cad.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1torque~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_torque_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitTorqueConversion\nfrom kittycad.models.unit_torque import UnitTorque\nfrom kittycad.types import Response\n\n\ndef example_get_torque_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitTorqueConversion, Error]\n ] = get_torque_unit_conversion.sync(\n client=client,\n input_unit=UnitTorque.NEWTON_METRES,\n output_unit=UnitTorque.NEWTON_METRES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitTorqueConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_torque_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1api-call-metrics/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_api_call_metrics\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallQueryGroup, Error\nfrom kittycad.models.api_call_query_group_by import ApiCallQueryGroupBy\nfrom kittycad.types import Response\n\n\ndef example_get_api_call_metrics():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[List[ApiCallQueryGroup], Error]\n ] = get_api_call_metrics.sync(\n client=client,\n group_by=ApiCallQueryGroupBy.EMAIL,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: List[ApiCallQueryGroup] = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_api_call_metrics.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1api-calls~1{id}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_api_call_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPrice, Error\nfrom kittycad.types import Response\n\n\ndef example_get_api_call_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiCallWithPrice, Error]] = get_api_call_for_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPrice = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_api_call_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment~1methods~1{id}/delete/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import delete_payment_method_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_payment_method_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_payment_method_for_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.delete_payment_method_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment~1tax/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import validate_customer_tax_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_validate_customer_tax_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = validate_customer_tax_information_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.validate_customer_tax_information_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1api-calls/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import list_api_calls\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPriceResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_api_calls():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiCallWithPriceResultsPage, Error]\n ] = list_api_calls.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPriceResultsPage = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.list_api_calls.html" + "client": "# Create a client with your token.\nfrom kittycad.client import Client\n\nclient = Client(token=\"$TOKEN\")\n\n# - OR -\n\n# Create a new client with your token parsed from the environment variable:\n# `KITTYCAD_API_TOKEN`.\nfrom kittycad.client import ClientFromEnv\n\nclient = ClientFromEnv()\n\n# NOTE: The python library additionally implements asyncio, however all the code samples we\n# show below use the sync functions for ease of use and understanding.\n# Check out the library docs at:\n# https://python.api.docs.kittycad.io/_autosummary/kittycad.api.html#module-kittycad.api\n# for more details.", + "install": "pip install kittycad" } }, { @@ -367,6 +15,14 @@ "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.executor.create_file_execution.html" } }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1energy~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_energy_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitEnergyConversion\nfrom kittycad.models.unit_energy import UnitEnergy\nfrom kittycad.types import Response\n\n\ndef example_get_energy_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitEnergyConversion, Error]\n ] = get_energy_unit_conversion.sync(\n client=client,\n input_unit=UnitEnergy.BTU,\n output_unit=UnitEnergy.BTU,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitEnergyConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_energy_unit_conversion.html" + } + }, { "op": "add", "path": "/paths/~1internal~1discord~1api-token~1{discord_id}/get/x-python", @@ -377,162 +33,66 @@ }, { "op": "add", - "path": "/paths/~1user~1session~1{token}/get/x-python", + "path": "/paths/~1unit~1conversion~1area~1{input_unit}~1{output_unit}/get/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_session_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Session\nfrom kittycad.types import Response\n\n\ndef example_get_session_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Session, Error]] = get_session_for_user.sync(\n client=client,\n token=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Session = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_session_for_user.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_area_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitAreaConversion\nfrom kittycad.models.unit_area import UnitArea\nfrom kittycad.types import Response\n\n\ndef example_get_area_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitAreaConversion, Error]\n ] = get_area_unit_conversion.sync(\n client=client,\n input_unit=UnitArea.CM2,\n output_unit=UnitArea.CM2,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitAreaConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_area_unit_conversion.html" } }, { "op": "add", - "path": "/paths/~1ws~1modeling~1commands/get/x-python", + "path": "/paths/~1api-calls~1{id}/get/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.modeling import modeling_commands_ws\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, WebSocketResponse\nfrom kittycad.types import Response\n\n\ndef example_modeling_commands_ws():\n # Create our client.\n client = ClientFromEnv()\n\n # Connect to the websocket.\n websocket = modeling_commands_ws.sync(\n client=client,\n fps=10,\n unlocked_framerate=False,\n video_res_height=10,\n video_res_width=10,\n webrtc=False,\n )\n\n # Send a message.\n websocket.send(\"{}\")\n\n # Get the messages.\n for message in websocket:\n print(message)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.modeling.modeling_commands_ws.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_api_call\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPrice, Error\nfrom kittycad.types import Response\n\n\ndef example_get_api_call():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiCallWithPrice, Error]] = get_api_call.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPrice = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_api_call.html" } }, { "op": "add", - "path": "/paths/~1unit~1conversion~1mass~1{input_unit}~1{output_unit}/get/x-python", + "path": "/paths/~1ws~1executor~1term/get/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_mass_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitMassConversion\nfrom kittycad.models.unit_mass import UnitMass\nfrom kittycad.types import Response\n\n\ndef example_get_mass_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitMassConversion, Error]\n ] = get_mass_unit_conversion.sync(\n client=client,\n input_unit=UnitMass.G,\n output_unit=UnitMass.G,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitMassConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_mass_unit_conversion.html" + "example": "from kittycad.api.executor import create_executor_term\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_create_executor_term():\n # Create our client.\n client = ClientFromEnv()\n\n # Connect to the websocket.\n websocket = create_executor_term.sync(\n client=client,\n )\n\n # Send a message.\n websocket.send(\"{}\")\n\n # Get the messages.\n for message in websocket:\n print(message)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.executor.create_executor_term.html" } }, { "op": "add", - "path": "/paths/~1file~1surface-area/post/x-python", + "path": "/paths/~1user~1onboarding/get/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_surface_area\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileSurfaceArea\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_area import UnitArea\nfrom kittycad.types import Response\n\n\ndef example_create_file_surface_area():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[FileSurfaceArea, Error]\n ] = create_file_surface_area.sync(\n client=client,\n output_unit=UnitArea.CM2,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileSurfaceArea = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_surface_area.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_onboarding_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Onboarding\nfrom kittycad.types import Response\n\n\ndef example_get_user_onboarding_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Onboarding, Error]] = get_user_onboarding_self.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Onboarding = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_onboarding_self.html" } }, { "op": "add", - "path": "/paths/~1unit~1conversion~1angle~1{input_unit}~1{output_unit}/get/x-python", + "path": "/paths/~1unit~1conversion~1force~1{input_unit}~1{output_unit}/get/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_angle_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitAngleConversion\nfrom kittycad.models.unit_angle import UnitAngle\nfrom kittycad.types import Response\n\n\ndef example_get_angle_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitAngleConversion, Error]\n ] = get_angle_unit_conversion.sync(\n client=client,\n input_unit=UnitAngle.DEGREES,\n output_unit=UnitAngle.DEGREES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitAngleConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_angle_unit_conversion.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_force_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitForceConversion\nfrom kittycad.models.unit_force import UnitForce\nfrom kittycad.types import Response\n\n\ndef example_get_force_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitForceConversion, Error]\n ] = get_force_unit_conversion.sync(\n client=client,\n input_unit=UnitForce.DYNES,\n output_unit=UnitForce.DYNES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitForceConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_force_unit_conversion.html" } }, { "op": "add", - "path": "/paths/~1users-extended/get/x-python", + "path": "/paths/~1.well-known~1ai-plugin.json/get/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import list_users_extended\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, ExtendedUserResultsPage\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_users_extended():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ExtendedUserResultsPage, Error]\n ] = list_users_extended.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ExtendedUserResultsPage = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.list_users_extended.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import get_ai_plugin_manifest\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AiPluginManifest, Error\nfrom kittycad.types import Response\n\n\ndef example_get_ai_plugin_manifest():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[AiPluginManifest, Error]\n ] = get_ai_plugin_manifest.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AiPluginManifest = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_ai_plugin_manifest.html" } }, { "op": "add", - "path": "/paths/~1openai~1openapi.json/get/x-python", + "path": "/paths/~1users/get/x-python", "value": { - "example": "from kittycad.api.meta import get_openai_schema\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_get_openai_schema():\n # Create our client.\n client = ClientFromEnv()\n\n get_openai_schema.sync(\n client=client,\n )\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_openai_schema.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import list_users\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UserResultsPage\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_users():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[UserResultsPage, Error]] = list_users.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UserResultsPage = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.list_users.html" } }, { "op": "add", - "path": "/paths/~1user~1api-tokens/post/x-python", + "path": "/paths/~1user~1payment~1intent/post/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import create_api_token_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiToken, Error\nfrom kittycad.types import Response\n\n\ndef example_create_api_token_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiToken, Error]] = create_api_token_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiToken = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.create_api_token_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1api-tokens/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import list_api_tokens_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiTokenResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_api_tokens_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiTokenResultsPage, Error]\n ] = list_api_tokens_for_user.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiTokenResultsPage = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.list_api_tokens_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment~1balance/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import get_payment_balance_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import CustomerBalance, Error\nfrom kittycad.types import Response\n\n\ndef example_get_payment_balance_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[CustomerBalance, Error]\n ] = get_payment_balance_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: CustomerBalance = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.get_payment_balance_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1async~1operations/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import list_async_operations\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AsyncApiCallResultsPage, Error\nfrom kittycad.models.api_call_status import ApiCallStatus\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_async_operations():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[AsyncApiCallResultsPage, Error]\n ] = list_async_operations.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n status=ApiCallStatus.QUEUED,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AsyncApiCallResultsPage = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.list_async_operations.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1temperature~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_temperature_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitTemperatureConversion\nfrom kittycad.models.unit_temperature import UnitTemperature\nfrom kittycad.types import Response\n\n\ndef example_get_temperature_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitTemperatureConversion, Error]\n ] = get_temperature_unit_conversion.sync(\n client=client,\n input_unit=UnitTemperature.CELSIUS,\n output_unit=UnitTemperature.CELSIUS,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitTemperatureConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_temperature_unit_conversion.html" - } - }, - { - "op": "add", - "path": "/paths/~1apps~1github~1webhook/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.apps import apps_github_webhook\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_apps_github_webhook():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = apps_github_webhook.sync(\n client=client,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.apps.apps_github_webhook.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1front-hash/get/x-python", - "value": { - "example": "from kittycad.api.users import get_user_front_hash_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_get_user_front_hash_self():\n # Create our client.\n client = ClientFromEnv()\n\n get_user_front_hash_self.sync(\n client=client,\n )\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_front_hash_self.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment/post/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import create_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Customer, Error\nfrom kittycad.models.billing_info import BillingInfo\nfrom kittycad.types import Response\n\n\ndef example_create_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[Customer, Error]\n ] = create_payment_information_for_user.sync(\n client=client,\n body=BillingInfo(\n name=\"\",\n phone=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Customer = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.create_payment_information_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment/put/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import update_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Customer, Error\nfrom kittycad.models.billing_info import BillingInfo\nfrom kittycad.types import Response\n\n\ndef example_update_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[Customer, Error]\n ] = update_payment_information_for_user.sync(\n client=client,\n body=BillingInfo(\n name=\"\",\n phone=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Customer = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.update_payment_information_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import get_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Customer, Error\nfrom kittycad.types import Response\n\n\ndef example_get_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[Customer, Error]\n ] = get_payment_information_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Customer = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.get_payment_information_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1user~1payment/delete/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import delete_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_payment_information_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.delete_payment_information_for_user.html" - } - }, - { - "op": "add", - "path": "/paths/~1_meta~1info/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import get_metadata\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Metadata\nfrom kittycad.types import Response\n\n\ndef example_get_metadata():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Metadata, Error]] = get_metadata.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Metadata = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_metadata.html" - } - }, - { - "op": "add", - "path": "/paths/~1unit~1conversion~1power~1{input_unit}~1{output_unit}/get/x-python", - "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_power_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitPowerConversion\nfrom kittycad.models.unit_power import UnitPower\nfrom kittycad.types import Response\n\n\ndef example_get_power_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitPowerConversion, Error]\n ] = get_power_unit_conversion.sync(\n client=client,\n input_unit=UnitPower.BTU_PER_MINUTE,\n output_unit=UnitPower.BTU_PER_MINUTE,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitPowerConversion = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_power_unit_conversion.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import create_payment_intent_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, PaymentIntent\nfrom kittycad.types import Response\n\n\ndef example_create_payment_intent_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[PaymentIntent, Error]\n ] = create_payment_intent_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: PaymentIntent = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.create_payment_intent_for_user.html" } }, { @@ -553,26 +113,82 @@ }, { "op": "add", - "path": "/paths/~1auth~1email~1callback/get/x-python", + "path": "/paths/~1ai~1text-to-cad~1{output_format}/post/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.hidden import auth_email_callback\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_auth_email_callback():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = auth_email_callback.sync(\n client=client,\n email=\"\",\n token=\"\",\n callback_url=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.auth_email_callback.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import create_text_to_cad\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, TextToCad\nfrom kittycad.models.file_export_format import FileExportFormat\nfrom kittycad.models.text_to_cad_create_body import TextToCadCreateBody\nfrom kittycad.types import Response\n\n\ndef example_create_text_to_cad():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[TextToCad, Error]] = create_text_to_cad.sync(\n client=client,\n output_format=FileExportFormat.FBX,\n body=TextToCadCreateBody(\n prompt=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: TextToCad = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.create_text_to_cad.html" } }, { "op": "add", - "path": "/paths/~1user~1text-to-cad~1{id}/post/x-python", + "path": "/paths/~1user~1payment~1methods/get/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import create_text_to_cad_model_feedback\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.models.ai_feedback import AiFeedback\nfrom kittycad.types import Response\n\n\ndef example_create_text_to_cad_model_feedback():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = create_text_to_cad_model_feedback.sync(\n client=client,\n id=\"\",\n feedback=AiFeedback.THUMBS_UP,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.create_text_to_cad_model_feedback.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import list_payment_methods_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, PaymentMethod\nfrom kittycad.types import Response\n\n\ndef example_list_payment_methods_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[List[PaymentMethod], Error]\n ] = list_payment_methods_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: List[PaymentMethod] = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.list_payment_methods_for_user.html" } }, { "op": "add", - "path": "/paths/~1user~1text-to-cad~1{id}/get/x-python", + "path": "/paths/~1file~1surface-area/post/x-python", "value": { - "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import get_text_to_cad_model_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, TextToCad\nfrom kittycad.types import Response\n\n\ndef example_get_text_to_cad_model_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[TextToCad, Error]\n ] = get_text_to_cad_model_for_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: TextToCad = result\n print(body)\n", - "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.get_text_to_cad_model_for_user.html" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_surface_area\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileSurfaceArea\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_area import UnitArea\nfrom kittycad.types import Response\n\n\ndef example_create_file_surface_area():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[FileSurfaceArea, Error]\n ] = create_file_surface_area.sync(\n client=client,\n output_unit=UnitArea.CM2,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileSurfaceArea = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_surface_area.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment~1balance/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import get_payment_balance_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import CustomerBalance, Error\nfrom kittycad.types import Response\n\n\ndef example_get_payment_balance_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[CustomerBalance, Error]\n ] = get_payment_balance_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: CustomerBalance = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.get_payment_balance_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1temperature~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_temperature_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitTemperatureConversion\nfrom kittycad.models.unit_temperature import UnitTemperature\nfrom kittycad.types import Response\n\n\ndef example_get_temperature_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitTemperatureConversion, Error]\n ] = get_temperature_unit_conversion.sync(\n client=client,\n input_unit=UnitTemperature.CELSIUS,\n output_unit=UnitTemperature.CELSIUS,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitTemperatureConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_temperature_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1user/put/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import update_user_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, User\nfrom kittycad.models.update_user import UpdateUser\nfrom kittycad.types import Response\n\n\ndef example_update_user_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[User, Error]] = update_user_self.sync(\n client=client,\n body=UpdateUser(\n company=\"\",\n discord=\"\",\n first_name=\"\",\n github=\"\",\n last_name=\"\",\n phone=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: User = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.update_user_self.html" + } + }, + { + "op": "add", + "path": "/paths/~1user/delete/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import delete_user_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_user_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_user_self.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.delete_user_self.html" + } + }, + { + "op": "add", + "path": "/paths/~1user/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, User\nfrom kittycad.types import Response\n\n\ndef example_get_user_self():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[User, Error]] = get_user_self.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: User = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_self.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1front-hash/get/x-python", + "value": { + "example": "from kittycad.api.users import get_user_front_hash_self\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_get_user_front_hash_self():\n # Create our client.\n client = ClientFromEnv()\n\n get_user_front_hash_self.sync(\n client=client,\n )\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_front_hash_self.html" + } + }, + { + "op": "add", + "path": "/paths/~1api-calls/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import list_api_calls\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPriceResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_api_calls():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiCallWithPriceResultsPage, Error]\n ] = list_api_calls.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPriceResultsPage = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.list_api_calls.html" } }, { @@ -585,10 +201,394 @@ }, { "op": "add", - "path": "/info/x-python", + "path": "/paths/~1file~1density/post/x-python", "value": { - "client": "# Create a client with your token.\nfrom kittycad.client import Client\n\nclient = Client(token=\"$TOKEN\")\n\n# - OR -\n\n# Create a new client with your token parsed from the environment variable:\n# `KITTYCAD_API_TOKEN`.\nfrom kittycad.client import ClientFromEnv\n\nclient = ClientFromEnv()\n\n# NOTE: The python library additionally implements asyncio, however all the code samples we\n# show below use the sync functions for ease of use and understanding.\n# Check out the library docs at:\n# https://python.api.docs.kittycad.io/_autosummary/kittycad.api.html#module-kittycad.api\n# for more details.", - "install": "pip install kittycad" + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_density\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileDensity\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_density import UnitDensity\nfrom kittycad.models.unit_mass import UnitMass\nfrom kittycad.types import Response\n\n\ndef example_create_file_density():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileDensity, Error]] = create_file_density.sync(\n client=client,\n material_mass=3.14,\n material_mass_unit=UnitMass.G,\n output_unit=UnitDensity.LB_FT3,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileDensity = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_density.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1extended/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_self_extended\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, ExtendedUser\nfrom kittycad.types import Response\n\n\ndef example_get_user_self_extended():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ExtendedUser, Error]] = get_user_self_extended.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ExtendedUser = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_self_extended.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment~1invoices/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import list_invoices_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Invoice\nfrom kittycad.types import Response\n\n\ndef example_list_invoices_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[List[Invoice], Error]] = list_invoices_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: List[Invoice] = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.list_invoices_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1file~1center-of-mass/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_center_of_mass\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileCenterOfMass\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_length import UnitLength\nfrom kittycad.types import Response\n\n\ndef example_create_file_center_of_mass():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[FileCenterOfMass, Error]\n ] = create_file_center_of_mass.sync(\n client=client,\n output_unit=UnitLength.CM,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileCenterOfMass = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_center_of_mass.html" + } + }, + { + "op": "add", + "path": "/paths/~1/get/x-python", + "value": { + "example": "from kittycad.api.meta import get_schema\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_get_schema():\n # Create our client.\n client = ClientFromEnv()\n\n get_schema.sync(\n client=client,\n )\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_schema.html" + } + }, + { + "op": "add", + "path": "/paths/~1openai~1openapi.json/get/x-python", + "value": { + "example": "from kittycad.api.meta import get_openai_schema\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.types import Response\n\n\ndef example_get_openai_schema():\n # Create our client.\n client = ClientFromEnv()\n\n get_openai_schema.sync(\n client=client,\n )\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_openai_schema.html" + } + }, + { + "op": "add", + "path": "/paths/~1users-extended/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import list_users_extended\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, ExtendedUserResultsPage\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_users_extended():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ExtendedUserResultsPage, Error]\n ] = list_users_extended.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ExtendedUserResultsPage = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.list_users_extended.html" + } + }, + { + "op": "add", + "path": "/paths/~1apps~1github~1webhook/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.apps import apps_github_webhook\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_apps_github_webhook():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = apps_github_webhook.sync(\n client=client,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.apps.apps_github_webhook.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1mass~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_mass_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitMassConversion\nfrom kittycad.models.unit_mass import UnitMass\nfrom kittycad.types import Response\n\n\ndef example_get_mass_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitMassConversion, Error]\n ] = get_mass_unit_conversion.sync(\n client=client,\n input_unit=UnitMass.G,\n output_unit=UnitMass.G,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitMassConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_mass_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import create_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Customer, Error\nfrom kittycad.models.billing_info import BillingInfo\nfrom kittycad.types import Response\n\n\ndef example_create_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[Customer, Error]\n ] = create_payment_information_for_user.sync(\n client=client,\n body=BillingInfo(\n name=\"\",\n phone=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Customer = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.create_payment_information_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment/put/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import update_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Customer, Error\nfrom kittycad.models.billing_info import BillingInfo\nfrom kittycad.types import Response\n\n\ndef example_update_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[Customer, Error]\n ] = update_payment_information_for_user.sync(\n client=client,\n body=BillingInfo(\n name=\"\",\n phone=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Customer = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.update_payment_information_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment/delete/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import delete_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_payment_information_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.delete_payment_information_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import get_payment_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Customer, Error\nfrom kittycad.types import Response\n\n\ndef example_get_payment_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[Customer, Error]\n ] = get_payment_information_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Customer = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.get_payment_information_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1auth~1email/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.hidden import auth_email\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, VerificationToken\nfrom kittycad.models.email_authentication_form import EmailAuthenticationForm\nfrom kittycad.types import Response\n\n\ndef example_auth_email():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[VerificationToken, Error]] = auth_email.sync(\n client=client,\n body=EmailAuthenticationForm(\n email=\"\",\n ),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: VerificationToken = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.auth_email.html" + } + }, + { + "op": "add", + "path": "/paths/~1async~1operations/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import list_async_operations\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AsyncApiCallResultsPage, Error\nfrom kittycad.models.api_call_status import ApiCallStatus\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_async_operations():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[AsyncApiCallResultsPage, Error]\n ] = list_async_operations.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n status=ApiCallStatus.QUEUED,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AsyncApiCallResultsPage = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.list_async_operations.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1api-calls/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import user_list_api_calls\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPriceResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_user_list_api_calls():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiCallWithPriceResultsPage, Error]\n ] = user_list_api_calls.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPriceResultsPage = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.user_list_api_calls.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1pressure~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_pressure_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitPressureConversion\nfrom kittycad.models.unit_pressure import UnitPressure\nfrom kittycad.types import Response\n\n\ndef example_get_pressure_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitPressureConversion, Error]\n ] = get_pressure_unit_conversion.sync(\n client=client,\n input_unit=UnitPressure.ATMOSPHERES,\n output_unit=UnitPressure.ATMOSPHERES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitPressureConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_pressure_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1api-tokens~1{token}/delete/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import delete_api_token_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_api_token_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_api_token_for_user.sync(\n client=client,\n token=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.delete_api_token_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1api-tokens~1{token}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import get_api_token_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiToken, Error\nfrom kittycad.types import Response\n\n\ndef example_get_api_token_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiToken, Error]] = get_api_token_for_user.sync(\n client=client,\n token=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiToken = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.get_api_token_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1file~1conversion~1{src_format}~1{output_format}/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileConversion\nfrom kittycad.models.file_export_format import FileExportFormat\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.types import Response\n\n\ndef example_create_file_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileConversion, Error]] = create_file_conversion.sync(\n client=client,\n output_format=FileExportFormat.FBX,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1file~1volume/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_volume\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileVolume\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_volume import UnitVolume\nfrom kittycad.types import Response\n\n\ndef example_create_file_volume():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileVolume, Error]] = create_file_volume.sync(\n client=client,\n output_unit=UnitVolume.CM3,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileVolume = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_volume.html" + } + }, + { + "op": "add", + "path": "/paths/~1ai-prompts~1{id}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import get_ai_prompt\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AiPrompt, Error\nfrom kittycad.types import Response\n\n\ndef example_get_ai_prompt():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[AiPrompt, Error]] = get_ai_prompt.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AiPrompt = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.get_ai_prompt.html" + } + }, + { + "op": "add", + "path": "/paths/~1users~1{id}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, User\nfrom kittycad.types import Response\n\n\ndef example_get_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[User, Error]] = get_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: User = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1ws~1modeling~1commands/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.modeling import modeling_commands_ws\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, WebSocketResponse\nfrom kittycad.types import Response\n\n\ndef example_modeling_commands_ws():\n # Create our client.\n client = ClientFromEnv()\n\n # Connect to the websocket.\n websocket = modeling_commands_ws.sync(\n client=client,\n fps=10,\n unlocked_framerate=False,\n video_res_height=10,\n video_res_width=10,\n webrtc=False,\n )\n\n # Send a message.\n websocket.send(\"{}\")\n\n # Get the messages.\n for message in websocket:\n print(message)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.modeling.modeling_commands_ws.html" + } + }, + { + "op": "add", + "path": "/paths/~1apps~1github~1consent/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.apps import apps_github_consent\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AppClientInfo, Error\nfrom kittycad.types import Response\n\n\ndef example_apps_github_consent():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[AppClientInfo, Error]] = apps_github_consent.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: AppClientInfo = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.apps.apps_github_consent.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1session~1{token}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_session_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Session\nfrom kittycad.types import Response\n\n\ndef example_get_session_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Session, Error]] = get_session_for_user.sync(\n client=client,\n token=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Session = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_session_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1power~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_power_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitPowerConversion\nfrom kittycad.models.unit_power import UnitPower\nfrom kittycad.types import Response\n\n\ndef example_get_power_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitPowerConversion, Error]\n ] = get_power_unit_conversion.sync(\n client=client,\n input_unit=UnitPower.BTU_PER_MINUTE,\n output_unit=UnitPower.BTU_PER_MINUTE,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitPowerConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_power_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment~1methods~1{id}/delete/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import delete_payment_method_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_delete_payment_method_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = delete_payment_method_for_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.delete_payment_method_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1file~1mass/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.file import create_file_mass\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, FileMass\nfrom kittycad.models.file_import_format import FileImportFormat\nfrom kittycad.models.unit_density import UnitDensity\nfrom kittycad.models.unit_mass import UnitMass\nfrom kittycad.types import Response\n\n\ndef example_create_file_mass():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[FileMass, Error]] = create_file_mass.sync(\n client=client,\n material_density=3.14,\n material_density_unit=UnitDensity.LB_FT3,\n output_unit=UnitMass.G,\n src_format=FileImportFormat.FBX,\n body=bytes(\"some bytes\", \"utf-8\"),\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: FileMass = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_mass.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1current~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_current_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitCurrentConversion\nfrom kittycad.models.unit_current import UnitCurrent\nfrom kittycad.types import Response\n\n\ndef example_get_current_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitCurrentConversion, Error]\n ] = get_current_unit_conversion.sync(\n client=client,\n input_unit=UnitCurrent.AMPERES,\n output_unit=UnitCurrent.AMPERES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitCurrentConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_current_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1torque~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_torque_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitTorqueConversion\nfrom kittycad.models.unit_torque import UnitTorque\nfrom kittycad.types import Response\n\n\ndef example_get_torque_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitTorqueConversion, Error]\n ] = get_torque_unit_conversion.sync(\n client=client,\n input_unit=UnitTorque.NEWTON_METRES,\n output_unit=UnitTorque.NEWTON_METRES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitTorqueConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_torque_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1_meta~1info/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import get_metadata\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Metadata\nfrom kittycad.types import Response\n\n\ndef example_get_metadata():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Metadata, Error]] = get_metadata.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Metadata = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_metadata.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1api-calls~1{id}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_api_call_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallWithPrice, Error\nfrom kittycad.types import Response\n\n\ndef example_get_api_call_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiCallWithPrice, Error]] = get_api_call_for_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiCallWithPrice = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_api_call_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1users-extended~1{id}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.users import get_user_extended\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, ExtendedUser\nfrom kittycad.types import Response\n\n\ndef example_get_user_extended():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ExtendedUser, Error]] = get_user_extended.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ExtendedUser = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_extended.html" + } + }, + { + "op": "add", + "path": "/paths/~1async~1operations~1{id}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_async_operation\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import (\n Error,\n FileCenterOfMass,\n FileConversion,\n FileDensity,\n FileMass,\n FileSurfaceArea,\n FileVolume,\n TextToCad,\n)\nfrom kittycad.types import Response\n\n\ndef example_get_async_operation():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[\n FileConversion,\n FileCenterOfMass,\n FileMass,\n FileVolume,\n FileDensity,\n FileSurfaceArea,\n TextToCad,\n Error,\n ]\n ] = get_async_operation.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Union[\n FileConversion,\n FileCenterOfMass,\n FileMass,\n FileVolume,\n FileDensity,\n FileSurfaceArea,\n TextToCad,\n ] = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_async_operation.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1frequency~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_frequency_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitFrequencyConversion\nfrom kittycad.models.unit_frequency import UnitFrequency\nfrom kittycad.types import Response\n\n\ndef example_get_frequency_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitFrequencyConversion, Error]\n ] = get_frequency_unit_conversion.sync(\n client=client,\n input_unit=UnitFrequency.GIGAHERTZ,\n output_unit=UnitFrequency.GIGAHERTZ,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitFrequencyConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_frequency_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1angle~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_angle_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitAngleConversion\nfrom kittycad.models.unit_angle import UnitAngle\nfrom kittycad.types import Response\n\n\ndef example_get_angle_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitAngleConversion, Error]\n ] = get_angle_unit_conversion.sync(\n client=client,\n input_unit=UnitAngle.DEGREES,\n output_unit=UnitAngle.DEGREES,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitAngleConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_angle_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1auth~1email~1callback/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.hidden import auth_email_callback\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_auth_email_callback():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = auth_email_callback.sync(\n client=client,\n email=\"\",\n token=\"\",\n callback_url=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.auth_email_callback.html" + } + }, + { + "op": "add", + "path": "/paths/~1api-call-metrics/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import get_api_call_metrics\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiCallQueryGroup, Error\nfrom kittycad.models.api_call_query_group_by import ApiCallQueryGroupBy\nfrom kittycad.types import Response\n\n\ndef example_get_api_call_metrics():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[List[ApiCallQueryGroup], Error]\n ] = get_api_call_metrics.sync(\n client=client,\n group_by=ApiCallQueryGroupBy.EMAIL,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: List[ApiCallQueryGroup] = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_api_call_metrics.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1text-to-cad~1{id}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import get_text_to_cad_model_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, TextToCad\nfrom kittycad.types import Response\n\n\ndef example_get_text_to_cad_model_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[TextToCad, Error]\n ] = get_text_to_cad_model_for_user.sync(\n client=client,\n id=\"\",\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: TextToCad = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.get_text_to_cad_model_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1text-to-cad~1{id}/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import create_text_to_cad_model_feedback\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.models.ai_feedback import AiFeedback\nfrom kittycad.types import Response\n\n\ndef example_create_text_to_cad_model_feedback():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = create_text_to_cad_model_feedback.sync(\n client=client,\n id=\"\",\n feedback=AiFeedback.THUMBS_UP,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.create_text_to_cad_model_feedback.html" + } + }, + { + "op": "add", + "path": "/paths/~1ping/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import ping\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, Pong\nfrom kittycad.types import Response\n\n\ndef example_ping():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[Pong, Error]] = ping.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Pong = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.ping.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1payment~1tax/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.payments import validate_customer_tax_information_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_validate_customer_tax_information_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = validate_customer_tax_information_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.validate_customer_tax_information_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1length~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_length_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitLengthConversion\nfrom kittycad.models.unit_length import UnitLength\nfrom kittycad.types import Response\n\n\ndef example_get_length_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitLengthConversion, Error]\n ] = get_length_unit_conversion.sync(\n client=client,\n input_unit=UnitLength.CM,\n output_unit=UnitLength.CM,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitLengthConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_length_unit_conversion.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1api-tokens/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import list_api_tokens_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiTokenResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_api_tokens_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiTokenResultsPage, Error]\n ] = list_api_tokens_for_user.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiTokenResultsPage = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.list_api_tokens_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1api-tokens/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_tokens import create_api_token_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiToken, Error\nfrom kittycad.types import Response\n\n\ndef example_create_api_token_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[ApiToken, Error]] = create_api_token_for_user.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: ApiToken = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.create_api_token_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1user~1text-to-cad/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import list_text_to_cad_models_for_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, TextToCadResultsPage\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_text_to_cad_models_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[TextToCadResultsPage, Error]\n ] = list_text_to_cad_models_for_user.sync(\n client=client,\n sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n limit=None, # Optional[int]\n page_token=None, # Optional[str]\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: TextToCadResultsPage = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.list_text_to_cad_models_for_user.html" + } + }, + { + "op": "add", + "path": "/paths/~1logout/post/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.hidden import logout\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_logout():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = logout.sync(\n client=client,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: Error = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.logout.html" + } + }, + { + "op": "add", + "path": "/paths/~1unit~1conversion~1volume~1{input_unit}~1{output_unit}/get/x-python", + "value": { + "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.unit import get_volume_unit_conversion\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error, UnitVolumeConversion\nfrom kittycad.models.unit_volume import UnitVolume\nfrom kittycad.types import Response\n\n\ndef example_get_volume_unit_conversion():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[UnitVolumeConversion, Error]\n ] = get_volume_unit_conversion.sync(\n client=client,\n input_unit=UnitVolume.CM3,\n output_unit=UnitVolume.CM3,\n value=3.14,\n )\n\n if isinstance(result, Error) or result == None:\n print(result)\n raise Exception(\"Error in response\")\n\n body: UnitVolumeConversion = result\n print(body)\n", + "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_volume_unit_conversion.html" } } ] \ No newline at end of file diff --git a/kittycad/api/modeling/modeling_commands_ws.py b/kittycad/api/modeling/modeling_commands_ws.py index 470959330..718b3bacf 100644 --- a/kittycad/api/modeling/modeling_commands_ws.py +++ b/kittycad/api/modeling/modeling_commands_ws.py @@ -1,5 +1,5 @@ import json -from typing import Any, Dict, Optional +from typing import Any, Dict import bson from websockets.client import WebSocketClientProtocol, connect as ws_connect_async @@ -153,7 +153,11 @@ class WebSocket: """Send data as bson to the websocket.""" self.ws.send(bson.BSON.encode(data.to_dict())) - def recv(self) -> Optional[WebSocketResponse]: + def recv(self) -> WebSocketResponse: """Receive data from the websocket.""" message = self.ws.recv() - return Optional[WebSocketResponse].from_dict(json.loads(message)) + return WebSocketResponse.from_dict(json.loads(message)) + + def close(self): + """Close the websocket.""" + self.ws.close() diff --git a/kittycad/client_test.py b/kittycad/client_test.py index da2a0bfef..e1aea0258 100644 --- a/kittycad/client_test.py +++ b/kittycad/client_test.py @@ -23,12 +23,14 @@ 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 @@ -307,7 +309,9 @@ def test_ws(): # Send a message. id = uuid.uuid4() - req = modeling_cmd_req(cmd=start_path(), cmd_id=ModelingCmdId(id)) + req = WebSocketRequest( + modeling_cmd_req(cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(id)) + ) j = json.dumps(req.to_dict()) print(f"Sending: {j}") websocket.send(req) @@ -318,3 +322,6 @@ def test_ws(): message = websocket.recv() print(json.dumps(message)) break + + # Close the websocket. + websocket.close() diff --git a/kittycad/models/async_api_call_output.py b/kittycad/models/async_api_call_output.py index 5aee1bf04..71be689e2 100644 --- a/kittycad/models/async_api_call_output.py +++ b/kittycad/models/async_api_call_output.py @@ -3,6 +3,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union import attr from dateutil.parser import isoparse +from typing_extensions import Self from ..models.ai_feedback import AiFeedback from ..models.api_call_status import ApiCallStatus @@ -1411,12 +1412,94 @@ class text_to_cad: return key in self.additional_properties -AsyncApiCallOutput = Union[ - file_conversion, - file_center_of_mass, - file_mass, - file_volume, - file_density, - file_surface_area, - text_to_cad, -] +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, + ] = None + + def __init__( + self, + type: Union[ + type(file_conversion), + type(file_center_of_mass), + type(file_mass), + type(file_volume), + type(file_density), + type(file_surface_area), + type(text_to_cad), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, file_conversion): + n: file_conversion = self.type + return n.to_dict() + elif isinstance(self.type, file_center_of_mass): + n: file_center_of_mass = self.type + return n.to_dict() + elif isinstance(self.type, file_mass): + n: file_mass = self.type + return n.to_dict() + elif isinstance(self.type, file_volume): + n: file_volume = self.type + return n.to_dict() + elif isinstance(self.type, file_density): + n: file_density = self.type + return n.to_dict() + elif isinstance(self.type, file_surface_area): + n: file_surface_area = self.type + return n.to_dict() + elif isinstance(self.type, text_to_cad): + n: text_to_cad = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "file_conversion": + n: file_conversion = file_conversion() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "file_center_of_mass": + n: file_center_of_mass = file_center_of_mass() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "file_mass": + n: file_mass = file_mass() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "file_volume": + n: file_volume = file_volume() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "file_density": + n: file_density = file_density() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "file_surface_area": + n: file_surface_area = file_surface_area() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "text_to_cad": + n: text_to_cad = text_to_cad() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/input_format.py b/kittycad/models/input_format.py index eedeaaa10..44b000124 100644 --- a/kittycad/models/input_format.py +++ b/kittycad/models/input_format.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union import attr +from typing_extensions import Self from ..models.system import System from ..models.unit_length import UnitLength @@ -434,4 +435,94 @@ class stl: return key in self.additional_properties -InputFormat = Union[fbx, gltf, obj, ply, sldprt, step, stl] +class InputFormat: + + """Input format specifier.""" + + type: Union[ + fbx, + gltf, + obj, + ply, + sldprt, + step, + stl, + ] = None + + def __init__( + self, + type: Union[ + type(fbx), + type(gltf), + type(obj), + type(ply), + type(sldprt), + type(step), + type(stl), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, fbx): + n: fbx = self.type + return n.to_dict() + elif isinstance(self.type, gltf): + n: gltf = self.type + return n.to_dict() + elif isinstance(self.type, obj): + n: obj = self.type + return n.to_dict() + elif isinstance(self.type, ply): + n: ply = self.type + return n.to_dict() + elif isinstance(self.type, sldprt): + n: sldprt = self.type + return n.to_dict() + elif isinstance(self.type, step): + n: step = self.type + return n.to_dict() + elif isinstance(self.type, stl): + n: stl = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "fbx": + n: fbx = fbx() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "gltf": + n: gltf = gltf() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "obj": + n: obj = obj() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "ply": + n: ply = ply() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "sldprt": + n: sldprt = sldprt() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "step": + n: step = step() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "stl": + n: stl = stl() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/modeling_cmd.py b/kittycad/models/modeling_cmd.py index 5ceb107c4..59d88b638 100644 --- a/kittycad/models/modeling_cmd.py +++ b/kittycad/models/modeling_cmd.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union, cast import attr +from typing_extensions import Self from ..models.annotation_options import AnnotationOptions from ..models.annotation_type import AnnotationType @@ -4877,76 +4878,734 @@ class curve_set_constraint: return key in self.additional_properties -ModelingCmd = Union[ - start_path, - move_path_pen, - extend_path, - extrude, - close_path, - camera_drag_start, - camera_drag_move, - camera_drag_end, - default_camera_look_at, - default_camera_zoom, - default_camera_enable_sketch_mode, - default_camera_disable_sketch_mode, - default_camera_focus_on, - export, - entity_get_parent_id, - entity_get_num_children, - entity_get_child_uuid, - entity_get_all_child_uuids, - edit_mode_enter, - edit_mode_exit, - select_with_point, - select_clear, - select_add, - select_remove, - select_replace, - select_get, - highlight_set_entity, - highlight_set_entities, - new_annotation, - update_annotation, - object_visible, - object_bring_to_front, - get_entity_type, - solid2d_add_hole, - solid3d_get_all_edge_faces, - solid3d_get_all_opposite_edges, - solid3d_get_opposite_edge, - solid3d_get_next_adjacent_edge, - solid3d_get_prev_adjacent_edge, - send_object, - entity_set_opacity, - entity_fade, - make_plane, - plane_set_color, - set_tool, - mouse_move, - mouse_click, - sketch_mode_enable, - sketch_mode_disable, - curve_get_type, - curve_get_control_points, - take_snapshot, - make_axes_gizmo, - path_get_info, - path_get_curve_uuids_for_vertices, - path_get_vertex_uuids, - handle_mouse_drag_start, - handle_mouse_drag_move, - handle_mouse_drag_end, - remove_scene_objects, - plane_intersect_and_project, - curve_get_end_points, - reconfigure_stream, - import_files, - mass, - density, - volume, - center_of_mass, - surface_area, - get_sketch_mode_plane, - curve_set_constraint, -] +class ModelingCmd: + + """Commands that the KittyCAD engine can execute.""" + + type: Union[ + start_path, + move_path_pen, + extend_path, + extrude, + close_path, + camera_drag_start, + camera_drag_move, + camera_drag_end, + default_camera_look_at, + default_camera_zoom, + default_camera_enable_sketch_mode, + default_camera_disable_sketch_mode, + default_camera_focus_on, + export, + entity_get_parent_id, + entity_get_num_children, + entity_get_child_uuid, + entity_get_all_child_uuids, + edit_mode_enter, + edit_mode_exit, + select_with_point, + select_clear, + select_add, + select_remove, + select_replace, + select_get, + highlight_set_entity, + highlight_set_entities, + new_annotation, + update_annotation, + object_visible, + object_bring_to_front, + get_entity_type, + solid2d_add_hole, + solid3d_get_all_edge_faces, + solid3d_get_all_opposite_edges, + solid3d_get_opposite_edge, + solid3d_get_next_adjacent_edge, + solid3d_get_prev_adjacent_edge, + send_object, + entity_set_opacity, + entity_fade, + make_plane, + plane_set_color, + set_tool, + mouse_move, + mouse_click, + sketch_mode_enable, + sketch_mode_disable, + curve_get_type, + curve_get_control_points, + take_snapshot, + make_axes_gizmo, + path_get_info, + path_get_curve_uuids_for_vertices, + path_get_vertex_uuids, + handle_mouse_drag_start, + handle_mouse_drag_move, + handle_mouse_drag_end, + remove_scene_objects, + plane_intersect_and_project, + curve_get_end_points, + reconfigure_stream, + import_files, + mass, + density, + volume, + center_of_mass, + surface_area, + get_sketch_mode_plane, + curve_set_constraint, + ] = None + + def __init__( + self, + type: Union[ + type(start_path), + type(move_path_pen), + type(extend_path), + type(extrude), + type(close_path), + type(camera_drag_start), + type(camera_drag_move), + type(camera_drag_end), + type(default_camera_look_at), + type(default_camera_zoom), + type(default_camera_enable_sketch_mode), + type(default_camera_disable_sketch_mode), + type(default_camera_focus_on), + type(export), + type(entity_get_parent_id), + type(entity_get_num_children), + type(entity_get_child_uuid), + type(entity_get_all_child_uuids), + type(edit_mode_enter), + type(edit_mode_exit), + type(select_with_point), + type(select_clear), + type(select_add), + type(select_remove), + type(select_replace), + type(select_get), + type(highlight_set_entity), + type(highlight_set_entities), + type(new_annotation), + type(update_annotation), + type(object_visible), + type(object_bring_to_front), + type(get_entity_type), + type(solid2d_add_hole), + type(solid3d_get_all_edge_faces), + type(solid3d_get_all_opposite_edges), + type(solid3d_get_opposite_edge), + type(solid3d_get_next_adjacent_edge), + type(solid3d_get_prev_adjacent_edge), + type(send_object), + type(entity_set_opacity), + type(entity_fade), + type(make_plane), + type(plane_set_color), + type(set_tool), + type(mouse_move), + type(mouse_click), + type(sketch_mode_enable), + type(sketch_mode_disable), + type(curve_get_type), + type(curve_get_control_points), + type(take_snapshot), + type(make_axes_gizmo), + type(path_get_info), + type(path_get_curve_uuids_for_vertices), + type(path_get_vertex_uuids), + type(handle_mouse_drag_start), + type(handle_mouse_drag_move), + type(handle_mouse_drag_end), + type(remove_scene_objects), + type(plane_intersect_and_project), + type(curve_get_end_points), + type(reconfigure_stream), + type(import_files), + type(mass), + type(density), + type(volume), + type(center_of_mass), + type(surface_area), + type(get_sketch_mode_plane), + type(curve_set_constraint), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, start_path): + n: start_path = self.type + return n.to_dict() + elif isinstance(self.type, move_path_pen): + n: move_path_pen = self.type + return n.to_dict() + elif isinstance(self.type, extend_path): + n: extend_path = self.type + return n.to_dict() + elif isinstance(self.type, extrude): + n: extrude = self.type + return n.to_dict() + elif isinstance(self.type, close_path): + n: close_path = self.type + return n.to_dict() + elif isinstance(self.type, camera_drag_start): + n: camera_drag_start = self.type + return n.to_dict() + elif isinstance(self.type, camera_drag_move): + n: camera_drag_move = self.type + return n.to_dict() + elif isinstance(self.type, camera_drag_end): + n: camera_drag_end = self.type + return n.to_dict() + elif isinstance(self.type, default_camera_look_at): + n: default_camera_look_at = self.type + return n.to_dict() + elif isinstance(self.type, default_camera_zoom): + n: default_camera_zoom = self.type + return n.to_dict() + elif isinstance(self.type, default_camera_enable_sketch_mode): + n: default_camera_enable_sketch_mode = self.type + return n.to_dict() + elif isinstance(self.type, default_camera_disable_sketch_mode): + n: default_camera_disable_sketch_mode = self.type + return n.to_dict() + elif isinstance(self.type, default_camera_focus_on): + n: default_camera_focus_on = self.type + return n.to_dict() + elif isinstance(self.type, export): + n: export = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_parent_id): + n: entity_get_parent_id = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_num_children): + n: entity_get_num_children = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_child_uuid): + n: entity_get_child_uuid = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_all_child_uuids): + n: entity_get_all_child_uuids = self.type + return n.to_dict() + elif isinstance(self.type, edit_mode_enter): + n: edit_mode_enter = self.type + return n.to_dict() + elif isinstance(self.type, edit_mode_exit): + n: edit_mode_exit = self.type + return n.to_dict() + elif isinstance(self.type, select_with_point): + n: select_with_point = self.type + return n.to_dict() + elif isinstance(self.type, select_clear): + n: select_clear = self.type + return n.to_dict() + elif isinstance(self.type, select_add): + n: select_add = self.type + return n.to_dict() + elif isinstance(self.type, select_remove): + n: select_remove = self.type + return n.to_dict() + elif isinstance(self.type, select_replace): + n: select_replace = self.type + return n.to_dict() + elif isinstance(self.type, select_get): + n: select_get = self.type + return n.to_dict() + elif isinstance(self.type, highlight_set_entity): + n: highlight_set_entity = self.type + return n.to_dict() + elif isinstance(self.type, highlight_set_entities): + n: highlight_set_entities = self.type + return n.to_dict() + elif isinstance(self.type, new_annotation): + n: new_annotation = self.type + return n.to_dict() + elif isinstance(self.type, update_annotation): + n: update_annotation = self.type + return n.to_dict() + elif isinstance(self.type, object_visible): + n: object_visible = self.type + return n.to_dict() + elif isinstance(self.type, object_bring_to_front): + n: object_bring_to_front = self.type + return n.to_dict() + elif isinstance(self.type, get_entity_type): + n: get_entity_type = self.type + return n.to_dict() + elif isinstance(self.type, solid2d_add_hole): + n: solid2d_add_hole = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_all_edge_faces): + n: solid3d_get_all_edge_faces = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_all_opposite_edges): + n: solid3d_get_all_opposite_edges = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_opposite_edge): + n: solid3d_get_opposite_edge = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_next_adjacent_edge): + n: solid3d_get_next_adjacent_edge = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_prev_adjacent_edge): + n: solid3d_get_prev_adjacent_edge = self.type + return n.to_dict() + elif isinstance(self.type, send_object): + n: send_object = self.type + return n.to_dict() + elif isinstance(self.type, entity_set_opacity): + n: entity_set_opacity = self.type + return n.to_dict() + elif isinstance(self.type, entity_fade): + n: entity_fade = self.type + return n.to_dict() + elif isinstance(self.type, make_plane): + n: make_plane = self.type + return n.to_dict() + elif isinstance(self.type, plane_set_color): + n: plane_set_color = self.type + return n.to_dict() + elif isinstance(self.type, set_tool): + n: set_tool = self.type + return n.to_dict() + elif isinstance(self.type, mouse_move): + n: mouse_move = self.type + return n.to_dict() + elif isinstance(self.type, mouse_click): + n: mouse_click = self.type + return n.to_dict() + elif isinstance(self.type, sketch_mode_enable): + n: sketch_mode_enable = self.type + return n.to_dict() + elif isinstance(self.type, sketch_mode_disable): + n: sketch_mode_disable = self.type + return n.to_dict() + elif isinstance(self.type, curve_get_type): + n: curve_get_type = self.type + return n.to_dict() + elif isinstance(self.type, curve_get_control_points): + n: curve_get_control_points = self.type + return n.to_dict() + elif isinstance(self.type, take_snapshot): + n: take_snapshot = self.type + return n.to_dict() + elif isinstance(self.type, make_axes_gizmo): + n: make_axes_gizmo = self.type + return n.to_dict() + elif isinstance(self.type, path_get_info): + n: path_get_info = self.type + return n.to_dict() + elif isinstance(self.type, path_get_curve_uuids_for_vertices): + n: path_get_curve_uuids_for_vertices = self.type + return n.to_dict() + elif isinstance(self.type, path_get_vertex_uuids): + n: path_get_vertex_uuids = self.type + return n.to_dict() + elif isinstance(self.type, handle_mouse_drag_start): + n: handle_mouse_drag_start = self.type + return n.to_dict() + elif isinstance(self.type, handle_mouse_drag_move): + n: handle_mouse_drag_move = self.type + return n.to_dict() + elif isinstance(self.type, handle_mouse_drag_end): + n: handle_mouse_drag_end = self.type + return n.to_dict() + elif isinstance(self.type, remove_scene_objects): + n: remove_scene_objects = self.type + return n.to_dict() + elif isinstance(self.type, plane_intersect_and_project): + n: plane_intersect_and_project = self.type + return n.to_dict() + elif isinstance(self.type, curve_get_end_points): + n: curve_get_end_points = self.type + return n.to_dict() + elif isinstance(self.type, reconfigure_stream): + n: reconfigure_stream = self.type + return n.to_dict() + elif isinstance(self.type, import_files): + n: import_files = self.type + return n.to_dict() + elif isinstance(self.type, mass): + n: mass = self.type + return n.to_dict() + elif isinstance(self.type, density): + n: density = self.type + return n.to_dict() + elif isinstance(self.type, volume): + n: volume = self.type + return n.to_dict() + elif isinstance(self.type, center_of_mass): + n: center_of_mass = self.type + return n.to_dict() + elif isinstance(self.type, surface_area): + n: surface_area = self.type + return n.to_dict() + elif isinstance(self.type, get_sketch_mode_plane): + n: get_sketch_mode_plane = self.type + return n.to_dict() + elif isinstance(self.type, curve_set_constraint): + n: curve_set_constraint = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "start_path": + n: start_path = start_path() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "move_path_pen": + n: move_path_pen = move_path_pen() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "extend_path": + n: extend_path = extend_path() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "extrude": + n: extrude = extrude() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "close_path": + n: close_path = close_path() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "camera_drag_start": + n: camera_drag_start = camera_drag_start() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "camera_drag_move": + n: camera_drag_move = camera_drag_move() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "camera_drag_end": + n: camera_drag_end = camera_drag_end() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "default_camera_look_at": + n: default_camera_look_at = default_camera_look_at() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "default_camera_zoom": + n: default_camera_zoom = default_camera_zoom() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "default_camera_enable_sketch_mode": + n: default_camera_enable_sketch_mode = default_camera_enable_sketch_mode() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "default_camera_disable_sketch_mode": + n: default_camera_disable_sketch_mode = default_camera_disable_sketch_mode() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "default_camera_focus_on": + n: default_camera_focus_on = default_camera_focus_on() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "export": + n: export = export() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_parent_id": + n: entity_get_parent_id = entity_get_parent_id() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_num_children": + n: entity_get_num_children = entity_get_num_children() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_child_uuid": + n: entity_get_child_uuid = entity_get_child_uuid() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_all_child_uuids": + n: entity_get_all_child_uuids = entity_get_all_child_uuids() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "edit_mode_enter": + n: edit_mode_enter = edit_mode_enter() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "edit_mode_exit": + n: edit_mode_exit = edit_mode_exit() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_with_point": + n: select_with_point = select_with_point() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_clear": + n: select_clear = select_clear() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_add": + n: select_add = select_add() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_remove": + n: select_remove = select_remove() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_replace": + n: select_replace = select_replace() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_get": + n: select_get = select_get() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "highlight_set_entity": + n: highlight_set_entity = highlight_set_entity() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "highlight_set_entities": + n: highlight_set_entities = highlight_set_entities() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "new_annotation": + n: new_annotation = new_annotation() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "update_annotation": + n: update_annotation = update_annotation() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "object_visible": + n: object_visible = object_visible() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "object_bring_to_front": + n: object_bring_to_front = object_bring_to_front() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "get_entity_type": + n: get_entity_type = get_entity_type() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid2d_add_hole": + n: solid2d_add_hole = solid2d_add_hole() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_all_edge_faces": + n: solid3d_get_all_edge_faces = solid3d_get_all_edge_faces() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_all_opposite_edges": + n: solid3d_get_all_opposite_edges = solid3d_get_all_opposite_edges() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_opposite_edge": + n: solid3d_get_opposite_edge = solid3d_get_opposite_edge() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_next_adjacent_edge": + n: solid3d_get_next_adjacent_edge = solid3d_get_next_adjacent_edge() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_prev_adjacent_edge": + n: solid3d_get_prev_adjacent_edge = solid3d_get_prev_adjacent_edge() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "send_object": + n: send_object = send_object() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_set_opacity": + n: entity_set_opacity = entity_set_opacity() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_fade": + n: entity_fade = entity_fade() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "make_plane": + n: make_plane = make_plane() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "plane_set_color": + n: plane_set_color = plane_set_color() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "set_tool": + n: set_tool = set_tool() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "mouse_move": + n: mouse_move = mouse_move() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "mouse_click": + n: mouse_click = mouse_click() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "sketch_mode_enable": + n: sketch_mode_enable = sketch_mode_enable() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "sketch_mode_disable": + n: sketch_mode_disable = sketch_mode_disable() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "curve_get_type": + n: curve_get_type = curve_get_type() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "curve_get_control_points": + n: curve_get_control_points = curve_get_control_points() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "take_snapshot": + n: take_snapshot = take_snapshot() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "make_axes_gizmo": + n: make_axes_gizmo = make_axes_gizmo() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "path_get_info": + n: path_get_info = path_get_info() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "path_get_curve_uuids_for_vertices": + n: path_get_curve_uuids_for_vertices = path_get_curve_uuids_for_vertices() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "path_get_vertex_uuids": + n: path_get_vertex_uuids = path_get_vertex_uuids() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "handle_mouse_drag_start": + n: handle_mouse_drag_start = handle_mouse_drag_start() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "handle_mouse_drag_move": + n: handle_mouse_drag_move = handle_mouse_drag_move() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "handle_mouse_drag_end": + n: handle_mouse_drag_end = handle_mouse_drag_end() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "remove_scene_objects": + n: remove_scene_objects = remove_scene_objects() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "plane_intersect_and_project": + n: plane_intersect_and_project = plane_intersect_and_project() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "curve_get_end_points": + n: curve_get_end_points = curve_get_end_points() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "reconfigure_stream": + n: reconfigure_stream = reconfigure_stream() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "import_files": + n: import_files = import_files() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "mass": + n: mass = mass() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "density": + n: density = density() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "volume": + n: volume = volume() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "center_of_mass": + n: center_of_mass = center_of_mass() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "surface_area": + n: surface_area = surface_area() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "get_sketch_mode_plane": + n: get_sketch_mode_plane = get_sketch_mode_plane() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "curve_set_constraint": + n: curve_set_constraint = curve_set_constraint() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/ok_modeling_cmd_response.py b/kittycad/models/ok_modeling_cmd_response.py index 7ed99f842..6d962e441 100644 --- a/kittycad/models/ok_modeling_cmd_response.py +++ b/kittycad/models/ok_modeling_cmd_response.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union import attr +from typing_extensions import Self from ..models.center_of_mass import CenterOfMass from ..models.curve_get_control_points import CurveGetControlPoints @@ -1974,36 +1975,334 @@ class get_sketch_mode_plane: return key in self.additional_properties -OkModelingCmdResponse = Union[ - empty, - export, - select_with_point, - highlight_set_entity, - entity_get_child_uuid, - entity_get_num_children, - entity_get_parent_id, - entity_get_all_child_uuids, - select_get, - get_entity_type, - solid3d_get_all_edge_faces, - solid3d_get_all_opposite_edges, - solid3d_get_opposite_edge, - solid3d_get_prev_adjacent_edge, - solid3d_get_next_adjacent_edge, - mouse_click, - curve_get_type, - curve_get_control_points, - take_snapshot, - path_get_info, - path_get_curve_uuids_for_vertices, - path_get_vertex_uuids, - plane_intersect_and_project, - curve_get_end_points, - import_files, - mass, - volume, - density, - surface_area, - center_of_mass, - get_sketch_mode_plane, -] +class OkModelingCmdResponse: + + """A successful response from a modeling command. This can be one of several types of responses, depending on the command.""" + + type: Union[ + empty, + export, + select_with_point, + highlight_set_entity, + entity_get_child_uuid, + entity_get_num_children, + entity_get_parent_id, + entity_get_all_child_uuids, + select_get, + get_entity_type, + solid3d_get_all_edge_faces, + solid3d_get_all_opposite_edges, + solid3d_get_opposite_edge, + solid3d_get_prev_adjacent_edge, + solid3d_get_next_adjacent_edge, + mouse_click, + curve_get_type, + curve_get_control_points, + take_snapshot, + path_get_info, + path_get_curve_uuids_for_vertices, + path_get_vertex_uuids, + plane_intersect_and_project, + curve_get_end_points, + import_files, + mass, + volume, + density, + surface_area, + center_of_mass, + get_sketch_mode_plane, + ] = None + + def __init__( + self, + type: Union[ + type(empty), + type(export), + type(select_with_point), + type(highlight_set_entity), + type(entity_get_child_uuid), + type(entity_get_num_children), + type(entity_get_parent_id), + type(entity_get_all_child_uuids), + type(select_get), + type(get_entity_type), + type(solid3d_get_all_edge_faces), + type(solid3d_get_all_opposite_edges), + type(solid3d_get_opposite_edge), + type(solid3d_get_prev_adjacent_edge), + type(solid3d_get_next_adjacent_edge), + type(mouse_click), + type(curve_get_type), + type(curve_get_control_points), + type(take_snapshot), + type(path_get_info), + type(path_get_curve_uuids_for_vertices), + type(path_get_vertex_uuids), + type(plane_intersect_and_project), + type(curve_get_end_points), + type(import_files), + type(mass), + type(volume), + type(density), + type(surface_area), + type(center_of_mass), + type(get_sketch_mode_plane), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, empty): + n: empty = self.type + return n.to_dict() + elif isinstance(self.type, export): + n: export = self.type + return n.to_dict() + elif isinstance(self.type, select_with_point): + n: select_with_point = self.type + return n.to_dict() + elif isinstance(self.type, highlight_set_entity): + n: highlight_set_entity = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_child_uuid): + n: entity_get_child_uuid = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_num_children): + n: entity_get_num_children = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_parent_id): + n: entity_get_parent_id = self.type + return n.to_dict() + elif isinstance(self.type, entity_get_all_child_uuids): + n: entity_get_all_child_uuids = self.type + return n.to_dict() + elif isinstance(self.type, select_get): + n: select_get = self.type + return n.to_dict() + elif isinstance(self.type, get_entity_type): + n: get_entity_type = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_all_edge_faces): + n: solid3d_get_all_edge_faces = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_all_opposite_edges): + n: solid3d_get_all_opposite_edges = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_opposite_edge): + n: solid3d_get_opposite_edge = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_prev_adjacent_edge): + n: solid3d_get_prev_adjacent_edge = self.type + return n.to_dict() + elif isinstance(self.type, solid3d_get_next_adjacent_edge): + n: solid3d_get_next_adjacent_edge = self.type + return n.to_dict() + elif isinstance(self.type, mouse_click): + n: mouse_click = self.type + return n.to_dict() + elif isinstance(self.type, curve_get_type): + n: curve_get_type = self.type + return n.to_dict() + elif isinstance(self.type, curve_get_control_points): + n: curve_get_control_points = self.type + return n.to_dict() + elif isinstance(self.type, take_snapshot): + n: take_snapshot = self.type + return n.to_dict() + elif isinstance(self.type, path_get_info): + n: path_get_info = self.type + return n.to_dict() + elif isinstance(self.type, path_get_curve_uuids_for_vertices): + n: path_get_curve_uuids_for_vertices = self.type + return n.to_dict() + elif isinstance(self.type, path_get_vertex_uuids): + n: path_get_vertex_uuids = self.type + return n.to_dict() + elif isinstance(self.type, plane_intersect_and_project): + n: plane_intersect_and_project = self.type + return n.to_dict() + elif isinstance(self.type, curve_get_end_points): + n: curve_get_end_points = self.type + return n.to_dict() + elif isinstance(self.type, import_files): + n: import_files = self.type + return n.to_dict() + elif isinstance(self.type, mass): + n: mass = self.type + return n.to_dict() + elif isinstance(self.type, volume): + n: volume = self.type + return n.to_dict() + elif isinstance(self.type, density): + n: density = self.type + return n.to_dict() + elif isinstance(self.type, surface_area): + n: surface_area = self.type + return n.to_dict() + elif isinstance(self.type, center_of_mass): + n: center_of_mass = self.type + return n.to_dict() + elif isinstance(self.type, get_sketch_mode_plane): + n: get_sketch_mode_plane = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "empty": + n: empty = empty() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "export": + n: export = export() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_with_point": + n: select_with_point = select_with_point() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "highlight_set_entity": + n: highlight_set_entity = highlight_set_entity() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_child_uuid": + n: entity_get_child_uuid = entity_get_child_uuid() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_num_children": + n: entity_get_num_children = entity_get_num_children() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_parent_id": + n: entity_get_parent_id = entity_get_parent_id() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "entity_get_all_child_uuids": + n: entity_get_all_child_uuids = entity_get_all_child_uuids() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "select_get": + n: select_get = select_get() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "get_entity_type": + n: get_entity_type = get_entity_type() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_all_edge_faces": + n: solid3d_get_all_edge_faces = solid3d_get_all_edge_faces() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_all_opposite_edges": + n: solid3d_get_all_opposite_edges = solid3d_get_all_opposite_edges() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_opposite_edge": + n: solid3d_get_opposite_edge = solid3d_get_opposite_edge() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_prev_adjacent_edge": + n: solid3d_get_prev_adjacent_edge = solid3d_get_prev_adjacent_edge() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "solid3d_get_next_adjacent_edge": + n: solid3d_get_next_adjacent_edge = solid3d_get_next_adjacent_edge() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "mouse_click": + n: mouse_click = mouse_click() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "curve_get_type": + n: curve_get_type = curve_get_type() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "curve_get_control_points": + n: curve_get_control_points = curve_get_control_points() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "take_snapshot": + n: take_snapshot = take_snapshot() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "path_get_info": + n: path_get_info = path_get_info() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "path_get_curve_uuids_for_vertices": + n: path_get_curve_uuids_for_vertices = path_get_curve_uuids_for_vertices() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "path_get_vertex_uuids": + n: path_get_vertex_uuids = path_get_vertex_uuids() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "plane_intersect_and_project": + n: plane_intersect_and_project = plane_intersect_and_project() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "curve_get_end_points": + n: curve_get_end_points = curve_get_end_points() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "import_files": + n: import_files = import_files() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "mass": + n: mass = mass() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "volume": + n: volume = volume() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "density": + n: density = density() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "surface_area": + n: surface_area = surface_area() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "center_of_mass": + n: center_of_mass = center_of_mass() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "get_sketch_mode_plane": + n: get_sketch_mode_plane = get_sketch_mode_plane() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/ok_web_socket_response_data.py b/kittycad/models/ok_web_socket_response_data.py index e013db01f..322b73c3a 100644 --- a/kittycad/models/ok_web_socket_response_data.py +++ b/kittycad/models/ok_web_socket_response_data.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union import attr +from typing_extensions import Self from ..types import UNSET, Unset @@ -340,6 +341,84 @@ class metrics_request: return key in self.additional_properties -OkWebSocketResponseData = Union[ - ice_server_info, trickle_ice, sdp_answer, modeling, export, metrics_request -] +class OkWebSocketResponseData: + + """The websocket messages this server sends.""" + + type: Union[ + ice_server_info, + trickle_ice, + sdp_answer, + modeling, + export, + metrics_request, + ] = None + + def __init__( + self, + type: Union[ + type(ice_server_info), + type(trickle_ice), + type(sdp_answer), + type(modeling), + type(export), + type(metrics_request), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, ice_server_info): + n: ice_server_info = self.type + return n.to_dict() + elif isinstance(self.type, trickle_ice): + n: trickle_ice = self.type + return n.to_dict() + elif isinstance(self.type, sdp_answer): + n: sdp_answer = self.type + return n.to_dict() + elif isinstance(self.type, modeling): + n: modeling = self.type + return n.to_dict() + elif isinstance(self.type, export): + n: export = self.type + return n.to_dict() + elif isinstance(self.type, metrics_request): + n: metrics_request = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "ice_server_info": + n: ice_server_info = ice_server_info() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "trickle_ice": + n: trickle_ice = trickle_ice() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "sdp_answer": + n: sdp_answer = sdp_answer() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "modeling": + n: modeling = modeling() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "export": + n: export = export() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "metrics_request": + n: metrics_request = metrics_request() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/output_format.py b/kittycad/models/output_format.py index 13fde5dd6..74825b22f 100644 --- a/kittycad/models/output_format.py +++ b/kittycad/models/output_format.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union import attr +from typing_extensions import Self from ..models.fbx_storage import FbxStorage from ..models.gltf_presentation import GltfPresentation @@ -494,4 +495,84 @@ class stl: return key in self.additional_properties -OutputFormat = Union[fbx, gltf, obj, ply, step, stl] +class OutputFormat: + + """Output format specifier.""" + + type: Union[ + fbx, + gltf, + obj, + ply, + step, + stl, + ] = None + + def __init__( + self, + type: Union[ + type(fbx), + type(gltf), + type(obj), + type(ply), + type(step), + type(stl), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, fbx): + n: fbx = self.type + return n.to_dict() + elif isinstance(self.type, gltf): + n: gltf = self.type + return n.to_dict() + elif isinstance(self.type, obj): + n: obj = self.type + return n.to_dict() + elif isinstance(self.type, ply): + n: ply = self.type + return n.to_dict() + elif isinstance(self.type, step): + n: step = self.type + return n.to_dict() + elif isinstance(self.type, stl): + n: stl = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "fbx": + n: fbx = fbx() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "gltf": + n: gltf = gltf() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "obj": + n: obj = obj() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "ply": + n: ply = ply() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "step": + n: step = step() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "stl": + n: stl = stl() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/path_segment.py b/kittycad/models/path_segment.py index 35c825b22..b73e38773 100644 --- a/kittycad/models/path_segment.py +++ b/kittycad/models/path_segment.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union import attr +from typing_extensions import Self from ..models.angle import Angle from ..models.point2d import Point2d @@ -436,4 +437,74 @@ class tangential_arc_to: return key in self.additional_properties -PathSegment = Union[line, arc, bezier, tangential_arc, tangential_arc_to] +class PathSegment: + + """A segment of a path. Paths are composed of many segments.""" + + type: Union[ + line, + arc, + bezier, + tangential_arc, + tangential_arc_to, + ] = None + + def __init__( + self, + type: Union[ + type(line), + type(arc), + type(bezier), + type(tangential_arc), + type(tangential_arc_to), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, line): + n: line = self.type + return n.to_dict() + elif isinstance(self.type, arc): + n: arc = self.type + return n.to_dict() + elif isinstance(self.type, bezier): + n: bezier = self.type + return n.to_dict() + elif isinstance(self.type, tangential_arc): + n: tangential_arc = self.type + return n.to_dict() + elif isinstance(self.type, tangential_arc_to): + n: tangential_arc_to = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "line": + n: line = line() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "arc": + n: arc = arc() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "bezier": + n: bezier = bezier() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "tangential_arc": + n: tangential_arc = tangential_arc() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "tangential_arc_to": + n: tangential_arc_to = tangential_arc_to() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/selection.py b/kittycad/models/selection.py index a7c09d3fe..e40a11634 100644 --- a/kittycad/models/selection.py +++ b/kittycad/models/selection.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union import attr +from typing_extensions import Self from ..types import UNSET, Unset @@ -282,6 +283,74 @@ class mesh_by_name: return key in self.additional_properties -Selection = Union[ - default_scene, scene_by_index, scene_by_name, mesh_by_index, mesh_by_name -] +class Selection: + + """Data item selection.""" + + type: Union[ + default_scene, + scene_by_index, + scene_by_name, + mesh_by_index, + mesh_by_name, + ] = None + + def __init__( + self, + type: Union[ + type(default_scene), + type(scene_by_index), + type(scene_by_name), + type(mesh_by_index), + type(mesh_by_name), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, default_scene): + n: default_scene = self.type + return n.to_dict() + elif isinstance(self.type, scene_by_index): + n: scene_by_index = self.type + return n.to_dict() + elif isinstance(self.type, scene_by_name): + n: scene_by_name = self.type + return n.to_dict() + elif isinstance(self.type, mesh_by_index): + n: mesh_by_index = self.type + return n.to_dict() + elif isinstance(self.type, mesh_by_name): + n: mesh_by_name = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "default_scene": + n: default_scene = default_scene() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "scene_by_index": + n: scene_by_index = scene_by_index() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "scene_by_name": + n: scene_by_name = scene_by_name() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "mesh_by_index": + n: mesh_by_index = mesh_by_index() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "mesh_by_name": + n: mesh_by_name = mesh_by_name() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/web_socket_request.py b/kittycad/models/web_socket_request.py index ac7545f65..773739f04 100644 --- a/kittycad/models/web_socket_request.py +++ b/kittycad/models/web_socket_request.py @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union, cast import attr +from typing_extensions import Self from ..models.client_metrics import ClientMetrics from ..models.modeling_cmd import ModelingCmd @@ -389,11 +390,84 @@ class metrics_response: return key in self.additional_properties -WebSocketRequest = Union[ - trickle_ice, - sdp_offer, - modeling_cmd_req, - modeling_cmd_batch_req, - ping, - metrics_response, -] +class WebSocketRequest: + + """The websocket messages the server receives.""" + + type: Union[ + trickle_ice, + sdp_offer, + modeling_cmd_req, + modeling_cmd_batch_req, + ping, + metrics_response, + ] = None + + def __init__( + self, + type: Union[ + type(trickle_ice), + type(sdp_offer), + type(modeling_cmd_req), + type(modeling_cmd_batch_req), + type(ping), + type(metrics_response), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, trickle_ice): + n: trickle_ice = self.type + return n.to_dict() + elif isinstance(self.type, sdp_offer): + n: sdp_offer = self.type + return n.to_dict() + elif isinstance(self.type, modeling_cmd_req): + n: modeling_cmd_req = self.type + return n.to_dict() + elif isinstance(self.type, modeling_cmd_batch_req): + n: modeling_cmd_batch_req = self.type + return n.to_dict() + elif isinstance(self.type, ping): + n: ping = self.type + return n.to_dict() + elif isinstance(self.type, metrics_response): + n: metrics_response = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "trickle_ice": + n: trickle_ice = trickle_ice() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "sdp_offer": + n: sdp_offer = sdp_offer() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "modeling_cmd_req": + n: modeling_cmd_req = modeling_cmd_req() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "modeling_cmd_batch_req": + n: modeling_cmd_batch_req = modeling_cmd_batch_req() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "ping": + n: ping = ping() + n.from_dict(d) + self.type = n + return self + elif d.get("type") == "metrics_response": + n: metrics_response = metrics_response() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type") diff --git a/kittycad/models/web_socket_response.py b/kittycad/models/web_socket_response.py index 7c1faa8f1..59ac9ce99 100644 --- a/kittycad/models/web_socket_response.py +++ b/kittycad/models/web_socket_response.py @@ -1,6 +1,49 @@ -from typing import Union +from typing import Any, Dict, Union + +from typing_extensions import Self from .failure_web_socket_response import FailureWebSocketResponse from .success_web_socket_response import SuccessWebSocketResponse -WebSocketResponse = Union[SuccessWebSocketResponse, FailureWebSocketResponse] + +class WebSocketResponse: + + """Websocket responses can either be successful or unsuccessful. Slightly different schemas in either case.""" + + type: Union[ + SuccessWebSocketResponse, + FailureWebSocketResponse, + ] = None + + def __init__( + self, + type: Union[ + type(SuccessWebSocketResponse), + type(FailureWebSocketResponse), + ], + ): + self.type = type + + def to_dict(self) -> Dict[str, Any]: + if isinstance(self.type, SuccessWebSocketResponse): + n: SuccessWebSocketResponse = self.type + return n.to_dict() + elif isinstance(self.type, FailureWebSocketResponse): + n: FailureWebSocketResponse = self.type + return n.to_dict() + + raise Exception("Unknown type") + + def from_dict(self, d) -> Self: + if d.get("type") == "SuccessWebSocketResponse": + n: SuccessWebSocketResponse = SuccessWebSocketResponse() + n.from_dict(d) + self.type = n + return Self + elif d.get("type") == "FailureWebSocketResponse": + n: FailureWebSocketResponse = FailureWebSocketResponse() + n.from_dict(d) + self.type = n + return self + + raise Exception("Unknown type")