Skip to content

Commit

Permalink
Update api spec (#351)
Browse files Browse the repository at this point in the history
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent fd5580b commit 45277b3
Show file tree
Hide file tree
Showing 12 changed files with 883 additions and 494 deletions.
802 changes: 401 additions & 401 deletions kittycad.py.patch.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions kittycad/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Contains all the data models used in inputs/outputs"""

from .account_provider import AccountProvider
from .add_hole_from_offset import AddHoleFromOffset
from .add_org_member import AddOrgMember
from .address_details import AddressDetails
from .angle import Angle
Expand Down Expand Up @@ -99,6 +100,7 @@
from .entity_linear_pattern import EntityLinearPattern
from .entity_linear_pattern_transform import EntityLinearPatternTransform
from .entity_make_helix import EntityMakeHelix
from .entity_make_helix_from_params import EntityMakeHelixFromParams
from .entity_mirror import EntityMirror
from .entity_mirror_across_edge import EntityMirrorAcrossEdge
from .entity_set_opacity import EntitySetOpacity
Expand All @@ -113,6 +115,7 @@
from .extended_user import ExtendedUser
from .extended_user_results_page import ExtendedUserResultsPage
from .extrude import Extrude
from .extruded_face_info import ExtrudedFaceInfo
from .extrusion_face_cap_type import ExtrusionFaceCapType
from .extrusion_face_info import ExtrusionFaceInfo
from .face_get_center import FaceGetCenter
Expand Down Expand Up @@ -271,6 +274,7 @@
from .set_tool import SetTool
from .shortlink import Shortlink
from .shortlink_results_page import ShortlinkResultsPage
from .side_face import SideFace
from .sketch_mode_disable import SketchModeDisable
from .solid2d_add_hole import Solid2dAddHole
from .solid3d_fillet_edge import Solid3dFilletEdge
Expand Down
11 changes: 11 additions & 0 deletions kittycad/models/add_hole_from_offset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from typing import List

from pydantic import BaseModel, ConfigDict


class AddHoleFromOffset(BaseModel):
"""The response from the `AddHoleFromOffset` command."""

entity_ids: List[str]

model_config = ConfigDict(protected_namespaces=())
2 changes: 2 additions & 0 deletions kittycad/models/entity_make_helix.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
class EntityMakeHelix(BaseModel):
"""The response from the `EntityMakeHelix` endpoint."""

helix_id: str

model_config = ConfigDict(protected_namespaces=())
9 changes: 9 additions & 0 deletions kittycad/models/entity_make_helix_from_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from pydantic import BaseModel, ConfigDict


class EntityMakeHelixFromParams(BaseModel):
"""The response from the `EntityMakeHelixFromParams` endpoint."""

helix_id: str

model_config = ConfigDict(protected_namespaces=())
4 changes: 4 additions & 0 deletions kittycad/models/entity_mirror.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from typing import List

from pydantic import BaseModel, ConfigDict


class EntityMirror(BaseModel):
"""The response from the `EntityMirror` endpoint."""

entity_ids: List[str]

model_config = ConfigDict(protected_namespaces=())
4 changes: 4 additions & 0 deletions kittycad/models/entity_mirror_across_edge.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from typing import List

from pydantic import BaseModel, ConfigDict


class EntityMirrorAcrossEdge(BaseModel):
"""The response from the `EntityMirrorAcrossEdge` endpoint."""

entity_ids: List[str]

model_config = ConfigDict(protected_namespaces=())
17 changes: 17 additions & 0 deletions kittycad/models/extruded_face_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import List, Optional

from pydantic import BaseModel, ConfigDict

from ..models.side_face import SideFace


class ExtrudedFaceInfo(BaseModel):
"""IDs for the extruded faces."""

bottom: Optional[str] = None

sides: List[SideFace]

top: str

model_config = ConfigDict(protected_namespaces=())
41 changes: 40 additions & 1 deletion kittycad/models/modeling_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..models.cut_type import CutType
from ..models.distance_type import DistanceType
from ..models.entity_type import EntityType
from ..models.extruded_face_info import ExtrudedFaceInfo
from ..models.image_format import ImageFormat
from ..models.import_file import ImportFile
from ..models.input_format import InputFormat
Expand Down Expand Up @@ -83,6 +84,8 @@ class OptionExtrude(BaseModel):

distance: LengthUnit

faces: Optional[ExtrudedFaceInfo] = None

target: ModelingCmdId

type: Literal["extrude"] = "extrude"
Expand Down Expand Up @@ -421,13 +424,35 @@ class OptionEntityMakeHelix(BaseModel):

revolutions: float

start_angle: Angle
start_angle: Angle = {"unit": "degrees", "value": 0.0} # type: ignore

type: Literal["entity_make_helix"] = "entity_make_helix"

model_config = ConfigDict(protected_namespaces=())


class OptionEntityMakeHelixFromParams(BaseModel):
"""Create a helix using the specified parameters."""

axis: Point3d

center: Point3d

is_clockwise: bool

length: LengthUnit

radius: float

revolutions: float

start_angle: Angle = {"unit": "degrees", "value": 0.0} # type: ignore

type: Literal["entity_make_helix_from_params"] = "entity_make_helix_from_params"

model_config = ConfigDict(protected_namespaces=())


class OptionEntityMirror(BaseModel):
"""Mirror the input entities over the specified axis. (Currently only supports sketches)"""

Expand Down Expand Up @@ -1376,6 +1401,18 @@ class OptionMakeOffsetPath(BaseModel):
model_config = ConfigDict(protected_namespaces=())


class OptionAddHoleFromOffset(BaseModel):
"""Add a hole to a closed path by offsetting it a uniform distance inward."""

object_id: str

offset: LengthUnit

type: Literal["add_hole_from_offset"] = "add_hole_from_offset"

model_config = ConfigDict(protected_namespaces=())


ModelingCmd = RootModel[
Annotated[
Union[
Expand Down Expand Up @@ -1408,6 +1445,7 @@ class OptionMakeOffsetPath(BaseModel):
OptionEntityLinearPattern,
OptionEntityCircularPattern,
OptionEntityMakeHelix,
OptionEntityMakeHelixFromParams,
OptionEntityMirror,
OptionEntityMirrorAcrossEdge,
OptionSelectWithPoint,
Expand Down Expand Up @@ -1490,6 +1528,7 @@ class OptionMakeOffsetPath(BaseModel):
OptionSelectGet,
OptionGetNumObjects,
OptionMakeOffsetPath,
OptionAddHoleFromOffset,
],
Field(discriminator="type"),
]
Expand Down
90 changes: 57 additions & 33 deletions kittycad/models/ok_modeling_cmd_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated

from ..models.add_hole_from_offset import AddHoleFromOffset
from ..models.camera_drag_end import CameraDragEnd
from ..models.camera_drag_move import CameraDragMove
from ..models.camera_drag_start import CameraDragStart
Expand Down Expand Up @@ -40,6 +41,7 @@
from ..models.entity_linear_pattern import EntityLinearPattern
from ..models.entity_linear_pattern_transform import EntityLinearPatternTransform
from ..models.entity_make_helix import EntityMakeHelix
from ..models.entity_make_helix_from_params import EntityMakeHelixFromParams
from ..models.entity_mirror import EntityMirror
from ..models.entity_mirror_across_edge import EntityMirrorAcrossEdge
from ..models.entity_set_opacity import EntitySetOpacity
Expand Down Expand Up @@ -251,36 +253,6 @@ class OptionDefaultCameraPerspectiveSettings(BaseModel):
model_config = ConfigDict(protected_namespaces=())


class OptionEntityMakeHelix(BaseModel):
""""""

data: EntityMakeHelix

type: Literal["entity_make_helix"] = "entity_make_helix"

model_config = ConfigDict(protected_namespaces=())


class OptionEntityMirror(BaseModel):
""""""

data: EntityMirror

type: Literal["entity_mirror"] = "entity_mirror"

model_config = ConfigDict(protected_namespaces=())


class OptionEntityMirrorAcrossEdge(BaseModel):
""""""

data: EntityMirrorAcrossEdge

type: Literal["entity_mirror_across_edge"] = "entity_mirror_across_edge"

model_config = ConfigDict(protected_namespaces=())


class OptionSelectAdd(BaseModel):
""""""

Expand Down Expand Up @@ -883,6 +855,16 @@ class OptionMakeOffsetPath(BaseModel):
model_config = ConfigDict(protected_namespaces=())


class OptionAddHoleFromOffset(BaseModel):
""""""

data: AddHoleFromOffset

type: Literal["add_hole_from_offset"] = "add_hole_from_offset"

model_config = ConfigDict(protected_namespaces=())


class OptionDefaultCameraFocusOn(BaseModel):
""""""

Expand Down Expand Up @@ -1255,6 +1237,46 @@ class OptionEntityCircularPattern(BaseModel):
model_config = ConfigDict(protected_namespaces=())


class OptionEntityMirror(BaseModel):
""""""

data: EntityMirror

type: Literal["entity_mirror"] = "entity_mirror"

model_config = ConfigDict(protected_namespaces=())


class OptionEntityMirrorAcrossEdge(BaseModel):
""""""

data: EntityMirrorAcrossEdge

type: Literal["entity_mirror_across_edge"] = "entity_mirror_across_edge"

model_config = ConfigDict(protected_namespaces=())


class OptionEntityMakeHelix(BaseModel):
""""""

data: EntityMakeHelix

type: Literal["entity_make_helix"] = "entity_make_helix"

model_config = ConfigDict(protected_namespaces=())


class OptionEntityMakeHelixFromParams(BaseModel):
""""""

data: EntityMakeHelixFromParams

type: Literal["entity_make_helix_from_params"] = "entity_make_helix_from_params"

model_config = ConfigDict(protected_namespaces=())


class OptionSolid3DGetExtrusionFaceInfo(BaseModel):
""""""

Expand Down Expand Up @@ -1291,9 +1313,6 @@ class OptionExtrusionFaceInfo(BaseModel):
OptionCameraDragStart,
OptionDefaultCameraLookAt,
OptionDefaultCameraPerspectiveSettings,
OptionEntityMakeHelix,
OptionEntityMirror,
OptionEntityMirrorAcrossEdge,
OptionSelectAdd,
OptionSelectRemove,
OptionSceneClearAll,
Expand Down Expand Up @@ -1354,6 +1373,7 @@ class OptionExtrusionFaceInfo(BaseModel):
OptionViewIsometric,
OptionGetNumObjects,
OptionMakeOffsetPath,
OptionAddHoleFromOffset,
OptionDefaultCameraFocusOn,
OptionSelectGet,
OptionSolid3DGetAllEdgeFaces,
Expand Down Expand Up @@ -1391,6 +1411,10 @@ class OptionExtrusionFaceInfo(BaseModel):
OptionEntityLinearPatternTransform,
OptionEntityLinearPattern,
OptionEntityCircularPattern,
OptionEntityMirror,
OptionEntityMirrorAcrossEdge,
OptionEntityMakeHelix,
OptionEntityMakeHelixFromParams,
OptionSolid3DGetExtrusionFaceInfo,
OptionExtrusionFaceInfo,
],
Expand Down
11 changes: 11 additions & 0 deletions kittycad/models/side_face.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from pydantic import BaseModel, ConfigDict


class SideFace(BaseModel):
"""IDs for a side face, extruded from the path of some sketch/2D shape."""

face_id: str

path_id: str

model_config = ConfigDict(protected_namespaces=())
Loading

0 comments on commit 45277b3

Please sign in to comment.