switch to pydantic

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-11-28 23:50:50 -08:00
parent d9d73522fd
commit bc3d698539
230 changed files with 4467 additions and 25280 deletions

16
generate/float.py.jinja2 Normal file
View File

@ -0,0 +1,16 @@
from typing import Any
from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
class {{name}}(float):
"""{{description}}"""
def __float__(self) -> float:
return self
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(cls, handler(float))

View File

@ -93,7 +93,7 @@ def sync(
client=client, client=client,
) )
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"]) # type: ignore
@ -179,20 +179,20 @@ class WebSocket:
""" """
for message in self.ws: for message in self.ws:
yield {{response_type}}.from_dict(json.loads(message)) yield {{response_type}}(**json.loads(message))
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.to_dict())) self.ws.send(json.dumps(data.model_dump()))
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.BSON.encode(data.to_dict())) self.ws.send(bson.encode(data.model_dump()))
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()
return {{response_type}}.from_dict(json.loads(message)) return {{response_type}}(**json.loads(message))
def close(self): def close(self):
"""Close the websocket.""" """Close the websocket."""

File diff suppressed because it is too large Load Diff

16
generate/int.py.jinja2 Normal file
View File

@ -0,0 +1,16 @@
from typing import Any
from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
class {{name}}(int):
"""{{description}}"""
def __int__(self) -> int:
return self
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(cls, handler(int))

20
generate/object.py.jinja2 Normal file
View File

@ -0,0 +1,20 @@
import datetime
from typing import List, Optional, Dict, Union, Any
from uuid import UUID
from pydantic import BaseModel, Base64Bytes, AnyUrl
from pydantic_extra_types.phone_numbers import PhoneNumber
{% for import in imports %}
{{ import }}
{% endfor %}
class {{ name }}(BaseModel):
"""{{ description }}"""
{% for field in fields %}
{% if field.value %}
{{ field.name }}: {{ field.type }} = {{ field.value }}
{% else %}
{{ field.name }}: {{ field.type }}
{% endif %}
{% endfor %}

View File

@ -5,13 +5,11 @@ 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.
@ -21,7 +19,7 @@ poetry run python generate/generate.py
poetry run isort . poetry run isort .
poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py
poetry run ruff check --fix . poetry run ruff check --fix .
poetry run mypy . || true poetry run mypy .
# Run the tests. # Run the tests.

16
generate/str.py.jinja2 Normal file
View File

@ -0,0 +1,16 @@
from typing import Any
from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
class {{name}}(str):
"""{{description}}"""
def __str__(self) -> str:
return self
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(cls, handler(str))

View File

@ -3,6 +3,9 @@ from typing_extensions import Self
import attr import attr
from ..types import UNSET, Unset from ..types import UNSET, Unset
from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
GY = TypeVar("GY", bound="{{name}}") GY = TypeVar("GY", bound="{{name}}")
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)
@ -24,14 +27,14 @@ class {{name}}:
]): ]):
self.type = type self.type = type
def to_dict(self) -> Dict[str, Any]: def model_dump(self) -> Dict[str, Any]:
{% for type in types %}{% if loop.first %} {% for type in types %}{% if loop.first %}
if isinstance(self.type, {{type.name}}): if isinstance(self.type, {{type.name}}):
{{type.var0}} : {{type.name}} = self.type {{type.var0}} : {{type.name}} = self.type
return {{type.var0}}.to_dict() return {{type.var0}}.model_dump()
{% else %}elif isinstance(self.type, {{type.name}}): {% else %}elif isinstance(self.type, {{type.name}}):
{{type.var0}} : {{type.name}} = self.type {{type.var0}} : {{type.name}} = self.type
return {{type.var0}}.to_dict() return {{type.var0}}.model_dump()
{% endif %}{% endfor %} {% endif %}{% endfor %}
raise Exception("Unknown type") raise Exception("Unknown type")
@ -39,12 +42,20 @@ class {{name}}:
def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY: def from_dict(cls: Type[GY], d: Dict[str, Any]) -> GY:
{% for type in types %}{% if loop.first %} {% for type in types %}{% if loop.first %}
if d.get("{{type.check}}") == {{type.value}}: if d.get("{{type.check}}") == {{type.value}}:
{{type.var1}} : {{type.name}} = {{type.name}}() {{type.var1}} : {{type.name}} = {{type.name}}(**d)
{{type.var1}}.from_dict(d)
return cls(type={{type.var1}}) return cls(type={{type.var1}})
{% else %}elif d.get("{{type.check}}") == {{type.value}}: {% else %}elif d.get("{{type.check}}") == {{type.value}}:
{{type.var1}} : {{type.name}} = {{type.name}}() {{type.var1}} : {{type.name}} = {{type.name}}(**d)
{{type.var1}}.from_dict(d)
return cls(type={{type.var1}}) return cls(type={{type.var1}})
{% endif %}{% endfor %} {% endif %}{% endfor %}
raise Exception("Unknown type") 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 %}
]))

File diff suppressed because it is too large Load Diff

View File

@ -35,15 +35,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = TextToCad.from_dict(response.json()) response_201 = TextToCad(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -39,12 +39,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -31,15 +31,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[AiPrompt, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[AiPrompt, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = AiPrompt.from_dict(response.json()) response_200 = AiPrompt(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,15 +31,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[TextToCad, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = TextToCad.from_dict(response.json()) response_200 = TextToCad(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -53,15 +53,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[AiPromptResultsPage, Error]]: ) -> Optional[Union[AiPromptResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = AiPromptResultsPage.from_dict(response.json()) response_200 = AiPromptResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -53,15 +53,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[TextToCadResultsPage, Error]]: ) -> Optional[Union[TextToCadResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = TextToCadResultsPage.from_dict(response.json()) response_200 = TextToCadResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -33,15 +33,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ApiCallWithPrice, Error]]: ) -> Optional[Union[ApiCallWithPrice, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiCallWithPrice.from_dict(response.json()) response_200 = ApiCallWithPrice(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -33,15 +33,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ApiCallWithPrice, Error]]: ) -> Optional[Union[ApiCallWithPrice, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiCallWithPrice.from_dict(response.json()) response_200 = ApiCallWithPrice(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -39,15 +39,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[List[ApiCallQueryGroup], Error]]: ) -> Optional[Union[List[ApiCallQueryGroup], Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = [ApiCallQueryGroup.from_dict(item) for item in response.json()] response_200 = [ApiCallQueryGroup(**item) for item in response.json()]
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -54,7 +54,7 @@ def _parse_response(
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
option_file_conversion = FileConversion.from_dict(data) option_file_conversion = FileConversion(**data)
return option_file_conversion return option_file_conversion
except ValueError: except ValueError:
pass pass
@ -63,7 +63,7 @@ def _parse_response(
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
option_file_center_of_mass = FileCenterOfMass.from_dict(data) option_file_center_of_mass = FileCenterOfMass(**data)
return option_file_center_of_mass return option_file_center_of_mass
except ValueError: except ValueError:
pass pass
@ -72,7 +72,7 @@ def _parse_response(
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
option_file_mass = FileMass.from_dict(data) option_file_mass = FileMass(**data)
return option_file_mass return option_file_mass
except ValueError: except ValueError:
pass pass
@ -81,7 +81,7 @@ def _parse_response(
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
option_file_volume = FileVolume.from_dict(data) option_file_volume = FileVolume(**data)
return option_file_volume return option_file_volume
except ValueError: except ValueError:
pass pass
@ -90,7 +90,7 @@ def _parse_response(
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
option_file_density = FileDensity.from_dict(data) option_file_density = FileDensity(**data)
return option_file_density return option_file_density
except ValueError: except ValueError:
pass pass
@ -99,7 +99,7 @@ def _parse_response(
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
option_file_surface_area = FileSurfaceArea.from_dict(data) option_file_surface_area = FileSurfaceArea(**data)
return option_file_surface_area return option_file_surface_area
except ValueError: except ValueError:
pass pass
@ -108,19 +108,19 @@ def _parse_response(
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
option_text_to_cad = TextToCad.from_dict(data) option_text_to_cad = TextToCad(**data)
return option_text_to_cad return option_text_to_cad
except ValueError: except ValueError:
raise raise
except TypeError: except TypeError:
raise raise
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -53,15 +53,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiCallWithPriceResultsPage.from_dict(response.json()) response_200 = ApiCallWithPriceResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -55,15 +55,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiCallWithPriceResultsPage.from_dict(response.json()) response_200 = ApiCallWithPriceResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -61,15 +61,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[AsyncApiCallResultsPage, Error]]: ) -> Optional[Union[AsyncApiCallResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = AsyncApiCallResultsPage.from_dict(response.json()) response_200 = AsyncApiCallResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -53,15 +53,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[ApiCallWithPriceResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiCallWithPriceResultsPage.from_dict(response.json()) response_200 = ApiCallWithPriceResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,15 +29,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = ApiToken.from_dict(response.json()) response_201 = ApiToken(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,12 +31,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -31,15 +31,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiToken.from_dict(response.json()) response_200 = ApiToken(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -53,15 +53,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ApiTokenResultsPage, Error]]: ) -> Optional[Union[ApiTokenResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiTokenResultsPage.from_dict(response.json()) response_200 = ApiTokenResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,12 +29,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -31,15 +31,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[AppClientInfo, Error]]: ) -> Optional[Union[AppClientInfo, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = AppClientInfo.from_dict(response.json()) response_200 = AppClientInfo(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,12 +31,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -33,7 +33,7 @@ def sync(
client=client, client=client,
) )
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"]) # type: ignore
async def asyncio( async def asyncio(

View File

@ -41,15 +41,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[CodeOutput, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[CodeOutput, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = CodeOutput.from_dict(response.json()) response_200 = CodeOutput(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -49,15 +49,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[FileCenterOfMass, Error]]: ) -> Optional[Union[FileCenterOfMass, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = FileCenterOfMass.from_dict(response.json()) response_201 = FileCenterOfMass(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -39,15 +39,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[FileConversion, Error]]: ) -> Optional[Union[FileConversion, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = FileConversion.from_dict(response.json()) response_201 = FileConversion(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -62,15 +62,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[FileDensity, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[FileDensity, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = FileDensity.from_dict(response.json()) response_201 = FileDensity(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -62,15 +62,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[FileMass, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[FileMass, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = FileMass.from_dict(response.json()) response_201 = FileMass(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -49,15 +49,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[FileSurfaceArea, Error]]: ) -> Optional[Union[FileSurfaceArea, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = FileSurfaceArea.from_dict(response.json()) response_201 = FileSurfaceArea(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -47,15 +47,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[FileVolume, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[FileVolume, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = FileVolume.from_dict(response.json()) response_201 = FileVolume(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -34,15 +34,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[VerificationToken, Error]]: ) -> Optional[Union[VerificationToken, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = VerificationToken.from_dict(response.json()) response_201 = VerificationToken(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -50,12 +50,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -29,12 +29,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -31,15 +31,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[AiPluginManifest, Error]]: ) -> Optional[Union[AiPluginManifest, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = AiPluginManifest.from_dict(response.json()) response_200 = AiPluginManifest(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,15 +29,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[Metadata, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Metadata, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = Metadata.from_dict(response.json()) response_200 = Metadata(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,12 +31,12 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]
response_200 = response.json() response_200 = response.json()
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,12 +31,12 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]
response_200 = response.json() response_200 = response.json()
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,15 +31,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[ApiToken, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ApiToken.from_dict(response.json()) response_200 = ApiToken(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,15 +29,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[Pong, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Pong, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = Pong.from_dict(response.json()) response_200 = Pong(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -82,7 +82,7 @@ def sync(
client=client, client=client,
) )
return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"], close_timeout=None, compression=None, max_size=None) # type: ignore return ws_connect(kwargs["url"].replace("http", "ws"), additional_headers=kwargs["headers"]) # type: ignore
async def asyncio( async def asyncio(
@ -153,20 +153,20 @@ class WebSocket:
""" """
for message in self.ws: for message in self.ws:
yield WebSocketResponse.from_dict(json.loads(message)) yield WebSocketResponse(**json.loads(message))
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.to_dict())) self.ws.send(json.dumps(data.model_dump()))
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.BSON.encode(data.to_dict())) self.ws.send(bson.encode(data.model_dump()))
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()
return WebSocketResponse.from_dict(json.loads(message)) return WebSocketResponse(**json.loads(message))
def close(self): def close(self):
"""Close the websocket.""" """Close the websocket."""

View File

@ -32,15 +32,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = Customer.from_dict(response.json()) response_201 = Customer(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,15 +31,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[PaymentIntent, Error]]: ) -> Optional[Union[PaymentIntent, Error]]:
if response.status_code == 201: if response.status_code == 201:
response_201 = PaymentIntent.from_dict(response.json()) response_201 = PaymentIntent(**response.json())
return response_201 return response_201
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,12 +29,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -31,12 +31,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -31,15 +31,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[CustomerBalance, Error]]: ) -> Optional[Union[CustomerBalance, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = CustomerBalance.from_dict(response.json()) response_200 = CustomerBalance(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,15 +29,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = Customer.from_dict(response.json()) response_200 = Customer(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,15 +31,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[List[Invoice], Error]]: ) -> Optional[Union[List[Invoice], Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = [Invoice.from_dict(item) for item in response.json()] response_200 = [Invoice(**item) for item in response.json()]
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,15 +31,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[List[PaymentMethod], Error]]: ) -> Optional[Union[List[PaymentMethod], Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = [PaymentMethod.from_dict(item) for item in response.json()] response_200 = [PaymentMethod(**item) for item in response.json()]
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -32,15 +32,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Customer, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = Customer.from_dict(response.json()) response_200 = Customer(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,12 +29,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitAngleConversion, Error]]: ) -> Optional[Union[UnitAngleConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitAngleConversion.from_dict(response.json()) response_200 = UnitAngleConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitAreaConversion, Error]]: ) -> Optional[Union[UnitAreaConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitAreaConversion.from_dict(response.json()) response_200 = UnitAreaConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitCurrentConversion, Error]]: ) -> Optional[Union[UnitCurrentConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitCurrentConversion.from_dict(response.json()) response_200 = UnitCurrentConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitEnergyConversion, Error]]: ) -> Optional[Union[UnitEnergyConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitEnergyConversion.from_dict(response.json()) response_200 = UnitEnergyConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitForceConversion, Error]]: ) -> Optional[Union[UnitForceConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitForceConversion.from_dict(response.json()) response_200 = UnitForceConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitFrequencyConversion, Error]]: ) -> Optional[Union[UnitFrequencyConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitFrequencyConversion.from_dict(response.json()) response_200 = UnitFrequencyConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitLengthConversion, Error]]: ) -> Optional[Union[UnitLengthConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitLengthConversion.from_dict(response.json()) response_200 = UnitLengthConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitMassConversion, Error]]: ) -> Optional[Union[UnitMassConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitMassConversion.from_dict(response.json()) response_200 = UnitMassConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitPowerConversion, Error]]: ) -> Optional[Union[UnitPowerConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitPowerConversion.from_dict(response.json()) response_200 = UnitPowerConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitPressureConversion, Error]]: ) -> Optional[Union[UnitPressureConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitPressureConversion.from_dict(response.json()) response_200 = UnitPressureConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitTemperatureConversion, Error]]: ) -> Optional[Union[UnitTemperatureConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitTemperatureConversion.from_dict(response.json()) response_200 = UnitTemperatureConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitTorqueConversion, Error]]: ) -> Optional[Union[UnitTorqueConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitTorqueConversion.from_dict(response.json()) response_200 = UnitTorqueConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -43,15 +43,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UnitVolumeConversion, Error]]: ) -> Optional[Union[UnitVolumeConversion, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UnitVolumeConversion.from_dict(response.json()) response_200 = UnitVolumeConversion(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,12 +29,12 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Error]: def _parse_response(*, response: httpx.Response) -> Optional[Error]:
return None return None
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]: def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:

View File

@ -31,15 +31,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[Session, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Session, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = Session.from_dict(response.json()) response_200 = Session(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,15 +31,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[User, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[User, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = User.from_dict(response.json()) response_200 = User(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -33,15 +33,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ExtendedUser, Error]]: ) -> Optional[Union[ExtendedUser, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ExtendedUser.from_dict(response.json()) response_200 = ExtendedUser(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,12 +31,12 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[str, Error]]:
response_200 = response.text response_200 = response.text
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,15 +29,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[Onboarding, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Onboarding, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = Onboarding.from_dict(response.json()) response_200 = Onboarding(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -29,15 +29,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[User, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[User, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = User.from_dict(response.json()) response_200 = User(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -31,15 +31,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ExtendedUser, Error]]: ) -> Optional[Union[ExtendedUser, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ExtendedUser.from_dict(response.json()) response_200 = ExtendedUser(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -53,15 +53,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[UserResultsPage, Error]]: ) -> Optional[Union[UserResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = UserResultsPage.from_dict(response.json()) response_200 = UserResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -53,15 +53,15 @@ def _parse_response(
*, response: httpx.Response *, response: httpx.Response
) -> Optional[Union[ExtendedUserResultsPage, Error]]: ) -> Optional[Union[ExtendedUserResultsPage, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = ExtendedUserResultsPage.from_dict(response.json()) response_200 = ExtendedUserResultsPage(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -32,15 +32,15 @@ def _get_kwargs(
def _parse_response(*, response: httpx.Response) -> Optional[Union[User, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[User, Error]]:
if response.status_code == 200: if response.status_code == 200:
response_200 = User.from_dict(response.json()) response_200 = User(**response.json())
return response_200 return response_200
if response.status_code == 400: if response.status_code == 400:
response_4XX = Error.from_dict(response.json()) response_4XX = Error(**response.json())
return response_4XX return response_4XX
if response.status_code == 500: if response.status_code == 500:
response_5XX = Error.from_dict(response.json()) response_5XX = Error(**response.json())
return response_5XX return response_5XX
return Error.from_dict(response.json()) return Error(**response.json())
def _build_response( def _build_response(

View File

@ -1,7 +1,7 @@
import json import json
import os import os
import uuid import uuid
from typing import Dict, Optional, Union from typing import Optional, Union, cast
import pytest import pytest
@ -14,25 +14,41 @@ from .client import ClientFromEnv
from .models import ( from .models import (
ApiCallStatus, ApiCallStatus,
ApiTokenResultsPage, ApiTokenResultsPage,
Base64Data, Axis,
AxisDirectionPair,
CreatedAtSortMode, CreatedAtSortMode,
Direction,
Error, Error,
ExtendedUserResultsPage, ExtendedUserResultsPage,
FailureWebSocketResponse,
FileConversion, FileConversion,
FileExportFormat, FileExportFormat,
FileImportFormat, FileImportFormat,
FileMass, FileMass,
FileVolume, FileVolume,
ImageFormat,
ImportFile,
InputFormat,
ModelingCmd, ModelingCmd,
ModelingCmdId, ModelingCmdId,
Pong, Pong,
SuccessWebSocketResponse,
System,
UnitDensity, UnitDensity,
UnitLength,
UnitMass, UnitMass,
UnitVolume, UnitVolume,
User, User,
WebSocketRequest, WebSocketRequest,
) )
from .models.modeling_cmd import start_path from .models.input_format import obj
from .models.modeling_cmd import (
default_camera_focus_on,
import_files,
start_path,
take_snapshot,
)
from .models.ok_web_socket_response_data import modeling
from .models.web_socket_request import modeling_cmd_req from .models.web_socket_request import modeling_cmd_req
from .types import Unset from .types import Unset
@ -131,11 +147,11 @@ def test_file_convert_stl():
print(f"FileConversion: {fc}") print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset) assert not isinstance(fc.outputs, Unset)
assert fc.outputs is not None
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty. # Make sure the bytes are not empty.
for key, value in outputs.items(): for key, value in fc.outputs.items():
assert len(value.get_decoded()) > 0 assert len(value) > 0
@pytest.mark.asyncio @pytest.mark.asyncio
@ -170,11 +186,11 @@ async def test_file_convert_stl_async():
print(f"FileConversion: {fc}") print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset) assert not isinstance(fc.outputs, Unset)
assert fc.outputs is not None
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty. # Make sure the bytes are not empty.
for key, value in outputs.items(): for key, value in fc.outputs.items():
assert len(value.get_decoded()) > 0 assert len(value) > 0
@pytest.mark.asyncio @pytest.mark.asyncio
@ -209,11 +225,11 @@ async def test_file_convert_obj_async():
print(f"FileConversion: {fc}") print(f"FileConversion: {fc}")
assert not isinstance(fc.outputs, Unset) assert not isinstance(fc.outputs, Unset)
assert fc.outputs is not None
outputs: Dict[str, Base64Data] = fc.outputs
# Make sure the bytes are not empty. # Make sure the bytes are not empty.
for key, value in outputs.items(): for key, value in fc.outputs.items():
assert len(value.get_decoded()) > 0 assert len(value) > 0
def test_file_mass(): def test_file_mass():
@ -244,7 +260,7 @@ def test_file_mass():
assert fm.id is not None assert fm.id is not None
assert fm.mass is not None assert fm.mass is not None
assert fm.to_dict() is not None assert fm.model_dump_json() is not None
assert fm.status == ApiCallStatus.COMPLETED assert fm.status == ApiCallStatus.COMPLETED
@ -275,7 +291,7 @@ def test_file_volume():
assert fv.id is not None assert fv.id is not None
assert fv.volume is not None assert fv.volume is not None
assert fv.to_dict() is not None assert fv.model_dump_json() is not None
assert fv.status == ApiCallStatus.COMPLETED assert fv.status == ApiCallStatus.COMPLETED
@ -311,11 +327,98 @@ def test_ws():
req = WebSocketRequest( req = WebSocketRequest(
modeling_cmd_req(cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(id)) modeling_cmd_req(cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(id))
) )
json.dumps(req.to_dict())
websocket.send(req) websocket.send(req)
# Get the messages. # Get the messages.
while True: while True:
message = websocket.recv() message = websocket.recv()
print(json.dumps(message.to_dict())) print(json.dumps(message.model_dump_json()))
break break
def test_ws_import():
# Create our client.
client = ClientFromEnv()
# Connect to the websocket.
with modeling_commands_ws.WebSocket(
client=client,
fps=30,
unlocked_framerate=False,
video_res_height=360,
video_res_width=480,
webrtc=False,
) as websocket:
# read the content of the file
dir_path = os.path.dirname(os.path.realpath(__file__))
file_name = "ORIGINALVOXEL-3.obj"
file = open(os.path.join(dir_path, "..", "assets", file_name), "rb")
content = file.read()
file.close()
cmd_id = uuid.uuid4()
ImportFile(data=content, path=file_name)
# form the request
req = WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(
import_files(
files=[ImportFile(data=content, path=file_name)],
format=InputFormat(
obj(
units=UnitLength.MM,
coords=System(
forward=AxisDirectionPair(
axis=Axis.Y, direction=Direction.NEGATIVE
),
up=AxisDirectionPair(
axis=Axis.Z, direction=Direction.POSITIVE
),
),
)
),
)
),
cmd_id=ModelingCmdId(cmd_id),
)
)
# Import files request must be sent as binary, because the file contents might be binary.
websocket.send_binary(req)
# Get the success message.
message = websocket.recv()
if isinstance(message, FailureWebSocketResponse):
raise Exception(message)
elif isinstance(message, SuccessWebSocketResponse):
response = cast(SuccessWebSocketResponse, message)
resp = cast(modeling, response.resp)
print(json.dumps(resp.model_dump_json()))
# Get the object id from the response.
# TODO: FIX
object_id = uuid.uuid4()
# Now we want to focus on the object.
cmd_id = uuid.uuid4()
# form the request
req = WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(default_camera_focus_on(uuid=object_id)),
cmd_id=ModelingCmdId(cmd_id),
)
)
websocket.send(req)
# Get the success message.
message = websocket.recv()
print(json.dumps(message.model_dump_json()))
# Now we want to snapshot as a png.
cmd_id = uuid.uuid4()
# form the request
# form the request
req = WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(take_snapshot(format=ImageFormat.PNG)),
cmd_id=ModelingCmdId(cmd_id),
)
)
websocket.send(req)

View File

@ -3854,16 +3854,15 @@ def test_create_executor_term():
client = ClientFromEnv() client = ClientFromEnv()
# Connect to the websocket. # Connect to the websocket.
websocket = create_executor_term.sync( with create_executor_term.sync(
client=client, client=client,
) ) as websocket:
# Send a message.
websocket.send("{}")
# Send a message. # Get the messages.
websocket.send("{}") for message in websocket:
print(message)
# Get the messages.
for message in websocket:
print(message)
# OR run async # OR run async
@ -3892,30 +3891,29 @@ def test_modeling_commands_ws():
client = ClientFromEnv() client = ClientFromEnv()
# Connect to the websocket. # Connect to the websocket.
websocket = modeling_commands_ws.WebSocket( with modeling_commands_ws.WebSocket(
client=client, client=client,
fps=10, fps=10,
unlocked_framerate=False, unlocked_framerate=False,
video_res_height=10, video_res_height=10,
video_res_width=10, video_res_width=10,
webrtc=False, webrtc=False,
) ) as websocket:
# Send a message.
# Send a message. websocket.send(
websocket.send( WebSocketRequest(
WebSocketRequest( sdp_offer(
sdp_offer( offer=RtcSessionDescription(
offer=RtcSessionDescription( sdp="<string>",
sdp="<string>", type=RtcSdpType.UNSPECIFIED,
type=RtcSdpType.UNSPECIFIED, ),
), )
) )
) )
)
# Get a message. # Get a message.
message = websocket.recv() message = websocket.recv()
print(message) print(message)
# OR run async # OR run async

View File

@ -34,7 +34,6 @@ from .async_api_call_results_page import AsyncApiCallResultsPage
from .async_api_call_type import AsyncApiCallType from .async_api_call_type import AsyncApiCallType
from .axis import Axis from .axis import Axis
from .axis_direction_pair import AxisDirectionPair from .axis_direction_pair import AxisDirectionPair
from .base64data import Base64Data
from .billing_info import BillingInfo from .billing_info import BillingInfo
from .cache_metadata import CacheMetadata from .cache_metadata import CacheMetadata
from .camera_drag_interaction_type import CameraDragInteractionType from .camera_drag_interaction_type import CameraDragInteractionType

View File

@ -1,79 +1,15 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Optional
import attr from pydantic import BaseModel
from ..models.ai_plugin_api_type import AiPluginApiType from ..models.ai_plugin_api_type import AiPluginApiType
from ..types import UNSET, Unset
SB = TypeVar("SB", bound="AiPluginApi")
@attr.s(auto_attribs=True) class AiPluginApi(BaseModel):
class AiPluginApi: """AI plugin api information."""
"""AI plugin api information.""" # noqa: E501
is_user_authenticated: Union[Unset, bool] = False is_user_authenticated: Optional[bool] = None
type: Union[Unset, AiPluginApiType] = UNSET
url: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) type: Optional[AiPluginApiType] = None
def to_dict(self) -> Dict[str, Any]: url: str
is_user_authenticated = self.is_user_authenticated
type: Union[Unset, AiPluginApiType] = UNSET
if not isinstance(self.type, Unset):
type = self.type
url = self.url
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if is_user_authenticated is not UNSET:
field_dict["is_user_authenticated"] = is_user_authenticated
if type is not UNSET:
field_dict["type"] = type
if url is not UNSET:
field_dict["url"] = url
return field_dict
@classmethod
def from_dict(cls: Type[SB], src_dict: Dict[str, Any]) -> SB:
d = src_dict.copy()
is_user_authenticated = d.pop("is_user_authenticated", UNSET)
_type = d.pop("type", UNSET)
type: Union[Unset, AiPluginApiType]
if isinstance(_type, Unset):
type = UNSET
if _type is None:
type = UNSET
else:
type = _type
url = d.pop("url", UNSET)
ai_plugin_api = cls(
is_user_authenticated=is_user_authenticated,
type=type,
url=url,
)
ai_plugin_api.additional_properties = d
return ai_plugin_api
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,82 +1,14 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Optional
import attr from pydantic import BaseModel
from ..models.ai_plugin_auth_type import AiPluginAuthType from ..models.ai_plugin_auth_type import AiPluginAuthType
from ..models.ai_plugin_http_auth_type import AiPluginHttpAuthType from ..models.ai_plugin_http_auth_type import AiPluginHttpAuthType
from ..types import UNSET, Unset
NP = TypeVar("NP", bound="AiPluginAuth")
@attr.s(auto_attribs=True) class AiPluginAuth(BaseModel):
class AiPluginAuth: """AI plugin auth information."""
"""AI plugin auth information.""" # noqa: E501
authorization_type: Union[Unset, AiPluginHttpAuthType] = UNSET authorization_type: Optional[AiPluginHttpAuthType] = None
type: Union[Unset, AiPluginAuthType] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) type: Optional[AiPluginAuthType] = None
def to_dict(self) -> Dict[str, Any]:
authorization_type: Union[Unset, AiPluginHttpAuthType] = UNSET
if not isinstance(self.authorization_type, Unset):
authorization_type = self.authorization_type
type: Union[Unset, AiPluginAuthType] = UNSET
if not isinstance(self.type, Unset):
type = self.type
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if authorization_type is not UNSET:
field_dict["authorization_type"] = authorization_type
if type is not UNSET:
field_dict["type"] = type
return field_dict
@classmethod
def from_dict(cls: Type[NP], src_dict: Dict[str, Any]) -> NP:
d = src_dict.copy()
_authorization_type = d.pop("authorization_type", UNSET)
authorization_type: Union[Unset, AiPluginHttpAuthType]
if isinstance(_authorization_type, Unset):
authorization_type = UNSET
if _authorization_type is None:
authorization_type = UNSET
else:
authorization_type = _authorization_type
_type = d.pop("type", UNSET)
type: Union[Unset, AiPluginAuthType]
if isinstance(_type, Unset):
type = UNSET
if _type is None:
type = UNSET
else:
type = _type
ai_plugin_auth = cls(
authorization_type=authorization_type,
type=type,
)
ai_plugin_auth.additional_properties = d
return ai_plugin_auth
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,143 +1,33 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast from typing import Optional
import attr from pydantic import BaseModel
from ..models.ai_plugin_api import AiPluginApi from ..models.ai_plugin_api import AiPluginApi
from ..models.ai_plugin_auth import AiPluginAuth from ..models.ai_plugin_auth import AiPluginAuth
from ..types import UNSET, Unset
SA = TypeVar("SA", bound="AiPluginManifest")
@attr.s(auto_attribs=True) class AiPluginManifest(BaseModel):
class AiPluginManifest:
"""AI plugin manifest. """AI plugin manifest.
This is used for OpenAI's ChatGPT plugins. You can read more about them [here](https://platform.openai.com/docs/plugins/getting-started/plugin-manifest). This is used for OpenAI's ChatGPT plugins. You can read more about them [here](https://platform.openai.com/docs/plugins/getting-started/plugin-manifest).
""" # noqa: E501 """
api: Union[Unset, AiPluginApi] = UNSET api: AiPluginApi
auth: Union[Unset, AiPluginAuth] = UNSET
contact_email: Union[Unset, str] = UNSET
description_for_human: Union[Unset, str] = UNSET
description_for_model: Union[Unset, str] = UNSET
legal_info_url: Union[Unset, str] = UNSET
logo_url: Union[Unset, str] = UNSET
name_for_human: Union[Unset, str] = UNSET
name_for_model: Union[Unset, str] = UNSET
schema_version: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) auth: AiPluginAuth
def to_dict(self) -> Dict[str, Any]: contact_email: Optional[str] = None
api: Union[Unset, AiPluginApi] = UNSET
if not isinstance(self.api, Unset):
api = self.api
auth: Union[Unset, AiPluginAuth] = UNSET
if not isinstance(self.auth, Unset):
auth = self.auth
contact_email = self.contact_email
description_for_human = self.description_for_human
description_for_model = self.description_for_model
legal_info_url = self.legal_info_url
logo_url = self.logo_url
name_for_human = self.name_for_human
name_for_model = self.name_for_model
schema_version = self.schema_version
field_dict: Dict[str, Any] = {} description_for_human: Optional[str] = None
field_dict.update(self.additional_properties)
field_dict.update({})
if api is not UNSET:
_api: AiPluginApi = cast(AiPluginApi, api)
field_dict["api"] = _api.to_dict()
if auth is not UNSET:
_auth: AiPluginAuth = cast(AiPluginAuth, auth)
field_dict["auth"] = _auth.to_dict()
if contact_email is not UNSET:
field_dict["contact_email"] = contact_email
if description_for_human is not UNSET:
field_dict["description_for_human"] = description_for_human
if description_for_model is not UNSET:
field_dict["description_for_model"] = description_for_model
if legal_info_url is not UNSET:
field_dict["legal_info_url"] = legal_info_url
if logo_url is not UNSET:
field_dict["logo_url"] = logo_url
if name_for_human is not UNSET:
field_dict["name_for_human"] = name_for_human
if name_for_model is not UNSET:
field_dict["name_for_model"] = name_for_model
if schema_version is not UNSET:
field_dict["schema_version"] = schema_version
return field_dict description_for_model: Optional[str] = None
@classmethod legal_info_url: str
def from_dict(cls: Type[SA], src_dict: Dict[str, Any]) -> SA:
d = src_dict.copy()
_api = d.pop("api", UNSET)
api: Union[Unset, AiPluginApi]
if isinstance(_api, Unset):
api = UNSET
if _api is None:
api = UNSET
else:
api = AiPluginApi.from_dict(_api)
_auth = d.pop("auth", UNSET) logo_url: str
auth: Union[Unset, AiPluginAuth]
if isinstance(_auth, Unset):
auth = UNSET
if _auth is None:
auth = UNSET
else:
auth = AiPluginAuth.from_dict(_auth)
contact_email = d.pop("contact_email", UNSET) name_for_human: Optional[str] = None
description_for_human = d.pop("description_for_human", UNSET) name_for_model: Optional[str] = None
description_for_model = d.pop("description_for_model", UNSET) schema_version: Optional[str] = None
legal_info_url = d.pop("legal_info_url", UNSET)
logo_url = d.pop("logo_url", UNSET)
name_for_human = d.pop("name_for_human", UNSET)
name_for_model = d.pop("name_for_model", UNSET)
schema_version = d.pop("schema_version", UNSET)
ai_plugin_manifest = cls(
api=api,
auth=auth,
contact_email=contact_email,
description_for_human=description_for_human,
description_for_model=description_for_model,
legal_info_url=legal_info_url,
logo_url=logo_url,
name_for_human=name_for_human,
name_for_model=name_for_model,
schema_version=schema_version,
)
ai_plugin_manifest.additional_properties = d
return ai_plugin_manifest
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,223 +1,42 @@
import datetime import datetime
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Any, Optional
import attr from pydantic import BaseModel
from dateutil.parser import isoparse
from ..models.ai_feedback import AiFeedback from ..models.ai_feedback import AiFeedback
from ..models.ai_prompt_type import AiPromptType from ..models.ai_prompt_type import AiPromptType
from ..models.api_call_status import ApiCallStatus from ..models.api_call_status import ApiCallStatus
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..models.uuid_binary import UuidBinary from ..models.uuid_binary import UuidBinary
from ..types import UNSET, Unset
GO = TypeVar("GO", bound="AiPrompt")
@attr.s(auto_attribs=True) class AiPrompt(BaseModel):
class AiPrompt: """An AI prompt."""
"""An AI prompt.""" # noqa: E501
completed_at: Union[Unset, datetime.datetime] = UNSET completed_at: Optional[datetime.datetime] = None
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
feedback: Union[Unset, AiFeedback] = UNSET
id: Union[Unset, UuidBinary] = UNSET
metadata: Union[Unset, Any] = UNSET
model_version: Union[Unset, str] = UNSET
output_file: Union[Unset, str] = UNSET
prompt: Union[Unset, str] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET
type: Union[Unset, AiPromptType] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) created_at: datetime.datetime
def to_dict(self) -> Dict[str, Any]: error: Optional[str] = None
completed_at: Union[Unset, str] = UNSET
if not isinstance(self.completed_at, Unset):
completed_at = self.completed_at.isoformat()
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
error = self.error
feedback: Union[Unset, AiFeedback] = UNSET
if not isinstance(self.feedback, Unset):
feedback = self.feedback
id: Union[Unset, UuidBinary] = UNSET
if not isinstance(self.id, Unset):
id = self.id
metadata = self.metadata
model_version = self.model_version
output_file = self.output_file
prompt = self.prompt
started_at: Union[Unset, str] = UNSET
if not isinstance(self.started_at, Unset):
started_at = self.started_at.isoformat()
status: Union[Unset, ApiCallStatus] = UNSET
if not isinstance(self.status, Unset):
status = self.status
type: Union[Unset, AiPromptType] = UNSET
if not isinstance(self.type, Unset):
type = self.type
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
field_dict: Dict[str, Any] = {} feedback: Optional[AiFeedback] = None
field_dict.update(self.additional_properties)
field_dict.update({})
if completed_at is not UNSET:
field_dict["completed_at"] = completed_at
if created_at is not UNSET:
field_dict["created_at"] = created_at
if error is not UNSET:
field_dict["error"] = error
if feedback is not UNSET:
field_dict["feedback"] = feedback
if id is not UNSET:
field_dict["id"] = id
if metadata is not UNSET:
field_dict["metadata"] = metadata
if model_version is not UNSET:
field_dict["model_version"] = model_version
if output_file is not UNSET:
field_dict["output_file"] = output_file
if prompt is not UNSET:
field_dict["prompt"] = prompt
if started_at is not UNSET:
field_dict["started_at"] = started_at
if status is not UNSET:
field_dict["status"] = status
if type is not UNSET:
field_dict["type"] = type
if updated_at is not UNSET:
field_dict["updated_at"] = updated_at
if user_id is not UNSET:
field_dict["user_id"] = user_id
return field_dict id: UuidBinary
@classmethod metadata: Optional[Any] = None
def from_dict(cls: Type[GO], src_dict: Dict[str, Any]) -> GO:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
if isinstance(_completed_at, Unset):
completed_at = UNSET
else:
completed_at = isoparse(_completed_at)
_created_at = d.pop("created_at", UNSET) model_version: str
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
error = d.pop("error", UNSET) output_file: Optional[str] = None
_feedback = d.pop("feedback", UNSET) prompt: str
feedback: Union[Unset, AiFeedback]
if isinstance(_feedback, Unset):
feedback = UNSET
if _feedback is None:
feedback = UNSET
else:
feedback = _feedback
_id = d.pop("id", UNSET) started_at: Optional[datetime.datetime] = None
id: Union[Unset, UuidBinary]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id
metadata = d.pop("metadata", UNSET) status: ApiCallStatus
model_version = d.pop("model_version", UNSET)
output_file = d.pop("output_file", UNSET) type: AiPromptType
prompt = d.pop("prompt", UNSET) updated_at: datetime.datetime
_started_at = d.pop("started_at", UNSET) user_id: Uuid
started_at: Union[Unset, datetime.datetime]
if isinstance(_started_at, Unset):
started_at = UNSET
else:
started_at = isoparse(_started_at)
_status = d.pop("status", UNSET)
status: Union[Unset, ApiCallStatus]
if isinstance(_status, Unset):
status = UNSET
if _status is None:
status = UNSET
else:
status = _status
_type = d.pop("type", UNSET)
type: Union[Unset, AiPromptType]
if isinstance(_type, Unset):
type = UNSET
if _type is None:
type = UNSET
else:
type = _type
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
ai_prompt = cls(
completed_at=completed_at,
created_at=created_at,
error=error,
feedback=feedback,
id=id,
metadata=metadata,
model_version=model_version,
output_file=output_file,
prompt=prompt,
started_at=started_at,
status=status,
type=type,
updated_at=updated_at,
user_id=user_id,
)
ai_prompt.additional_properties = d
return ai_prompt
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,70 +1,13 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast from typing import List, Optional
import attr from pydantic import BaseModel
from ..types import UNSET, Unset from ..models.ai_prompt import AiPrompt
PI = TypeVar("PI", bound="AiPromptResultsPage")
@attr.s(auto_attribs=True) class AiPromptResultsPage(BaseModel):
class AiPromptResultsPage: """A single page of results"""
"""A single page of results""" # noqa: E501
from ..models.ai_prompt import AiPrompt items: List[AiPrompt]
items: Union[Unset, List[AiPrompt]] = UNSET next_page: Optional[str] = None
next_page: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.ai_prompt import AiPrompt
items: Union[Unset, List[AiPrompt]] = UNSET
if not isinstance(self.items, Unset):
items = self.items
next_page = self.next_page
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if items is not UNSET:
field_dict["items"] = items
if next_page is not UNSET:
field_dict["next_page"] = next_page
return field_dict
@classmethod
def from_dict(cls: Type[PI], src_dict: Dict[str, Any]) -> PI:
d = src_dict.copy()
from ..models.ai_prompt import AiPrompt
items = cast(List[AiPrompt], d.pop("items", UNSET))
next_page = d.pop("next_page", UNSET)
ai_prompt_results_page = cls(
items=items,
next_page=next_page,
)
ai_prompt_results_page.additional_properties = d
return ai_prompt_results_page
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,72 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr from pydantic import BaseModel
from ..models.unit_angle import UnitAngle from ..models.unit_angle import UnitAngle
from ..types import UNSET, Unset
UZ = TypeVar("UZ", bound="Angle")
@attr.s(auto_attribs=True) class Angle(BaseModel):
class Angle: """An angle, with a specific unit."""
"""An angle, with a specific unit.""" # noqa: E501
unit: Union[Unset, UnitAngle] = UNSET unit: UnitAngle
value: Union[Unset, float] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) value: float
def to_dict(self) -> Dict[str, Any]:
unit: Union[Unset, UnitAngle] = UNSET
if not isinstance(self.unit, Unset):
unit = self.unit
value = self.value
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if unit is not UNSET:
field_dict["unit"] = unit
if value is not UNSET:
field_dict["value"] = value
return field_dict
@classmethod
def from_dict(cls: Type[UZ], src_dict: Dict[str, Any]) -> UZ:
d = src_dict.copy()
_unit = d.pop("unit", UNSET)
unit: Union[Unset, UnitAngle]
if isinstance(_unit, Unset):
unit = UNSET
if _unit is None:
unit = UNSET
else:
unit = _unit
value = d.pop("value", UNSET)
angle = cls(
unit=unit,
value=value,
)
angle.additional_properties = d
return angle
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,81 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr from pydantic import BaseModel
from ..models.annotation_line_end import AnnotationLineEnd from ..models.annotation_line_end import AnnotationLineEnd
from ..types import UNSET, Unset
FB = TypeVar("FB", bound="AnnotationLineEndOptions")
@attr.s(auto_attribs=True) class AnnotationLineEndOptions(BaseModel):
class AnnotationLineEndOptions: """Options for annotation text"""
"""Options for annotation text""" # noqa: E501
end: Union[Unset, AnnotationLineEnd] = UNSET end: AnnotationLineEnd
start: Union[Unset, AnnotationLineEnd] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) start: AnnotationLineEnd
def to_dict(self) -> Dict[str, Any]:
end: Union[Unset, AnnotationLineEnd] = UNSET
if not isinstance(self.end, Unset):
end = self.end
start: Union[Unset, AnnotationLineEnd] = UNSET
if not isinstance(self.start, Unset):
start = self.start
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if end is not UNSET:
field_dict["end"] = end
if start is not UNSET:
field_dict["start"] = start
return field_dict
@classmethod
def from_dict(cls: Type[FB], src_dict: Dict[str, Any]) -> FB:
d = src_dict.copy()
_end = d.pop("end", UNSET)
end: Union[Unset, AnnotationLineEnd]
if isinstance(_end, Unset):
end = UNSET
if _end is None:
end = UNSET
else:
end = _end
_start = d.pop("start", UNSET)
start: Union[Unset, AnnotationLineEnd]
if isinstance(_start, Unset):
start = UNSET
if _start is None:
start = UNSET
else:
start = _start
annotation_line_end_options = cls(
end=end,
start=start,
)
annotation_line_end_options.additional_properties = d
return annotation_line_end_options
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,129 +1,22 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast from typing import Optional
import attr from pydantic import BaseModel
from ..models.annotation_line_end_options import AnnotationLineEndOptions from ..models.annotation_line_end_options import AnnotationLineEndOptions
from ..models.annotation_text_options import AnnotationTextOptions from ..models.annotation_text_options import AnnotationTextOptions
from ..models.color import Color from ..models.color import Color
from ..models.point3d import Point3d from ..models.point3d import Point3d
from ..types import UNSET, Unset
QP = TypeVar("QP", bound="AnnotationOptions")
@attr.s(auto_attribs=True) class AnnotationOptions(BaseModel):
class AnnotationOptions: """Options for annotations"""
"""Options for annotations""" # noqa: E501
color: Union[Unset, Color] = UNSET color: Optional[Color] = None
line_ends: Union[Unset, AnnotationLineEndOptions] = UNSET
line_width: Union[Unset, float] = UNSET
position: Union[Unset, Point3d] = UNSET
text: Union[Unset, AnnotationTextOptions] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) line_ends: Optional[AnnotationLineEndOptions] = None
def to_dict(self) -> Dict[str, Any]: line_width: Optional[float] = None
color: Union[Unset, Color] = UNSET
if not isinstance(self.color, Unset):
color = self.color
line_ends: Union[Unset, AnnotationLineEndOptions] = UNSET
if not isinstance(self.line_ends, Unset):
line_ends = self.line_ends
line_width = self.line_width
position: Union[Unset, Point3d] = UNSET
if not isinstance(self.position, Unset):
position = self.position
text: Union[Unset, AnnotationTextOptions] = UNSET
if not isinstance(self.text, Unset):
text = self.text
field_dict: Dict[str, Any] = {} position: Optional[Point3d] = None
field_dict.update(self.additional_properties)
field_dict.update({})
if color is not UNSET:
_color: Color = cast(Color, color)
field_dict["color"] = _color.to_dict()
if line_ends is not UNSET:
_line_ends: AnnotationLineEndOptions = cast(
AnnotationLineEndOptions, line_ends
)
field_dict["line_ends"] = _line_ends.to_dict()
if line_width is not UNSET:
field_dict["line_width"] = line_width
if position is not UNSET:
_position: Point3d = cast(Point3d, position)
field_dict["position"] = _position.to_dict()
if text is not UNSET:
_text: AnnotationTextOptions = cast(AnnotationTextOptions, text)
field_dict["text"] = _text.to_dict()
return field_dict text: Optional[AnnotationTextOptions] = None
@classmethod
def from_dict(cls: Type[QP], src_dict: Dict[str, Any]) -> QP:
d = src_dict.copy()
_color = d.pop("color", UNSET)
color: Union[Unset, Color]
if isinstance(_color, Unset):
color = UNSET
if _color is None:
color = UNSET
else:
color = Color.from_dict(_color)
_line_ends = d.pop("line_ends", UNSET)
line_ends: Union[Unset, AnnotationLineEndOptions]
if isinstance(_line_ends, Unset):
line_ends = UNSET
if _line_ends is None:
line_ends = UNSET
else:
line_ends = AnnotationLineEndOptions.from_dict(_line_ends)
line_width = d.pop("line_width", UNSET)
_position = d.pop("position", UNSET)
position: Union[Unset, Point3d]
if isinstance(_position, Unset):
position = UNSET
if _position is None:
position = UNSET
else:
position = Point3d.from_dict(_position)
_text = d.pop("text", UNSET)
text: Union[Unset, AnnotationTextOptions]
if isinstance(_text, Unset):
text = UNSET
if _text is None:
text = UNSET
else:
text = AnnotationTextOptions.from_dict(_text)
annotation_options = cls(
color=color,
line_ends=line_ends,
line_width=line_width,
position=position,
text=text,
)
annotation_options.additional_properties = d
return annotation_options
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,96 +1,17 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr from pydantic import BaseModel
from ..models.annotation_text_alignment_x import AnnotationTextAlignmentX from ..models.annotation_text_alignment_x import AnnotationTextAlignmentX
from ..models.annotation_text_alignment_y import AnnotationTextAlignmentY from ..models.annotation_text_alignment_y import AnnotationTextAlignmentY
from ..types import UNSET, Unset
KC = TypeVar("KC", bound="AnnotationTextOptions")
@attr.s(auto_attribs=True) class AnnotationTextOptions(BaseModel):
class AnnotationTextOptions: """Options for annotation text"""
"""Options for annotation text""" # noqa: E501
point_size: Union[Unset, int] = UNSET point_size: int
text: Union[Unset, str] = UNSET
x: Union[Unset, AnnotationTextAlignmentX] = UNSET
y: Union[Unset, AnnotationTextAlignmentY] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) text: str
def to_dict(self) -> Dict[str, Any]: x: AnnotationTextAlignmentX
point_size = self.point_size
text = self.text
x: Union[Unset, AnnotationTextAlignmentX] = UNSET
if not isinstance(self.x, Unset):
x = self.x
y: Union[Unset, AnnotationTextAlignmentY] = UNSET
if not isinstance(self.y, Unset):
y = self.y
field_dict: Dict[str, Any] = {} y: AnnotationTextAlignmentY
field_dict.update(self.additional_properties)
field_dict.update({})
if point_size is not UNSET:
field_dict["point_size"] = point_size
if text is not UNSET:
field_dict["text"] = text
if x is not UNSET:
field_dict["x"] = x
if y is not UNSET:
field_dict["y"] = y
return field_dict
@classmethod
def from_dict(cls: Type[KC], src_dict: Dict[str, Any]) -> KC:
d = src_dict.copy()
point_size = d.pop("point_size", UNSET)
text = d.pop("text", UNSET)
_x = d.pop("x", UNSET)
x: Union[Unset, AnnotationTextAlignmentX]
if isinstance(_x, Unset):
x = UNSET
if _x is None:
x = UNSET
else:
x = _x
_y = d.pop("y", UNSET)
y: Union[Unset, AnnotationTextAlignmentY]
if isinstance(_y, Unset):
y = UNSET
if _y is None:
y = UNSET
else:
y = _y
annotation_text_options = cls(
point_size=point_size,
text=text,
x=x,
y=y,
)
annotation_text_options.additional_properties = d
return annotation_text_options
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,62 +1,10 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr from pydantic import BaseModel
from ..types import UNSET, Unset
HX = TypeVar("HX", bound="ApiCallQueryGroup")
@attr.s(auto_attribs=True) class ApiCallQueryGroup(BaseModel):
class ApiCallQueryGroup: """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.""" # noqa: E501
count: Union[Unset, int] = UNSET count: int
query: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) query: str
def to_dict(self) -> Dict[str, Any]:
count = self.count
query = self.query
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if count is not UNSET:
field_dict["count"] = count
if query is not UNSET:
field_dict["query"] = query
return field_dict
@classmethod
def from_dict(cls: Type[HX], src_dict: Dict[str, Any]) -> HX:
d = src_dict.copy()
count = d.pop("count", UNSET)
query = d.pop("query", UNSET)
api_call_query_group = cls(
count=count,
query=query,
)
api_call_query_group.additional_properties = d
return api_call_query_group
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,266 +1,57 @@
import datetime import datetime
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Optional
import attr from pydantic import BaseModel
from dateutil.parser import isoparse
from ..models.method import Method from ..models.method import Method
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset
LB = TypeVar("LB", bound="ApiCallWithPrice")
@attr.s(auto_attribs=True) class ApiCallWithPrice(BaseModel):
class ApiCallWithPrice:
"""An API call with the price. """An API call with the price.
This is a join of the `ApiCall` and `ApiCallPrice` tables.""" # noqa: E501 This is a join of the `ApiCall` and `ApiCallPrice` tables."""
completed_at: Union[Unset, datetime.datetime] = UNSET completed_at: Optional[datetime.datetime] = None
created_at: Union[Unset, datetime.datetime] = UNSET
duration: Union[Unset, int] = UNSET
email: Union[Unset, str] = UNSET
endpoint: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
ip_address: Union[Unset, str] = UNSET
litterbox: Union[Unset, bool] = False
method: Union[Unset, Method] = UNSET
minutes: Union[Unset, int] = UNSET
origin: Union[Unset, str] = UNSET
price: Union[Unset, float] = UNSET
request_body: Union[Unset, str] = UNSET
request_query_params: Union[Unset, str] = UNSET
response_body: Union[Unset, str] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status_code: Union[Unset, int] = UNSET
stripe_invoice_item_id: Union[Unset, str] = UNSET
token: Union[Unset, str] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_agent: Union[Unset, str] = UNSET
user_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) created_at: datetime.datetime
def to_dict(self) -> Dict[str, Any]: duration: Optional[int] = None
completed_at: Union[Unset, str] = UNSET
if not isinstance(self.completed_at, Unset):
completed_at = self.completed_at.isoformat()
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
duration = self.duration
email = self.email
endpoint = self.endpoint
id = self.id
ip_address = self.ip_address
litterbox = self.litterbox
method: Union[Unset, Method] = UNSET
if not isinstance(self.method, Unset):
method = self.method
minutes = self.minutes
origin = self.origin
price = self.price
request_body = self.request_body
request_query_params = self.request_query_params
response_body = self.response_body
started_at: Union[Unset, str] = UNSET
if not isinstance(self.started_at, Unset):
started_at = self.started_at.isoformat()
status_code = self.status_code
stripe_invoice_item_id = self.stripe_invoice_item_id
token = self.token
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_agent = self.user_agent
user_id = self.user_id
field_dict: Dict[str, Any] = {} email: Optional[str] = None
field_dict.update(self.additional_properties)
field_dict.update({})
if completed_at is not UNSET:
field_dict["completed_at"] = completed_at
if created_at is not UNSET:
field_dict["created_at"] = created_at
if duration is not UNSET:
field_dict["duration"] = duration
if email is not UNSET:
field_dict["email"] = email
if endpoint is not UNSET:
field_dict["endpoint"] = endpoint
if id is not UNSET:
field_dict["id"] = id
if ip_address is not UNSET:
field_dict["ip_address"] = ip_address
if litterbox is not UNSET:
field_dict["litterbox"] = litterbox
if method is not UNSET:
field_dict["method"] = method
if minutes is not UNSET:
field_dict["minutes"] = minutes
if origin is not UNSET:
field_dict["origin"] = origin
if price is not UNSET:
field_dict["price"] = price
if request_body is not UNSET:
field_dict["request_body"] = request_body
if request_query_params is not UNSET:
field_dict["request_query_params"] = request_query_params
if response_body is not UNSET:
field_dict["response_body"] = response_body
if started_at is not UNSET:
field_dict["started_at"] = started_at
if status_code is not UNSET:
field_dict["status_code"] = status_code
if stripe_invoice_item_id is not UNSET:
field_dict["stripe_invoice_item_id"] = stripe_invoice_item_id
if token is not UNSET:
field_dict["token"] = token
if updated_at is not UNSET:
field_dict["updated_at"] = updated_at
if user_agent is not UNSET:
field_dict["user_agent"] = user_agent
if user_id is not UNSET:
field_dict["user_id"] = user_id
return field_dict endpoint: Optional[str] = None
@classmethod id: Uuid
def from_dict(cls: Type[LB], src_dict: Dict[str, Any]) -> LB:
d = src_dict.copy()
_completed_at = d.pop("completed_at", UNSET)
completed_at: Union[Unset, datetime.datetime]
if isinstance(_completed_at, Unset):
completed_at = UNSET
else:
completed_at = isoparse(_completed_at)
_created_at = d.pop("created_at", UNSET) ip_address: Optional[str] = None
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
duration = d.pop("duration", UNSET) litterbox: Optional[bool] = None
email = d.pop("email", UNSET) method: Method
endpoint = d.pop("endpoint", UNSET) minutes: Optional[int] = None
_id = d.pop("id", UNSET) origin: Optional[str] = None
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id
ip_address = d.pop("ip_address", UNSET) price: Optional[float] = None
litterbox = d.pop("litterbox", UNSET) request_body: Optional[str] = None
_method = d.pop("method", UNSET) request_query_params: Optional[str] = None
method: Union[Unset, Method]
if isinstance(_method, Unset):
method = UNSET
if _method is None:
method = UNSET
else:
method = _method
minutes = d.pop("minutes", UNSET) response_body: Optional[str] = None
origin = d.pop("origin", UNSET) started_at: Optional[datetime.datetime] = None
price = d.pop("price", UNSET) status_code: Optional[int] = None
request_body = d.pop("request_body", UNSET) stripe_invoice_item_id: Optional[str] = None
request_query_params = d.pop("request_query_params", UNSET) token: Uuid
response_body = d.pop("response_body", UNSET) updated_at: datetime.datetime
_started_at = d.pop("started_at", UNSET) user_agent: str
started_at: Union[Unset, datetime.datetime]
if isinstance(_started_at, Unset):
started_at = UNSET
else:
started_at = isoparse(_started_at)
status_code = d.pop("status_code", UNSET) user_id: Uuid
stripe_invoice_item_id = d.pop("stripe_invoice_item_id", UNSET)
_token = d.pop("token", UNSET)
token: Union[Unset, Uuid]
if isinstance(_token, Unset):
token = UNSET
if _token is None:
token = UNSET
else:
token = _token
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
user_agent = d.pop("user_agent", UNSET)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
api_call_with_price = cls(
completed_at=completed_at,
created_at=created_at,
duration=duration,
email=email,
endpoint=endpoint,
id=id,
ip_address=ip_address,
litterbox=litterbox,
method=method,
minutes=minutes,
origin=origin,
price=price,
request_body=request_body,
request_query_params=request_query_params,
response_body=response_body,
started_at=started_at,
status_code=status_code,
stripe_invoice_item_id=stripe_invoice_item_id,
token=token,
updated_at=updated_at,
user_agent=user_agent,
user_id=user_id,
)
api_call_with_price.additional_properties = d
return api_call_with_price
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,70 +1,13 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast from typing import List, Optional
import attr from pydantic import BaseModel
from ..types import UNSET, Unset from ..models.api_call_with_price import ApiCallWithPrice
NE = TypeVar("NE", bound="ApiCallWithPriceResultsPage")
@attr.s(auto_attribs=True) class ApiCallWithPriceResultsPage(BaseModel):
class ApiCallWithPriceResultsPage: """A single page of results"""
"""A single page of results""" # noqa: E501
from ..models.api_call_with_price import ApiCallWithPrice items: List[ApiCallWithPrice]
items: Union[Unset, List[ApiCallWithPrice]] = UNSET next_page: Optional[str] = None
next_page: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.api_call_with_price import ApiCallWithPrice
items: Union[Unset, List[ApiCallWithPrice]] = UNSET
if not isinstance(self.items, Unset):
items = self.items
next_page = self.next_page
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if items is not UNSET:
field_dict["items"] = items
if next_page is not UNSET:
field_dict["next_page"] = next_page
return field_dict
@classmethod
def from_dict(cls: Type[NE], src_dict: Dict[str, Any]) -> NE:
d = src_dict.copy()
from ..models.api_call_with_price import ApiCallWithPrice
items = cast(List[ApiCallWithPrice], d.pop("items", UNSET))
next_page = d.pop("next_page", UNSET)
api_call_with_price_results_page = cls(
items=items,
next_page=next_page,
)
api_call_with_price_results_page.additional_properties = d
return api_call_with_price_results_page
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,72 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr from pydantic import BaseModel
from ..models.error_code import ErrorCode from ..models.error_code import ErrorCode
from ..types import UNSET, Unset
TL = TypeVar("TL", bound="ApiError")
@attr.s(auto_attribs=True) class ApiError(BaseModel):
class ApiError: """An error."""
"""An error.""" # noqa: E501
error_code: Union[Unset, ErrorCode] = UNSET error_code: ErrorCode
message: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) message: str
def to_dict(self) -> Dict[str, Any]:
error_code: Union[Unset, ErrorCode] = UNSET
if not isinstance(self.error_code, Unset):
error_code = self.error_code
message = self.message
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if error_code is not UNSET:
field_dict["error_code"] = error_code
if message is not UNSET:
field_dict["message"] = message
return field_dict
@classmethod
def from_dict(cls: Type[TL], src_dict: Dict[str, Any]) -> TL:
d = src_dict.copy()
_error_code = d.pop("error_code", UNSET)
error_code: Union[Unset, ErrorCode]
if isinstance(_error_code, Unset):
error_code = UNSET
if _error_code is None:
error_code = UNSET
else:
error_code = _error_code
message = d.pop("message", UNSET)
api_error = cls(
error_code=error_code,
message=message,
)
api_error.additional_properties = d
return api_error
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,130 +1,23 @@
import datetime import datetime
from typing import Any, Dict, List, Type, TypeVar, Union
import attr from pydantic import BaseModel
from dateutil.parser import isoparse
from ..models.uuid import Uuid from ..models.uuid import Uuid
from ..types import UNSET, Unset
MN = TypeVar("MN", bound="ApiToken")
@attr.s(auto_attribs=True) class ApiToken(BaseModel):
class ApiToken:
"""An API token. """An API token.
These are used to authenticate users with Bearer authentication.""" # noqa: E501 These are used to authenticate users with Bearer authentication."""
created_at: Union[Unset, datetime.datetime] = UNSET created_at: datetime.datetime
id: Union[Unset, str] = UNSET
is_valid: Union[Unset, bool] = False
token: Union[Unset, str] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) id: Uuid
def to_dict(self) -> Dict[str, Any]: is_valid: bool
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
id = self.id
is_valid = self.is_valid
token = self.token
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
field_dict: Dict[str, Any] = {} token: Uuid
field_dict.update(self.additional_properties)
field_dict.update({})
if created_at is not UNSET:
field_dict["created_at"] = created_at
if id is not UNSET:
field_dict["id"] = id
if is_valid is not UNSET:
field_dict["is_valid"] = is_valid
if token is not UNSET:
field_dict["token"] = token
if updated_at is not UNSET:
field_dict["updated_at"] = updated_at
if user_id is not UNSET:
field_dict["user_id"] = user_id
return field_dict updated_at: datetime.datetime
@classmethod user_id: Uuid
def from_dict(cls: Type[MN], src_dict: Dict[str, Any]) -> MN:
d = src_dict.copy()
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
_id = d.pop("id", UNSET)
id: Union[Unset, Uuid]
if isinstance(_id, Unset):
id = UNSET
if _id is None:
id = UNSET
else:
id = _id
is_valid = d.pop("is_valid", UNSET)
_token = d.pop("token", UNSET)
token: Union[Unset, Uuid]
if isinstance(_token, Unset):
token = UNSET
if _token is None:
token = UNSET
else:
token = _token
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
_user_id = d.pop("user_id", UNSET)
user_id: Union[Unset, Uuid]
if isinstance(_user_id, Unset):
user_id = UNSET
if _user_id is None:
user_id = UNSET
else:
user_id = _user_id
api_token = cls(
created_at=created_at,
id=id,
is_valid=is_valid,
token=token,
updated_at=updated_at,
user_id=user_id,
)
api_token.additional_properties = d
return api_token
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,70 +1,13 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast from typing import List, Optional
import attr from pydantic import BaseModel
from ..types import UNSET, Unset from ..models.api_token import ApiToken
JV = TypeVar("JV", bound="ApiTokenResultsPage")
@attr.s(auto_attribs=True) class ApiTokenResultsPage(BaseModel):
class ApiTokenResultsPage: """A single page of results"""
"""A single page of results""" # noqa: E501
from ..models.api_token import ApiToken items: List[ApiToken]
items: Union[Unset, List[ApiToken]] = UNSET next_page: Optional[str] = None
next_page: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
from ..models.api_token import ApiToken
items: Union[Unset, List[ApiToken]] = UNSET
if not isinstance(self.items, Unset):
items = self.items
next_page = self.next_page
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if items is not UNSET:
field_dict["items"] = items
if next_page is not UNSET:
field_dict["next_page"] = next_page
return field_dict
@classmethod
def from_dict(cls: Type[JV], src_dict: Dict[str, Any]) -> JV:
d = src_dict.copy()
from ..models.api_token import ApiToken
items = cast(List[ApiToken], d.pop("items", UNSET))
next_page = d.pop("next_page", UNSET)
api_token_results_page = cls(
items=items,
next_page=next_page,
)
api_token_results_page.additional_properties = d
return api_token_results_page
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

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