Skip to content

Commit

Permalink
Update api spec (#237)
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 87f9f38 commit 40e278a
Show file tree
Hide file tree
Showing 11 changed files with 549 additions and 384 deletions.
742 changes: 371 additions & 371 deletions kittycad.py.patch.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion kittycad/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
from .path_command import PathCommand
from .path_component_constraint_bound import PathComponentConstraintBound
from .path_component_constraint_type import PathComponentConstraintType
from .path_get_curve_uuid import PathGetCurveUuid
from .path_get_curve_uuids_for_vertices import PathGetCurveUuidsForVertices
from .path_get_info import PathGetInfo
from .path_get_vertex_uuids import PathGetVertexUuids
Expand Down Expand Up @@ -202,7 +203,7 @@
from .service_account import ServiceAccount
from .service_account_results_page import ServiceAccountResultsPage
from .session import Session
from .session_token_type import SessionTokenType
from .session_token_uuid import SessionTokenUuid
from .solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
from .solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
from .solid3d_get_extrusion_face_info import Solid3dGetExtrusionFaceInfo
Expand All @@ -211,6 +212,7 @@
from .solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
from .stl_storage import StlStorage
from .store_coupon_params import StoreCouponParams
from .string_uuid import StringUuid
from .subscription_tier_feature import SubscriptionTierFeature
from .subscription_tier_price import SubscriptionTierPrice
from .subscription_tier_type import SubscriptionTierType
Expand Down
3 changes: 2 additions & 1 deletion kittycad/models/api_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pydantic import BaseModel, ConfigDict

from ..models.string_uuid import StringUuid
from ..models.uuid import Uuid


Expand All @@ -19,7 +20,7 @@ class ApiToken(BaseModel):

label: Optional[str] = None

token: Uuid
token: StringUuid

updated_at: datetime.datetime

Expand Down
28 changes: 27 additions & 1 deletion kittycad/models/modeling_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class entity_get_distance(BaseModel):


class entity_linear_pattern_transform(BaseModel):
"""Create a linear pattern using this entity."""
"""Create a pattern using this entity by specifying the transform for each desired repetition."""

entity_id: str

Expand Down Expand Up @@ -383,6 +383,18 @@ class entity_mirror(BaseModel):
model_config = ConfigDict(protected_namespaces=())


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

edge_id: str

ids: List[str]

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

model_config = ConfigDict(protected_namespaces=())


class edit_mode_enter(BaseModel):
"""Enter edit mode"""

Expand Down Expand Up @@ -939,6 +951,18 @@ class path_get_curve_uuids_for_vertices(BaseModel):
model_config = ConfigDict(protected_namespaces=())


class path_get_curve_uuid(BaseModel):
"""Obtain curve id by index"""

index: int

path_id: str

type: Literal["path_get_curve_uuid"] = "path_get_curve_uuid"

model_config = ConfigDict(protected_namespaces=())


class path_get_vertex_uuids(BaseModel):
"""Obtain vertex ids for a path"""

Expand Down Expand Up @@ -1260,6 +1284,7 @@ class get_num_objects(BaseModel):
entity_circular_pattern,
entity_make_helix,
entity_mirror,
entity_mirror_across_edge,
edit_mode_enter,
select_with_point,
select_add,
Expand Down Expand Up @@ -1307,6 +1332,7 @@ class get_num_objects(BaseModel):
make_axes_gizmo,
path_get_info,
path_get_curve_uuids_for_vertices,
path_get_curve_uuid,
path_get_vertex_uuids,
handle_mouse_drag_start,
handle_mouse_drag_move,
Expand Down
12 changes: 12 additions & 0 deletions kittycad/models/ok_modeling_cmd_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from ..models.imported_geometry import ImportedGeometry
from ..models.mass import Mass
from ..models.mouse_click import MouseClick
from ..models.path_get_curve_uuid import PathGetCurveUuid
from ..models.path_get_curve_uuids_for_vertices import PathGetCurveUuidsForVertices
from ..models.path_get_info import PathGetInfo
from ..models.path_get_vertex_uuids import PathGetVertexUuids
Expand Down Expand Up @@ -366,6 +367,16 @@ class path_get_curve_uuids_for_vertices(BaseModel):
model_config = ConfigDict(protected_namespaces=())


class path_get_curve_uuid(BaseModel):
"""The response to the 'PathGetCurveUuid' endpoint"""

data: PathGetCurveUuid

type: Literal["path_get_curve_uuid"] = "path_get_curve_uuid"

model_config = ConfigDict(protected_namespaces=())


class path_get_vertex_uuids(BaseModel):
"""The response to the 'PathGetVertexUuids' endpoint"""

Expand Down Expand Up @@ -610,6 +621,7 @@ class extrusion_face_info(BaseModel):
path_get_info,
path_segment_info,
path_get_curve_uuids_for_vertices,
path_get_curve_uuid,
path_get_vertex_uuids,
curve_get_end_points,
face_is_planar,
Expand Down
11 changes: 11 additions & 0 deletions kittycad/models/path_get_curve_uuid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

from pydantic import BaseModel, ConfigDict



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

curve_id: str

model_config = ConfigDict(protected_namespaces=())
3 changes: 2 additions & 1 deletion kittycad/models/service_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pydantic import BaseModel, ConfigDict

from ..models.string_uuid import StringUuid
from ..models.uuid import Uuid


Expand All @@ -24,7 +25,7 @@ class ServiceAccount(BaseModel):

org_id: Uuid

token: Uuid
token: StringUuid

updated_at: datetime.datetime

Expand Down
4 changes: 2 additions & 2 deletions kittycad/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel, ConfigDict

from ..models.session_token_type import SessionTokenType
from ..models.session_token_uuid import SessionTokenUuid
from ..models.uuid import Uuid


Expand All @@ -15,7 +15,7 @@ class Session(BaseModel):

id: Uuid

session_token: SessionTokenType
session_token: SessionTokenUuid

updated_at: datetime.datetime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pydantic_core import CoreSchema, core_schema


class SessionTokenType(str):
class SessionTokenUuid(str):
"""An auth token. A uuid with a prefix of ses-"""

def __str__(self) -> str:
Expand Down
17 changes: 17 additions & 0 deletions kittycad/models/string_uuid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Any

from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema


class StringUuid(str):
"""An auth token. A UUIDv4"""

def __str__(self) -> str:
return self

@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(cls, handler(str))
107 changes: 101 additions & 6 deletions spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -13210,7 +13210,7 @@
"description": "The API token itself.",
"allOf": [
{
"$ref": "#/components/schemas/Uuid"
"$ref": "#/components/schemas/StringUuid"
}
]
},
Expand Down Expand Up @@ -19384,7 +19384,7 @@
]
},
{
"description": "Create a linear pattern using this entity.",
"description": "Create a pattern using this entity by specifying the transform for each desired repetition.",
"type": "object",
"properties": {
"entity_id": {
Expand All @@ -19393,7 +19393,7 @@
"format": "uuid"
},
"transform": {
"description": "How to transform each repeated solid. The total number of repetitions equals the size of this list.",
"description": "How to transform each repeated solid. The 0th transform will create the first copy of the entity. The total number of (optional) repetitions equals the size of this list.",
"type": "array",
"items": {
"$ref": "#/components/schemas/LinearTransform"
Expand Down Expand Up @@ -19607,6 +19607,36 @@
"type"
]
},
{
"description": "Mirror the input entities over the specified edge. (Currently only supports sketches)",
"type": "object",
"properties": {
"edge_id": {
"description": "The edge to use as the mirror axis, must be linear and lie in the plane of the solid",
"type": "string",
"format": "uuid"
},
"ids": {
"description": "ID of the mirror entities.",
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"type": {
"type": "string",
"enum": [
"entity_mirror_across_edge"
]
}
},
"required": [
"edge_id",
"ids",
"type"
]
},
{
"description": "Enter edit mode",
"type": "object",
Expand Down Expand Up @@ -20935,6 +20965,34 @@
"vertex_ids"
]
},
{
"description": "Obtain curve id by index",
"type": "object",
"properties": {
"index": {
"description": "IDs of the vertices for which to obtain curve ids from",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"path_id": {
"description": "Which path to query",
"type": "string",
"format": "uuid"
},
"type": {
"type": "string",
"enum": [
"path_get_curve_uuid"
]
}
},
"required": [
"index",
"path_id",
"type"
]
},
{
"description": "Obtain vertex ids for a path",
"type": "object",
Expand Down Expand Up @@ -22321,6 +22379,25 @@
"type"
]
},
{
"description": "The response to the 'PathGetCurveUuid' endpoint",
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/PathGetCurveUuid"
},
"type": {
"type": "string",
"enum": [
"path_get_curve_uuid"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The response to the 'PathGetVertexUuids' endpoint",
"type": "object",
Expand Down Expand Up @@ -23537,6 +23614,20 @@
"angle_between"
]
},
"PathGetCurveUuid": {
"description": "The response from the `PathGetCurveUuid` command.",
"type": "object",
"properties": {
"curve_id": {
"description": "The UUID of the curve entity.",
"type": "string",
"format": "uuid"
}
},
"required": [
"curve_id"
]
},
"PathGetCurveUuidsForVertices": {
"description": "The response from the `PathGetCurveUuidsForVertices` command.",
"type": "object",
Expand Down Expand Up @@ -24559,7 +24650,7 @@
"description": "The API token itself.",
"allOf": [
{
"$ref": "#/components/schemas/Uuid"
"$ref": "#/components/schemas/StringUuid"
}
]
},
Expand Down Expand Up @@ -24628,7 +24719,7 @@
"description": "The session token.",
"allOf": [
{
"$ref": "#/components/schemas/SessionTokenType"
"$ref": "#/components/schemas/SessionTokenUuid"
}
]
},
Expand Down Expand Up @@ -24656,7 +24747,7 @@
"user_id"
]
},
"SessionTokenType": {
"SessionTokenUuid": {
"description": "An auth token. A uuid with a prefix of ses-",
"type": "string"
},
Expand Down Expand Up @@ -24782,6 +24873,10 @@
"percent_off"
]
},
"StringUuid": {
"description": "An auth token. A UUIDv4",
"type": "string"
},
"SubscriptionTierFeature": {
"description": "A subscription tier feature.",
"type": "object",
Expand Down

0 comments on commit 40e278a

Please sign in to comment.