Update api spec (#65)

* 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-01-31 11:27:22 -08:00
committed by GitHub
parent 0403eddfd7
commit e4370b6108
11 changed files with 21 additions and 632 deletions

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,6 @@ from ...models.file_conversion import FileConversion
from ...models.file2_d_vector_conversion import File2DVectorConversion from ...models.file2_d_vector_conversion import File2DVectorConversion
from ...models.file3_d_conversion import File3DConversion from ...models.file3_d_conversion import File3DConversion
from ...models.file_center_of_mass import FileCenterOfMass from ...models.file_center_of_mass import FileCenterOfMass
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
from ...models.file_mass import FileMass from ...models.file_mass import FileMass
from ...models.file_volume import FileVolume from ...models.file_volume import FileVolume
from ...models.file_density import FileDensity from ...models.file_density import FileDensity
@ -33,7 +32,7 @@ def _get_kwargs(
} }
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
try: try:
@ -64,13 +63,6 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return option return option
except: except:
pass pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileCenterOfMassWithUniformDensity.from_dict(data)
return option
except:
pass
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
@ -108,7 +100,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return None return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
return Response( return Response(
status_code=response.status_code, status_code=response.status_code,
content=response.content, content=response.content,
@ -121,7 +113,7 @@ def sync_detailed(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client, client=client,
@ -139,7 +131,7 @@ def sync(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async operation. """ 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. 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. If the user is not authenticated to view the specified async operation, then it is not returned.
@ -155,7 +147,7 @@ async def asyncio_detailed(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client, client=client,
@ -171,7 +163,7 @@ async def asyncio(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async operation. """ 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. 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. If the user is not authenticated to view the specified async operation, then it is not returned.

View File

@ -9,13 +9,12 @@ from ...models.file3_d_import_format import File3DImportFormat
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
material_density: float,
src_format: File3DImportFormat, src_format: File3DImportFormat,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/file/center-of-mass?material_density={material_density}&src_format={src_format}".format(client.base_url, material_density=material_density, src_format=src_format) url = "{}/file/center-of-mass?src_format={src_format}".format(client.base_url, src_format=src_format)
headers: Dict[str, Any] = client.get_headers() headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies() cookies: Dict[str, Any] = client.get_cookies()
@ -52,14 +51,12 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileCent
def sync_detailed( def sync_detailed(
material_density: float,
src_format: File3DImportFormat, src_format: File3DImportFormat,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileCenterOfMass, Error]]: ) -> Response[Union[Any, FileCenterOfMass, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
material_density=material_density,
src_format=src_format, src_format=src_format,
body=body, body=body,
client=client, client=client,
@ -74,18 +71,15 @@ def sync_detailed(
def sync( def sync(
material_density: float,
src_format: File3DImportFormat, src_format: File3DImportFormat,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileCenterOfMass, Error]]: ) -> Optional[Union[Any, FileCenterOfMass, Error]]:
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously. """ Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
Does the same as the `center_of_mass_with_uniform_density` endpoint; except, this has a redundant `material_density value`. Kept for legacy in this version.
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. """ 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( return sync_detailed(
material_density=material_density,
src_format=src_format, src_format=src_format,
body=body, body=body,
client=client, client=client,
@ -93,14 +87,12 @@ If the operation is performed asynchronously, the `id` of the operation will be
async def asyncio_detailed( async def asyncio_detailed(
material_density: float,
src_format: File3DImportFormat, src_format: File3DImportFormat,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileCenterOfMass, Error]]: ) -> Response[Union[Any, FileCenterOfMass, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
material_density=material_density,
src_format=src_format, src_format=src_format,
body=body, body=body,
client=client, client=client,
@ -113,19 +105,16 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
material_density: float,
src_format: File3DImportFormat, src_format: File3DImportFormat,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileCenterOfMass, Error]]: ) -> Optional[Union[Any, FileCenterOfMass, Error]]:
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously. """ Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
Does the same as the `center_of_mass_with_uniform_density` endpoint; except, this has a redundant `material_density value`. Kept for legacy in this version.
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. """ 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 ( return (
await asyncio_detailed( await asyncio_detailed(
material_density=material_density,
src_format=src_format, src_format=src_format,
body=body, body=body,
client=client, client=client,

View File

@ -1,122 +0,0 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
from ...models.error import Error
from ...models.file3_d_import_format import File3DImportFormat
from ...types import Response
def _get_kwargs(
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/center-of-mass-with-uniform-density?src_format={src_format}".format(client.base_url, 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, FileCenterOfMassWithUniformDensity, Error]]:
if response.status_code == 201:
response_201 = FileCenterOfMassWithUniformDensity.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, FileCenterOfMassWithUniformDensity, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
kwargs = _get_kwargs(
src_format=src_format,
body=body,
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
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(
src_format=src_format,
body=body,
client=client,
).parsed
async def asyncio_detailed(
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Response[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
kwargs = _get_kwargs(
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(
src_format: File3DImportFormat,
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, FileCenterOfMassWithUniformDensity, Error]]:
""" Get the center of mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
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(
src_format=src_format,
body=body,
client=client,
)
).parsed

View File

@ -7,7 +7,6 @@ from ...models.file_conversion import FileConversion
from ...models.file2_d_vector_conversion import File2DVectorConversion from ...models.file2_d_vector_conversion import File2DVectorConversion
from ...models.file3_d_conversion import File3DConversion from ...models.file3_d_conversion import File3DConversion
from ...models.file_center_of_mass import FileCenterOfMass from ...models.file_center_of_mass import FileCenterOfMass
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
from ...models.file_mass import FileMass from ...models.file_mass import FileMass
from ...models.file_volume import FileVolume from ...models.file_volume import FileVolume
from ...models.file_density import FileDensity from ...models.file_density import FileDensity
@ -33,7 +32,7 @@ def _get_kwargs(
} }
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
try: try:
@ -64,13 +63,6 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return option return option
except: except:
pass pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileCenterOfMassWithUniformDensity.from_dict(data)
return option
except:
pass
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
@ -108,7 +100,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return None return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
return Response( return Response(
status_code=response.status_code, status_code=response.status_code,
content=response.content, content=response.content,
@ -121,7 +113,7 @@ def sync_detailed(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client, client=client,
@ -139,7 +131,7 @@ def sync(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async file conversion. """ 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. 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. If the user is not authenticated to view the specified file conversion, then it is not returned.
@ -155,7 +147,7 @@ async def asyncio_detailed(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client, client=client,
@ -171,7 +163,7 @@ async def asyncio(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
""" Get the status and output of an async file conversion. """ 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. 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. If the user is not authenticated to view the specified file conversion, then it is not returned.

View File

@ -7,7 +7,6 @@ from ...models.file_conversion import FileConversion
from ...models.file2_d_vector_conversion import File2DVectorConversion from ...models.file2_d_vector_conversion import File2DVectorConversion
from ...models.file3_d_conversion import File3DConversion from ...models.file3_d_conversion import File3DConversion
from ...models.file_center_of_mass import FileCenterOfMass from ...models.file_center_of_mass import FileCenterOfMass
from ...models.file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
from ...models.file_mass import FileMass from ...models.file_mass import FileMass
from ...models.file_volume import FileVolume from ...models.file_volume import FileVolume
from ...models.file_density import FileDensity from ...models.file_density import FileDensity
@ -33,7 +32,7 @@ def _get_kwargs(
} }
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
try: try:
@ -64,13 +63,6 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return option return option
except: except:
pass pass
try:
if not isinstance(data, dict):
raise TypeError()
option = FileCenterOfMassWithUniformDensity.from_dict(data)
return option
except:
pass
try: try:
if not isinstance(data, dict): if not isinstance(data, dict):
raise TypeError() raise TypeError()
@ -108,7 +100,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
return None return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
return Response( return Response(
status_code=response.status_code, status_code=response.status_code,
content=response.content, content=response.content,
@ -121,7 +113,7 @@ def sync_detailed(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client, client=client,
@ -139,7 +131,7 @@ def sync(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> 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. """ 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. """ This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
@ -153,7 +145,7 @@ async def asyncio_detailed(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> Response[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client, client=client,
@ -169,7 +161,7 @@ async def asyncio(
id: str, id: str,
*, *,
client: Client, client: Client,
) -> Optional[Union[Any, FileConversion, File2DVectorConversion, File3DConversion, FileCenterOfMass, FileCenterOfMassWithUniformDensity, FileMass, FileVolume, FileDensity, FileSurfaceArea, Error]]: ) -> 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. """ 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. """ This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """

View File

@ -42,7 +42,6 @@ from .file3_d_conversion import File3DConversion
from .file3_d_export_format import File3DExportFormat from .file3_d_export_format import File3DExportFormat
from .file3_d_import_format import File3DImportFormat from .file3_d_import_format import File3DImportFormat
from .file_center_of_mass import FileCenterOfMass from .file_center_of_mass import FileCenterOfMass
from .file_center_of_mass_with_uniform_density import FileCenterOfMassWithUniformDensity
from .file_conversion import FileConversion from .file_conversion import FileConversion
from .file_density import FileDensity from .file_density import FileDensity
from .file_export_format import FileExportFormat from .file_export_format import FileExportFormat

View File

@ -7,7 +7,6 @@ class AsyncApiCallType(str, Enum):
FILE3_D_CONVERSION = 'File3DConversion' FILE3_D_CONVERSION = 'File3DConversion'
FILE_VOLUME = 'FileVolume' FILE_VOLUME = 'FileVolume'
FILE_CENTER_OF_MASS = 'FileCenterOfMass' FILE_CENTER_OF_MASS = 'FileCenterOfMass'
FILE_CENTER_OF_MASS_WITH_UNIFORM_DENSITY = 'FileCenterOfMassWithUniformDensity'
FILE_MASS = 'FileMass' FILE_MASS = 'FileMass'
FILE_DENSITY = 'FileDensity' FILE_DENSITY = 'FileDensity'
FILE_SURFACE_AREA = 'FileSurfaceArea' FILE_SURFACE_AREA = 'FileSurfaceArea'

View File

@ -20,7 +20,6 @@ class FileCenterOfMass:
created_at: Union[Unset, datetime.datetime] = UNSET created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET error: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET id: Union[Unset, str] = UNSET
material_density: Union[Unset, float] = UNSET
src_format: Union[Unset, File3DImportFormat] = UNSET src_format: Union[Unset, File3DImportFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, ApiCallStatus] = UNSET status: Union[Unset, ApiCallStatus] = UNSET
@ -41,7 +40,6 @@ class FileCenterOfMass:
created_at = self.created_at.isoformat() created_at = self.created_at.isoformat()
error = self.error error = self.error
id = self.id id = self.id
material_density = self.material_density
src_format: Union[Unset, str] = UNSET src_format: Union[Unset, str] = UNSET
if not isinstance(self.src_format, Unset): if not isinstance(self.src_format, Unset):
src_format = self.src_format.value src_format = self.src_format.value
@ -69,8 +67,6 @@ class FileCenterOfMass:
field_dict['error'] = error field_dict['error'] = error
if id is not UNSET: if id is not UNSET:
field_dict['id'] = id field_dict['id'] = id
if material_density is not UNSET:
field_dict['material_density'] = material_density
if src_format is not UNSET: if src_format is not UNSET:
field_dict['src_format'] = src_format field_dict['src_format'] = src_format
if started_at is not UNSET: if started_at is not UNSET:
@ -107,8 +103,6 @@ class FileCenterOfMass:
id = d.pop("id", UNSET) id = d.pop("id", UNSET)
material_density = d.pop("material_density", UNSET)
_src_format = d.pop("src_format", UNSET) _src_format = d.pop("src_format", UNSET)
src_format: Union[Unset, File3DImportFormat] src_format: Union[Unset, File3DImportFormat]
if isinstance(_src_format, Unset): if isinstance(_src_format, Unset):
@ -145,7 +139,6 @@ class FileCenterOfMass:
created_at=created_at, created_at=created_at,
error=error, error=error,
id=id, id=id,
material_density=material_density,
src_format=src_format, src_format=src_format,
started_at=started_at, started_at=started_at,
status=status, status=status,

View File

@ -1,166 +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_import_format import File3DImportFormat
from ..models.api_call_status import ApiCallStatus
from ..types import UNSET, Unset
T = TypeVar("T", bound="FileCenterOfMassWithUniformDensity")
@attr.s(auto_attribs=True)
class FileCenterOfMassWithUniformDensity:
""" """
center_of_mass: Union[Unset, List[float]] = UNSET
completed_at: Union[Unset, datetime.datetime] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
error: Union[Unset, str] = UNSET
id: Union[Unset, str] = 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]:
center_of_mass: Union[Unset, List[float]] = UNSET
if not isinstance(self.center_of_mass, Unset):
center_of_mass = self.center_of_mass
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
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 center_of_mass is not UNSET:
field_dict['center_of_mass'] = center_of_mass
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 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()
center_of_mass = cast(List[float], d.pop("center_of_mass", UNSET))
_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)
_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)
file_center_of_mass_with_uniform_density = cls(
center_of_mass=center_of_mass,
completed_at=completed_at,
created_at=created_at,
error=error,
id=id,
src_format=src_format,
started_at=started_at,
status=status,
updated_at=updated_at,
user_id=user_id,
)
file_center_of_mass_with_uniform_density.additional_properties = d
return file_center_of_mass_with_uniform_density
@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

281
spec.json
View File

@ -709,12 +709,6 @@
], ],
"description": "The unique identifier of the API call.\n\nThis is the same as the API call ID." "description": "The unique identifier of the API call.\n\nThis is the same as the API call ID."
}, },
"material_density": {
"default": 0.0,
"description": "The material density as denoted by the user.",
"format": "float",
"type": "number"
},
"src_format": { "src_format": {
"allOf": [ "allOf": [
{ {
@ -765,94 +759,6 @@
], ],
"type": "object" "type": "object"
}, },
{
"description": "File center of mass.",
"properties": {
"center_of_mass": {
"description": "The resulting center of mass.",
"items": {
"format": "double",
"type": "number"
},
"nullable": true,
"type": "array"
},
"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."
},
"src_format": {
"allOf": [
{
"$ref": "#/components/schemas/File3DImportFormat"
}
],
"description": "The source format of the file."
},
"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": [
"FileCenterOfMassWithUniformDensity"
],
"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",
"src_format",
"status",
"type",
"updated_at"
],
"type": "object"
},
{ {
"description": "A file mass.", "description": "A file mass.",
"properties": { "properties": {
@ -1236,7 +1142,6 @@
"File3DConversion", "File3DConversion",
"FileVolume", "FileVolume",
"FileCenterOfMass", "FileCenterOfMass",
"FileCenterOfMassWithUniformDensity",
"FileMass", "FileMass",
"FileDensity", "FileDensity",
"FileSurfaceArea" "FileSurfaceArea"
@ -2917,93 +2822,6 @@
"type": "string" "type": "string"
}, },
"FileCenterOfMass": { "FileCenterOfMass": {
"description": "A file center of mass result.",
"properties": {
"center_of_mass": {
"description": "The resulting center of mass.",
"items": {
"format": "double",
"type": "number"
},
"nullable": true,
"type": "array"
},
"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."
},
"material_density": {
"default": 0.0,
"description": "The material density as denoted by the user.",
"format": "float",
"type": "number"
},
"src_format": {
"allOf": [
{
"$ref": "#/components/schemas/File3DImportFormat"
}
],
"description": "The source format of the file."
},
"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",
"src_format",
"status",
"updated_at"
],
"type": "object"
},
"FileCenterOfMassWithUniformDensity": {
"description": "A file center of mass result.", "description": "A file center of mass result.",
"properties": { "properties": {
"center_of_mass": { "center_of_mass": {
@ -9280,20 +9098,9 @@
}, },
"/file/center-of-mass": { "/file/center-of-mass": {
"post": { "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.\nDoes the same as the `center_of_mass_with_uniform_density` endpoint; except, this has a redundant `material_density value`. Kept for legacy in this version.\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.", "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.",
"operationId": "create_file_center_of_mass", "operationId": "create_file_center_of_mass",
"parameters": [ "parameters": [
{
"description": "The material density.",
"in": "query",
"name": "material_density",
"required": true,
"schema": {
"format": "float",
"type": "number"
},
"style": "form"
},
{ {
"description": "The format of the file.", "description": "The format of the file.",
"in": "query", "in": "query",
@ -9375,92 +9182,6 @@
] ]
} }
}, },
"/file/center-of-mass-with-uniform-density": {
"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.",
"operationId": "create_file_center_of_mass_with_uniform_density",
"parameters": [
{
"description": "The format of the file.",
"in": "query",
"name": "src_format",
"required": true,
"schema": {
"$ref": "#/components/schemas/File3DImportFormat"
},
"style": "form"
}
],
"requestBody": {
"content": {
"application/octet-stream": {
"schema": {
"format": "binary",
"type": "string"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FileCenterOfMassWithUniformDensity"
}
}
},
"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": "Get CAD file center of mass.",
"tags": [
"file",
"beta"
]
}
},
"/file/conversion/{src_format}/{output_format}": { "/file/conversion/{src_format}/{output_format}": {
"post": { "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.", "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.",