Update api spec (#202)

* YOYO NEW API SPEC!

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
zoo-github-actions-auth[bot]
2024-03-04 12:53:31 -08:00
committed by GitHub
parent a3089ef956
commit 042bb964e5
69 changed files with 3505 additions and 5458 deletions

View File

@ -35,4 +35,4 @@ jobs:
- name: Run ruff
shell: bash
run: |
poetry run ruff check --format=github .
poetry run ruff check --output-format=github .

View File

@ -1577,7 +1577,7 @@ def generateObjectTypeCode(
description = ""
if "description" in schema:
description = schema["description"]
description = schema["description"].replace('"', '\\"')
imports = []
refs = getRefs(schema)
@ -1801,6 +1801,11 @@ def getRequestBodyRefs(endpoint: dict) -> List[str]:
if "$ref" in form:
ref = form["$ref"].replace("#/components/schemas/", "")
refs.append(ref)
elif content_type == "multipart/form-data":
form = content[content_type]["schema"]
if "$ref" in form:
ref = form["$ref"].replace("#/components/schemas/", "")
refs.append(ref)
else:
# Throw an error for an unsupported content type.
logging.error("content: ", content)
@ -1839,6 +1844,15 @@ def getRequestBodyTypeSchema(
elif form != {}:
logging.error("not a ref: ", form)
raise Exception("not a ref")
elif content_type == "multipart/form-data":
form = content[content_type]["schema"]
if "$ref" in form:
ref = form["$ref"].replace("#/components/schemas/", "")
type_schema = data["components"]["schemas"][ref]
return ref, type_schema
elif form != {}:
type_schema = form
return None, type_schema
else:
logging.error("unsupported content type: ", content_type)
raise Exception("unsupported content type")

File diff suppressed because it is too large Load Diff

View File

@ -79,6 +79,7 @@ def sync(
*,
client: Client,
) -> Optional[Union[KclCodeCompletionResponse, Error]]:
return sync_detailed(
body=body,
client=client,
@ -106,6 +107,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Union[KclCodeCompletionResponse, Error]]:
return (
await asyncio_detailed(
body=body,

View File

@ -20,6 +20,7 @@ def _get_kwargs(
) # noqa: E501
if feedback is not None:
if "?" in url:
url = url + "&feedback=" + str(feedback)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -22,24 +22,28 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:
url = url + "?sort_by=" + str(sort_by)
if no_models is not None:
if "?" in url:
url = url + "&no_models=" + str(no_models)
else:

View File

@ -19,6 +19,7 @@ def _get_kwargs(
) # noqa: E501
if group_by is not None:
if "?" in url:
url = url + "&group_by=" + str(group_by)
else:

View File

@ -35,9 +35,7 @@ def _get_kwargs(
}
def _parse_response(
*, response: httpx.Response
) -> Optional[
def _parse_response(*, response: httpx.Response) -> Optional[
Union[
FileConversion,
FileCenterOfMass,
@ -123,9 +121,7 @@ def _parse_response(
return Error(**response.json())
def _build_response(
*, response: httpx.Response
) -> Response[
def _build_response(*, response: httpx.Response) -> Response[
Optional[
Union[
FileConversion,

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -23,18 +23,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -23,24 +23,28 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:
url = url + "?sort_by=" + str(sort_by)
if status is not None:
if "?" in url:
url = url + "&status=" + str(status)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -18,6 +18,7 @@ def _get_kwargs(
) # noqa: E501
if label is not None:
if "?" in url:
url = url + "&label=" + str(label)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -22,6 +22,7 @@ def _get_kwargs(
) # noqa: E501
if output is not None:
if "?" in url:
url = url + "&output=" + str(output)
else:
@ -92,6 +93,7 @@ def sync(
client: Client,
output: Optional[str] = None,
) -> Optional[Union[CodeOutput, Error]]:
return sync_detailed(
lang=lang,
output=output,
@ -127,6 +129,7 @@ async def asyncio(
client: Client,
output: Optional[str] = None,
) -> Optional[Union[CodeOutput, Error]]:
return (
await asyncio_detailed(
lang=lang,

View File

@ -22,12 +22,14 @@ def _get_kwargs(
) # noqa: E501
if output_unit is not None:
if "?" in url:
url = url + "&output_unit=" + str(output_unit)
else:
url = url + "?output_unit=" + str(output_unit)
if src_format is not None:
if "?" in url:
url = url + "&src_format=" + str(src_format)
else:

View File

@ -25,24 +25,28 @@ def _get_kwargs(
) # noqa: E501
if material_mass is not None:
if "?" in url:
url = url + "&material_mass=" + str(material_mass)
else:
url = url + "?material_mass=" + str(material_mass)
if material_mass_unit is not None:
if "?" in url:
url = url + "&material_mass_unit=" + str(material_mass_unit)
else:
url = url + "?material_mass_unit=" + str(material_mass_unit)
if output_unit is not None:
if "?" in url:
url = url + "&output_unit=" + str(output_unit)
else:
url = url + "?output_unit=" + str(output_unit)
if src_format is not None:
if "?" in url:
url = url + "&src_format=" + str(src_format)
else:

View File

@ -25,24 +25,28 @@ def _get_kwargs(
) # noqa: E501
if material_density is not None:
if "?" in url:
url = url + "&material_density=" + str(material_density)
else:
url = url + "?material_density=" + str(material_density)
if material_density_unit is not None:
if "?" in url:
url = url + "&material_density_unit=" + str(material_density_unit)
else:
url = url + "?material_density_unit=" + str(material_density_unit)
if output_unit is not None:
if "?" in url:
url = url + "&output_unit=" + str(output_unit)
else:
url = url + "?output_unit=" + str(output_unit)
if src_format is not None:
if "?" in url:
url = url + "&src_format=" + str(src_format)
else:

View File

@ -22,12 +22,14 @@ def _get_kwargs(
) # noqa: E501
if output_unit is not None:
if "?" in url:
url = url + "&output_unit=" + str(output_unit)
else:
url = url + "?output_unit=" + str(output_unit)
if src_format is not None:
if "?" in url:
url = url + "&src_format=" + str(src_format)
else:

View File

@ -22,12 +22,14 @@ def _get_kwargs(
) # noqa: E501
if output_unit is not None:
if "?" in url:
url = url + "&output_unit=" + str(output_unit)
else:
url = url + "?output_unit=" + str(output_unit)
if src_format is not None:
if "?" in url:
url = url + "&src_format=" + str(src_format)
else:

View File

@ -79,6 +79,7 @@ def sync(
*,
client: Client,
) -> Optional[Union[VerificationTokenResponse, Error]]:
return sync_detailed(
body=body,
client=client,
@ -106,6 +107,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Union[VerificationTokenResponse, Error]]:
return (
await asyncio_detailed(
body=body,

View File

@ -19,18 +19,21 @@ def _get_kwargs(
) # noqa: E501
if callback_url is not None:
if "?" in url:
url = url + "&callback_url=" + str(callback_url)
else:
url = url + "?callback_url=" + str(callback_url)
if email is not None:
if "?" in url:
url = url + "&email=" + str(email)
else:
url = url + "?email=" + str(email)
if token is not None:
if "?" in url:
url = url + "&token=" + str(token)
else:
@ -96,6 +99,7 @@ def sync(
client: Client,
callback_url: Optional[str] = None,
) -> Optional[Error]:
return sync_detailed(
callback_url=callback_url,
email=email,
@ -131,6 +135,7 @@ async def asyncio(
client: Client,
callback_url: Optional[str] = None,
) -> Optional[Error]:
return (
await asyncio_detailed(
callback_url=callback_url,

View File

@ -20,6 +20,7 @@ def _get_kwargs(
) # noqa: E501
if callback_url is not None:
if "?" in url:
url = url + "&callback_url=" + str(callback_url)
else:

View File

@ -77,6 +77,7 @@ def sync(
*,
client: Client,
) -> Optional[Error]:
return sync_detailed(
provider_id=provider_id,
body=body,
@ -108,6 +109,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Error]:
return (
await asyncio_detailed(
provider_id=provider_id,

View File

@ -0,0 +1,100 @@
from typing import Any, Dict, Optional
import httpx
from ...client import Client
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/events".format(
client.base_url,
) # noqa: E501
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[Error]:
return None
if response.status_code == 400:
response_4XX = Error(**response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error(**response.json())
return response_5XX
return Error(**response.json())
def _build_response(*, response: httpx.Response) -> Response[Optional[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[Optional[Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.post(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Error]:
"""We collect anonymous telemetry data for improving our product.""" # noqa: E501
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Optional[Error]]:
kwargs = _get_kwargs(
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(
*,
client: Client,
) -> Optional[Error]:
"""We collect anonymous telemetry data for improving our product.""" # noqa: E501
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -71,6 +71,7 @@ def sync(
*,
client: Client,
) -> Optional[Union[IpAddrInfo, Error]]:
return sync_detailed(
client=client,
).parsed
@ -94,6 +95,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Union[IpAddrInfo, Error]]:
return (
await asyncio_detailed(
client=client,

View File

@ -70,6 +70,7 @@ def sync(
*,
client: Client,
) -> Optional[Union[dict, Error]]:
return sync_detailed(
client=client,
).parsed
@ -93,6 +94,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Union[dict, Error]]:
return (
await asyncio_detailed(
client=client,

View File

@ -71,6 +71,7 @@ def sync(
*,
client: Client,
) -> Optional[Union[Pong, Error]]:
return sync_detailed(
client=client,
).parsed
@ -94,6 +95,7 @@ async def asyncio(
*,
client: Client,
) -> Optional[Union[Pong, Error]]:
return (
await asyncio_detailed(
client=client,

View File

@ -22,30 +22,35 @@ def _get_kwargs(
url = "{}/ws/modeling/commands".format(client.base_url) # noqa: E501
if fps is not None:
if "?" in url:
url = url + "&fps=" + str(fps)
else:
url = url + "?fps=" + str(fps)
if unlocked_framerate is not None:
if "?" in url:
url = url + "&unlocked_framerate=" + str(unlocked_framerate).lower()
else:
url = url + "?unlocked_framerate=" + str(unlocked_framerate).lower()
if video_res_height is not None:
if "?" in url:
url = url + "&video_res_height=" + str(video_res_height)
else:
url = url + "?video_res_height=" + str(video_res_height)
if video_res_width is not None:
if "?" in url:
url = url + "&video_res_width=" + str(video_res_width)
else:
url = url + "?video_res_width=" + str(video_res_width)
if webrtc is not None:
if "?" in url:
url = url + "&webrtc=" + str(webrtc).lower()
else:

View File

@ -23,24 +23,28 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:
url = url + "?sort_by=" + str(sort_by)
if role is not None:
if "?" in url:
url = url + "&role=" + str(role)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -18,6 +18,7 @@ def _get_kwargs(
) # noqa: E501
if label is not None:
if "?" in url:
url = url + "&label=" + str(label)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -23,6 +23,7 @@ def _get_kwargs(
) # noqa: E501
if value is not None:
if "?" in url:
url = url + "&value=" + str(value)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -21,18 +21,21 @@ def _get_kwargs(
) # noqa: E501
if limit is not None:
if "?" in url:
url = url + "&limit=" + str(limit)
else:
url = url + "?limit=" + str(limit)
if page_token is not None:
if "?" in url:
url = url + "&page_token=" + str(page_token)
else:
url = url + "?page_token=" + str(page_token)
if sort_by is not None:
if "?" in url:
url = url + "&sort_by=" + str(sort_by)
else:

View File

@ -173,14 +173,14 @@ async def test_file_convert_stl_async():
file.close()
# Get the fc.
result: Optional[
Union[FileConversion, Error]
] = await create_file_conversion.asyncio(
result: Optional[Union[FileConversion, Error]] = (
await create_file_conversion.asyncio(
client=client,
body=content,
src_format=FileImportFormat.STL,
output_format=FileExportFormat.OBJ,
)
)
assert isinstance(result, FileConversion)
@ -212,14 +212,14 @@ async def test_file_convert_obj_async():
file.close()
# Get the fc.
result: Optional[
Union[FileConversion, Error]
] = await create_file_conversion.asyncio(
result: Optional[Union[FileConversion, Error]] = (
await create_file_conversion.asyncio(
client=client,
body=content,
src_format=FileImportFormat.OBJ,
output_format=FileExportFormat.STL,
)
)
assert isinstance(result, FileConversion)
@ -556,12 +556,12 @@ def test_text_to_cad():
while (
body.status == ApiCallStatus.IN_PROGRESS or body.status == ApiCallStatus.QUEUED
) and time.time() - start_time < 120:
result_status: Optional[
Union[TextToCad, Error]
] = get_text_to_cad_model_for_user.sync(
result_status: Optional[Union[TextToCad, Error]] = (
get_text_to_cad_model_for_user.sync(
client=client,
id=body.id,
)
)
if isinstance(result_status, Error) or result_status is None:
print(result_status)

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,10 @@ from .axis_direction_pair import AxisDirectionPair
from .billing_info import BillingInfo
from .block_reason import BlockReason
from .cache_metadata import CacheMetadata
from .camera_drag_end import CameraDragEnd
from .camera_drag_interaction_type import CameraDragInteractionType
from .camera_drag_move import CameraDragMove
from .camera_settings import CameraSettings
from .card_details import CardDetails
from .center_of_mass import CenterOfMass
from .client_metrics import ClientMetrics
@ -53,6 +56,8 @@ from .curve_get_type import CurveGetType
from .curve_type import CurveType
from .customer import Customer
from .customer_balance import CustomerBalance
from .default_camera_get_settings import DefaultCameraGetSettings
from .default_camera_zoom import DefaultCameraZoom
from .density import Density
from .der_encoded_key_pair import DerEncodedKeyPair
from .device_access_token_request_form import DeviceAccessTokenRequestForm

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class CameraDragEnd(BaseModel):
"""The response from the `CameraDragEnd` command."""
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class CameraDragMove(BaseModel):
"""The response from the `CameraDragMove` command. Note this is an \"unreliable\" channel message, so this data may need more data like a \"sequence\" """
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,23 @@
from typing import Optional
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d
class CameraSettings(BaseModel):
"""Camera settings including position, center, fov etc"""
center: Point3d
fov_y: Optional[float] = None
ortho: bool
ortho_scale: Optional[float] = None
pos: Point3d
up: Point3d
model_config = ConfigDict(protected_namespaces=())

View File

@ -10,7 +10,7 @@ class CodeOutput(BaseModel):
<details><summary>JSON schema</summary>
```json { "description": "Output of the code being executed.", "type": "object", "properties": { "output_files": { "description": "The contents of the files requested if they were passed.", "type": "array", "items": { "$ref": "#/components/schemas/OutputFile" } }, "stderr": { "description": "The stderr of the code.", "default": "", "type": "string" }, "stdout": { "description": "The stdout of the code.", "default": "", "type": "string" } } } ``` </details>
```json { \"description\": \"Output of the code being executed.\", \"type\": \"object\", \"properties\": { \"output_files\": { \"description\": \"The contents of the files requested if they were passed.\", \"type\": \"array\", \"items\": { \"$ref\": \"#/components/schemas/OutputFile\" } }, \"stderr\": { \"description\": \"The stderr of the code.\", \"default\": \"\", \"type\": \"string\" }, \"stdout\": { \"description\": \"The stdout of the code.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>
"""
output_files: Optional[List[OutputFile]] = None

View File

@ -8,7 +8,7 @@ from ..models.currency import Currency
class Customer(BaseModel):
"""The resource representing a payment "Customer"."""
"""The resource representing a payment \"Customer\"."""
address: Optional[AddressDetails] = None

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class DefaultCameraGetSettings(BaseModel):
"""The response from the `DefaultCameraGetSettings` command."""
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

View File

@ -0,0 +1,12 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings
class DefaultCameraZoom(BaseModel):
"""The response from the `DefaultCameraZoom` command."""
settings: CameraSettings
model_config = ConfigDict(protected_namespaces=())

View File

@ -39,7 +39,7 @@ class start_path(BaseModel):
class move_path_pen(BaseModel):
"""Move the path's "pen"."""
"""Move the path's \"pen\"."""
path: ModelingCmdId
@ -51,7 +51,7 @@ class move_path_pen(BaseModel):
class extend_path(BaseModel):
"""Extend a path by adding a new segment which starts at the path's "pen". If no "pen" location has been set before (via `MovePen`), then the pen is at the origin."""
"""Extend a path by adding a new segment which starts at the path's \"pen\". If no \"pen\" location has been set before (via `MovePen`), then the pen is at the origin."""
path: ModelingCmdId
@ -124,6 +124,14 @@ class camera_drag_end(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class default_camera_get_settings(BaseModel):
"""Gets the default camera's camera settings"""
type: Literal["default_camera_get_settings"] = "default_camera_get_settings"
model_config = ConfigDict(protected_namespaces=())
class default_camera_look_at(BaseModel):
"""Change what the default camera is looking at."""
@ -149,9 +157,9 @@ class default_camera_perspective_settings(BaseModel):
sequence: Optional[int] = None
type: Literal[
type: Literal["default_camera_perspective_settings"] = (
"default_camera_perspective_settings"
] = "default_camera_perspective_settings"
)
up: Point3d
@ -185,9 +193,9 @@ class default_camera_enable_sketch_mode(BaseModel):
ortho: bool
type: Literal[
type: Literal["default_camera_enable_sketch_mode"] = (
"default_camera_enable_sketch_mode"
] = "default_camera_enable_sketch_mode"
)
x_axis: Point3d
@ -199,9 +207,9 @@ class default_camera_enable_sketch_mode(BaseModel):
class default_camera_disable_sketch_mode(BaseModel):
"""Disable sketch mode, from the default camera."""
type: Literal[
type: Literal["default_camera_disable_sketch_mode"] = (
"default_camera_disable_sketch_mode"
] = "default_camera_disable_sketch_mode"
)
model_config = ConfigDict(protected_namespaces=())
@ -323,7 +331,7 @@ class edit_mode_enter(BaseModel):
class select_with_point(BaseModel):
"""Modifies the selection by simulating a "mouse click" at the given x,y window coordinate Returns ID of whatever was selected."""
"""Modifies the selection by simulating a \"mouse click\" at the given x,y window coordinate Returns ID of whatever was selected."""
selected_at_window: Point2d
@ -551,6 +559,8 @@ class solid3d_fillet_edge(BaseModel):
radius: LengthUnit
tolerance: LengthUnit
type: Literal["solid3d_fillet_edge"] = "solid3d_fillet_edge"
model_config = ConfigDict(protected_namespaces=())
@ -777,9 +787,9 @@ class path_get_curve_uuids_for_vertices(BaseModel):
path_id: str
type: Literal[
type: Literal["path_get_curve_uuids_for_vertices"] = (
"path_get_curve_uuids_for_vertices"
] = "path_get_curve_uuids_for_vertices"
)
vertex_ids: List[str]
@ -1069,6 +1079,7 @@ ModelingCmd = RootModel[
camera_drag_start,
camera_drag_move,
camera_drag_end,
default_camera_get_settings,
default_camera_look_at,
default_camera_perspective_settings,
default_camera_zoom,

View File

@ -3,10 +3,14 @@ from typing import Literal, Union
from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated
from ..models.camera_drag_end import CameraDragEnd
from ..models.camera_drag_move import CameraDragMove
from ..models.center_of_mass import CenterOfMass
from ..models.curve_get_control_points import CurveGetControlPoints
from ..models.curve_get_end_points import CurveGetEndPoints
from ..models.curve_get_type import CurveGetType
from ..models.default_camera_get_settings import DefaultCameraGetSettings
from ..models.default_camera_zoom import DefaultCameraZoom
from ..models.density import Density
from ..models.entity_circular_pattern import EntityCircularPattern
from ..models.entity_get_all_child_uuids import EntityGetAllChildUuids
@ -119,6 +123,46 @@ class entity_get_all_child_uuids(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class camera_drag_move(BaseModel):
"""The response to the 'CameraDragMove' endpoint"""
data: CameraDragMove
type: Literal["camera_drag_move"] = "camera_drag_move"
model_config = ConfigDict(protected_namespaces=())
class camera_drag_end(BaseModel):
"""The response to the 'CameraDragEnd' endpoint"""
data: CameraDragEnd
type: Literal["camera_drag_end"] = "camera_drag_end"
model_config = ConfigDict(protected_namespaces=())
class default_camera_get_settings(BaseModel):
"""The response to the 'DefaultCameraGetSettings' endpoint"""
data: DefaultCameraGetSettings
type: Literal["default_camera_get_settings"] = "default_camera_get_settings"
model_config = ConfigDict(protected_namespaces=())
class default_camera_zoom(BaseModel):
"""The response to the 'DefaultCameraZoom' endpoint"""
data: DefaultCameraZoom
type: Literal["default_camera_zoom"] = "default_camera_zoom"
model_config = ConfigDict(protected_namespaces=())
class select_get(BaseModel):
"""The response to the 'SelectGet' endpoint"""
@ -254,9 +298,9 @@ class path_get_curve_uuids_for_vertices(BaseModel):
data: PathGetCurveUuidsForVertices
type: Literal[
type: Literal["path_get_curve_uuids_for_vertices"] = (
"path_get_curve_uuids_for_vertices"
] = "path_get_curve_uuids_for_vertices"
)
model_config = ConfigDict(protected_namespaces=())
@ -422,6 +466,10 @@ OkModelingCmdResponse = RootModel[
entity_get_num_children,
entity_get_parent_id,
entity_get_all_child_uuids,
camera_drag_move,
camera_drag_end,
default_camera_get_settings,
default_camera_zoom,
select_get,
solid3d_get_all_edge_faces,
solid3d_get_all_opposite_edges,

View File

@ -116,6 +116,22 @@ class metrics_request(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class PongData(BaseModel):
""""""
model_config = ConfigDict(protected_namespaces=())
class pong(BaseModel):
"""Pong response to a Ping message."""
data: PongData
type: Literal["pong"] = "pong"
model_config = ConfigDict(protected_namespaces=())
OkWebSocketResponseData = RootModel[
Annotated[
Union[
@ -125,6 +141,7 @@ OkWebSocketResponseData = RootModel[
modeling,
export,
metrics_request,
pong,
],
Field(discriminator="type"),
]

View File

@ -9,7 +9,7 @@ class OutputFile(BaseModel):
<details><summary>JSON schema</summary>
```json { "description": "Output file contents.", "type": "object", "properties": { "contents": { "description": "The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.", "type": "string" }, "name": { "description": "The name of the file.", "default": "", "type": "string" } } } ``` </details>
```json { \"description\": \"Output file contents.\", \"type\": \"object\", \"properties\": { \"contents\": { \"description\": \"The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.\", \"type\": \"string\" }, \"name\": { \"description\": \"The name of the file.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>
"""
contents: Optional[str] = None

View File

@ -10,7 +10,7 @@ from ..models.point3d import Point3d
class line(BaseModel):
"""A straight line segment. Goes from the current path "pen" to the given endpoint."""
"""A straight line segment. Goes from the current path \"pen\" to the given endpoint."""
end: Point3d

View File

@ -1,4 +1,5 @@
""" Contains some shared types for properties """
from typing import (
BinaryIO,
Generic,

2724
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ pydantic-extra-types = "^2.1.0"
[tool.poetry.dev-dependencies]
autoclasstoc = "^1.6.0"
black = "^23.12.1"
black = "^24.2.0"
isort = "^5.12.0"
jinja2 = "^3.1.3"
jsonpatch = "^1.33"
@ -32,10 +32,10 @@ openapi-parser = "^0.2.6"
openapi-spec-validator = "^0.6.0"
prance = "^23.6.21"
pyenchant = "^3.2.2"
pytest = "^8.1.0"
pytest = "^8.0.2"
pytest-asyncio = "^0.21.1"
pytest-cov = "^4.1.0"
ruff = "^0.2.2"
ruff = "^0.3.0"
Sphinx = "^7.1.2"
sphinx-autoapi = "^2.0.1"
sphinx-autodoc-typehints = "^1.24.0"

359
spec.json
View File

@ -1746,6 +1746,126 @@
}
}
},
"/events": {
"post": {
"tags": [
"meta",
"hidden"
],
"summary": "Creates an internal telemetry event.",
"description": "We collect anonymous telemetry data for improving our product.",
"operationId": "create_event",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "string",
"format": "binary"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "resource updated",
"headers": {
"Access-Control-Allow-Credentials": {
"description": "Access-Control-Allow-Credentials header.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
},
"Access-Control-Allow-Headers": {
"description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
},
"Access-Control-Allow-Methods": {
"description": "Access-Control-Allow-Methods header.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
},
"Access-Control-Allow-Origin": {
"description": "Access-Control-Allow-Origin header.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
},
"options": {
"tags": [
"hidden"
],
"summary": "OPTIONS endpoint.",
"description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.",
"operationId": "options_create_event",
"responses": {
"204": {
"description": "successful operation, no content",
"headers": {
"Access-Control-Allow-Credentials": {
"description": "Access-Control-Allow-Credentials header.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
},
"Access-Control-Allow-Headers": {
"description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
},
"Access-Control-Allow-Methods": {
"description": "Access-Control-Allow-Methods header.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
},
"Access-Control-Allow-Origin": {
"description": "Access-Control-Allow-Origin header.",
"style": "simple",
"required": true,
"schema": {
"type": "string"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/file/center-of-mass": {
"post": {
"tags": [
@ -14117,6 +14237,23 @@
"ok"
]
},
"CameraDragEnd": {
"description": "The response from the `CameraDragEnd` command.",
"type": "object",
"properties": {
"settings": {
"description": "Camera settings",
"allOf": [
{
"$ref": "#/components/schemas/CameraSettings"
}
]
}
},
"required": [
"settings"
]
},
"CameraDragInteractionType": {
"description": "The type of camera drag interaction.",
"oneOf": [
@ -14143,6 +14280,75 @@
}
]
},
"CameraDragMove": {
"description": "The response from the `CameraDragMove` command. Note this is an \"unreliable\" channel message, so this data may need more data like a \"sequence\"",
"type": "object",
"properties": {
"settings": {
"description": "Camera settings",
"allOf": [
{
"$ref": "#/components/schemas/CameraSettings"
}
]
}
},
"required": [
"settings"
]
},
"CameraSettings": {
"description": "Camera settings including position, center, fov etc",
"type": "object",
"properties": {
"center": {
"description": "Camera's look-at center (center-pos gives viewing vector)",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"fov_y": {
"nullable": true,
"description": "Camera's field-of-view angle (if ortho is false)",
"type": "number",
"format": "float"
},
"ortho": {
"description": "Whether or not the camera is in ortho mode",
"type": "boolean"
},
"ortho_scale": {
"nullable": true,
"description": "The camera's ortho scale (derived from viewing distance if ortho is true)",
"type": "number",
"format": "float"
},
"pos": {
"description": "Camera position (vantage)",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"up": {
"description": "Camera's world-space up vector",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
}
},
"required": [
"center",
"ortho",
"pos",
"up"
]
},
"CardDetails": {
"description": "The card details of a payment method.",
"type": "object",
@ -15033,6 +15239,40 @@
"updated_at"
]
},
"DefaultCameraGetSettings": {
"description": "The response from the `DefaultCameraGetSettings` command.",
"type": "object",
"properties": {
"settings": {
"description": "Camera settings",
"allOf": [
{
"$ref": "#/components/schemas/CameraSettings"
}
]
}
},
"required": [
"settings"
]
},
"DefaultCameraZoom": {
"description": "The response from the `DefaultCameraZoom` command.",
"type": "object",
"properties": {
"settings": {
"description": "Camera settings",
"allOf": [
{
"$ref": "#/components/schemas/CameraSettings"
}
]
}
},
"required": [
"settings"
]
},
"Density": {
"description": "The density response.",
"type": "object",
@ -18204,6 +18444,21 @@
"window"
]
},
{
"description": "Gets the default camera's camera settings",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"default_camera_get_settings"
]
}
},
"required": [
"type"
]
},
{
"description": "Change what the default camera is looking at.",
"type": "object",
@ -19262,6 +19517,14 @@
}
]
},
"tolerance": {
"description": "The maximum acceptable surface gap computed between the filleted surfaces. Must be positive (i.e. greater than zero).",
"allOf": [
{
"$ref": "#/components/schemas/LengthUnit"
}
]
},
"type": {
"type": "string",
"enum": [
@ -19273,6 +19536,7 @@
"edge_id",
"object_id",
"radius",
"tolerance",
"type"
]
},
@ -20746,6 +21010,82 @@
"type"
]
},
{
"description": "The response to the 'CameraDragMove' endpoint",
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/CameraDragMove"
},
"type": {
"type": "string",
"enum": [
"camera_drag_move"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The response to the 'CameraDragEnd' endpoint",
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/CameraDragEnd"
},
"type": {
"type": "string",
"enum": [
"camera_drag_end"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The response to the 'DefaultCameraGetSettings' endpoint",
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/DefaultCameraGetSettings"
},
"type": {
"type": "string",
"enum": [
"default_camera_get_settings"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The response to the 'DefaultCameraZoom' endpoint",
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/DefaultCameraZoom"
},
"type": {
"type": "string",
"enum": [
"default_camera_zoom"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The response to the 'SelectGet' endpoint",
"type": "object",
@ -21478,6 +21818,25 @@
"data",
"type"
]
},
{
"description": "Pong response to a Ping message.",
"type": "object",
"properties": {
"data": {
"type": "object"
},
"type": {
"type": "string",
"enum": [
"pong"
]
}
},
"required": [
"data",
"type"
]
}
]
},