Update api spec (#73)

* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jess Frazelle
2023-04-17 10:07:16 -07:00
committed by GitHub
parent 11a1948ebc
commit 573f4a8bc8
13 changed files with 180 additions and 1140 deletions

File diff suppressed because one or more lines are too long

View File

@ -81,6 +81,7 @@ def sync(
*,
client: Client,
) -> Optional[Union[Any, Mesh, Error]]:
""" This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better. """
return sync_detailed(
input_format=input_format,
@ -117,6 +118,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, Mesh, Error]]:
""" This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better. """
return (
await asyncio_detailed(

View File

@ -75,6 +75,7 @@ def sync(
*,
client: Client,
) -> Optional[Union[Any, Mesh, Error]]:
""" This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better. """
return sync_detailed(
output_format=output_format,
@ -107,6 +108,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, Mesh, Error]]:
""" This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better. """
return (
await asyncio_detailed(

View File

@ -5,7 +5,6 @@ import httpx
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.file2_d_vector_conversion import File2DVectorConversion
from ...models.file3_d_conversion import File3DConversion
from ...models.file_center_of_mass import FileCenterOfMass
from ...models.file_mass import FileMass
from ...models.file_volume import FileVolume
@ -32,7 +31,7 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
if response.status_code == 200:
data = response.json()
try:
@ -49,13 +48,6 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = File3DConversion.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
@ -100,7 +92,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -113,7 +105,7 @@ def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
) -> Response[Union[Any, FileConversion, File2DVectorConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -131,7 +123,7 @@ def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async operation.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
If the user is not authenticated to view the specified async operation, then it is not returned.
@ -147,7 +139,7 @@ async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
) -> Response[Union[Any, FileConversion, File2DVectorConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
@ -163,7 +155,7 @@ async def asyncio(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async operation.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
If the user is not authenticated to view the specified async operation, then it is not returned.

View File

@ -1,134 +0,0 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file3_d_conversion import File3DConversion
from ...models.error import Error
from ...models.file3_d_export_format import File3DExportFormat
from ...models.file3_d_import_format import File3DImportFormat
from ...types import Response
def _get_kwargs(
output_format: File3DExportFormat,
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/3d/conversion/{src_format}/{output_format}".format(client.base_url, output_format=output_format, src_format=src_format)
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(),
"content": body,
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, File3DConversion, Error]]:
if response.status_code == 201:
response_201 = File3DConversion.from_dict(response.json())
return response_201
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, File3DConversion, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
output_format: File3DExportFormat,
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, File3DConversion, Error]]:
kwargs = _get_kwargs(
output_format=output_format,
src_format=src_format,
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
output_format: File3DExportFormat,
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, File3DConversion, Error]]:
""" Convert a 3D file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
If 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. """
return sync_detailed(
output_format=output_format,
src_format=src_format,
body=body,
client=client,
).parsed
async def asyncio_detailed(
output_format: File3DExportFormat,
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, File3DConversion, Error]]:
kwargs = _get_kwargs(
output_format=output_format,
src_format=src_format,
body=body,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.post(**kwargs)
return _build_response(response=response)
async def asyncio(
output_format: File3DExportFormat,
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, File3DConversion, Error]]:
""" Convert a 3D file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
If 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. """
return (
await asyncio_detailed(
output_format=output_format,
src_format=src_format,
body=body,
client=client,
)
).parsed

View File

@ -1,177 +0,0 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.file2_d_vector_conversion import File2DVectorConversion
from ...models.file3_d_conversion import File3DConversion
from ...models.file_center_of_mass import FileCenterOfMass
from ...models.file_mass import FileMass
from ...models.file_volume import FileVolume
from ...models.file_density import FileDensity
from ...models.file_surface_area import FileSurfaceArea
from ...models.error import Error
from ...types import Response
def _get_kwargs(
id: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/conversions/{id}".format(client.base_url, id=id)
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, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
if response.status_code == 200:
data = response.json()
try:
if not isinstance(data, dict):
raise TypeError()
option = FileConversion.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = File2DVectorConversion.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = File3DConversion.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileCenterOfMass.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileMass.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileVolume.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileDensity.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileSurfaceArea.from_dict(data)
return option
except:
raise
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, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async file conversion.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
If the user is not authenticated to view the specified file conversion, then it is not returned.
Only KittyCAD employees with the proper access can view file conversions for other users. """
return sync_detailed(
id=id,
client=client,
).parsed
async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs(
id=id,
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(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async file conversion.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
If the user is not authenticated to view the specified file conversion, then it is not returned.
Only KittyCAD employees with the proper access can view file conversions for other users. """
return (
await asyncio_detailed(
id=id,
client=client,
)
).parsed

View File

@ -1,173 +0,0 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.file2_d_vector_conversion import File2DVectorConversion
from ...models.file3_d_conversion import File3DConversion
from ...models.file_center_of_mass import FileCenterOfMass
from ...models.file_mass import FileMass
from ...models.file_volume import FileVolume
from ...models.file_density import FileDensity
from ...models.file_surface_area import FileSurfaceArea
from ...models.error import Error
from ...types import Response
def _get_kwargs(
id: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/file/conversions/{id}".format(client.base_url, id=id)
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, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
if response.status_code == 200:
data = response.json()
try:
if not isinstance(data, dict):
raise TypeError()
option = FileConversion.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = File2DVectorConversion.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = File3DConversion.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileCenterOfMass.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileMass.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileVolume.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileDensity.from_dict(data)
return option
except:
pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileSurfaceArea.from_dict(data)
return option
except:
raise
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, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs(
id=id,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
return sync_detailed(
id=id,
client=client,
).parsed
async def asyncio_detailed(
id: str,
*,
client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs(
id=id,
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(
id: str,
*,
client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
return (
await asyncio_detailed(
id=id,
client=client,
)
).parsed

View File

@ -0,0 +1,100 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.dict import dict
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/openai/openapi.json".format(client.base_url)
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, dict, Error]]:
if response.status_code == 200:
response_200 = 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, dict, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, dict, Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[Any, dict, Error]]:
""" This is the same as the OpenAPI schema, BUT it has some modifications to make it compatible with OpenAI. For example, descriptions must be < 300 chars. """
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, dict, Error]]:
kwargs = _get_kwargs(
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(
*,
client: Client,
) -> Optional[Union[Any, dict, Error]]:
""" This is the same as the OpenAPI schema, BUT it has some modifications to make it compatible with OpenAI. For example, descriptions must be < 300 chars. """
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -45,8 +45,6 @@ from .extended_user_results_page import ExtendedUserResultsPage
from .file2_d_vector_conversion import File2DVectorConversion
from .file2_d_vector_export_format import File2DVectorExportFormat
from .file2_d_vector_import_format import File2DVectorImportFormat
from .file3_d_conversion import File3DConversion
from .file3_d_export_format import File3DExportFormat
from .file3_d_import_format import File3DImportFormat
from .file_center_of_mass import FileCenterOfMass
from .file_conversion import FileConversion

View File

@ -4,7 +4,6 @@ from enum import Enum
class AsyncApiCallType(str, Enum):
FILE_CONVERSION = 'FileConversion'
FILE2_D_VECTOR_CONVERSION = 'File2DVectorConversion'
FILE3_D_CONVERSION = 'File3DConversion'
FILE_VOLUME = 'FileVolume'
FILE_CENTER_OF_MASS = 'FileCenterOfMass'
FILE_MASS = 'FileMass'

View File

@ -1,179 +0,0 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..models.file3_d_export_format import File3DExportFormat
from ..models.file3_d_import_format import File3DImportFormat
from ..models.api_call_status import ApiCallStatus
from ..types import UNSET, Unset
T = TypeVar("T", bound="File3DConversion")
@attr.s(auto_attribs=True)
class File3DConversion:
""" """
completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
output: Union[Unset, str] = UNSET
output_format: Union[Unset, File3DExportFormat] = UNSET
src_format: Union[Unset, File3DImportFormat] = 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
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()
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
output = self.output
output_format: Union[Unset, str] = UNSET
if not isinstance(self.output_format, Unset):
output_format = self.output_format.value
src_format: Union[Unset, str] = UNSET
if not isinstance(self.src_format, Unset):
src_format = self.src_format.value
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
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 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 output is not UNSET:
field_dict['output'] = output
if output_format is not UNSET:
field_dict['output_format'] = output_format
if src_format is not UNSET:
field_dict['src_format'] = src_format
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
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)
_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)
output = d.pop("output", UNSET)
_output_format = d.pop("output_format", UNSET)
output_format: Union[Unset, File3DExportFormat]
if isinstance(_output_format, Unset):
output_format = UNSET
else:
output_format = File3DExportFormat(_output_format)
_src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, File3DImportFormat]
if isinstance(_src_format, Unset):
src_format = UNSET
else:
src_format = File3DImportFormat(_src_format)
_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)
file3_d_conversion = cls(
completed_at=completed_at,
created_at=created_at,
error=error,
id=id,
output=output,
output_format=output_format,
src_format=src_format,
started_at=started_at,
status=status,
updated_at=updated_at,
user_id=user_id,
)
file3_d_conversion.additional_properties = d
return file3_d_conversion
@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,15 +0,0 @@
from enum import Enum
class File3DExportFormat(str, Enum):
DAE = 'dae'
FBX = 'fbx'
FBXB = 'fbxb'
OBJ = 'obj'
OBJ_NOMTL = 'obj_nomtl'
PLY = 'ply'
STEP = 'step'
STL = 'stl'
def __str__(self) -> str:
return str(self.value)

513
spec.json
View File

@ -716,101 +716,6 @@
],
"type": "object"
},
{
"description": "A 3D file conversion.",
"properties": {
"completed_at": {
"description": "The time and date the API call was completed.",
"format": "date-time",
"nullable": true,
"title": "DateTime",
"type": "string"
},
"created_at": {
"description": "The time and date the API call 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 API call.\n\nThis is the same as the API call ID."
},
"output": {
"description": "The converted file, if completed, base64 encoded.",
"format": "byte",
"nullable": true,
"title": "String",
"type": "string"
},
"output_format": {
"allOf": [
{
"$ref": "#/components/schemas/File3DExportFormat"
}
],
"description": "The output format of the file conversion."
},
"src_format": {
"allOf": [
{
"$ref": "#/components/schemas/File3DImportFormat"
}
],
"description": "The source format of the file conversion."
},
"started_at": {
"description": "The time and date the API call was started.",
"format": "date-time",
"nullable": true,
"title": "DateTime",
"type": "string"
},
"status": {
"allOf": [
{
"$ref": "#/components/schemas/ApiCallStatus"
}
],
"description": "The status of the API call."
},
"type": {
"enum": [
"File3DConversion"
],
"type": "string"
},
"updated_at": {
"description": "The time and date the API call was last updated.",
"format": "date-time",
"title": "DateTime",
"type": "string"
},
"user_id": {
"description": "The user ID of the user who created the API call.",
"type": "string"
}
},
"required": [
"created_at",
"id",
"output_format",
"src_format",
"status",
"type",
"updated_at"
],
"type": "object"
},
{
"description": "File center of mass.",
"properties": {
@ -1279,7 +1184,6 @@
"enum": [
"FileConversion",
"File2DVectorConversion",
"File3DConversion",
"FileVolume",
"FileCenterOfMass",
"FileMass",
@ -3099,108 +3003,6 @@
],
"type": "string"
},
"File3DConversion": {
"description": "A 3D file conversion.",
"properties": {
"completed_at": {
"description": "The time and date the API call was completed.",
"format": "date-time",
"nullable": true,
"title": "DateTime",
"type": "string"
},
"created_at": {
"description": "The time and date the API call 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 API call.\n\nThis is the same as the API call ID."
},
"output": {
"description": "The converted file, if completed, base64 encoded.",
"format": "byte",
"nullable": true,
"title": "String",
"type": "string"
},
"output_format": {
"allOf": [
{
"$ref": "#/components/schemas/File3DExportFormat"
}
],
"description": "The output format of the file conversion."
},
"src_format": {
"allOf": [
{
"$ref": "#/components/schemas/File3DImportFormat"
}
],
"description": "The source format of the file conversion."
},
"started_at": {
"description": "The time and date the API call was started.",
"format": "date-time",
"nullable": true,
"title": "DateTime",
"type": "string"
},
"status": {
"allOf": [
{
"$ref": "#/components/schemas/ApiCallStatus"
}
],
"description": "The status of the API call."
},
"updated_at": {
"description": "The time and date the API call was last updated.",
"format": "date-time",
"title": "DateTime",
"type": "string"
},
"user_id": {
"description": "The user ID of the user who created the API call.",
"type": "string"
}
},
"required": [
"created_at",
"id",
"output_format",
"src_format",
"status",
"updated_at"
],
"type": "object"
},
"File3DExportFormat": {
"description": "The valid types of 3d output file formats, can include formats that use suplimentary files. For example, the OBJ format can use a MTL file.",
"enum": [
"dae",
"fbx",
"fbxb",
"obj",
"obj_nomtl",
"ply",
"step",
"stl"
],
"type": "string"
},
"File3DImportFormat": {
"description": "The valid types of 3d source file formats, can include formats that use suplimentary files. For example, the OBJ format can use a MTL file.",
"enum": [
@ -8203,7 +8005,8 @@
},
"summary": "Get AI plugin manifest.",
"tags": [
"meta"
"meta",
"hidden"
]
}
},
@ -8272,6 +8075,7 @@
},
"/ai/image-to-3d/{input_format}/{output_format}": {
"post": {
"description": "This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.",
"operationId": "create_image_to_3d",
"parameters": [
{
@ -8368,6 +8172,7 @@
},
"/ai/text-to-3d/{output_format}": {
"post": {
"description": "This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.",
"operationId": "create_text_to_3d",
"parameters": [
{
@ -9363,7 +9168,8 @@
},
"summary": "Get a physics constant.",
"tags": [
"constant"
"constant",
"hidden"
]
}
},
@ -9462,101 +9268,6 @@
]
}
},
"/file/3d/conversion/{src_format}/{output_format}": {
"post": {
"description": "Convert a 3D 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.",
"operationId": "create_file_3d_conversion",
"parameters": [
{
"description": "The format the file should be converted to.",
"in": "path",
"name": "output_format",
"required": true,
"schema": {
"$ref": "#/components/schemas/File3DExportFormat"
},
"style": "simple"
},
{
"description": "The format of the file to convert.",
"in": "path",
"name": "src_format",
"required": true,
"schema": {
"$ref": "#/components/schemas/File3DImportFormat"
},
"style": "simple"
}
],
"requestBody": {
"content": {
"application/octet-stream": {
"schema": {
"format": "binary",
"type": "string"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/File3DConversion"
}
}
},
"description": "successful creation",
"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": "Convert 3D file.",
"tags": [
"file"
]
}
},
"/file/center-of-mass": {
"post": {
"description": "Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.\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.",
@ -9738,80 +9449,6 @@
]
}
},
"/file/conversions/{id}": {
"get": {
"description": "Get the status and output of an async file conversion.\nThis endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.\nIf the user is not authenticated to view the specified file conversion, then it is not returned.\nOnly KittyCAD employees with the proper access can view file conversions for other users.",
"operationId": "get_file_conversion",
"parameters": [
{
"description": "The ID of the async operation.",
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
},
"style": "simple"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AsyncApiCallOutput"
}
}
},
"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 file conversion.",
"tags": [
"file"
]
}
},
"/file/density": {
"post": {
"description": "Get the density of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.\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.",
@ -10762,6 +10399,67 @@
]
}
},
"/openai/openapi.json": {
"get": {
"description": "This is the same as the OpenAPI schema, BUT it has some modifications to make it compatible with OpenAI. For example, descriptions must be < 300 chars.",
"operationId": "get_openai_schema",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {}
}
},
"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 AI plugin OpenAPI schema.",
"tags": [
"meta",
"hidden"
]
}
},
"/ping": {
"get": {
"operationId": "ping",
@ -14438,80 +14136,6 @@
]
}
},
"/user/file/conversions/{id}": {
"get": {
"description": "Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.\nThis endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.",
"operationId": "get_file_conversion_for_user",
"parameters": [
{
"description": "The ID of the async operation.",
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
},
"style": "simple"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AsyncApiCallOutput"
}
}
},
"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 file conversion for your user.",
"tags": [
"file"
]
}
},
"/user/front-hash": {
"get": {
"description": "This info is sent to front when initialing the front chat, it prevents impersonations using js hacks in the browser",
@ -15388,7 +15012,8 @@
},
"summary": "Validate a customer's information is correct and valid for automatic tax.",
"tags": [
"payments"
"payments",
"hidden"
]
}
},