Compare commits

...

10 Commits

Author SHA1 Message Date
b3eeaef41d bump
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-22 13:43:15 -07:00
0ac4e4c9c0 Update api spec (#216)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-22 13:41:53 -07:00
35bbe91eb4 bump tag
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-22 11:39:19 -07:00
b4ce8e9642 Update api spec (#215)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-22 11:10:19 -07:00
479cf6a937 Update api spec (#214)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-18 14:44:34 -07:00
acea57bcba Update api spec (#213)
* YOYO NEW API SPEC!

* I have generated the latest API!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-17 09:49:04 -07:00
64e8aa2816 Update api spec (#212)
* YOYO NEW API SPEC!

* fixes

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

* I have generated the latest API!

---------

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>
2024-04-12 12:03:34 -07:00
38801b52a7 fix
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-11 11:23:34 -07:00
e73f39cfa9 reviewers
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-11 11:16:11 -07:00
7536ca8683 assignee
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-04-11 11:05:49 -07:00
12 changed files with 1083 additions and 690 deletions

View File

@ -67,6 +67,9 @@ jobs:
gh pr create --title "Update lang spec docs for python" \
--body "Updating the generated docs for python" \
--head "$NEW_BRANCH" \
--reviewer jessfraz \
--reviewer irev-dev \
--reviewer franknoirot \
--base main || true
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

View File

@ -1270,7 +1270,7 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
f.write("from ." + camel_to_snake(ref_name) + " import " + ref_name + "\n")
all_options.append(ref_name)
if isNestedObjectOneOf(schema):
if isNestedObjectAnyOf(schema):
# We want to write each of the nested objects.
for any_of in schema["anyOf"]:
# Get the nested object.
@ -1326,6 +1326,47 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
f.write(object_code)
f.write("\n")
all_options.append(object_name)
else:
# We want to write each of the nested objects.
for any_of in schema["anyOf"]:
# Get the nested object.
if "properties" in any_of:
for prop_name in any_of["properties"]:
nested_object = any_of["properties"][prop_name]
if nested_object == {}:
f.write("from typing import Any\n")
f.write(prop_name + " = Any\n")
f.write("\n")
all_options.append(prop_name)
elif "$ref" in nested_object:
ref = nested_object["$ref"]
ref_name = ref[ref.rfind("/") + 1 :]
f.write(
"from ."
+ camel_to_snake(ref_name)
+ " import "
+ ref_name
+ "\n"
)
f.write("\n")
if prop_name != ref_name:
f.write(prop_name + " = " + ref_name + "\n")
f.write("\n")
all_options.append(prop_name)
else:
object_code = generateObjectTypeCode(
prop_name, nested_object, "object", data, None, None
)
f.write(object_code)
f.write("\n")
all_options.append(prop_name)
elif "type" in any_of and any_of["type"] == "string":
enum_code = generateEnumTypeCode(
any_of["enum"][0], any_of, "string", []
)
f.write(enum_code)
f.write("\n")
all_options.append(any_of["enum"][0])
# Write the sum type.
description = getAnyOfDescription(schema)
@ -1953,6 +1994,40 @@ def getOneOfRefType(schema: dict) -> str:
raise Exception("Cannot get oneOf ref type for schema: ", schema)
def isNestedObjectAnyOf(schema: dict) -> bool:
if "anyOf" not in schema:
return False
is_nested_object = False
for any_of in schema["anyOf"]:
# Check if each are an object w 1 property in it.
if (
"type" in any_of
and any_of["type"] == "object"
and "properties" in any_of
and len(any_of["properties"]) == 1
):
for prop_name in any_of["properties"]:
nested_object = any_of["properties"][prop_name]
if "type" in nested_object and nested_object["type"] == "object":
is_nested_object = True
else:
is_nested_object = False
break
elif (
"type" in any_of
and any_of["type"] == "string"
and "enum" in any_of
and len(any_of["enum"]) == 1
):
is_nested_object = True
else:
is_nested_object = False
break
return is_nested_object
def isNestedObjectOneOf(schema: dict) -> bool:
if "oneOf" not in schema:
return False
@ -1961,7 +2036,8 @@ def isNestedObjectOneOf(schema: dict) -> bool:
for one_of in schema["oneOf"]:
# Check if each are an object w 1 property in it.
if (
one_of["type"] == "object"
"type" in one_of
and one_of["type"] == "object"
and "properties" in one_of
and len(one_of["properties"]) == 1
):
@ -1973,7 +2049,10 @@ def isNestedObjectOneOf(schema: dict) -> bool:
is_nested_object = False
break
elif (
one_of["type"] == "string" and "enum" in one_of and len(one_of["enum"]) == 1
"type" in one_of
and one_of["type"] == "string"
and "enum" in one_of
and len(one_of["enum"]) == 1
):
is_nested_object = True
else:

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@ from .async_api_call_type import AsyncApiCallType
from .auth_callback import AuthCallback
from .axis import Axis
from .axis_direction_pair import AxisDirectionPair
from .batch_response import BatchResponse
from .billing_info import BillingInfo
from .block_reason import BlockReason
from .cache_metadata import CacheMetadata

View File

@ -0,0 +1,24 @@
from typing import Union
from pydantic import BaseModel, ConfigDict, RootModel
class response(BaseModel):
"""Response to the modeling command."""
model_config = ConfigDict(protected_namespaces=())
class errors(BaseModel):
"""Errors that occurred during the modeling command."""
model_config = ConfigDict(protected_namespaces=())
BatchResponse = RootModel[
Union[
response,
errors,
]
]

View File

@ -7,6 +7,8 @@ from ..models.point3d import Point3d
class GetSketchModePlane(BaseModel):
"""The plane for sketch mode."""
origin: Point3d
x_axis: Point3d
y_axis: Point3d

View File

@ -373,6 +373,20 @@ class entity_make_helix(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class entity_mirror(BaseModel):
"""Mirror the input entities over the specified axis. (Currently only supports sketches)"""
axis: Point3d
ids: List[str]
point: Point3d
type: Literal["entity_mirror"] = "entity_mirror"
model_config = ConfigDict(protected_namespaces=())
class edit_mode_enter(BaseModel):
"""Enter edit mode"""
@ -481,6 +495,16 @@ class update_annotation(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class edge_lines_visible(BaseModel):
"""Changes visibility of scene-wide edge lines on brep solids"""
hidden: bool
type: Literal["edge_lines_visible"] = "edge_lines_visible"
model_config = ConfigDict(protected_namespaces=())
class object_visible(BaseModel):
"""Hide or show an object"""
@ -1147,6 +1171,18 @@ class default_camera_set_perspective(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class zoom_to_fit(BaseModel):
"""Fit the view to the specified object(s)."""
object_ids: Optional[List[str]] = None
padding: float
type: Literal["zoom_to_fit"] = "zoom_to_fit"
model_config = ConfigDict(protected_namespaces=())
class solid3d_get_extrusion_face_info(BaseModel):
"""Get a concise description of all of an extrusion's faces."""
@ -1219,6 +1255,7 @@ ModelingCmd = RootModel[
entity_linear_pattern,
entity_circular_pattern,
entity_make_helix,
entity_mirror,
edit_mode_enter,
select_with_point,
select_add,
@ -1229,6 +1266,7 @@ ModelingCmd = RootModel[
highlight_set_entities,
new_annotation,
update_annotation,
edge_lines_visible,
object_visible,
object_bring_to_front,
object_set_material_params_pbr,
@ -1285,6 +1323,7 @@ ModelingCmd = RootModel[
set_selection_filter,
default_camera_set_orthographic,
default_camera_set_perspective,
zoom_to_fit,
solid3d_get_extrusion_face_info,
edit_mode_exit,
select_clear,

View File

@ -1,8 +1,9 @@
from typing import List, Literal, Union
from typing import Dict, List, Literal, Union
from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated
from ..models.batch_response import BatchResponse
from ..models.ice_server import IceServer
from ..models.ok_modeling_cmd_response import OkModelingCmdResponse
from ..models.raw_file import RawFile
@ -82,6 +83,24 @@ class modeling(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class ModelingBatchData(BaseModel):
""""""
responses: Dict[str, BatchResponse]
model_config = ConfigDict(protected_namespaces=())
class modeling_batch(BaseModel):
"""Response to a ModelingBatch."""
data: ModelingBatchData
type: Literal["modeling_batch"] = "modeling_batch"
model_config = ConfigDict(protected_namespaces=())
class ExportData(BaseModel):
""""""
@ -139,6 +158,7 @@ OkWebSocketResponseData = RootModel[
trickle_ice,
sdp_answer,
modeling,
modeling_batch,
export,
metrics_request,
pong,

View File

@ -2,6 +2,7 @@ import datetime
from pydantic import BaseModel, ConfigDict
from ..models.uuid import Uuid
class Session(BaseModel):
@ -9,12 +10,14 @@ class Session(BaseModel):
created_at: datetime.datetime
expires_at: datetime.datetime
expires: datetime.datetime
token: str
id: Uuid
session_token: Uuid
updated_at: datetime.datetime
user_id: str
user_id: Uuid
model_config = ConfigDict(protected_namespaces=())

View File

@ -1,4 +1,4 @@
from typing import List, Literal, Optional, Union
from typing import Dict, List, Literal, Optional, Union
from pydantic import BaseModel, ConfigDict, Field, RootModel
from typing_extensions import Annotated
@ -75,6 +75,16 @@ class metrics_response(BaseModel):
model_config = ConfigDict(protected_namespaces=())
class headers(BaseModel):
"""Authentication header request."""
headers: Dict[str, str]
type: Literal["headers"] = "headers"
model_config = ConfigDict(protected_namespaces=())
WebSocketRequest = RootModel[
Annotated[
Union[
@ -84,6 +94,7 @@ WebSocketRequest = RootModel[
modeling_cmd_batch_req,
ping,
metrics_response,
headers,
],
Field(discriminator="type"),
]

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "kittycad"
version = "0.6.11"
version = "0.6.14"
description = "A client library for accessing KittyCAD"
authors = []

227
spec.json
View File

@ -14257,6 +14257,44 @@
"direction"
]
},
"BatchResponse": {
"description": "Websocket responses can either be successful or unsuccessful. Slightly different schemas in either case.",
"anyOf": [
{
"description": "Response sent when a request succeeded.",
"type": "object",
"properties": {
"response": {
"description": "Response to the modeling command.",
"allOf": [
{
"$ref": "#/components/schemas/OkModelingCmdResponse"
}
]
}
},
"required": [
"response"
]
},
{
"description": "Response sent when a request did not succeed.",
"type": "object",
"properties": {
"errors": {
"description": "Errors that occurred during the modeling command.",
"type": "array",
"items": {
"$ref": "#/components/schemas/ApiError"
}
}
},
"required": [
"errors"
]
}
]
},
"BillingInfo": {
"description": "The billing information for payments.",
"type": "object",
@ -17062,6 +17100,14 @@
"description": "The plane for sketch mode.",
"type": "object",
"properties": {
"origin": {
"description": "The origin.",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"x_axis": {
"description": "The x axis.",
"allOf": [
@ -17088,6 +17134,7 @@
}
},
"required": [
"origin",
"x_axis",
"y_axis",
"z_axis"
@ -19387,6 +19434,48 @@
"type"
]
},
{
"description": "Mirror the input entities over the specified axis. (Currently only supports sketches)",
"type": "object",
"properties": {
"axis": {
"description": "Axis to use as mirror.",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"ids": {
"description": "ID of the mirror entities.",
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"point": {
"description": "Point through which the mirror axis passes.",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"type": {
"type": "string",
"enum": [
"entity_mirror"
]
}
},
"required": [
"axis",
"ids",
"point",
"type"
]
},
{
"description": "Enter edit mode",
"type": "object",
@ -19651,6 +19740,26 @@
"type"
]
},
{
"description": "Changes visibility of scene-wide edge lines on brep solids",
"type": "object",
"properties": {
"hidden": {
"description": "Whether or not the edge lines should be hidden.",
"type": "boolean"
},
"type": {
"type": "string",
"enum": [
"edge_lines_visible"
]
}
},
"required": [
"hidden",
"type"
]
},
{
"description": "Hide or show an object",
"type": "object",
@ -21266,6 +21375,36 @@
"type"
]
},
{
"description": "Fit the view to the specified object(s).",
"type": "object",
"properties": {
"object_ids": {
"description": "Which objects to fit camera to; if empty, fit to all non-default objects. Defaults to empty vector.",
"default": [],
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"padding": {
"description": "How much to pad the view frame by.",
"type": "number",
"format": "float"
},
"type": {
"type": "string",
"enum": [
"zoom_to_fit"
]
}
},
"required": [
"padding",
"type"
]
},
{
"description": "Get a concise description of all of an extrusion's faces.",
"type": "object",
@ -22467,6 +22606,37 @@
"type"
]
},
{
"description": "Response to a ModelingBatch.",
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"responses": {
"description": "For each request in the batch, maps its ID to the request's outcome.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/BatchResponse"
}
}
},
"required": [
"responses"
]
},
"type": {
"type": "string",
"enum": [
"modeling_batch"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The exported files.",
"type": "object",
@ -24163,35 +24333,53 @@
"type": "object",
"properties": {
"created_at": {
"title": "DateTime",
"description": "The date and time the session was created.",
"type": "string",
"format": "date-time"
},
"expires_at": {
"expires": {
"title": "DateTime",
"description": "The date and time the session expires.",
"type": "string",
"format": "date-time"
},
"token": {
"id": {
"description": "The unique identifier for the session.",
"allOf": [
{
"$ref": "#/components/schemas/Uuid"
}
]
},
"session_token": {
"description": "The session token.",
"type": "string",
"format": "uuid"
"allOf": [
{
"$ref": "#/components/schemas/Uuid"
}
]
},
"updated_at": {
"title": "DateTime",
"description": "The date and time the session was last updated.",
"type": "string",
"format": "date-time"
},
"user_id": {
"description": "The user ID of the user that the session belongs to.",
"type": "string",
"format": "uuid"
"allOf": [
{
"$ref": "#/components/schemas/Uuid"
}
]
}
},
"required": [
"created_at",
"expires_at",
"token",
"expires",
"id",
"session_token",
"updated_at",
"user_id"
]
@ -27170,6 +27358,29 @@
"metrics",
"type"
]
},
{
"description": "Authentication header request.",
"type": "object",
"properties": {
"headers": {
"description": "The authentication header.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"type": {
"type": "string",
"enum": [
"headers"
]
}
},
"required": [
"headers",
"type"
]
}
]
},