I have generated the latest API!
This commit is contained in:
File diff suppressed because one or more lines are too long
1
kittycad/api/constant/__init__.py
Normal file
1
kittycad/api/constant/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
""" Contains methods for accessing the constant API paths: Constants. These are helpful as helpers. """
|
108
kittycad/api/constant/get_physics_constant.py
Normal file
108
kittycad/api/constant/get_physics_constant.py
Normal file
@ -0,0 +1,108 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.physics_constant import PhysicsConstant
|
||||
from ...models.error import Error
|
||||
from ...models.physics_constant_name import PhysicsConstantName
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
constant: PhysicsConstantName,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/constant/physics/{constant}".format(client.base_url, constant=constant)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, PhysicsConstant, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PhysicsConstant.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, PhysicsConstant, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
constant: PhysicsConstantName,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, PhysicsConstant, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
constant=constant,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
constant: PhysicsConstantName,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, PhysicsConstant, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
constant=constant,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
constant: PhysicsConstantName,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, PhysicsConstant, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
constant=constant,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
constant: PhysicsConstantName,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, PhysicsConstant, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
constant=constant,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -63,6 +63,8 @@ from .payment_intent import PaymentIntent
|
||||
from .payment_method import PaymentMethod
|
||||
from .payment_method_card_checks import PaymentMethodCardChecks
|
||||
from .payment_method_type import PaymentMethodType
|
||||
from .physics_constant import PhysicsConstant
|
||||
from .physics_constant_name import PhysicsConstantName
|
||||
from .plugins_info import PluginsInfo
|
||||
from .pong import Pong
|
||||
from .registry_service_config import RegistryServiceConfig
|
||||
|
164
kittycad/models/physics_constant.py
Normal file
164
kittycad/models/physics_constant.py
Normal file
@ -0,0 +1,164 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.physics_constant_name import PhysicsConstantName
|
||||
from ..models.uuid import Uuid
|
||||
from ..models.api_call_status import ApiCallStatus
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="PhysicsConstant")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class PhysicsConstant:
|
||||
""" """
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
constant: Union[Unset, PhysicsConstantName] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, ApiCallStatus] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
value: Union[Unset, float] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
constant: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.constant, Unset):
|
||||
constant = self.constant.value
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
user_id = self.user_id
|
||||
value = self.value
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if constant is not UNSET:
|
||||
field_dict['constant'] = constant
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if started_at is not UNSET:
|
||||
field_dict['started_at'] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict['status'] = status
|
||||
if updated_at is not UNSET:
|
||||
field_dict['updated_at'] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict['user_id'] = user_id
|
||||
if value is not UNSET:
|
||||
field_dict['value'] = value
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
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)
|
||||
|
||||
_constant = d.pop("constant", UNSET)
|
||||
constant: Union[Unset, PhysicsConstantName]
|
||||
if isinstance(_constant, Unset):
|
||||
constant = UNSET
|
||||
else:
|
||||
constant = PhysicsConstantName(_constant)
|
||||
|
||||
_created_at = d.pop("created_at", UNSET)
|
||||
created_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_created_at, Unset):
|
||||
created_at = UNSET
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, ApiCallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = ApiCallStatus(_status)
|
||||
|
||||
_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)
|
||||
|
||||
value = d.pop("value", UNSET)
|
||||
|
||||
physics_constant = cls(
|
||||
completed_at=completed_at,
|
||||
constant=constant,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
id=id,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
value=value,
|
||||
)
|
||||
|
||||
physics_constant.additional_properties = d
|
||||
return physics_constant
|
||||
|
||||
@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
|
40
kittycad/models/physics_constant_name.py
Normal file
40
kittycad/models/physics_constant_name.py
Normal file
@ -0,0 +1,40 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class PhysicsConstantName(str, Enum):
|
||||
PI = 'pi'
|
||||
C = 'c'
|
||||
SPEED_OF_LIGHT = 'speed_of_light'
|
||||
G = 'G'
|
||||
NEWTONIAN_GRAVIATION = 'newtonian_graviation'
|
||||
H = 'h'
|
||||
PLANK_CONST = 'plank_const'
|
||||
MU_0 = 'mu_0'
|
||||
VACUUM_PERMEABILITY = 'vacuum_permeability'
|
||||
E_0 = 'E_0'
|
||||
VACUUM_PERMITIVITY = 'vacuum_permitivity'
|
||||
Z_0 = 'Z_0'
|
||||
VACUUM_IMPEDANCE = 'vacuum_impedance'
|
||||
K_E = 'k_e'
|
||||
COULOMB_CONST = 'coulomb_const'
|
||||
E = 'e'
|
||||
ELEMENTARY_CHARGE = 'elementary_charge'
|
||||
M_E = 'm_e'
|
||||
ELECTRON_MASS = 'electron_mass'
|
||||
M_P = 'm_p'
|
||||
PROTON_MASS = 'proton_mass'
|
||||
MU_B = 'mu_B'
|
||||
BOHR_MAGNETON = 'bohr_magneton'
|
||||
NA = 'NA'
|
||||
AVOGADRO_NUM = 'avogadro_num'
|
||||
R = 'R'
|
||||
MOLAR_GAS_CONST = 'molar_gas_const'
|
||||
K_B = 'K_B'
|
||||
BOLTZMANN_CONST = 'boltzmann_const'
|
||||
F = 'F'
|
||||
FARADAY_CONST = 'faraday_const'
|
||||
SIGMA = 'sigma'
|
||||
STEFAN_BOLTZMANN_CONST = 'stefan_boltzmann_const'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
Reference in New Issue
Block a user