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)
|
197
spec.json
197
spec.json
@ -3352,6 +3352,123 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"PhysicsConstant": {
|
||||
"description": "A physics constant.",
|
||||
"properties": {
|
||||
"completed_at": {
|
||||
"description": "The time and date the constant was completed.",
|
||||
"format": "date-time",
|
||||
"nullable": true,
|
||||
"title": "DateTime",
|
||||
"type": "string"
|
||||
},
|
||||
"constant": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/PhysicsConstantName"
|
||||
}
|
||||
],
|
||||
"description": "The constant we are returning."
|
||||
},
|
||||
"created_at": {
|
||||
"description": "The time and date the constant was created.",
|
||||
"format": "date-time",
|
||||
"title": "DateTime",
|
||||
"type": "string"
|
||||
},
|
||||
"error": {
|
||||
"description": "The error the function returned, if any.",
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Uuid"
|
||||
}
|
||||
],
|
||||
"description": "The unique identifier of the constant request.\n\nThis is the same as the API call ID."
|
||||
},
|
||||
"started_at": {
|
||||
"description": "The time and date the constant was started.",
|
||||
"format": "date-time",
|
||||
"nullable": true,
|
||||
"title": "DateTime",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ApiCallStatus"
|
||||
}
|
||||
],
|
||||
"description": "The status of the constant."
|
||||
},
|
||||
"updated_at": {
|
||||
"description": "The time and date the constant was last updated.",
|
||||
"format": "date-time",
|
||||
"title": "DateTime",
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"description": "The user ID of the user who created the constant.",
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"description": "The resulting value of the constant.",
|
||||
"format": "double",
|
||||
"nullable": true,
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"constant",
|
||||
"created_at",
|
||||
"id",
|
||||
"status",
|
||||
"updated_at"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"PhysicsConstantName": {
|
||||
"description": "The valid types of phys constant names.",
|
||||
"enum": [
|
||||
"pi",
|
||||
"c",
|
||||
"speed_of_light",
|
||||
"G",
|
||||
"newtonian_graviation",
|
||||
"h",
|
||||
"plank_const",
|
||||
"mu_0",
|
||||
"vacuum_permeability",
|
||||
"E_0",
|
||||
"vacuum_permitivity",
|
||||
"Z_0",
|
||||
"vacuum_impedance",
|
||||
"k_e",
|
||||
"coulomb_const",
|
||||
"e",
|
||||
"elementary_charge",
|
||||
"m_e",
|
||||
"electron_mass",
|
||||
"m_p",
|
||||
"proton_mass",
|
||||
"mu_B",
|
||||
"bohr_magneton",
|
||||
"NA",
|
||||
"avogadro_num",
|
||||
"R",
|
||||
"molar_gas_const",
|
||||
"K_B",
|
||||
"boltzmann_const",
|
||||
"F",
|
||||
"faraday_const",
|
||||
"sigma",
|
||||
"stefan_boltzmann_const"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"PluginsInfo": {
|
||||
"description": "Available plugins per type.\n\n**Note**: Only unmanaged (V1) plugins are included in this list. V1 plugins are \\\"lazily\\\" loaded, and are not returned in this list if there is no resource using the plugin.",
|
||||
"properties": {
|
||||
@ -7415,6 +7532,79 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/constant/physics/{constant}": {
|
||||
"get": {
|
||||
"operationId": "get_physics_constant",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "The constant to get.",
|
||||
"in": "path",
|
||||
"name": "constant",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/PhysicsConstantName"
|
||||
},
|
||||
"style": "simple"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/PhysicsConstant"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "successful operation",
|
||||
"headers": {
|
||||
"Access-Control-Allow-Credentials": {
|
||||
"description": "Access-Control-Allow-Credentials header.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"style": "simple"
|
||||
},
|
||||
"Access-Control-Allow-Headers": {
|
||||
"description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"style": "simple"
|
||||
},
|
||||
"Access-Control-Allow-Methods": {
|
||||
"description": "Access-Control-Allow-Methods header.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"style": "simple"
|
||||
},
|
||||
"Access-Control-Allow-Origin": {
|
||||
"description": "Access-Control-Allow-Origin header.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"style": "simple"
|
||||
}
|
||||
}
|
||||
},
|
||||
"4XX": {
|
||||
"$ref": "#/components/responses/Error"
|
||||
},
|
||||
"5XX": {
|
||||
"$ref": "#/components/responses/Error"
|
||||
}
|
||||
},
|
||||
"summary": "Get a physics constant.",
|
||||
"tags": [
|
||||
"constant"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/file/conversion/{src_format}/{output_format}": {
|
||||
"post": {
|
||||
"description": "Convert a CAD file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.\nIf the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.\nIf the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.",
|
||||
@ -13161,6 +13351,13 @@
|
||||
},
|
||||
"name": "beta"
|
||||
},
|
||||
{
|
||||
"description": "Constants. These are helpful as helpers.",
|
||||
"externalDocs": {
|
||||
"url": "https://docs.kittycad.io/api/constant"
|
||||
},
|
||||
"name": "constant"
|
||||
},
|
||||
{
|
||||
"description": "CAD file operations. Create, get, and list CAD file conversions. More endpoints will be added here in the future as we build out transforms, etc on CAD models.",
|
||||
"externalDocs": {
|
||||
|
Reference in New Issue
Block a user