Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-11-29 00:39:14 -08:00
parent bc3d698539
commit faaeb3a472
74 changed files with 496 additions and 1985 deletions

View File

@ -183,15 +183,15 @@ class WebSocket:
def send(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}): def send(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}):
"""Send data to the websocket.""" """Send data to the websocket."""
self.ws.send(json.dumps(data.model_dump())) self.ws.send(json.dumps(data.model_dump(mode="json")))
def send_binary(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}): def send_binary(self, data:{% for arg in args %}{%if arg.name == "body" %}{{arg.type}}{% endif %}{% endfor %}):
"""Send data as bson to the websocket.""" """Send data as bson to the websocket."""
self.ws.send(bson.encode(data.model_dump())) self.ws.send(bson.encode(data.model_dump(mode="json"))) # type: ignore
def recv(self) -> {{response_type}}: def recv(self) -> {{response_type}}:
"""Receive data from the websocket.""" """Receive data from the websocket."""
message = self.ws.recv() message = self.ws.recv(timeout=60)
return {{response_type}}(**json.loads(message)) return {{response_type}}(**json.loads(message))
def close(self): def close(self):

View File

@ -2056,13 +2056,13 @@ def getTypeName(schema: dict) -> str:
): ):
return "datetime.datetime" return "datetime.datetime"
elif schema["format"] == "byte": elif schema["format"] == "byte":
return "Base64Bytes" return "Base64Data"
elif schema["format"] == "uuid": elif schema["format"] == "uuid":
return "UUID" return "UUID"
elif schema["format"] == "url": elif schema["format"] == "url":
return "AnyUrl" return "AnyUrl"
elif schema["format"] == "phone": elif schema["format"] == "phone":
return "PhoneNumber" return "str"
return "str" return "str"
elif schema["type"] == "number": elif schema["type"] == "number":
return "float" return "float"

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel, Base64Bytes, AnyUrl from pydantic import BaseModel, Base64Bytes, AnyUrl
from pydantic_extra_types.phone_numbers import PhoneNumber from pydantic_extra_types.phone_numbers import PhoneNumber
from .base64data import Base64Data
{% for import in imports %} {% for import in imports %}
{{ import }} {{ import }}

View File

@ -5,11 +5,14 @@ set -o pipefail
# Fix for ci. # Fix for ci.
git config --global --add safe.directory /home/user/src git config --global --add safe.directory /home/user/src
git add kittycad/models/base64data.py
git add kittycad/models/empty.py git add kittycad/models/empty.py
# Cleanup old stuff. # Cleanup old stuff.
rm -rf kittycad/models rm -rf kittycad/models
rm -rf kittycad/api rm -rf kittycad/api
git checkout kittycad/models/base64data.py
git checkout kittycad/models/empty.py git checkout kittycad/models/empty.py
# Generate new. # Generate new.

View File

@ -1,61 +1,10 @@
from typing import Dict, Any, Union, Type, TypeVar from typing import Dict, Any, Union, Type, TypeVar
from typing_extensions import Self from pydantic import RootModel
import attr
from ..types import UNSET, Unset
from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
GY = TypeVar("GY", bound="{{name}}") {{name}} = RootModel[Union[
@attr.s(auto_attribs=True)
class {{name}}:
{% if description %}
"""{{description}}"""
{% endif %}
type: Union[
{% for type in types %} {% for type in types %}
{{type.name}}, {{type.name}},
{% endfor %} {% endfor %}
] ]]
def __init__(self,
type: Union[
{% for type in types %}
{{type.name}},
{% endfor %}
]):
self.type = type
def model_dump(self) -> Dict[str, Any]:
{% for type in types %}{% if loop.first %}
if isinstance(self.type, {{type.name}}):
{{type.var0}} : {{type.name}} = self.type
return {{type.var0}}.model_dump()
{% else %}elif isinstance(self.type, {{type.name}}):
{{type.var0}} : {{type.name}} = self.type
return {{type.var0}}.model_dump()
{% endif %}{% endfor %}
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
{% for type in types %}{% if loop.first %}
if d.get("{{type.check}}") == {{type.value}}:
{{type.var1}} : {{type.name}} = {{type.name}}(**d)
return cls(type={{type.var1}})
{% else %}elif d.get("{{type.check}}") == {{type.value}}:
{{type.var1}} : {{type.name}} = {{type.name}}(**d)
return cls(type={{type.var1}})
{% endif %}{% endfor %}
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(cls, handler(Union[
{% for type in types %}
{{type.name}},
{% endfor %}
]))

View File

@ -1,74 +1,82 @@
[ [
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1payment/post/x-python", "path": "/info/x-python",
"value": { "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=\"<string>\",\n phone=\"<string>\",\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", "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.",
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.create_payment_information_for_user.html" "install": "pip install kittycad"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1payment/get/x-python", "path": "/paths/~1apps~1github~1consent/get/x-python",
"value": { "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", "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.payments.get_payment_information_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.apps.apps_github_consent.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1payment/delete/x-python", "path": "/paths/~1ws~1modeling~1commands/get/x-python",
"value": { "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", "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, WebSocketRequest, WebSocketResponse\nfrom kittycad.models.rtc_sdp_type import RtcSdpType\nfrom kittycad.models.rtc_session_description import RtcSessionDescription\nfrom kittycad.models.web_socket_request import sdp_offer\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 with modeling_commands_ws.WebSocket(\n client=client,\n fps=10,\n unlocked_framerate=False,\n video_res_height=10,\n video_res_width=10,\n webrtc=False,\n ) as websocket:\n # Send a message.\n websocket.send(\n WebSocketRequest(\n sdp_offer(\n offer=RtcSessionDescription(\n sdp=\"<string>\",\n type=RtcSdpType.UNSPECIFIED,\n ),\n )\n )\n )\n\n # Get a message.\n message = websocket.recv()\n print(message)\n",
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.delete_payment_information_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.modeling.modeling_commands_ws.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1payment/put/x-python", "path": "/paths/~1unit~1conversion~1angle~1{input_unit}~1{output_unit}/get/x-python",
"value": { "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=\"<string>\",\n phone=\"<string>\",\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", "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.payments.update_payment_information_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_angle_unit_conversion.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1api-tokens~1{token}/get/x-python", "path": "/paths/~1ai-prompts/get/x-python",
"value": { "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=\"<uuid>\",\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", "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import list_ai_prompts\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AiPromptResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_ai_prompts():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[AiPromptResultsPage, Error]] = list_ai_prompts.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: AiPromptResultsPage = result\n print(body)\n",
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.get_api_token_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.list_ai_prompts.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1api-tokens~1{token}/delete/x-python", "path": "/paths/~1ai-prompts~1{id}/get/x-python",
"value": { "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=\"<uuid>\",\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", "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=\"<uuid>\",\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.api_tokens.delete_api_token_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.get_ai_prompt.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1session~1{token}/get/x-python", "path": "/paths/~1ai~1text-to-cad~1{output_format}/post/x-python",
"value": { "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=\"<uuid>\",\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", "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=\"<string>\",\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.users.get_session_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.create_text_to_cad.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1ping/get/x-python", "path": "/paths/~1internal~1discord~1api-token~1{discord_id}/get/x-python",
"value": { "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", "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import internal_get_api_token_for_discord_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiToken, Error\nfrom kittycad.types import Response\n\n\ndef example_internal_get_api_token_for_discord_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiToken, Error]\n ] = internal_get_api_token_for_discord_user.sync(\n client=client,\n discord_id=\"<string>\",\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.meta.ping.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.internal_get_api_token_for_discord_user.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1.well-known~1ai-plugin.json/get/x-python", "path": "/paths/~1unit~1conversion~1mass~1{input_unit}~1{output_unit}/get/x-python",
"value": { "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", "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.meta.get_ai_plugin_manifest.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_mass_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=\"<string>\",\n discord=\"<string>\",\n first_name=\"<string>\",\n github=\"<string>\",\n last_name=\"<string>\",\n phone=\"<string>\",\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"
} }
}, },
{ {
@ -89,66 +97,10 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user/put/x-python", "path": "/paths/~1user~1api-tokens/post/x-python",
"value": { "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=\"<string>\",\n discord=\"<string>\",\n first_name=\"<string>\",\n github=\"<string>\",\n last_name=\"<string>\",\n phone=\"<string>\",\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", "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.users.update_user_self.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_tokens.create_api_token_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=\"<string>\",\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~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/~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/~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=\"<string>\",\n token=\"<string>\",\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/~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/~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~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"
} }
}, },
{ {
@ -161,10 +113,74 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1api-tokens/post/x-python", "path": "/paths/~1user~1api-tokens~1{token}/get/x-python",
"value": { "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", "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=\"<uuid>\",\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" "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=\"<uuid>\",\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~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/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=\"<string>\",\n phone=\"<string>\",\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/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/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=\"<string>\",\n phone=\"<string>\",\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/~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/~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~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"
} }
}, },
{ {
@ -175,14 +191,6 @@
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_mass.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_mass.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", "op": "add",
"path": "/paths/~1user~1api-calls~1{id}/get/x-python", "path": "/paths/~1user~1api-calls~1{id}/get/x-python",
@ -193,58 +201,18 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1api-calls/get/x-python", "path": "/paths/~1user~1payment~1intent/post/x-python",
"value": { "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", "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.api_calls.list_api_calls.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.create_payment_intent_for_user.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1file~1execute~1{lang}/post/x-python", "path": "/paths/~1user~1api-calls/get/x-python",
"value": { "value": {
"example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.executor import create_file_execution\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import CodeOutput, Error\nfrom kittycad.models.code_language import CodeLanguage\nfrom kittycad.types import Response\n\n\ndef example_create_file_execution():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[CodeOutput, Error]] = create_file_execution.sync(\n client=client,\n lang=CodeLanguage.GO,\n output=None, # Optional[str]\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: CodeOutput = result\n print(body)\n", "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.executor.create_file_execution.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.user_list_api_calls.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, WebSocketRequest, WebSocketResponse\nfrom kittycad.models.rtc_sdp_type import RtcSdpType\nfrom kittycad.models.rtc_session_description import RtcSessionDescription\nfrom kittycad.models.web_socket_request import sdp_offer\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 with modeling_commands_ws.WebSocket(\n client=client,\n fps=10,\n unlocked_framerate=False,\n video_res_height=10,\n video_res_width=10,\n webrtc=False,\n ) as websocket:\n # Send a message.\n websocket.send(\n WebSocketRequest(\n sdp_offer(\n offer=RtcSessionDescription(\n sdp=\"<string>\",\n type=RtcSdpType.UNSPECIFIED,\n ),\n )\n )\n )\n\n # Get a message.\n message = websocket.recv()\n print(message)\n",
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.modeling.modeling_commands_ws.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=\"<string>\",\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/~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/~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=\"<string>\",\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/~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"
} }
}, },
{ {
@ -257,34 +225,26 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1unit~1conversion~1energy~1{input_unit}~1{output_unit}/get/x-python", "path": "/paths/~1_meta~1info/get/x-python",
"value": { "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", "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.unit.get_energy_unit_conversion.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.get_metadata.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1apps~1github~1webhook/post/x-python", "path": "/paths/~1file~1density/post/x-python",
"value": { "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", "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.apps.apps_github_webhook.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_density.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1payment~1methods~1{id}/delete/x-python", "path": "/paths/~1auth~1email~1callback/get/x-python",
"value": { "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=\"<string>\",\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", "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=\"<string>\",\n token=\"<string>\",\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.payments.delete_payment_method_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.auth_email_callback.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"
} }
}, },
{ {
@ -297,34 +257,34 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1_meta~1info/get/x-python", "path": "/paths/~1unit~1conversion~1length~1{input_unit}~1{output_unit}/get/x-python",
"value": { "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", "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.meta.get_metadata.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_length_unit_conversion.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1ai-prompts/get/x-python", "path": "/paths/~1apps~1github~1webhook/post/x-python",
"value": { "value": {
"example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.ai import list_ai_prompts\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import AiPromptResultsPage, Error\nfrom kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.types import Response\n\n\ndef example_list_ai_prompts():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[AiPromptResultsPage, Error]] = list_ai_prompts.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: AiPromptResultsPage = result\n print(body)\n", "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.ai.list_ai_prompts.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.apps.apps_github_webhook.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1onboarding/get/x-python", "path": "/paths/~1file~1execute~1{lang}/post/x-python",
"value": { "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", "example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.executor import create_file_execution\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import CodeOutput, Error\nfrom kittycad.models.code_language import CodeLanguage\nfrom kittycad.types import Response\n\n\ndef example_create_file_execution():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Union[CodeOutput, Error]] = create_file_execution.sync(\n client=client,\n lang=CodeLanguage.GO,\n output=None, # Optional[str]\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: CodeOutput = result\n print(body)\n",
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_onboarding_self.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.executor.create_file_execution.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1internal~1discord~1api-token~1{discord_id}/get/x-python", "path": "/paths/~1async~1operations~1{id}/get/x-python",
"value": { "value": {
"example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.meta import internal_get_api_token_for_discord_user\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import ApiToken, Error\nfrom kittycad.types import Response\n\n\ndef example_internal_get_api_token_for_discord_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiToken, Error]\n ] = internal_get_api_token_for_discord_user.sync(\n client=client,\n discord_id=\"<string>\",\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", "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=\"<string>\",\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.meta.internal_get_api_token_for_discord_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.get_async_operation.html"
} }
}, },
{ {
@ -335,14 +295,6 @@
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.list_text_to_cad_models_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.ai.list_text_to_cad_models_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", "op": "add",
"path": "/paths/~1users/get/x-python", "path": "/paths/~1users/get/x-python",
@ -353,66 +305,66 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1text-to-cad~1{id}/get/x-python", "path": "/paths/~1file~1conversion~1{src_format}~1{output_format}/post/x-python",
"value": { "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=\"<uuid>\",\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", "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.ai.get_text_to_cad_model_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_conversion.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1user~1text-to-cad~1{id}/post/x-python", "path": "/paths/~1user~1payment~1methods~1{id}/delete/x-python",
"value": { "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=\"<uuid>\",\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", "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=\"<string>\",\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" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.delete_payment_method_for_user.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1api-calls~1{id}/get/x-python", "path": "/paths/~1unit~1conversion~1volume~1{input_unit}~1{output_unit}/get/x-python",
"value": { "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=\"<string>\",\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", "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.api_calls.get_api_call.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_volume_unit_conversion.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1apps~1github~1callback/get/x-python", "path": "/paths/~1user~1payment~1balance/get/x-python",
"value": { "value": {
"example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.apps import apps_github_callback\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_apps_github_callback():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = apps_github_callback.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", "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.apps.apps_github_callback.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.get_payment_balance_for_user.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1unit~1conversion~1length~1{input_unit}~1{output_unit}/get/x-python", "path": "/paths/~1async~1operations/get/x-python",
"value": { "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", "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.unit.get_length_unit_conversion.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.api_calls.list_async_operations.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1unit~1conversion~1power~1{input_unit}~1{output_unit}/get/x-python", "path": "/paths/~1unit~1conversion~1current~1{input_unit}~1{output_unit}/get/x-python",
"value": { "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", "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_power_unit_conversion.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_current_unit_conversion.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1users~1{id}~1api-calls/get/x-python", "path": "/paths/~1auth~1email/post/x-python",
"value": { "value": {
"example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.api_calls import list_api_calls_for_user\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_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiCallWithPriceResultsPage, Error]\n ] = list_api_calls_for_user.sync(\n client=client,\n id=\"<string>\",\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", "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=\"<string>\",\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.api_calls.list_api_calls_for_user.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.hidden.auth_email.html"
} }
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1users-extended~1{id}/get/x-python", "path": "/paths/~1ping/get/x-python",
"value": { "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=\"<string>\",\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", "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.users.get_user_extended.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.meta.ping.html"
} }
}, },
{ {
@ -425,10 +377,114 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/paths/~1unit~1conversion~1volume~1{input_unit}~1{output_unit}/get/x-python", "path": "/paths/~1user~1extended/get/x-python",
"value": { "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", "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.unit.get_volume_unit_conversion.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.get_user_self_extended.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/~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=\"<uuid>\",\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/~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=\"<uuid>\",\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/~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 with create_executor_term.sync(\n client=client,\n ) as websocket:\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/~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=\"<string>\",\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/~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=\"<string>\",\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/~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/~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=\"<string>\",\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~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/~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/~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=\"<uuid>\",\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~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/~1users~1{id}~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_for_user\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_for_user():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[\n Union[ApiCallWithPriceResultsPage, Error]\n ] = list_api_calls_for_user.sync(\n client=client,\n id=\"<string>\",\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_for_user.html"
} }
}, },
{ {
@ -447,46 +503,6 @@
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.payments.list_invoices_for_user.html" "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/~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~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/~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 with create_executor_term.sync(\n client=client,\n ) as websocket:\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/~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=\"<uuid>\",\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", "op": "add",
"path": "/paths/~1file~1surface-area/post/x-python", "path": "/paths/~1file~1surface-area/post/x-python",
@ -495,22 +511,6 @@
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_surface_area.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.file.create_file_surface_area.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/~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", "op": "add",
"path": "/paths/~1users-extended/get/x-python", "path": "/paths/~1users-extended/get/x-python",
@ -519,54 +519,6 @@
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.list_users_extended.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.users.list_users_extended.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=\"<string>\",\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/~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/~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~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/~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~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", "op": "add",
"path": "/paths/~1unit~1conversion~1frequency~1{input_unit}~1{output_unit}/get/x-python", "path": "/paths/~1unit~1conversion~1frequency~1{input_unit}~1{output_unit}/get/x-python",
@ -575,6 +527,38 @@
"libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_frequency_unit_conversion.html" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_frequency_unit_conversion.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"
}
},
{
"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/~1apps~1github~1callback/get/x-python",
"value": {
"example": "from typing import Any, List, Optional, Tuple, Union\n\nfrom kittycad.api.apps import apps_github_callback\nfrom kittycad.client import ClientFromEnv\nfrom kittycad.models import Error\nfrom kittycad.types import Response\n\n\ndef example_apps_github_callback():\n # Create our client.\n client = ClientFromEnv()\n\n result: Optional[Error] = apps_github_callback.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.apps.apps_github_callback.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", "op": "add",
"path": "/paths/~1openai~1openapi.json/get/x-python", "path": "/paths/~1openai~1openapi.json/get/x-python",
@ -585,10 +569,26 @@
}, },
{ {
"op": "add", "op": "add",
"path": "/info/x-python", "path": "/paths/~1unit~1conversion~1area~1{input_unit}~1{output_unit}/get/x-python",
"value": { "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.", "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",
"install": "pip install kittycad" "libDocsLink": "https://python.api.docs.kittycad.io/_autosummary/kittycad.api.unit.get_area_unit_conversion.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/~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"
} }
} }
] ]

View File

@ -157,15 +157,15 @@ class WebSocket:
def send(self, data: WebSocketRequest): def send(self, data: WebSocketRequest):
"""Send data to the websocket.""" """Send data to the websocket."""
self.ws.send(json.dumps(data.model_dump())) self.ws.send(json.dumps(data.model_dump(mode="json")))
def send_binary(self, data: WebSocketRequest): def send_binary(self, data: WebSocketRequest):
"""Send data as bson to the websocket.""" """Send data as bson to the websocket."""
self.ws.send(bson.encode(data.model_dump())) self.ws.send(bson.encode(data.model_dump(mode="json"))) # type: ignore
def recv(self) -> WebSocketResponse: def recv(self) -> WebSocketResponse:
"""Receive data from the websocket.""" """Receive data from the websocket."""
message = self.ws.recv() message = self.ws.recv(timeout=60)
return WebSocketResponse(**json.loads(message)) return WebSocketResponse(**json.loads(message))
def close(self): def close(self):

View File

@ -151,7 +151,7 @@ def test_file_convert_stl():
# Make sure the bytes are not empty. # Make sure the bytes are not empty.
for key, value in fc.outputs.items(): for key, value in fc.outputs.items():
assert len(value) > 0 assert len(value.get_decoded()) > 0
@pytest.mark.asyncio @pytest.mark.asyncio
@ -190,7 +190,7 @@ async def test_file_convert_stl_async():
# Make sure the bytes are not empty. # Make sure the bytes are not empty.
for key, value in fc.outputs.items(): for key, value in fc.outputs.items():
assert len(value) > 0 assert len(value.get_decoded()) > 0
@pytest.mark.asyncio @pytest.mark.asyncio
@ -229,7 +229,7 @@ async def test_file_convert_obj_async():
# Make sure the bytes are not empty. # Make sure the bytes are not empty.
for key, value in fc.outputs.items(): for key, value in fc.outputs.items():
assert len(value) > 0 assert len(value.get_decoded()) > 0
def test_file_mass(): def test_file_mass():

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class ApiCallQueryGroup(BaseModel): class ApiCallQueryGroup(BaseModel):
"""A response for a query on the API call table that is grouped by something.""" """A response for a query on the API call table that is grouped by something."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class AppClientInfo(BaseModel): class AppClientInfo(BaseModel):
"""Information about a third party app client.""" """Information about a third party app client."""

View File

@ -1,9 +1,7 @@
import datetime import datetime
from typing import Any, Dict, Optional, Type, TypeVar, Union from typing import Dict, Optional, Union
import attr from pydantic import BaseModel, RootModel
from pydantic import Base64Bytes, BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.ai_feedback import AiFeedback from ..models.ai_feedback import AiFeedback
from ..models.api_call_status import ApiCallStatus from ..models.api_call_status import ApiCallStatus
@ -18,6 +16,7 @@ from ..models.unit_length import UnitLength
from ..models.unit_mass import UnitMass from ..models.unit_mass import UnitMass
from ..models.unit_volume import UnitVolume from ..models.unit_volume import UnitVolume
from ..models.uuid import Uuid from ..models.uuid import Uuid
from .base64data import Base64Data
class file_conversion(BaseModel): class file_conversion(BaseModel):
@ -35,7 +34,7 @@ class file_conversion(BaseModel):
output_format_options: Optional[OutputFormat] = None output_format_options: Optional[OutputFormat] = None
outputs: Optional[Dict[str, Base64Bytes]] = None outputs: Optional[Dict[str, Base64Data]] = None
src_format: FileImportFormat src_format: FileImportFormat
@ -217,7 +216,7 @@ class text_to_cad(BaseModel):
output_format: FileExportFormat output_format: FileExportFormat
outputs: Optional[Dict[str, Base64Bytes]] = None outputs: Optional[Dict[str, Base64Data]] = None
prompt: str prompt: str
@ -232,15 +231,8 @@ class text_to_cad(BaseModel):
user_id: Uuid user_id: Uuid
GY = TypeVar("GY", bound="AsyncApiCallOutput") AsyncApiCallOutput = RootModel[
Union[
@attr.s(auto_attribs=True)
class AsyncApiCallOutput:
"""The output from the async API call."""
type: Union[
file_conversion, file_conversion,
file_center_of_mass, file_center_of_mass,
file_mass, file_mass,
@ -249,87 +241,4 @@ class AsyncApiCallOutput:
file_surface_area, file_surface_area,
text_to_cad, text_to_cad,
] ]
]
def __init__(
self,
type: Union[
file_conversion,
file_center_of_mass,
file_mass,
file_volume,
file_density,
file_surface_area,
text_to_cad,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, file_conversion):
SB: file_conversion = self.type
return SB.model_dump()
elif isinstance(self.type, file_center_of_mass):
SA: file_center_of_mass = self.type
return SA.model_dump()
elif isinstance(self.type, file_mass):
PI: file_mass = self.type
return PI.model_dump()
elif isinstance(self.type, file_volume):
FB: file_volume = self.type
return FB.model_dump()
elif isinstance(self.type, file_density):
KC: file_density = self.type
return KC.model_dump()
elif isinstance(self.type, file_surface_area):
LB: file_surface_area = self.type
return LB.model_dump()
elif isinstance(self.type, text_to_cad):
TL: text_to_cad = self.type
return TL.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "file_conversion":
NP: file_conversion = file_conversion(**d)
return cls(type=NP)
elif d.get("type") == "file_center_of_mass":
GO: file_center_of_mass = file_center_of_mass(**d)
return cls(type=GO)
elif d.get("type") == "file_mass":
UZ: file_mass = file_mass(**d)
return cls(type=UZ)
elif d.get("type") == "file_volume":
QP: file_volume = file_volume(**d)
return cls(type=QP)
elif d.get("type") == "file_density":
HX: file_density = file_density(**d)
return cls(type=HX)
elif d.get("type") == "file_surface_area":
NE: file_surface_area = file_surface_area(**d)
return cls(type=NE)
elif d.get("type") == "text_to_cad":
MN: text_to_cad = text_to_cad(**d)
return cls(type=MN)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
file_conversion,
file_center_of_mass,
file_mass,
file_volume,
file_density,
file_surface_area,
text_to_cad,
]
),
)

View File

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

View File

@ -1,7 +1,6 @@
from typing import Optional from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
from pydantic_extra_types.phone_number import PhoneNumber
from ..models.new_address import NewAddress from ..models.new_address import NewAddress
@ -13,4 +12,4 @@ class BillingInfo(BaseModel):
name: Optional[str] = None name: Optional[str] = None
phone: Optional[PhoneNumber] = None phone: Optional[str] = None

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class CacheMetadata(BaseModel): class CacheMetadata(BaseModel):
"""Metadata about our cache. """Metadata about our cache.

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class ClientMetrics(BaseModel): class ClientMetrics(BaseModel):
"""ClientMetrics contains information regarding the state of the peer.""" """ClientMetrics contains information regarding the state of the peer."""

View File

@ -3,6 +3,7 @@ from typing import List, Optional
from pydantic import BaseModel from pydantic import BaseModel
class Cluster(BaseModel): class Cluster(BaseModel):
"""Cluster information.""" """Cluster information."""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class Color(BaseModel): class Color(BaseModel):
"""An RGBA color""" """An RGBA color"""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class Coupon(BaseModel): class Coupon(BaseModel):
"""The resource representing a Coupon.""" """The resource representing a Coupon."""

View File

@ -2,7 +2,6 @@ import datetime
from typing import Dict, Optional from typing import Dict, Optional
from pydantic import BaseModel from pydantic import BaseModel
from pydantic_extra_types.phone_number import PhoneNumber
from ..models.currency import Currency from ..models.currency import Currency
from ..models.new_address import NewAddress from ..models.new_address import NewAddress
@ -29,4 +28,4 @@ class Customer(BaseModel):
name: Optional[str] = None name: Optional[str] = None
phone: Optional[PhoneNumber] = None phone: Optional[str] = None

View File

@ -3,6 +3,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class DeviceAuthRequestForm(BaseModel): class DeviceAuthRequestForm(BaseModel):
"""The request parameters for the OAuth 2.0 Device Authorization Grant flow.""" """The request parameters for the OAuth 2.0 Device Authorization Grant flow."""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class DeviceAuthVerifyParams(BaseModel): class DeviceAuthVerifyParams(BaseModel):
"""The request parameters to verify the `user_code` for the OAuth 2.0 Device Authorization Grant.""" """The request parameters to verify the `user_code` for the OAuth 2.0 Device Authorization Grant."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class EmailAuthenticationForm(BaseModel): class EmailAuthenticationForm(BaseModel):
"""The body of the form for email authentication.""" """The body of the form for email authentication."""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class EntityGetAllChildUuids(BaseModel): class EntityGetAllChildUuids(BaseModel):
"""The response from the `EntityGetAllChildUuids` command.""" """The response from the `EntityGetAllChildUuids` command."""

View File

@ -3,6 +3,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class EntityGetChildUuid(BaseModel): class EntityGetChildUuid(BaseModel):
"""The response from the `EntityGetChildUuid` command.""" """The response from the `EntityGetChildUuid` command."""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class EntityGetNumChildren(BaseModel): class EntityGetNumChildren(BaseModel):
"""The response from the `EntityGetNumChildren` command.""" """The response from the `EntityGetNumChildren` command."""

View File

@ -3,6 +3,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class EntityGetParentId(BaseModel): class EntityGetParentId(BaseModel):
"""The response from the `EntityGetParentId` command.""" """The response from the `EntityGetParentId` command."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class Error(BaseModel): class Error(BaseModel):
"""Error information from a response.""" """Error information from a response."""

View File

@ -1,10 +1,12 @@
from pydantic import Base64Bytes, BaseModel from pydantic import BaseModel
from .base64data import Base64Data
class ExportFile(BaseModel): class ExportFile(BaseModel):
"""A file to be exported to the client.""" """A file to be exported to the client."""
contents: Base64Bytes contents: Base64Data
name: str name: str

View File

@ -2,7 +2,6 @@ import datetime
from typing import Optional from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
from pydantic_extra_types.phone_number import PhoneNumber
from ..models.uuid import Uuid from ..models.uuid import Uuid
@ -39,7 +38,7 @@ class ExtendedUser(BaseModel):
name: Optional[str] = None name: Optional[str] = None
phone: Optional[PhoneNumber] = None phone: Optional[str] = None
stripe_id: Optional[str] = None stripe_id: Optional[str] = None

View File

@ -1,7 +1,7 @@
import datetime import datetime
from typing import Dict, Optional from typing import Dict, Optional
from pydantic import Base64Bytes, BaseModel from pydantic import BaseModel
from ..models.api_call_status import ApiCallStatus from ..models.api_call_status import ApiCallStatus
from ..models.file_export_format import FileExportFormat from ..models.file_export_format import FileExportFormat
@ -9,6 +9,7 @@ from ..models.file_import_format import FileImportFormat
from ..models.input_format import InputFormat from ..models.input_format import InputFormat
from ..models.output_format import OutputFormat from ..models.output_format import OutputFormat
from ..models.uuid import Uuid from ..models.uuid import Uuid
from .base64data import Base64Data
class FileConversion(BaseModel): class FileConversion(BaseModel):
@ -26,7 +27,7 @@ class FileConversion(BaseModel):
output_format_options: Optional[OutputFormat] = None output_format_options: Optional[OutputFormat] = None
outputs: Optional[Dict[str, Base64Bytes]] = None outputs: Optional[Dict[str, Base64Data]] = None
src_format: FileImportFormat src_format: FileImportFormat

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class FileSystemMetadata(BaseModel): class FileSystemMetadata(BaseModel):
"""Metadata about our file system. """Metadata about our file system.

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class Gateway(BaseModel): class Gateway(BaseModel):
"""Gateway information.""" """Gateway information."""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class HighlightSetEntity(BaseModel): class HighlightSetEntity(BaseModel):
"""The response from the `HighlightSetEntity` command.""" """The response from the `HighlightSetEntity` command."""

View File

@ -3,6 +3,7 @@ from typing import List, Optional
from pydantic import BaseModel from pydantic import BaseModel
class IceServer(BaseModel): class IceServer(BaseModel):
"""Representation of an ICE server used for STUN/TURN Used to initiate WebRTC connections based on <https://developer.mozilla.org/en-US/docs/Web/API/RTCIceServer>""" """Representation of an ICE server used for STUN/TURN Used to initiate WebRTC connections based on <https://developer.mozilla.org/en-US/docs/Web/API/RTCIceServer>"""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class ImportFile(BaseModel): class ImportFile(BaseModel):
"""File to import into the current model""" """File to import into the current model"""

View File

@ -3,6 +3,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class ImportFiles(BaseModel): class ImportFiles(BaseModel):
"""Data from importing the files""" """Data from importing the files"""

View File

@ -1,8 +1,6 @@
from typing import Any, Dict, Type, TypeVar, Union from typing import Union
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.system import System from ..models.system import System
from ..models.unit_length import UnitLength from ..models.unit_length import UnitLength
@ -62,15 +60,8 @@ class stl(BaseModel):
units: UnitLength units: UnitLength
GY = TypeVar("GY", bound="InputFormat") InputFormat = RootModel[
Union[
@attr.s(auto_attribs=True)
class InputFormat:
"""Input format specifier."""
type: Union[
fbx, fbx,
gltf, gltf,
obj, obj,
@ -79,87 +70,4 @@ class InputFormat:
step, step,
stl, stl,
] ]
]
def __init__(
self,
type: Union[
fbx,
gltf,
obj,
ply,
sldprt,
step,
stl,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, fbx):
JV: fbx = self.type
return JV.model_dump()
elif isinstance(self.type, gltf):
FV: gltf = self.type
return FV.model_dump()
elif isinstance(self.type, obj):
OY: obj = self.type
return OY.model_dump()
elif isinstance(self.type, ply):
TM: ply = self.type
return TM.model_dump()
elif isinstance(self.type, sldprt):
AH: sldprt = self.type
return AH.model_dump()
elif isinstance(self.type, step):
JR: step = self.type
return JR.model_dump()
elif isinstance(self.type, stl):
HK: stl = self.type
return HK.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "fbx":
IO: fbx = fbx(**d)
return cls(type=IO)
elif d.get("type") == "gltf":
LE: gltf = gltf(**d)
return cls(type=LE)
elif d.get("type") == "obj":
HO: obj = obj(**d)
return cls(type=HO)
elif d.get("type") == "ply":
BS: ply = ply(**d)
return cls(type=BS)
elif d.get("type") == "sldprt":
EG: sldprt = sldprt(**d)
return cls(type=EG)
elif d.get("type") == "step":
LY: step = step(**d)
return cls(type=LY)
elif d.get("type") == "stl":
VR: stl = stl(**d)
return cls(type=VR)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
fbx,
gltf,
obj,
ply,
sldprt,
step,
stl,
]
),
)

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class JetstreamApiStats(BaseModel): class JetstreamApiStats(BaseModel):
"""Jetstream API statistics.""" """Jetstream API statistics."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class JetstreamConfig(BaseModel): class JetstreamConfig(BaseModel):
"""Jetstream configuration.""" """Jetstream configuration."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class LeafNode(BaseModel): class LeafNode(BaseModel):
"""Leaf node information.""" """Leaf node information."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class MetaClusterInfo(BaseModel): class MetaClusterInfo(BaseModel):
"""Jetstream statistics.""" """Jetstream statistics."""

View File

@ -1,9 +1,7 @@
from typing import Any, Dict, List, Optional, Type, TypeVar, Union from typing import List, Optional, Union
from uuid import UUID from uuid import UUID
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.annotation_options import AnnotationOptions from ..models.annotation_options import AnnotationOptions
from ..models.annotation_type import AnnotationType from ..models.annotation_type import AnnotationType
@ -724,15 +722,8 @@ class curve_set_constraint(BaseModel):
type: str = "curve_set_constraint" type: str = "curve_set_constraint"
GY = TypeVar("GY", bound="ModelingCmd") ModelingCmd = RootModel[
Union[
@attr.s(auto_attribs=True)
class ModelingCmd:
"""Commands that the KittyCAD engine can execute."""
type: Union[
start_path, start_path,
move_path_pen, move_path_pen,
extend_path, extend_path,
@ -805,605 +796,4 @@ class ModelingCmd:
get_sketch_mode_plane, get_sketch_mode_plane,
curve_set_constraint, curve_set_constraint,
] ]
]
def __init__(
self,
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,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, start_path):
ON: start_path = self.type
return ON.model_dump()
elif isinstance(self.type, move_path_pen):
US: move_path_pen = self.type
return US.model_dump()
elif isinstance(self.type, extend_path):
FH: extend_path = self.type
return FH.model_dump()
elif isinstance(self.type, extrude):
BB: extrude = self.type
return BB.model_dump()
elif isinstance(self.type, close_path):
TV: close_path = self.type
return TV.model_dump()
elif isinstance(self.type, camera_drag_start):
CE: camera_drag_start = self.type
return CE.model_dump()
elif isinstance(self.type, camera_drag_move):
LT: camera_drag_move = self.type
return LT.model_dump()
elif isinstance(self.type, camera_drag_end):
YY: camera_drag_end = self.type
return YY.model_dump()
elif isinstance(self.type, default_camera_look_at):
FZ: default_camera_look_at = self.type
return FZ.model_dump()
elif isinstance(self.type, default_camera_zoom):
NN: default_camera_zoom = self.type
return NN.model_dump()
elif isinstance(self.type, default_camera_enable_sketch_mode):
VI: default_camera_enable_sketch_mode = self.type
return VI.model_dump()
elif isinstance(self.type, default_camera_disable_sketch_mode):
QF: default_camera_disable_sketch_mode = self.type
return QF.model_dump()
elif isinstance(self.type, default_camera_focus_on):
OJ: default_camera_focus_on = self.type
return OJ.model_dump()
elif isinstance(self.type, export):
YF: export = self.type
return YF.model_dump()
elif isinstance(self.type, entity_get_parent_id):
LK: entity_get_parent_id = self.type
return LK.model_dump()
elif isinstance(self.type, entity_get_num_children):
WB: entity_get_num_children = self.type
return WB.model_dump()
elif isinstance(self.type, entity_get_child_uuid):
HC: entity_get_child_uuid = self.type
return HC.model_dump()
elif isinstance(self.type, entity_get_all_child_uuids):
PV: entity_get_all_child_uuids = self.type
return PV.model_dump()
elif isinstance(self.type, edit_mode_enter):
TP: edit_mode_enter = self.type
return TP.model_dump()
elif isinstance(self.type, edit_mode_exit):
OM: edit_mode_exit = self.type
return OM.model_dump()
elif isinstance(self.type, select_with_point):
RS: select_with_point = self.type
return RS.model_dump()
elif isinstance(self.type, select_clear):
MP: select_clear = self.type
return MP.model_dump()
elif isinstance(self.type, select_add):
RO: select_add = self.type
return RO.model_dump()
elif isinstance(self.type, select_remove):
BA: select_remove = self.type
return BA.model_dump()
elif isinstance(self.type, select_replace):
CB: select_replace = self.type
return CB.model_dump()
elif isinstance(self.type, select_get):
TO: select_get = self.type
return TO.model_dump()
elif isinstance(self.type, highlight_set_entity):
EO: highlight_set_entity = self.type
return EO.model_dump()
elif isinstance(self.type, highlight_set_entities):
QO: highlight_set_entities = self.type
return QO.model_dump()
elif isinstance(self.type, new_annotation):
IZ: new_annotation = self.type
return IZ.model_dump()
elif isinstance(self.type, update_annotation):
NK: update_annotation = self.type
return NK.model_dump()
elif isinstance(self.type, object_visible):
QE: object_visible = self.type
return QE.model_dump()
elif isinstance(self.type, object_bring_to_front):
KT: object_bring_to_front = self.type
return KT.model_dump()
elif isinstance(self.type, get_entity_type):
GU: get_entity_type = self.type
return GU.model_dump()
elif isinstance(self.type, solid2d_add_hole):
UP: solid2d_add_hole = self.type
return UP.model_dump()
elif isinstance(self.type, solid3d_get_all_edge_faces):
DJ: solid3d_get_all_edge_faces = self.type
return DJ.model_dump()
elif isinstance(self.type, solid3d_get_all_opposite_edges):
TR: solid3d_get_all_opposite_edges = self.type
return TR.model_dump()
elif isinstance(self.type, solid3d_get_opposite_edge):
JF: solid3d_get_opposite_edge = self.type
return JF.model_dump()
elif isinstance(self.type, solid3d_get_next_adjacent_edge):
EL: solid3d_get_next_adjacent_edge = self.type
return EL.model_dump()
elif isinstance(self.type, solid3d_get_prev_adjacent_edge):
LF: solid3d_get_prev_adjacent_edge = self.type
return LF.model_dump()
elif isinstance(self.type, send_object):
GN: send_object = self.type
return GN.model_dump()
elif isinstance(self.type, entity_set_opacity):
VJ: entity_set_opacity = self.type
return VJ.model_dump()
elif isinstance(self.type, entity_fade):
YW: entity_fade = self.type
return YW.model_dump()
elif isinstance(self.type, make_plane):
NO: make_plane = self.type
return NO.model_dump()
elif isinstance(self.type, plane_set_color):
RG: plane_set_color = self.type
return RG.model_dump()
elif isinstance(self.type, set_tool):
LD: set_tool = self.type
return LD.model_dump()
elif isinstance(self.type, mouse_move):
TN: mouse_move = self.type
return TN.model_dump()
elif isinstance(self.type, mouse_click):
UG: mouse_click = self.type
return UG.model_dump()
elif isinstance(self.type, sketch_mode_enable):
NZ: sketch_mode_enable = self.type
return NZ.model_dump()
elif isinstance(self.type, sketch_mode_disable):
LO: sketch_mode_disable = self.type
return LO.model_dump()
elif isinstance(self.type, curve_get_type):
OW: curve_get_type = self.type
return OW.model_dump()
elif isinstance(self.type, curve_get_control_points):
PQ: curve_get_control_points = self.type
return PQ.model_dump()
elif isinstance(self.type, take_snapshot):
OU: take_snapshot = self.type
return OU.model_dump()
elif isinstance(self.type, make_axes_gizmo):
XI: make_axes_gizmo = self.type
return XI.model_dump()
elif isinstance(self.type, path_get_info):
PS: path_get_info = self.type
return PS.model_dump()
elif isinstance(self.type, path_get_curve_uuids_for_vertices):
XL: path_get_curve_uuids_for_vertices = self.type
return XL.model_dump()
elif isinstance(self.type, path_get_vertex_uuids):
FT: path_get_vertex_uuids = self.type
return FT.model_dump()
elif isinstance(self.type, handle_mouse_drag_start):
SC: handle_mouse_drag_start = self.type
return SC.model_dump()
elif isinstance(self.type, handle_mouse_drag_move):
JA: handle_mouse_drag_move = self.type
return JA.model_dump()
elif isinstance(self.type, handle_mouse_drag_end):
UK: handle_mouse_drag_end = self.type
return UK.model_dump()
elif isinstance(self.type, remove_scene_objects):
MT: remove_scene_objects = self.type
return MT.model_dump()
elif isinstance(self.type, plane_intersect_and_project):
TF: plane_intersect_and_project = self.type
return TF.model_dump()
elif isinstance(self.type, curve_get_end_points):
JD: curve_get_end_points = self.type
return JD.model_dump()
elif isinstance(self.type, reconfigure_stream):
BH: reconfigure_stream = self.type
return BH.model_dump()
elif isinstance(self.type, import_files):
CN: import_files = self.type
return CN.model_dump()
elif isinstance(self.type, mass):
SO: mass = self.type
return SO.model_dump()
elif isinstance(self.type, density):
AM: density = self.type
return AM.model_dump()
elif isinstance(self.type, volume):
SG: volume = self.type
return SG.model_dump()
elif isinstance(self.type, center_of_mass):
SY: center_of_mass = self.type
return SY.model_dump()
elif isinstance(self.type, surface_area):
WS: surface_area = self.type
return WS.model_dump()
elif isinstance(self.type, get_sketch_mode_plane):
MK: get_sketch_mode_plane = self.type
return MK.model_dump()
elif isinstance(self.type, curve_set_constraint):
FY: curve_set_constraint = self.type
return FY.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "start_path":
PC: start_path = start_path(**d)
return cls(type=PC)
elif d.get("type") == "move_path_pen":
KQ: move_path_pen = move_path_pen(**d)
return cls(type=KQ)
elif d.get("type") == "extend_path":
NH: extend_path = extend_path(**d)
return cls(type=NH)
elif d.get("type") == "extrude":
PJ: extrude = extrude(**d)
return cls(type=PJ)
elif d.get("type") == "close_path":
CR: close_path = close_path(**d)
return cls(type=CR)
elif d.get("type") == "camera_drag_start":
MS: camera_drag_start = camera_drag_start(**d)
return cls(type=MS)
elif d.get("type") == "camera_drag_move":
ED: camera_drag_move = camera_drag_move(**d)
return cls(type=ED)
elif d.get("type") == "camera_drag_end":
DO: camera_drag_end = camera_drag_end(**d)
return cls(type=DO)
elif d.get("type") == "default_camera_look_at":
GL: default_camera_look_at = default_camera_look_at(**d)
return cls(type=GL)
elif d.get("type") == "default_camera_zoom":
OH: default_camera_zoom = default_camera_zoom(**d)
return cls(type=OH)
elif d.get("type") == "default_camera_enable_sketch_mode":
ET: default_camera_enable_sketch_mode = default_camera_enable_sketch_mode(
**d
)
return cls(type=ET)
elif d.get("type") == "default_camera_disable_sketch_mode":
DI: default_camera_disable_sketch_mode = default_camera_disable_sketch_mode(
**d
)
return cls(type=DI)
elif d.get("type") == "default_camera_focus_on":
UF: default_camera_focus_on = default_camera_focus_on(**d)
return cls(type=UF)
elif d.get("type") == "export":
PY: export = export(**d)
return cls(type=PY)
elif d.get("type") == "entity_get_parent_id":
AR: entity_get_parent_id = entity_get_parent_id(**d)
return cls(type=AR)
elif d.get("type") == "entity_get_num_children":
KK: entity_get_num_children = entity_get_num_children(**d)
return cls(type=KK)
elif d.get("type") == "entity_get_child_uuid":
FM: entity_get_child_uuid = entity_get_child_uuid(**d)
return cls(type=FM)
elif d.get("type") == "entity_get_all_child_uuids":
QI: entity_get_all_child_uuids = entity_get_all_child_uuids(**d)
return cls(type=QI)
elif d.get("type") == "edit_mode_enter":
CF: edit_mode_enter = edit_mode_enter(**d)
return cls(type=CF)
elif d.get("type") == "edit_mode_exit":
EN: edit_mode_exit = edit_mode_exit(**d)
return cls(type=EN)
elif d.get("type") == "select_with_point":
LR: select_with_point = select_with_point(**d)
return cls(type=LR)
elif d.get("type") == "select_clear":
WF: select_clear = select_clear(**d)
return cls(type=WF)
elif d.get("type") == "select_add":
DN: select_add = select_add(**d)
return cls(type=DN)
elif d.get("type") == "select_remove":
OR: select_remove = select_remove(**d)
return cls(type=OR)
elif d.get("type") == "select_replace":
LC: select_replace = select_replace(**d)
return cls(type=LC)
elif d.get("type") == "select_get":
ZP: select_get = select_get(**d)
return cls(type=ZP)
elif d.get("type") == "highlight_set_entity":
NY: highlight_set_entity = highlight_set_entity(**d)
return cls(type=NY)
elif d.get("type") == "highlight_set_entities":
KX: highlight_set_entities = highlight_set_entities(**d)
return cls(type=KX)
elif d.get("type") == "new_annotation":
WO: new_annotation = new_annotation(**d)
return cls(type=WO)
elif d.get("type") == "update_annotation":
UQ: update_annotation = update_annotation(**d)
return cls(type=UQ)
elif d.get("type") == "object_visible":
XH: object_visible = object_visible(**d)
return cls(type=XH)
elif d.get("type") == "object_bring_to_front":
BV: object_bring_to_front = object_bring_to_front(**d)
return cls(type=BV)
elif d.get("type") == "get_entity_type":
SS: get_entity_type = get_entity_type(**d)
return cls(type=SS)
elif d.get("type") == "solid2d_add_hole":
AZ: solid2d_add_hole = solid2d_add_hole(**d)
return cls(type=AZ)
elif d.get("type") == "solid3d_get_all_edge_faces":
WJ: solid3d_get_all_edge_faces = solid3d_get_all_edge_faces(**d)
return cls(type=WJ)
elif d.get("type") == "solid3d_get_all_opposite_edges":
YD: solid3d_get_all_opposite_edges = solid3d_get_all_opposite_edges(**d)
return cls(type=YD)
elif d.get("type") == "solid3d_get_opposite_edge":
VP: solid3d_get_opposite_edge = solid3d_get_opposite_edge(**d)
return cls(type=VP)
elif d.get("type") == "solid3d_get_next_adjacent_edge":
ZG: solid3d_get_next_adjacent_edge = solid3d_get_next_adjacent_edge(**d)
return cls(type=ZG)
elif d.get("type") == "solid3d_get_prev_adjacent_edge":
CS: solid3d_get_prev_adjacent_edge = solid3d_get_prev_adjacent_edge(**d)
return cls(type=CS)
elif d.get("type") == "send_object":
GD: send_object = send_object(**d)
return cls(type=GD)
elif d.get("type") == "entity_set_opacity":
OX: entity_set_opacity = entity_set_opacity(**d)
return cls(type=OX)
elif d.get("type") == "entity_fade":
QX: entity_fade = entity_fade(**d)
return cls(type=QX)
elif d.get("type") == "make_plane":
VX: make_plane = make_plane(**d)
return cls(type=VX)
elif d.get("type") == "plane_set_color":
IT: plane_set_color = plane_set_color(**d)
return cls(type=IT)
elif d.get("type") == "set_tool":
UA: set_tool = set_tool(**d)
return cls(type=UA)
elif d.get("type") == "mouse_move":
MZ: mouse_move = mouse_move(**d)
return cls(type=MZ)
elif d.get("type") == "mouse_click":
CY: mouse_click = mouse_click(**d)
return cls(type=CY)
elif d.get("type") == "sketch_mode_enable":
LI: sketch_mode_enable = sketch_mode_enable(**d)
return cls(type=LI)
elif d.get("type") == "sketch_mode_disable":
XJ: sketch_mode_disable = sketch_mode_disable(**d)
return cls(type=XJ)
elif d.get("type") == "curve_get_type":
JQ: curve_get_type = curve_get_type(**d)
return cls(type=JQ)
elif d.get("type") == "curve_get_control_points":
IM: curve_get_control_points = curve_get_control_points(**d)
return cls(type=IM)
elif d.get("type") == "take_snapshot":
KL: take_snapshot = take_snapshot(**d)
return cls(type=KL)
elif d.get("type") == "make_axes_gizmo":
PO: make_axes_gizmo = make_axes_gizmo(**d)
return cls(type=PO)
elif d.get("type") == "path_get_info":
WR: path_get_info = path_get_info(**d)
return cls(type=WR)
elif d.get("type") == "path_get_curve_uuids_for_vertices":
ZX: path_get_curve_uuids_for_vertices = path_get_curve_uuids_for_vertices(
**d
)
return cls(type=ZX)
elif d.get("type") == "path_get_vertex_uuids":
NX: path_get_vertex_uuids = path_get_vertex_uuids(**d)
return cls(type=NX)
elif d.get("type") == "handle_mouse_drag_start":
TX: handle_mouse_drag_start = handle_mouse_drag_start(**d)
return cls(type=TX)
elif d.get("type") == "handle_mouse_drag_move":
SK: handle_mouse_drag_move = handle_mouse_drag_move(**d)
return cls(type=SK)
elif d.get("type") == "handle_mouse_drag_end":
CX: handle_mouse_drag_end = handle_mouse_drag_end(**d)
return cls(type=CX)
elif d.get("type") == "remove_scene_objects":
LJ: remove_scene_objects = remove_scene_objects(**d)
return cls(type=LJ)
elif d.get("type") == "plane_intersect_and_project":
HF: plane_intersect_and_project = plane_intersect_and_project(**d)
return cls(type=HF)
elif d.get("type") == "curve_get_end_points":
RZ: curve_get_end_points = curve_get_end_points(**d)
return cls(type=RZ)
elif d.get("type") == "reconfigure_stream":
SX: reconfigure_stream = reconfigure_stream(**d)
return cls(type=SX)
elif d.get("type") == "import_files":
GS: import_files = import_files(**d)
return cls(type=GS)
elif d.get("type") == "mass":
ZS: mass = mass(**d)
return cls(type=ZS)
elif d.get("type") == "density":
GK: density = density(**d)
return cls(type=GK)
elif d.get("type") == "volume":
QZ: volume = volume(**d)
return cls(type=QZ)
elif d.get("type") == "center_of_mass":
YK: center_of_mass = center_of_mass(**d)
return cls(type=YK)
elif d.get("type") == "surface_area":
SL: surface_area = surface_area(**d)
return cls(type=SL)
elif d.get("type") == "get_sketch_mode_plane":
TU: get_sketch_mode_plane = get_sketch_mode_plane(**d)
return cls(type=TU)
elif d.get("type") == "curve_set_constraint":
FD: curve_set_constraint = curve_set_constraint(**d)
return cls(type=FD)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
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,
]
),
)

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class MouseClick(BaseModel): class MouseClick(BaseModel):
"""The response from the `MouseClick` command.""" """The response from the `MouseClick` command."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class OAuth2ClientInfo(BaseModel): class OAuth2ClientInfo(BaseModel):
"""Information about an OAuth 2.0 client.""" """Information about an OAuth 2.0 client."""

View File

@ -1,8 +1,6 @@
from typing import Any, Dict, Type, TypeVar, Union from typing import Union
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.center_of_mass import CenterOfMass from ..models.center_of_mass import CenterOfMass
from ..models.curve_get_control_points import CurveGetControlPoints from ..models.curve_get_control_points import CurveGetControlPoints
@ -282,15 +280,8 @@ class get_sketch_mode_plane(BaseModel):
type: str = "get_sketch_mode_plane" type: str = "get_sketch_mode_plane"
GY = TypeVar("GY", bound="OkModelingCmdResponse") OkModelingCmdResponse = RootModel[
Union[
@attr.s(auto_attribs=True)
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, empty,
export, export,
select_with_point, select_with_point,
@ -323,281 +314,4 @@ class OkModelingCmdResponse:
center_of_mass, center_of_mass,
get_sketch_mode_plane, get_sketch_mode_plane,
] ]
]
def __init__(
self,
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,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, empty):
TZ: empty = self.type
return TZ.model_dump()
elif isinstance(self.type, export):
RQ: export = self.type
return RQ.model_dump()
elif isinstance(self.type, select_with_point):
CM: select_with_point = self.type
return CM.model_dump()
elif isinstance(self.type, highlight_set_entity):
WP: highlight_set_entity = self.type
return WP.model_dump()
elif isinstance(self.type, entity_get_child_uuid):
LN: entity_get_child_uuid = self.type
return LN.model_dump()
elif isinstance(self.type, entity_get_num_children):
MG: entity_get_num_children = self.type
return MG.model_dump()
elif isinstance(self.type, entity_get_parent_id):
BF: entity_get_parent_id = self.type
return BF.model_dump()
elif isinstance(self.type, entity_get_all_child_uuids):
MB: entity_get_all_child_uuids = self.type
return MB.model_dump()
elif isinstance(self.type, select_get):
FJ: select_get = self.type
return FJ.model_dump()
elif isinstance(self.type, get_entity_type):
SF: get_entity_type = self.type
return SF.model_dump()
elif isinstance(self.type, solid3d_get_all_edge_faces):
BM: solid3d_get_all_edge_faces = self.type
return BM.model_dump()
elif isinstance(self.type, solid3d_get_all_opposite_edges):
NC: solid3d_get_all_opposite_edges = self.type
return NC.model_dump()
elif isinstance(self.type, solid3d_get_opposite_edge):
FF: solid3d_get_opposite_edge = self.type
return FF.model_dump()
elif isinstance(self.type, solid3d_get_prev_adjacent_edge):
FS: solid3d_get_prev_adjacent_edge = self.type
return FS.model_dump()
elif isinstance(self.type, solid3d_get_next_adjacent_edge):
EQ: solid3d_get_next_adjacent_edge = self.type
return EQ.model_dump()
elif isinstance(self.type, mouse_click):
MD: mouse_click = self.type
return MD.model_dump()
elif isinstance(self.type, curve_get_type):
UJ: curve_get_type = self.type
return UJ.model_dump()
elif isinstance(self.type, curve_get_control_points):
DL: curve_get_control_points = self.type
return DL.model_dump()
elif isinstance(self.type, take_snapshot):
PT: take_snapshot = self.type
return PT.model_dump()
elif isinstance(self.type, path_get_info):
VF: path_get_info = self.type
return VF.model_dump()
elif isinstance(self.type, path_get_curve_uuids_for_vertices):
WH: path_get_curve_uuids_for_vertices = self.type
return WH.model_dump()
elif isinstance(self.type, path_get_vertex_uuids):
UY: path_get_vertex_uuids = self.type
return UY.model_dump()
elif isinstance(self.type, plane_intersect_and_project):
SM: plane_intersect_and_project = self.type
return SM.model_dump()
elif isinstance(self.type, curve_get_end_points):
CG: curve_get_end_points = self.type
return CG.model_dump()
elif isinstance(self.type, import_files):
ZB: import_files = self.type
return ZB.model_dump()
elif isinstance(self.type, mass):
FX: mass = self.type
return FX.model_dump()
elif isinstance(self.type, volume):
KU: volume = self.type
return KU.model_dump()
elif isinstance(self.type, density):
FA: density = self.type
return FA.model_dump()
elif isinstance(self.type, surface_area):
JG: surface_area = self.type
return JG.model_dump()
elif isinstance(self.type, center_of_mass):
RY: center_of_mass = self.type
return RY.model_dump()
elif isinstance(self.type, get_sketch_mode_plane):
AD: get_sketch_mode_plane = self.type
return AD.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "empty":
AX: empty = empty(**d)
return cls(type=AX)
elif d.get("type") == "export":
ZL: export = export(**d)
return cls(type=ZL)
elif d.get("type") == "select_with_point":
OS: select_with_point = select_with_point(**d)
return cls(type=OS)
elif d.get("type") == "highlight_set_entity":
XO: highlight_set_entity = highlight_set_entity(**d)
return cls(type=XO)
elif d.get("type") == "entity_get_child_uuid":
KR: entity_get_child_uuid = entity_get_child_uuid(**d)
return cls(type=KR)
elif d.get("type") == "entity_get_num_children":
UE: entity_get_num_children = entity_get_num_children(**d)
return cls(type=UE)
elif d.get("type") == "entity_get_parent_id":
UU: entity_get_parent_id = entity_get_parent_id(**d)
return cls(type=UU)
elif d.get("type") == "entity_get_all_child_uuids":
TB: entity_get_all_child_uuids = entity_get_all_child_uuids(**d)
return cls(type=TB)
elif d.get("type") == "select_get":
HB: select_get = select_get(**d)
return cls(type=HB)
elif d.get("type") == "get_entity_type":
DU: get_entity_type = get_entity_type(**d)
return cls(type=DU)
elif d.get("type") == "solid3d_get_all_edge_faces":
TY: solid3d_get_all_edge_faces = solid3d_get_all_edge_faces(**d)
return cls(type=TY)
elif d.get("type") == "solid3d_get_all_opposite_edges":
GP: solid3d_get_all_opposite_edges = solid3d_get_all_opposite_edges(**d)
return cls(type=GP)
elif d.get("type") == "solid3d_get_opposite_edge":
YO: solid3d_get_opposite_edge = solid3d_get_opposite_edge(**d)
return cls(type=YO)
elif d.get("type") == "solid3d_get_prev_adjacent_edge":
WN: solid3d_get_prev_adjacent_edge = solid3d_get_prev_adjacent_edge(**d)
return cls(type=WN)
elif d.get("type") == "solid3d_get_next_adjacent_edge":
UW: solid3d_get_next_adjacent_edge = solid3d_get_next_adjacent_edge(**d)
return cls(type=UW)
elif d.get("type") == "mouse_click":
HD: mouse_click = mouse_click(**d)
return cls(type=HD)
elif d.get("type") == "curve_get_type":
RU: curve_get_type = curve_get_type(**d)
return cls(type=RU)
elif d.get("type") == "curve_get_control_points":
QT: curve_get_control_points = curve_get_control_points(**d)
return cls(type=QT)
elif d.get("type") == "take_snapshot":
HR: take_snapshot = take_snapshot(**d)
return cls(type=HR)
elif d.get("type") == "path_get_info":
VM: path_get_info = path_get_info(**d)
return cls(type=VM)
elif d.get("type") == "path_get_curve_uuids_for_vertices":
DQ: path_get_curve_uuids_for_vertices = path_get_curve_uuids_for_vertices(
**d
)
return cls(type=DQ)
elif d.get("type") == "path_get_vertex_uuids":
PD: path_get_vertex_uuids = path_get_vertex_uuids(**d)
return cls(type=PD)
elif d.get("type") == "plane_intersect_and_project":
JL: plane_intersect_and_project = plane_intersect_and_project(**d)
return cls(type=JL)
elif d.get("type") == "curve_get_end_points":
QA: curve_get_end_points = curve_get_end_points(**d)
return cls(type=QA)
elif d.get("type") == "import_files":
AU: import_files = import_files(**d)
return cls(type=AU)
elif d.get("type") == "mass":
BL: mass = mass(**d)
return cls(type=BL)
elif d.get("type") == "volume":
PZ: volume = volume(**d)
return cls(type=PZ)
elif d.get("type") == "density":
GE: density = density(**d)
return cls(type=GE)
elif d.get("type") == "surface_area":
HH: surface_area = surface_area(**d)
return cls(type=HH)
elif d.get("type") == "center_of_mass":
AE: center_of_mass = center_of_mass(**d)
return cls(type=AE)
elif d.get("type") == "get_sketch_mode_plane":
AB: get_sketch_mode_plane = get_sketch_mode_plane(**d)
return cls(type=AB)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
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,
]
),
)

View File

@ -1,8 +1,6 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import List, Union
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.ice_server import IceServer from ..models.ice_server import IceServer
from ..models.ok_modeling_cmd_response import OkModelingCmdResponse from ..models.ok_modeling_cmd_response import OkModelingCmdResponse
@ -93,15 +91,8 @@ class metrics_request(BaseModel):
type: str = "metrics_request" type: str = "metrics_request"
GY = TypeVar("GY", bound="OkWebSocketResponseData") OkWebSocketResponseData = RootModel[
Union[
@attr.s(auto_attribs=True)
class OkWebSocketResponseData:
"""The websocket messages this server sends."""
type: Union[
ice_server_info, ice_server_info,
trickle_ice, trickle_ice,
sdp_answer, sdp_answer,
@ -109,79 +100,4 @@ class OkWebSocketResponseData:
export, export,
metrics_request, metrics_request,
] ]
]
def __init__(
self,
type: Union[
ice_server_info,
trickle_ice,
sdp_answer,
modeling,
export,
metrics_request,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, ice_server_info):
VY: ice_server_info = self.type
return VY.model_dump()
elif isinstance(self.type, trickle_ice):
MC: trickle_ice = self.type
return MC.model_dump()
elif isinstance(self.type, sdp_answer):
BR: sdp_answer = self.type
return BR.model_dump()
elif isinstance(self.type, modeling):
OK: modeling = self.type
return OK.model_dump()
elif isinstance(self.type, export):
OP: export = self.type
return OP.model_dump()
elif isinstance(self.type, metrics_request):
LV: metrics_request = self.type
return LV.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "ice_server_info":
DW: ice_server_info = ice_server_info(**d)
return cls(type=DW)
elif d.get("type") == "trickle_ice":
AV: trickle_ice = trickle_ice(**d)
return cls(type=AV)
elif d.get("type") == "sdp_answer":
WM: sdp_answer = sdp_answer(**d)
return cls(type=WM)
elif d.get("type") == "modeling":
MU: modeling = modeling(**d)
return cls(type=MU)
elif d.get("type") == "export":
WW: export = export(**d)
return cls(type=WW)
elif d.get("type") == "metrics_request":
II: metrics_request = metrics_request(**d)
return cls(type=II)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
ice_server_info,
trickle_ice,
sdp_answer,
modeling,
export,
metrics_request,
]
),
)

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class Onboarding(BaseModel): class Onboarding(BaseModel):
"""Onboarding details""" """Onboarding details"""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class OutputFile(BaseModel): class OutputFile(BaseModel):
"""Output file contents.""" """Output file contents."""

View File

@ -1,8 +1,6 @@
from typing import Any, Dict, Type, TypeVar, Union from typing import Union
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.fbx_storage import FbxStorage from ..models.fbx_storage import FbxStorage
from ..models.gltf_presentation import GltfPresentation from ..models.gltf_presentation import GltfPresentation
@ -78,15 +76,8 @@ class stl(BaseModel):
units: UnitLength units: UnitLength
GY = TypeVar("GY", bound="OutputFormat") OutputFormat = RootModel[
Union[
@attr.s(auto_attribs=True)
class OutputFormat:
"""Output format specifier."""
type: Union[
fbx, fbx,
gltf, gltf,
obj, obj,
@ -94,79 +85,4 @@ class OutputFormat:
step, step,
stl, stl,
] ]
]
def __init__(
self,
type: Union[
fbx,
gltf,
obj,
ply,
step,
stl,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, fbx):
FC: fbx = self.type
return FC.model_dump()
elif isinstance(self.type, gltf):
EI: gltf = self.type
return EI.model_dump()
elif isinstance(self.type, obj):
JE: obj = self.type
return JE.model_dump()
elif isinstance(self.type, ply):
JW: ply = self.type
return JW.model_dump()
elif isinstance(self.type, step):
AS: step = self.type
return AS.model_dump()
elif isinstance(self.type, stl):
YQ: stl = self.type
return YQ.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "fbx":
OA: fbx = fbx(**d)
return cls(type=OA)
elif d.get("type") == "gltf":
CQ: gltf = gltf(**d)
return cls(type=CQ)
elif d.get("type") == "obj":
RD: obj = obj(**d)
return cls(type=RD)
elif d.get("type") == "ply":
KZ: ply = ply(**d)
return cls(type=KZ)
elif d.get("type") == "step":
IU: step = step(**d)
return cls(type=IU)
elif d.get("type") == "stl":
NQ: stl = stl(**d)
return cls(type=NQ)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
fbx,
gltf,
obj,
ply,
step,
stl,
]
),
)

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class PathGetCurveUuidsForVertices(BaseModel): class PathGetCurveUuidsForVertices(BaseModel):
"""The response from the `PathGetCurveUuidsForVertices` command.""" """The response from the `PathGetCurveUuidsForVertices` command."""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class PathGetVertexUuids(BaseModel): class PathGetVertexUuids(BaseModel):
"""The response from the `PathGetVertexUuids` command.""" """The response from the `PathGetVertexUuids` command."""

View File

@ -1,8 +1,6 @@
from typing import Any, Dict, Optional, Type, TypeVar, Union from typing import Optional, Union
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.angle import Angle from ..models.angle import Angle
from ..models.point2d import Point2d from ..models.point2d import Point2d
@ -73,86 +71,12 @@ class tangential_arc_to(BaseModel):
type: str = "tangential_arc_to" type: str = "tangential_arc_to"
GY = TypeVar("GY", bound="PathSegment") PathSegment = RootModel[
Union[
@attr.s(auto_attribs=True)
class PathSegment:
"""A segment of a path. Paths are composed of many segments."""
type: Union[
line, line,
arc, arc,
bezier, bezier,
tangential_arc, tangential_arc,
tangential_arc_to, tangential_arc_to,
] ]
]
def __init__(
self,
type: Union[
line,
arc,
bezier,
tangential_arc,
tangential_arc_to,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, line):
EW: line = self.type
return EW.model_dump()
elif isinstance(self.type, arc):
BT: arc = self.type
return BT.model_dump()
elif isinstance(self.type, bezier):
AG: bezier = self.type
return AG.model_dump()
elif isinstance(self.type, tangential_arc):
EA: tangential_arc = self.type
return EA.model_dump()
elif isinstance(self.type, tangential_arc_to):
VW: tangential_arc_to = self.type
return VW.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "line":
BU: line = line(**d)
return cls(type=BU)
elif d.get("type") == "arc":
GR: arc = arc(**d)
return cls(type=GR)
elif d.get("type") == "bezier":
EJ: bezier = bezier(**d)
return cls(type=EJ)
elif d.get("type") == "tangential_arc":
LQ: tangential_arc = tangential_arc(**d)
return cls(type=LQ)
elif d.get("type") == "tangential_arc_to":
DP: tangential_arc_to = tangential_arc_to(**d)
return cls(type=DP)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
line,
arc,
bezier,
tangential_arc,
tangential_arc_to,
]
),
)

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class PaymentIntent(BaseModel): class PaymentIntent(BaseModel):
"""A payment intent response.""" """A payment intent response."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class PaymentMethodCardChecks(BaseModel): class PaymentMethodCardChecks(BaseModel):
"""Card checks.""" """Card checks."""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class Point2d(BaseModel): class Point2d(BaseModel):
"""A point in 2D space""" """A point in 2D space"""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class Point3d(BaseModel): class Point3d(BaseModel):
"""A point in 3D space""" """A point in 3D space"""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class Pong(BaseModel): class Pong(BaseModel):
"""The response from the `/ping` endpoint.""" """The response from the `/ping` endpoint."""

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class RawFile(BaseModel): class RawFile(BaseModel):
"""A raw file with unencoded contents to be passed over binary websockets.""" """A raw file with unencoded contents to be passed over binary websockets."""

View File

@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
class RtcIceCandidateInit(BaseModel): class RtcIceCandidateInit(BaseModel):
"""ICECandidateInit is used to serialize ice candidates""" """ICECandidateInit is used to serialize ice candidates"""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class SelectGet(BaseModel): class SelectGet(BaseModel):
"""The response from the `SelectGet` command.""" """The response from the `SelectGet` command."""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class SelectWithPoint(BaseModel): class SelectWithPoint(BaseModel):
"""The response from the `SelectWithPoint` command.""" """The response from the `SelectWithPoint` command."""

View File

@ -1,8 +1,6 @@
from typing import Any, Dict, Type, TypeVar, Union from typing import Union
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
@ -44,86 +42,12 @@ class mesh_by_name(BaseModel):
type: str = "mesh_by_name" type: str = "mesh_by_name"
GY = TypeVar("GY", bound="Selection") Selection = RootModel[
Union[
@attr.s(auto_attribs=True)
class Selection:
"""Data item selection."""
type: Union[
default_scene, default_scene,
scene_by_index, scene_by_index,
scene_by_name, scene_by_name,
mesh_by_index, mesh_by_index,
mesh_by_name, mesh_by_name,
] ]
]
def __init__(
self,
type: Union[
default_scene,
scene_by_index,
scene_by_name,
mesh_by_index,
mesh_by_name,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, default_scene):
JO: default_scene = self.type
return JO.model_dump()
elif isinstance(self.type, scene_by_index):
TE: scene_by_index = self.type
return TE.model_dump()
elif isinstance(self.type, scene_by_name):
WY: scene_by_name = self.type
return WY.model_dump()
elif isinstance(self.type, mesh_by_index):
QV: mesh_by_index = self.type
return QV.model_dump()
elif isinstance(self.type, mesh_by_name):
BP: mesh_by_name = self.type
return BP.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "default_scene":
OF: default_scene = default_scene(**d)
return cls(type=OF)
elif d.get("type") == "scene_by_index":
OV: scene_by_index = scene_by_index(**d)
return cls(type=OV)
elif d.get("type") == "scene_by_name":
FK: scene_by_name = scene_by_name(**d)
return cls(type=FK)
elif d.get("type") == "mesh_by_index":
PE: mesh_by_index = mesh_by_index(**d)
return cls(type=PE)
elif d.get("type") == "mesh_by_name":
FP: mesh_by_name = mesh_by_name(**d)
return cls(type=FP)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
default_scene,
scene_by_index,
scene_by_name,
mesh_by_index,
mesh_by_name,
]
),
)

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class Solid3dGetAllEdgeFaces(BaseModel): class Solid3dGetAllEdgeFaces(BaseModel):
"""The response from the `Solid3dGetAllEdgeFaces` command.""" """The response from the `Solid3dGetAllEdgeFaces` command."""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class Solid3dGetAllOppositeEdges(BaseModel): class Solid3dGetAllOppositeEdges(BaseModel):
"""The response from the `Solid3dGetAllOppositeEdges` command.""" """The response from the `Solid3dGetAllOppositeEdges` command."""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class Solid3dGetNextAdjacentEdge(BaseModel): class Solid3dGetNextAdjacentEdge(BaseModel):
"""The response from the `Solid3dGetNextAdjacentEdge` command.""" """The response from the `Solid3dGetNextAdjacentEdge` command."""

View File

@ -3,6 +3,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class Solid3dGetOppositeEdge(BaseModel): class Solid3dGetOppositeEdge(BaseModel):
"""The response from the `Solid3dGetOppositeEdge` command.""" """The response from the `Solid3dGetOppositeEdge` command."""

View File

@ -4,6 +4,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
class Solid3dGetPrevAdjacentEdge(BaseModel): class Solid3dGetPrevAdjacentEdge(BaseModel):
"""The response from the `Solid3dGetPrevAdjacentEdge` command.""" """The response from the `Solid3dGetPrevAdjacentEdge` command."""

View File

@ -1,8 +1,10 @@
from pydantic import Base64Bytes, BaseModel from pydantic import BaseModel
from .base64data import Base64Data
class TakeSnapshot(BaseModel): class TakeSnapshot(BaseModel):
"""The response from the `TakeSnapshot` command.""" """The response from the `TakeSnapshot` command."""
contents: Base64Bytes contents: Base64Data

View File

@ -1,12 +1,13 @@
import datetime import datetime
from typing import Dict, Optional from typing import Dict, Optional
from pydantic import Base64Bytes, BaseModel from pydantic import BaseModel
from ..models.ai_feedback import AiFeedback from ..models.ai_feedback import AiFeedback
from ..models.api_call_status import ApiCallStatus from ..models.api_call_status import ApiCallStatus
from ..models.file_export_format import FileExportFormat from ..models.file_export_format import FileExportFormat
from ..models.uuid import Uuid from ..models.uuid import Uuid
from .base64data import Base64Data
class TextToCad(BaseModel): class TextToCad(BaseModel):
@ -26,7 +27,7 @@ class TextToCad(BaseModel):
output_format: FileExportFormat output_format: FileExportFormat
outputs: Optional[Dict[str, Base64Bytes]] = None outputs: Optional[Dict[str, Base64Data]] = None
prompt: str prompt: str

View File

@ -2,6 +2,7 @@
from pydantic import BaseModel from pydantic import BaseModel
class TextToCadCreateBody(BaseModel): class TextToCadCreateBody(BaseModel):
"""Body for generating models from text.""" """Body for generating models from text."""

View File

@ -1,7 +1,7 @@
from typing import Optional from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
from pydantic_extra_types.phone_number import PhoneNumber
class UpdateUser(BaseModel): class UpdateUser(BaseModel):
@ -17,4 +17,4 @@ class UpdateUser(BaseModel):
last_name: Optional[str] = None last_name: Optional[str] = None
phone: Optional[PhoneNumber] = None phone: Optional[str] = None

View File

@ -2,7 +2,6 @@ import datetime
from typing import Optional from typing import Optional
from pydantic import BaseModel from pydantic import BaseModel
from pydantic_extra_types.phone_number import PhoneNumber
from ..models.uuid import Uuid from ..models.uuid import Uuid
@ -32,6 +31,6 @@ class User(BaseModel):
name: Optional[str] = None name: Optional[str] = None
phone: Optional[PhoneNumber] = None phone: Optional[str] = None
updated_at: datetime.datetime updated_at: datetime.datetime

View File

@ -1,8 +1,6 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import List, Union
import attr from pydantic import BaseModel, RootModel
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from ..models.client_metrics import ClientMetrics from ..models.client_metrics import ClientMetrics
from ..models.modeling_cmd import ModelingCmd from ..models.modeling_cmd import ModelingCmd
@ -60,15 +58,8 @@ class metrics_response(BaseModel):
type: str = "metrics_response" type: str = "metrics_response"
GY = TypeVar("GY", bound="WebSocketRequest") WebSocketRequest = RootModel[
Union[
@attr.s(auto_attribs=True)
class WebSocketRequest:
"""The websocket messages the server receives."""
type: Union[
trickle_ice, trickle_ice,
sdp_offer, sdp_offer,
modeling_cmd_req, modeling_cmd_req,
@ -76,79 +67,4 @@ class WebSocketRequest:
ping, ping,
metrics_response, metrics_response,
] ]
]
def __init__(
self,
type: Union[
trickle_ice,
sdp_offer,
modeling_cmd_req,
modeling_cmd_batch_req,
ping,
metrics_response,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, trickle_ice):
WI: trickle_ice = self.type
return WI.model_dump()
elif isinstance(self.type, sdp_offer):
YR: sdp_offer = self.type
return YR.model_dump()
elif isinstance(self.type, modeling_cmd_req):
XK: modeling_cmd_req = self.type
return XK.model_dump()
elif isinstance(self.type, modeling_cmd_batch_req):
OB: modeling_cmd_batch_req = self.type
return OB.model_dump()
elif isinstance(self.type, ping):
QQ: ping = self.type
return QQ.model_dump()
elif isinstance(self.type, metrics_response):
WX: metrics_response = self.type
return WX.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("type") == "trickle_ice":
QL: trickle_ice = trickle_ice(**d)
return cls(type=QL)
elif d.get("type") == "sdp_offer":
ME: sdp_offer = sdp_offer(**d)
return cls(type=ME)
elif d.get("type") == "modeling_cmd_req":
EB: modeling_cmd_req = modeling_cmd_req(**d)
return cls(type=EB)
elif d.get("type") == "modeling_cmd_batch_req":
VK: modeling_cmd_batch_req = modeling_cmd_batch_req(**d)
return cls(type=VK)
elif d.get("type") == "ping":
ZC: ping = ping(**d)
return cls(type=ZC)
elif d.get("type") == "metrics_response":
BE: metrics_response = metrics_response(**d)
return cls(type=BE)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
trickle_ice,
sdp_offer,
modeling_cmd_req,
modeling_cmd_batch_req,
ping,
metrics_response,
]
),
)

View File

@ -1,65 +1,13 @@
from typing import Any, Dict, Type, TypeVar, Union from typing import Union
import attr from pydantic import RootModel
from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from .failure_web_socket_response import FailureWebSocketResponse from .failure_web_socket_response import FailureWebSocketResponse
from .success_web_socket_response import SuccessWebSocketResponse from .success_web_socket_response import SuccessWebSocketResponse
GY = TypeVar("GY", bound="WebSocketResponse") WebSocketResponse = RootModel[
Union[
@attr.s(auto_attribs=True)
class WebSocketResponse:
"""Websocket responses can either be successful or unsuccessful. Slightly different schemas in either case."""
type: Union[
SuccessWebSocketResponse, SuccessWebSocketResponse,
FailureWebSocketResponse, FailureWebSocketResponse,
] ]
]
def __init__(
self,
type: Union[
SuccessWebSocketResponse,
FailureWebSocketResponse,
],
):
self.type = type
def model_dump(self) -> Dict[str, Any]:
if isinstance(self.type, SuccessWebSocketResponse):
HV: SuccessWebSocketResponse = self.type
return HV.model_dump()
elif isinstance(self.type, FailureWebSocketResponse):
CL: FailureWebSocketResponse = self.type
return CL.model_dump()
raise Exception("Unknown type")
@classmethod
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
if d.get("success") is True:
CD: SuccessWebSocketResponse = SuccessWebSocketResponse(**d)
return cls(type=CD)
elif d.get("success") is False:
ZO: FailureWebSocketResponse = FailureWebSocketResponse(**d)
return cls(type=ZO)
raise Exception("Unknown type")
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(
cls,
handler(
Union[
SuccessWebSocketResponse,
FailureWebSocketResponse,
]
),
)