From 5b7d8699cecc6948741b1e9e547f27510b221e85 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 30 Aug 2023 18:26:52 +0000 Subject: [PATCH 1/2] YOYO NEW API SPEC! --- spec.json | 2250 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 1646 insertions(+), 604 deletions(-) diff --git a/spec.json b/spec.json index bba341a..b61308f 100644 --- a/spec.json +++ b/spec.json @@ -635,6 +635,28 @@ ], "type": "object" }, + "ApiError": { + "description": "An error.", + "properties": { + "error_code": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorCode" + } + ], + "description": "The error code." + }, + "message": { + "description": "The error message.", + "type": "string" + } + }, + "required": [ + "error_code", + "message" + ], + "type": "object" + }, "ApiToken": { "description": "An API token.\n\nThese are used to authenticate users with Bearer authentication.", "properties": { @@ -4890,6 +4912,47 @@ } ] }, + "CurveGetControlPoints": { + "description": "The response from the `CurveGetControlPoints` command.", + "properties": { + "control_points": { + "description": "Control points in the curve.", + "items": { + "$ref": "#/components/schemas/Point3d" + }, + "type": "array" + } + }, + "required": [ + "control_points" + ], + "type": "object" + }, + "CurveGetType": { + "description": "The response from the `CurveGetType` command.", + "properties": { + "curve_type": { + "allOf": [ + { + "$ref": "#/components/schemas/CurveType" + } + ], + "description": "Curve type" + } + }, + "required": [ + "curve_type" + ], + "type": "object" + }, + "CurveType": { + "description": "The type of Curve (embedded within path)", + "enum": [ + "line", + "nurbs" + ], + "type": "string" + }, "Customer": { "description": "The resource representing a payment \"Customer\".", "properties": { @@ -5493,28 +5556,6 @@ ], "type": "object" }, - "EngineError": { - "description": "An error.", - "properties": { - "error_code": { - "allOf": [ - { - "$ref": "#/components/schemas/ErrorCode" - } - ], - "description": "The error code." - }, - "message": { - "description": "The error message.", - "type": "string" - } - }, - "required": [ - "error_code", - "message" - ], - "type": "object" - }, "EngineMetadata": { "description": "Metadata about our currently running server.\n\nThis is mostly used for internal purposes and debugging.", "properties": { @@ -5569,6 +5610,66 @@ ], "type": "object" }, + "EntityGetAllChildUuids": { + "description": "The response from the `EntityGetAllChildUuids` command.", + "properties": { + "entity_ids": { + "description": "The UUIDs of the child entities.", + "items": { + "format": "uuid", + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "entity_ids" + ], + "type": "object" + }, + "EntityGetChildUuid": { + "description": "The response from the `EntityGetChildUuid` command.", + "properties": { + "entity_id": { + "description": "The UUID of the child entity.", + "format": "uuid", + "type": "string" + } + }, + "required": [ + "entity_id" + ], + "type": "object" + }, + "EntityGetNumChildren": { + "description": "The response from the `EntityGetNumChildren` command.", + "properties": { + "num": { + "description": "The number of children the entity has.", + "format": "uint32", + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "num" + ], + "type": "object" + }, + "EntityGetParentId": { + "description": "The response from the `EntityGetParentId` command.", + "properties": { + "entity_id": { + "description": "The UUID of the parent entity.", + "format": "uuid", + "type": "string" + } + }, + "required": [ + "entity_id" + ], + "type": "object" + }, "EntityType": { "description": "The type of entity", "enum": [ @@ -5579,7 +5680,8 @@ "solid2d", "solid3d", "edge", - "face" + "face", + "plane" ], "type": "string" }, @@ -5629,40 +5731,59 @@ "type": "object" }, "ErrorCode": { - "description": "The type of errorcode.", + "description": "The type of error sent by the KittyCAD API.", "oneOf": [ { - "description": "User requested something impossible or invalid", + "description": "Graphics engine failed to complete request, consider retrying", + "enum": [ + "internal_engine" + ], + "type": "string" + }, + { + "description": "API failed to complete request, consider retrying", + "enum": [ + "internal_api" + ], + "type": "string" + }, + { + "description": "User requested something geometrically or graphically impossible. Don't retry this request, as it's inherently impossible. Instead, read the error message and change your request.", "enum": [ "bad_request" ], "type": "string" }, { - "description": "Engine failed to complete request, consider retrying", + "description": "Client sent invalid JSON.", "enum": [ - "internal_engine" + "invalid_json" + ], + "type": "string" + }, + { + "description": "Problem sending data between client and KittyCAD API.", + "enum": [ + "connection_problem" + ], + "type": "string" + }, + { + "description": "Client sent a Websocket message type which the KittyCAD API does not handle.", + "enum": [ + "message_type_not_accepted" + ], + "type": "string" + }, + { + "description": "Client sent a Websocket message intended for WebRTC but it was configured as a WebRTC connection.", + "enum": [ + "message_type_not_accepted_for_web_r_t_c" ], "type": "string" } ] }, - "ErrorResponse": { - "description": "The error response.", - "properties": { - "errors": { - "description": "A list of errors.", - "items": { - "$ref": "#/components/schemas/EngineError" - }, - "type": "array" - } - }, - "required": [ - "errors" - ], - "type": "object" - }, "ExecutorMetadata": { "description": "Metadata about our currently running server.\n\nThis is mostly used for internal purposes and debugging.", "properties": { @@ -5694,6 +5815,22 @@ ], "type": "object" }, + "Export": { + "description": "The response from the `Export` endpoint.", + "properties": { + "files": { + "description": "The files that were exported.", + "items": { + "$ref": "#/components/schemas/ExportFile" + }, + "type": "array" + } + }, + "required": [ + "files" + ], + "type": "object" + }, "ExportFile": { "description": "A file to be exported to the client.", "properties": { @@ -5826,6 +5963,52 @@ ], "type": "object" }, + "FailureWebSocketResponse": { + "description": "Unsuccessful Websocket response.", + "properties": { + "errors": { + "description": "The errors that occurred.", + "items": { + "$ref": "#/components/schemas/ApiError" + }, + "type": "array" + }, + "request_id": { + "description": "Which request this is a response to. If the request was a modeling command, this is the modeling command ID. If no request ID was sent, this will be null.", + "format": "uuid", + "nullable": true, + "type": "string" + }, + "success": { + "description": "Always false", + "type": "boolean" + } + }, + "required": [ + "errors", + "success" + ], + "type": "object" + }, + "FbxStorage": { + "description": "Describes the storage format of an FBX file.", + "oneOf": [ + { + "description": "ASCII FBX encoding.", + "enum": [ + "ascii" + ], + "type": "string" + }, + { + "description": "Binary FBX encoding.", + "enum": [ + "binary" + ], + "type": "string" + } + ] + }, "FileCenterOfMass": { "description": "A file center of mass result.", "properties": { @@ -6138,7 +6321,21 @@ "description": "The valid types of output file formats.", "oneOf": [ { - "description": "glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb).", + "description": "Autodesk Filmbox (FBX) format. ", + "enum": [ + "fbx" + ], + "type": "string" + }, + { + "description": "Binary glTF 2.0.\n\nThis is a single binary with .glb extension.\n\nThis is better if you want a compressed format as opposed to the human readable glTF that lacks compression.", + "enum": [ + "glb" + ], + "type": "string" + }, + { + "description": "glTF 2.0. Embedded glTF 2.0 (pretty printed).\n\nSingle JSON file with .gltf extension binary data encoded as base64 data URIs.\n\nThe JSON contents are pretty printed.\n\nIt is human readable, single file, and you can view the diff easily in a git commit.", "enum": [ "gltf" ], @@ -6177,6 +6374,13 @@ "FileImportFormat": { "description": "The valid types of source file formats.", "oneOf": [ + { + "description": "Autodesk Filmbox (FBX) format. ", + "enum": [ + "fbx" + ], + "type": "string" + }, { "description": "glTF 2.0.", "enum": [ @@ -6537,61 +6741,161 @@ }, "type": "object" }, - "IceServer": { - "description": "Representation of an ICE server used for STUN/TURN Used to initiate WebRTC connections based on ", + "GetEntityType": { + "description": "The response from the `GetEntityType` command.", "properties": { - "credential": { - "description": "Credentials for a given TURN server.", - "nullable": true, - "type": "string" - }, - "urls": { - "description": "URLs for a given STUN/TURN server. IceServer urls can either be a string or an array of strings But, we choose to always convert to an array of strings for consistency", - "items": { - "type": "string" - }, - "type": "array" - }, - "username": { - "description": "Username for a given TURN server.", - "nullable": true, - "type": "string" + "entity_type": { + "allOf": [ + { + "$ref": "#/components/schemas/EntityType" + } + ], + "description": "The type of the entity." } }, "required": [ - "urls" + "entity_type" ], "type": "object" }, - "ImageType": { - "description": "An enumeration.", - "enum": [ - "png", - "jpg" - ], - "type": "string" - }, - "IndexInfo": { - "description": "IndexInfo contains information about a registry.", - "properties": { - "mirrors": { - "description": "List of mirrors, expressed as URIs.", - "items": { - "type": "string" - }, - "type": "array" - }, - "name": { - "description": "Name of the registry, such as \\\"docker.io\\\".", - "nullable": true, + "GltfPresentation": { + "description": "Describes the presentation style of the glTF JSON.", + "oneOf": [ + { + "description": "Condense the JSON into the smallest possible size.", + "enum": [ + "compact" + ], "type": "string" }, - "official": { - "description": "Indicates whether this is an official registry (i.e., Docker Hub / docker.io)", - "nullable": true, - "type": "boolean" - }, - "secure": { + { + "description": "Expand the JSON into a more human readable format.\n\nThis is the default setting.", + "enum": [ + "pretty" + ], + "type": "string" + } + ] + }, + "GltfStorage": { + "description": "Describes the storage format of a glTF 2.0 scene.", + "oneOf": [ + { + "description": "Binary glTF 2.0.\n\nThis is a single binary with .glb extension.", + "enum": [ + "binary" + ], + "type": "string" + }, + { + "description": "Standard glTF 2.0.\n\nThis is a JSON file with .gltf extension paired with a separate binary blob file with .bin extension.", + "enum": [ + "standard" + ], + "type": "string" + }, + { + "description": "Embedded glTF 2.0.\n\nSingle JSON file with .gltf extension binary data encoded as base64 data URIs.\n\nThis is the default setting.", + "enum": [ + "embedded" + ], + "type": "string" + } + ] + }, + "HighlightSetEntity": { + "description": "The response from the `HighlightSetEntity` command.", + "properties": { + "entity_id": { + "description": "The UUID of the entity that was highlighted.", + "format": "uuid", + "nullable": true, + "type": "string" + }, + "sequence": { + "description": "If the client sent a sequence ID with its request, the backend sends it back.", + "format": "uint32", + "minimum": 0, + "nullable": true, + "type": "integer" + } + }, + "type": "object" + }, + "IceServer": { + "description": "Representation of an ICE server used for STUN/TURN Used to initiate WebRTC connections based on ", + "properties": { + "credential": { + "description": "Credentials for a given TURN server.", + "nullable": true, + "type": "string" + }, + "urls": { + "description": "URLs for a given STUN/TURN server. IceServer urls can either be a string or an array of strings But, we choose to always convert to an array of strings for consistency", + "items": { + "type": "string" + }, + "type": "array" + }, + "username": { + "description": "Username for a given TURN server.", + "nullable": true, + "type": "string" + } + }, + "required": [ + "urls" + ], + "type": "object" + }, + "ImageFormat": { + "description": "Enum containing the variety of image formats snapshots may be exported to.", + "oneOf": [ + { + "description": ".png format", + "enum": [ + "png" + ], + "type": "string" + }, + { + "description": ".jpeg format", + "enum": [ + "jpeg" + ], + "type": "string" + } + ] + }, + "ImageType": { + "description": "An enumeration.", + "enum": [ + "png", + "jpg" + ], + "type": "string" + }, + "IndexInfo": { + "description": "IndexInfo contains information about a registry.", + "properties": { + "mirrors": { + "description": "List of mirrors, expressed as URIs.", + "items": { + "type": "string" + }, + "type": "array" + }, + "name": { + "description": "Name of the registry, such as \\\"docker.io\\\".", + "nullable": true, + "type": "string" + }, + "official": { + "description": "Indicates whether this is an official registry (i.e., Docker Hub / docker.io)", + "nullable": true, + "type": "boolean" + }, + "secure": { "description": "Indicates if the registry is part of the list of insecure registries. If `false`, the registry is insecure. Insecure registries accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) communication.\n\n**Warning**: Insecure registries can be useful when running a local registry. However, because its use creates security vulnerabilities it should ONLY be enabled for testing purposes. For increased security, users should add their CA to their system's list of trusted CAs instead of enabling this option.", "nullable": true, "type": "boolean" @@ -6602,6 +6906,21 @@ "InputFormat": { "description": "Input format specifier.", "oneOf": [ + { + "description": "Autodesk Filmbox (FBX) format.", + "properties": { + "type": { + "enum": [ + "fbx" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + }, { "description": "Binary glTF 2.0. We refer to this as glTF since that is how our customers refer to it, but this can also import binary glTF (glb).", "properties": { @@ -7642,6 +7961,27 @@ ], "type": "object" }, + { + "description": "Adjust zoom of the default camera.", + "properties": { + "magnitude": { + "description": "Move the camera forward along the vector it's looking at, by this magnitudedefaultCameraZoom. Basically, how much should the camera move forward by.", + "format": "float", + "type": "number" + }, + "type": { + "enum": [ + "default_camera_zoom" + ], + "type": "string" + } + }, + "required": [ + "magnitude", + "type" + ], + "type": "object" + }, { "description": "Enable sketch mode, where users can sketch 2D geometry. Users choose a plane to sketch on.", "properties": { @@ -8341,112 +8681,581 @@ "type" ], "type": "object" - } - ] - }, - "ModelingCmdId": { - "description": "All commands have unique IDs. These should be randomly generated.", - "format": "uuid", - "type": "string" - }, - "ModelingCmdReq": { - "description": "A graphics command submitted to the KittyCAD engine via the Modeling API.", - "properties": { - "cmd": { - "allOf": [ - { - "$ref": "#/components/schemas/ModelingCmd" - } - ], - "description": "Which command to submit to the Kittycad engine." - }, - "cmd_id": { - "allOf": [ - { - "$ref": "#/components/schemas/ModelingCmdId" - } - ], - "description": "ID of command being submitted." - } - }, - "required": [ - "cmd", - "cmd_id" - ], - "type": "object" - }, - "ModelingCmdReqBatch": { - "description": "A batch set of graphics commands submitted to the KittyCAD engine via the Modeling API.", - "properties": { - "cmds": { - "additionalProperties": { - "$ref": "#/components/schemas/ModelingCmdReq" - }, - "description": "A set of commands to submit to the KittyCAD engine in a batch.", - "type": "object" - } - }, - "required": [ - "cmds" - ], - "type": "object" - }, - "ModelingError": { - "description": "Why a command submitted to the Modeling API failed.", - "properties": { - "error_code": { - "description": "A string error code which refers to a family of errors. E.g. \"InvalidInput\".", - "type": "string" - }, - "external_message": { - "description": "Describe the specific error which occurred. Will be shown to users, not logged.", - "type": "string" - }, - "internal_message": { - "description": "Describe the specific error which occurred. Will be logged, not shown to users.", - "type": "string" }, - "status_code": { - "description": "A HTTP status code.", - "format": "uint16", - "minimum": 0, - "type": "integer" - } - }, - "required": [ - "error_code", - "external_message", - "internal_message", - "status_code" - ], - "type": "object" - }, - "ModelingOutcome": { - "description": "The result from one modeling command in a batch.", - "oneOf": [ { - "additionalProperties": false, - "description": "Each successful command has some result.", + "description": "Sends object to front or back.", "properties": { - "success": { - "$ref": "#/components/schemas/OkModelingCmdResponse" + "front": { + "description": "Bring to front = true, send to back = false.", + "type": "boolean" + }, + "object_id": { + "description": "Which object is being changed.", + "format": "uuid", + "type": "string" + }, + "type": { + "enum": [ + "send_object" + ], + "type": "string" } }, "required": [ - "success" + "front", + "object_id", + "type" ], "type": "object" }, { - "additionalProperties": false, - "description": "It failed. Why? See 'struct Error' above.", + "description": "Set opacity of the entity.", "properties": { - "error": { - "$ref": "#/components/schemas/ModelingError" + "entity_id": { + "description": "Which entity is being changed.", + "format": "uuid", + "type": "string" + }, + "opacity": { + "description": "How transparent should it be? 0 or lower is totally transparent. 1 or greater is totally opaque.", + "format": "float", + "type": "number" + }, + "type": { + "enum": [ + "entity_set_opacity" + ], + "type": "string" } }, "required": [ - "error" + "entity_id", + "opacity", + "type" + ], + "type": "object" + }, + { + "description": "Fade the entity in or out.", + "properties": { + "duration_seconds": { + "default": 0.4000000059604645, + "description": "How many seconds the animation should take.", + "format": "float", + "type": "number" + }, + "entity_id": { + "description": "Which entity is being changed.", + "format": "uuid", + "type": "string" + }, + "fade_in": { + "description": "Fade in = true, fade out = false.", + "type": "boolean" + }, + "type": { + "enum": [ + "entity_fade" + ], + "type": "string" + } + }, + "required": [ + "entity_id", + "fade_in", + "type" + ], + "type": "object" + }, + { + "description": "Make a plane.", + "properties": { + "clobber": { + "description": "If true, any existing drawables within the obj will be replaced (the object will be reset)", + "type": "boolean" + }, + "origin": { + "allOf": [ + { + "$ref": "#/components/schemas/Point3d" + } + ], + "description": "Origin of the plane" + }, + "size": { + "description": "What should the plane's span/extent? When rendered visually, this is both the width and height along X and Y axis respectively.", + "format": "float", + "type": "number" + }, + "type": { + "enum": [ + "make_plane" + ], + "type": "string" + }, + "x_axis": { + "allOf": [ + { + "$ref": "#/components/schemas/Point3d" + } + ], + "description": "What should the plane's X axis be?" + }, + "y_axis": { + "allOf": [ + { + "$ref": "#/components/schemas/Point3d" + } + ], + "description": "What should the plane's Y axis be?" + } + }, + "required": [ + "clobber", + "origin", + "size", + "type", + "x_axis", + "y_axis" + ], + "type": "object" + }, + { + "description": "Set the plane's color.", + "properties": { + "color": { + "allOf": [ + { + "$ref": "#/components/schemas/Color" + } + ], + "description": "What color it should be." + }, + "plane_id": { + "description": "Which plane is being changed.", + "format": "uuid", + "type": "string" + }, + "type": { + "enum": [ + "plane_set_color" + ], + "type": "string" + } + }, + "required": [ + "color", + "plane_id", + "type" + ], + "type": "object" + }, + { + "description": "Set the active tool.", + "properties": { + "tool": { + "allOf": [ + { + "$ref": "#/components/schemas/SceneToolType" + } + ], + "description": "What tool should be active." + }, + "type": { + "enum": [ + "set_tool" + ], + "type": "string" + } + }, + "required": [ + "tool", + "type" + ], + "type": "object" + }, + { + "description": "Send a mouse move event.", + "properties": { + "type": { + "enum": [ + "mouse_move" + ], + "type": "string" + }, + "window": { + "allOf": [ + { + "$ref": "#/components/schemas/Point2d" + } + ], + "description": "Where the mouse is" + } + }, + "required": [ + "type", + "window" + ], + "type": "object" + }, + { + "description": "Send a mouse click event. Updates modified/selected entities.", + "properties": { + "type": { + "enum": [ + "mouse_click" + ], + "type": "string" + }, + "window": { + "allOf": [ + { + "$ref": "#/components/schemas/Point2d" + } + ], + "description": "Where the mouse is" + } + }, + "required": [ + "type", + "window" + ], + "type": "object" + }, + { + "description": "Enable sketch mode on the given plane.", + "properties": { + "animated": { + "description": "Animate the transition to sketch mode.", + "type": "boolean" + }, + "ortho": { + "description": "Use an orthographic camera.", + "type": "boolean" + }, + "plane_id": { + "description": "Sketch on this plane.", + "format": "uuid", + "type": "string" + }, + "type": { + "enum": [ + "sketch_mode_enable" + ], + "type": "string" + } + }, + "required": [ + "animated", + "ortho", + "plane_id", + "type" + ], + "type": "object" + }, + { + "description": "Disable sketch mode.", + "properties": { + "type": { + "enum": [ + "sketch_mode_disable" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + }, + { + "description": "Get type of a given curve.", + "properties": { + "curve_id": { + "description": "Which curve to query.", + "format": "uuid", + "type": "string" + }, + "type": { + "enum": [ + "curve_get_type" + ], + "type": "string" + } + }, + "required": [ + "curve_id", + "type" + ], + "type": "object" + }, + { + "description": "Get control points of a given curve.", + "properties": { + "curve_id": { + "description": "Which curve to query.", + "format": "uuid", + "type": "string" + }, + "type": { + "enum": [ + "curve_get_control_points" + ], + "type": "string" + } + }, + "required": [ + "curve_id", + "type" + ], + "type": "object" + }, + { + "description": "Take a snapshot.", + "properties": { + "format": { + "allOf": [ + { + "$ref": "#/components/schemas/ImageFormat" + } + ], + "description": "What image format to return." + }, + "type": { + "enum": [ + "take_snapshot" + ], + "type": "string" + } + }, + "required": [ + "format", + "type" + ], + "type": "object" + }, + { + "description": "Add a gizmo showing the axes.", + "properties": { + "clobber": { + "description": "If true, any existing drawables within the obj will be replaced (the object will be reset)", + "type": "boolean" + }, + "gizmo_mode": { + "description": "If true, axes gizmo will be placed in the corner of the screen. If false, it will be placed at the origin of the scene.", + "type": "boolean" + }, + "type": { + "enum": [ + "make_axes_gizmo" + ], + "type": "string" + } + }, + "required": [ + "clobber", + "gizmo_mode", + "type" + ], + "type": "object" + }, + { + "description": "Query the given path", + "properties": { + "path_id": { + "description": "Which path to query", + "format": "uuid", + "type": "string" + }, + "type": { + "enum": [ + "path_get_info" + ], + "type": "string" + } + }, + "required": [ + "path_id", + "type" + ], + "type": "object" + }, + { + "description": "Start dragging mouse.", + "properties": { + "type": { + "enum": [ + "handle_mouse_drag_start" + ], + "type": "string" + }, + "window": { + "allOf": [ + { + "$ref": "#/components/schemas/Point2d" + } + ], + "description": "The mouse position." + } + }, + "required": [ + "type", + "window" + ], + "type": "object" + }, + { + "description": "Continue dragging mouse.", + "properties": { + "type": { + "enum": [ + "handle_mouse_drag_move" + ], + "type": "string" + }, + "window": { + "allOf": [ + { + "$ref": "#/components/schemas/Point2d" + } + ], + "description": "The mouse position." + } + }, + "required": [ + "type", + "window" + ], + "type": "object" + }, + { + "description": "Stop dragging mouse.", + "properties": { + "type": { + "enum": [ + "handle_mouse_drag_end" + ], + "type": "string" + }, + "window": { + "allOf": [ + { + "$ref": "#/components/schemas/Point2d" + } + ], + "description": "The mouse position." + } + }, + "required": [ + "type", + "window" + ], + "type": "object" + } + ] + }, + "ModelingCmdId": { + "description": "All commands have unique IDs. These should be randomly generated.", + "format": "uuid", + "type": "string" + }, + "ModelingCmdReq": { + "description": "A graphics command submitted to the KittyCAD engine via the Modeling API.", + "properties": { + "cmd": { + "allOf": [ + { + "$ref": "#/components/schemas/ModelingCmd" + } + ], + "description": "Which command to submit to the Kittycad engine." + }, + "cmd_id": { + "allOf": [ + { + "$ref": "#/components/schemas/ModelingCmdId" + } + ], + "description": "ID of command being submitted." + } + }, + "required": [ + "cmd", + "cmd_id" + ], + "type": "object" + }, + "ModelingCmdReqBatch": { + "description": "A batch set of graphics commands submitted to the KittyCAD engine via the Modeling API.", + "properties": { + "cmds": { + "additionalProperties": { + "$ref": "#/components/schemas/ModelingCmdReq" + }, + "type": "object" + } + }, + "required": [ + "cmds" + ], + "type": "object" + }, + "ModelingError": { + "description": "Why a command submitted to the Modeling API failed.", + "properties": { + "error_code": { + "description": "A string error code which refers to a family of errors. E.g. \"InvalidInput\".", + "type": "string" + }, + "external_message": { + "description": "Describe the specific error which occurred. Will be shown to users, not logged.", + "type": "string" + }, + "internal_message": { + "description": "Describe the specific error which occurred. Will be logged, not shown to users.", + "type": "string" + }, + "status_code": { + "description": "A HTTP status code.", + "format": "uint16", + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "error_code", + "external_message", + "internal_message", + "status_code" + ], + "type": "object" + }, + "ModelingOutcome": { + "description": "The result from one modeling command in a batch.", + "oneOf": [ + { + "additionalProperties": false, + "description": "Each successful command has some result.", + "properties": { + "success": { + "$ref": "#/components/schemas/OkModelingCmdResponse" + } + }, + "required": [ + "success" + ], + "type": "object" + }, + { + "additionalProperties": false, + "description": "It failed. Why? See 'struct Error' above.", + "properties": { + "error": { + "$ref": "#/components/schemas/ModelingError" + } + }, + "required": [ + "error" ], "type": "object" }, @@ -8485,7 +9294,6 @@ "additionalProperties": { "$ref": "#/components/schemas/ModelingOutcome" }, - "description": "The results from each command in the batch.", "type": "object" } }, @@ -8494,6 +9302,32 @@ ], "type": "object" }, + "MouseClick": { + "description": "The response from the `MouseClick` command.", + "properties": { + "entities_modified": { + "description": "Entities that are modified.", + "items": { + "format": "uuid", + "type": "string" + }, + "type": "array" + }, + "entities_selected": { + "description": "Entities that are selected.", + "items": { + "format": "uuid", + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "entities_modified", + "entities_selected" + ], + "type": "object" + }, "NewAddress": { "description": "The struct that is used to create a new record. This is automatically generated and has all the same fields as the main struct only it is missing the `id`.", "properties": { @@ -8587,12 +9421,8 @@ { "description": "The response from the `Export` command. When this is being performed over a websocket, this is sent as binary not JSON. The binary data can be deserialized as `bincode` into a `Vec`.", "properties": { - "files": { - "description": "The files that were exported.", - "items": { - "$ref": "#/components/schemas/ExportFile" - }, - "type": "array" + "data": { + "$ref": "#/components/schemas/Export" }, "type": { "enum": [ @@ -8602,7 +9432,7 @@ } }, "required": [ - "files", + "data", "type" ], "type": "object" @@ -8610,11 +9440,8 @@ { "description": "The response from the `SelectWithPoint` command.", "properties": { - "entity_id": { - "description": "The UUID of the entity that was selected.", - "format": "uuid", - "nullable": true, - "type": "string" + "data": { + "$ref": "#/components/schemas/SelectWithPoint" }, "type": { "enum": [ @@ -8624,6 +9451,7 @@ } }, "required": [ + "data", "type" ], "type": "object" @@ -8631,18 +9459,8 @@ { "description": "The response from the `HighlightSetEntity` command.", "properties": { - "entity_id": { - "description": "The UUID of the entity that was highlighted.", - "format": "uuid", - "nullable": true, - "type": "string" - }, - "sequence": { - "description": "If the client sent a sequence ID with its request, the backend sends it back.", - "format": "uint32", - "minimum": 0, - "nullable": true, - "type": "integer" + "data": { + "$ref": "#/components/schemas/HighlightSetEntity" }, "type": { "enum": [ @@ -8652,6 +9470,7 @@ } }, "required": [ + "data", "type" ], "type": "object" @@ -8659,10 +9478,8 @@ { "description": "The response from the `EntityGetChildUuid` command.", "properties": { - "entity_id": { - "description": "The UUID of the child entity.", - "format": "uuid", - "type": "string" + "data": { + "$ref": "#/components/schemas/EntityGetChildUuid" }, "type": { "enum": [ @@ -8672,7 +9489,7 @@ } }, "required": [ - "entity_id", + "data", "type" ], "type": "object" @@ -8680,11 +9497,8 @@ { "description": "The response from the `EntityGetNumChildren` command.", "properties": { - "num": { - "description": "The number of children the entity has.", - "format": "uint32", - "minimum": 0, - "type": "integer" + "data": { + "$ref": "#/components/schemas/EntityGetNumChildren" }, "type": { "enum": [ @@ -8694,7 +9508,7 @@ } }, "required": [ - "num", + "data", "type" ], "type": "object" @@ -8702,10 +9516,8 @@ { "description": "The response from the `EntityGetParentId` command.", "properties": { - "entity_id": { - "description": "The UUID of the parent entity.", - "format": "uuid", - "type": "string" + "data": { + "$ref": "#/components/schemas/EntityGetParentId" }, "type": { "enum": [ @@ -8715,7 +9527,7 @@ } }, "required": [ - "entity_id", + "data", "type" ], "type": "object" @@ -8723,13 +9535,8 @@ { "description": "The response from the `EntityGetAllChildUuids` command.", "properties": { - "entity_ids": { - "description": "The UUIDs of the child entities.", - "items": { - "format": "uuid", - "type": "string" - }, - "type": "array" + "data": { + "$ref": "#/components/schemas/EntityGetAllChildUuids" }, "type": { "enum": [ @@ -8739,7 +9546,7 @@ } }, "required": [ - "entity_ids", + "data", "type" ], "type": "object" @@ -8747,13 +9554,8 @@ { "description": "The response from the `SelectGet` command.", "properties": { - "entity_ids": { - "description": "The UUIDs of the selected entities.", - "items": { - "format": "uuid", - "type": "string" - }, - "type": "array" + "data": { + "$ref": "#/components/schemas/SelectGet" }, "type": { "enum": [ @@ -8763,142 +9565,379 @@ } }, "required": [ - "entity_ids", + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `GetEntityType` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/GetEntityType" + }, + "type": { + "enum": [ + "get_entity_type" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `Solid3dGetAllEdgeFaces` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/Solid3dGetAllEdgeFaces" + }, + "type": { + "enum": [ + "solid3d_get_all_edge_faces" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `Solid3dGetAllOppositeEdges` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/Solid3dGetAllOppositeEdges" + }, + "type": { + "enum": [ + "solid3d_get_all_opposite_edges" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `Solid3dGetOppositeEdge` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/Solid3dGetOppositeEdge" + }, + "type": { + "enum": [ + "solid3d_get_opposite_edge" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `Solid3dGetPrevAdjacentEdge` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/Solid3dGetPrevAdjacentEdge" + }, + "type": { + "enum": [ + "solid3d_get_prev_adjacent_edge" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `Solid3dGetNextAdjacentEdge` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/Solid3dGetNextAdjacentEdge" + }, + "type": { + "enum": [ + "solid3d_get_next_adjacent_edge" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `MouseClick` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/MouseClick" + }, + "type": { + "enum": [ + "mouse_click" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `CurveGetType` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/CurveGetType" + }, + "type": { + "enum": [ + "curve_get_type" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `CurveGetControlPoints` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/CurveGetControlPoints" + }, + "type": { + "enum": [ + "curve_get_control_points" + ], + "type": "string" + } + }, + "required": [ + "data", + "type" + ], + "type": "object" + }, + { + "description": "The response from the `Take Snapshot` command.", + "properties": { + "data": { + "$ref": "#/components/schemas/TakeSnapshot" + }, + "type": { + "enum": [ + "take_snapshot" + ], + "type": "string" + } + }, + "required": [ + "data", "type" ], "type": "object" }, { - "description": "The response from the `GetEntityType` command.", + "description": "The response from the `Path Get Info` command.", "properties": { - "entity_type": { - "allOf": [ - { - "$ref": "#/components/schemas/EntityType" - } - ], - "description": "The type of the entity." + "data": { + "$ref": "#/components/schemas/PathGetInfo" }, "type": { "enum": [ - "get_entity_type" + "path_get_info" ], "type": "string" } }, "required": [ - "entity_type", + "data", "type" ], "type": "object" - }, + } + ] + }, + "OkWebSocketResponseData": { + "description": "The websocket messages this server sends.", + "oneOf": [ { - "description": "The response from the `Solid3dGetAllEdgeFaces` command.", + "description": "Information about the ICE servers.", "properties": { - "faces": { - "description": "The UUIDs of the faces.", - "items": { - "format": "uuid", - "type": "string" + "data": { + "properties": { + "ice_servers": { + "description": "Information about the ICE servers.", + "items": { + "$ref": "#/components/schemas/IceServer" + }, + "type": "array" + } }, - "type": "array" + "required": [ + "ice_servers" + ], + "type": "object" }, "type": { "enum": [ - "solid3d_get_all_edge_faces" + "ice_server_info" ], "type": "string" } }, "required": [ - "faces", + "data", "type" ], "type": "object" }, { - "description": "The response from the `Solid3dGetAllOppositeEdges` command.", + "description": "The trickle ICE candidate response.", "properties": { - "edges": { - "description": "The UUIDs of the edges.", - "items": { - "format": "uuid", - "type": "string" + "data": { + "properties": { + "candidate": { + "allOf": [ + { + "$ref": "#/components/schemas/RtcIceCandidateInit" + } + ], + "description": "Information about the ICE candidate." + } }, - "type": "array" + "required": [ + "candidate" + ], + "type": "object" }, "type": { "enum": [ - "solid3d_get_all_opposite_edges" + "trickle_ice" ], "type": "string" } }, "required": [ - "edges", + "data", "type" ], "type": "object" }, { - "description": "The response from the `Solid3dGetOppositeEdge` command.", + "description": "The SDP answer response.", "properties": { - "edge": { - "description": "The UUID of the edge.", - "format": "uuid", - "type": "string" + "data": { + "properties": { + "answer": { + "allOf": [ + { + "$ref": "#/components/schemas/RtcSessionDescription" + } + ], + "description": "The session description." + } + }, + "required": [ + "answer" + ], + "type": "object" }, "type": { "enum": [ - "solid3d_get_opposite_edge" + "sdp_answer" ], "type": "string" } }, "required": [ - "edge", + "data", "type" ], "type": "object" }, { - "description": "The response from the `Solid3dGetPrevAdjacentEdge` command.", + "description": "The modeling command response.", "properties": { - "edge": { - "description": "The UUID of the edge.", - "format": "uuid", - "type": "string" + "data": { + "properties": { + "modeling_response": { + "allOf": [ + { + "$ref": "#/components/schemas/OkModelingCmdResponse" + } + ], + "description": "The result of the command." + } + }, + "required": [ + "modeling_response" + ], + "type": "object" }, "type": { "enum": [ - "solid3d_get_prev_adjacent_edge" + "modeling" ], "type": "string" } }, "required": [ - "edge", + "data", "type" ], "type": "object" }, { - "description": "The response from the `Solid3dGetNextAdjacentEdge` command.", + "description": "The exported files.", "properties": { - "edge": { - "description": "The UUID of the edge.", - "format": "uuid", - "type": "string" + "data": { + "properties": { + "files": { + "description": "The exported files", + "items": { + "$ref": "#/components/schemas/RawFile" + }, + "type": "array" + } + }, + "required": [ + "files" + ], + "type": "object" }, "type": { "enum": [ - "solid3d_get_next_adjacent_edge" + "export" ], "type": "string" } }, "required": [ - "edge", + "data", "type" ], "type": "object" @@ -8942,13 +9981,45 @@ "OutputFormat": { "description": "Output format specifier.", "oneOf": [ + { + "description": "Autodesk Filmbox (FBX) format.", + "properties": { + "storage": { + "allOf": [ + { + "$ref": "#/components/schemas/FbxStorage" + } + ], + "description": "Specifies which kind of FBX will be exported." + }, + "type": { + "enum": [ + "fbx" + ], + "type": "string" + } + }, + "required": [ + "storage", + "type" + ], + "type": "object" + }, { "description": "glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). If you prefer ascii output, you can set that option for the export.", "properties": { + "presentation": { + "allOf": [ + { + "$ref": "#/components/schemas/GltfPresentation" + } + ], + "description": "Specifies how the JSON will be presented." + }, "storage": { "allOf": [ { - "$ref": "#/components/schemas/Storage" + "$ref": "#/components/schemas/GltfStorage" } ], "description": "Specifies which kind of glTF 2.0 will be exported." @@ -8961,6 +10032,7 @@ } }, "required": [ + "presentation", "storage", "type" ], @@ -9004,7 +10076,7 @@ "storage": { "allOf": [ { - "$ref": "#/components/schemas/Storage" + "$ref": "#/components/schemas/PlyStorage" } ], "description": "The storage for the output PLY file." @@ -9061,7 +10133,7 @@ "storage": { "allOf": [ { - "$ref": "#/components/schemas/Storage" + "$ref": "#/components/schemas/StlStorage" } ], "description": "Export storage." @@ -9082,6 +10154,33 @@ } ] }, + "PathCommand": { + "description": "The path component command type (within a Path)", + "enum": [ + "move_to", + "line_to", + "bez_curve_to", + "nurbs_curve_to", + "add_arc" + ], + "type": "string" + }, + "PathGetInfo": { + "description": "The response from the `PathGetInfo` command.", + "properties": { + "segments": { + "description": "All segments in the path, in the order they were added.", + "items": { + "$ref": "#/components/schemas/PathSegmentInfo" + }, + "type": "array" + } + }, + "required": [ + "segments" + ], + "type": "object" + }, "PathSegment": { "description": "A segment of a path. Paths are composed of many segments.", "oneOf": [ @@ -9195,6 +10294,32 @@ } ] }, + "PathSegmentInfo": { + "description": "Info about a path segment", + "properties": { + "command": { + "allOf": [ + { + "$ref": "#/components/schemas/PathCommand" + } + ], + "description": "What is the path segment?" + }, + "command_id": { + "allOf": [ + { + "$ref": "#/components/schemas/ModelingCmdId" + } + ], + "description": "Which command created this path? This field is absent if the path command is not actually creating a path segment, e.g. moving the pen doesn't create a path segment.", + "nullable": true + } + }, + "required": [ + "command" + ], + "type": "object" + }, "PaymentIntent": { "description": "A payment intent response.", "properties": { @@ -9325,6 +10450,32 @@ }, "type": "object" }, + "PlyStorage": { + "description": "The storage for the output PLY file.", + "oneOf": [ + { + "description": "Write numbers in their ascii representation (e.g. -13, 6.28, etc.). Properties are separated by spaces and elements are separated by line breaks.", + "enum": [ + "ascii" + ], + "type": "string" + }, + { + "description": "Encode payload as binary using little endian.", + "enum": [ + "binary_little_endian" + ], + "type": "string" + }, + { + "description": "Encode payload as binary using big endian.", + "enum": [ + "binary_big_endian" + ], + "type": "string" + } + ] + }, "Point2d": { "description": "A point in 2D space", "properties": { @@ -9455,85 +10606,6 @@ }, "type": "object" }, - "RtcIceCandidate": { - "description": "ICECandidate represents a ice candidate", - "properties": { - "address": { - "description": "The address of the candidate.", - "type": "string" - }, - "component": { - "description": "The component of the candidate.", - "format": "uint16", - "minimum": 0, - "type": "integer" - }, - "foundation": { - "description": "The foundation for the address.", - "type": "string" - }, - "port": { - "description": "The port used for the candidate.", - "format": "uint16", - "minimum": 0, - "type": "integer" - }, - "priority": { - "description": "The priority of the candidate.", - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "protocol": { - "allOf": [ - { - "$ref": "#/components/schemas/RtcIceProtocol" - } - ], - "description": "The protocol used for the candidate." - }, - "related_address": { - "description": "The related address of the candidate.", - "type": "string" - }, - "related_port": { - "description": "The related port of the candidate.", - "format": "uint16", - "minimum": 0, - "type": "integer" - }, - "stats_id": { - "description": "The stats ID.", - "type": "string" - }, - "tcp_type": { - "description": "The TCP type of the candidate.", - "type": "string" - }, - "typ": { - "allOf": [ - { - "$ref": "#/components/schemas/RtcIceCandidateType" - } - ], - "description": "The type of the candidate." - } - }, - "required": [ - "address", - "component", - "foundation", - "port", - "priority", - "protocol", - "related_address", - "related_port", - "stats_id", - "tcp_type", - "typ" - ], - "type": "object" - }, "RtcIceCandidateInit": { "description": "ICECandidateInit is used to serialize ice candidates", "properties": { @@ -9548,87 +10620,21 @@ "nullable": true, "type": "integer" }, - "sdpMid": { - "description": "The identifier of the \"media stream identification\" as defined in [RFC 8841](https://tools.ietf.org/html/rfc8841).", - "nullable": true, - "type": "string" - }, - "usernameFragment": { - "description": "The username fragment (as defined in [RFC 8445](https://tools.ietf.org/html/rfc8445#section-5.2.1)) associated with the object.", - "nullable": true, - "type": "string" - } - }, - "required": [ - "candidate" - ], - "type": "object" - }, - "RtcIceCandidateType": { - "description": "ICECandidateType represents the type of the ICE candidate used.", - "oneOf": [ - { - "description": "Unspecified indicates that the candidate type is unspecified.", - "enum": [ - "unspecified" - ], - "type": "string" - }, - { - "description": "ICECandidateTypeHost indicates that the candidate is of Host type as described in . A candidate obtained by binding to a specific port from an IP address on the host. This includes IP addresses on physical interfaces and logical ones, such as ones obtained through VPNs.", - "enum": [ - "host" - ], - "type": "string" - }, - { - "description": "ICECandidateTypeSrflx indicates the the candidate is of Server Reflexive type as described . A candidate type whose IP address and port are a binding allocated by a NAT for an ICE agent after it sends a packet through the NAT to a server, such as a STUN server.", - "enum": [ - "srflx" - ], - "type": "string" - }, - { - "description": "ICECandidateTypePrflx indicates that the candidate is of Peer Reflexive type. A candidate type whose IP address and port are a binding allocated by a NAT for an ICE agent after it sends a packet through the NAT to its peer.", - "enum": [ - "prflx" - ], - "type": "string" - }, - { - "description": "ICECandidateTypeRelay indicates the the candidate is of Relay type as described in . A candidate type obtained from a relay server, such as a TURN server.", - "enum": [ - "relay" - ], - "type": "string" - } - ] - }, - "RtcIceProtocol": { - "description": "ICEProtocol indicates the transport protocol type that is used in the ice.URL structure.", - "oneOf": [ - { - "description": "Unspecified indicates that the protocol is unspecified.", - "enum": [ - "unspecified" - ], - "type": "string" - }, - { - "description": "UDP indicates the URL uses a UDP transport.", - "enum": [ - "udp" - ], + "sdpMid": { + "description": "The identifier of the \"media stream identification\" as defined in [RFC 8841](https://tools.ietf.org/html/rfc8841).", + "nullable": true, "type": "string" }, - { - "description": "TCP indicates the URL uses a TCP transport.", - "enum": [ - "tcp" - ], + "usernameFragment": { + "description": "The username fragment (as defined in [RFC 8445](https://tools.ietf.org/html/rfc8445#section-5.2.1)) associated with the object.", + "nullable": true, "type": "string" } - ] + }, + "required": [ + "candidate" + ], + "type": "object" }, "RtcSdpType": { "description": "SDPType describes the type of an SessionDescription.", @@ -9736,6 +10742,47 @@ } ] }, + "SceneToolType": { + "description": "The type of scene's active tool", + "enum": [ + "camera_revolve", + "select", + "move", + "sketch_line", + "sketch_curve", + "sketch_curve_mod" + ], + "type": "string" + }, + "SelectGet": { + "description": "The response from the `SelectGet` command.", + "properties": { + "entity_ids": { + "description": "The UUIDs of the selected entities.", + "items": { + "format": "uuid", + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "entity_ids" + ], + "type": "object" + }, + "SelectWithPoint": { + "description": "The response from the `SelectWithPoint` command.", + "properties": { + "entity_id": { + "description": "The UUID of the entity that was selected.", + "format": "uuid", + "nullable": true, + "type": "string" + } + }, + "type": "object" + }, "Session": { "description": "An authentication session.\n\nFor our UIs, these are automatically created by Next.js.", "properties": { @@ -9782,62 +10829,128 @@ ], "type": "object" }, - "SnakeCaseResult": { - "description": "Serde serializes Result into JSON as \"Ok\" and \"Err\", but we want \"ok\" and \"err\". So, create a new enum that serializes as lowercase.", - "oneOf": [ - { - "additionalProperties": false, - "description": "The result is Ok.", - "properties": { - "ok": { - "$ref": "#/components/schemas/OkModelingCmdResponse" - } + "Solid3dGetAllEdgeFaces": { + "description": "The response from the `Solid3dGetAllEdgeFaces` command.", + "properties": { + "faces": { + "description": "The UUIDs of the faces.", + "items": { + "format": "uuid", + "type": "string" }, - "required": [ - "ok" - ], - "type": "object" - }, - { - "additionalProperties": false, - "description": "The result is Err.", - "properties": { - "err": { - "$ref": "#/components/schemas/ErrorResponse" - } + "type": "array" + } + }, + "required": [ + "faces" + ], + "type": "object" + }, + "Solid3dGetAllOppositeEdges": { + "description": "The response from the `Solid3dGetAllOppositeEdges` command.", + "properties": { + "edges": { + "description": "The UUIDs of the edges.", + "items": { + "format": "uuid", + "type": "string" }, - "required": [ - "err" - ], - "type": "object" + "type": "array" } - ] + }, + "required": [ + "edges" + ], + "type": "object" }, - "Storage": { - "description": "Describes the storage format of a glTF 2.0 scene.", + "Solid3dGetNextAdjacentEdge": { + "description": "The response from the `Solid3dGetNextAdjacentEdge` command.", + "properties": { + "edge": { + "description": "The UUID of the edge.", + "format": "uuid", + "type": "string" + } + }, + "required": [ + "edge" + ], + "type": "object" + }, + "Solid3dGetOppositeEdge": { + "description": "The response from the `Solid3dGetOppositeEdge` command.", + "properties": { + "edge": { + "description": "The UUID of the edge.", + "format": "uuid", + "type": "string" + } + }, + "required": [ + "edge" + ], + "type": "object" + }, + "Solid3dGetPrevAdjacentEdge": { + "description": "The response from the `Solid3dGetPrevAdjacentEdge` command.", + "properties": { + "edge": { + "description": "The UUID of the edge.", + "format": "uuid", + "type": "string" + } + }, + "required": [ + "edge" + ], + "type": "object" + }, + "StlStorage": { + "description": "Export storage.", "oneOf": [ { - "description": "Binary glTF 2.0.\n\nThis is a single binary with .glb extension.\n\nThis is the default setting.", + "description": "Plaintext encoding.", "enum": [ - "binary" + "ascii" ], "type": "string" }, { - "description": "Standard glTF 2.0.\n\nThis is a JSON file with .gltf extension paired with a separate binary blob file with .bin extension.", + "description": "Binary STL encoding.\n\nThis is the default setting.", "enum": [ - "standard" + "binary" ], "type": "string" + } + ] + }, + "SuccessWebSocketResponse": { + "description": "Successful Websocket response.", + "properties": { + "request_id": { + "description": "Which request this is a response to. If the request was a modeling command, this is the modeling command ID. If no request ID was sent, this will be null.", + "format": "uuid", + "nullable": true, + "type": "string" }, - { - "description": "Embedded glTF 2.0.\n\nSingle JSON file with .gltf extension binary data encoded as base64 data URIs.", - "enum": [ - "embedded" + "resp": { + "allOf": [ + { + "$ref": "#/components/schemas/OkWebSocketResponseData" + } ], - "type": "string" + "description": "The data sent with a successful response. This will be flattened into a 'type' and 'data' field." + }, + "success": { + "description": "Always true", + "type": "boolean" } - ] + }, + "required": [ + "resp", + "success" + ], + "type": "object" }, "System": { "description": "Co-ordinate system definition.\n\nThe `up` axis must be orthogonal to the `forward` axis.\n\nSee [cglearn.eu] for background reading.\n\n[cglearn.eu](https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1)", @@ -9907,6 +11020,21 @@ ], "type": "string" }, + "TakeSnapshot": { + "description": "The response from the `TakeSnapshot` command.", + "properties": { + "contents": { + "description": "Contents of the image.", + "format": "byte", + "title": "String", + "type": "string" + } + }, + "required": [ + "contents" + ], + "type": "object" + }, "UnitAngle": { "description": "The valid types of angle formats.", "oneOf": [ @@ -11883,7 +13011,7 @@ ], "type": "object" }, - "WebSocketMessages": { + "WebSocketRequest": { "description": "The websocket messages the server receives.", "oneOf": [ { @@ -11966,140 +13094,44 @@ "type" ], "type": "object" - } - ] - }, - "WebSocketResponses": { - "description": "The websocket messages this server sends.", - "oneOf": [ - { - "description": "The trickle ICE candidate response.", - "properties": { - "candidate": { - "allOf": [ - { - "$ref": "#/components/schemas/RtcIceCandidate" - } - ], - "description": "Information about the ICE candidate." - }, - "type": { - "enum": [ - "trickle_ice" - ], - "type": "string" - } - }, - "required": [ - "candidate", - "type" - ], - "type": "object" - }, - { - "description": "The SDP answer response.", - "properties": { - "answer": { - "allOf": [ - { - "$ref": "#/components/schemas/RtcSessionDescription" - } - ], - "description": "The session description." - }, - "type": { - "enum": [ - "sdp_answer" - ], - "type": "string" - } - }, - "required": [ - "answer", - "type" - ], - "type": "object" }, { - "description": "The ICE server info response.", + "description": "The client-to-server Ping to ensure the WebSocket stays alive.", "properties": { - "ice_servers": { - "description": "Information about the ICE servers.", - "items": { - "$ref": "#/components/schemas/IceServer" - }, - "type": "array" - }, "type": { "enum": [ - "ice_server_info" + "ping" ], "type": "string" } }, "required": [ - "ice_servers", "type" ], "type": "object" - }, + } + ] + }, + "WebSocketResponse": { + "anyOf": [ { - "description": "The modeling command response.", - "properties": { - "cmd_id": { - "allOf": [ - { - "$ref": "#/components/schemas/ModelingCmdId" - } - ], - "description": "The ID of the command." - }, - "result": { - "allOf": [ - { - "$ref": "#/components/schemas/SnakeCaseResult" - } - ], - "description": "The result of the command." - }, - "type": { - "enum": [ - "modeling" - ], - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/SuccessWebSocketResponse" } - }, - "required": [ - "cmd_id", - "result", - "type" ], - "type": "object" + "description": "Response sent when a request succeeded." }, { - "description": "The export command response, this is sent as binary.", - "properties": { - "files": { - "description": "The exported files.", - "items": { - "$ref": "#/components/schemas/RawFile" - }, - "type": "array" - }, - "type": { - "enum": [ - "export" - ], - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/FailureWebSocketResponse" } - }, - "required": [ - "files", - "type" ], - "type": "object" + "description": "Response sent when a request did not succeed." } - ] + ], + "description": "Websocket responses can either be successful or unsuccessful. Slightly different schemas in either case." } } }, @@ -14600,7 +15632,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebSocketMessages" + "$ref": "#/components/schemas/WebSocketRequest" } } }, @@ -14611,7 +15643,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebSocketResponses" + "$ref": "#/components/schemas/WebSocketResponse" } } }, @@ -14851,7 +15883,9 @@ "200": { "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/OkModelingCmdResponse" + } } }, "description": "successful operation", @@ -19263,6 +20297,14 @@ "minimum": 0, "type": "integer" } + }, + { + "description": "If true, will start a webrtc connection.", + "in": "query", + "name": "webrtc", + "schema": { + "type": "boolean" + } } ], "responses": { From 7969a3a8357e8fbf47ce7bc704658f94e5389b98 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Wed, 30 Aug 2023 12:46:35 -0700 Subject: [PATCH 2/2] updates Signed-off-by: Jess Frazelle --- cmd/main.go | 2 +- cmd/template.go | 2 +- cmd/types.go | 14 +- examples_test.go | 8 +- kittycad.go.patch.json | 4 +- paths.go | 26 +- types.go | 1460 ++++++++++++++++++++++++++-------------- 7 files changed, 1001 insertions(+), 515 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 86a9d20..82669df 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -58,7 +58,7 @@ func run() error { Tags: []Tag{}, Examples: []string{}, Paths: []string{}, - Types: []string{}, + Types: map[string]string{}, WorkingDirectory: wd, } // Format the tags for our data. diff --git a/cmd/template.go b/cmd/template.go index 7ca474c..200803c 100644 --- a/cmd/template.go +++ b/cmd/template.go @@ -27,7 +27,7 @@ type Data struct { WorkingDirectory string Examples []string Paths []string - Types []string + Types map[string]string } // Tag holds information about tags. diff --git a/cmd/types.go b/cmd/types.go index 9b376bb..760a63b 100644 --- a/cmd/types.go +++ b/cmd/types.go @@ -177,7 +177,7 @@ func (data *Data) generateEnumType(name string, s *openapi3.Schema, additionalDo } // Add the type to our types. - data.Types = append(data.Types, enumString) + data.Types[enum.Name] = enumString return nil } @@ -268,7 +268,7 @@ func (data *Data) generateObjectType(name string, s *openapi3.Schema, spec *open } // Add the type to our types. - data.Types = append(data.Types, objectString) + data.Types[object.Name] = objectString return nil } @@ -328,15 +328,17 @@ func (data *Data) generateOneOfType(name string, s *openapi3.Schema, spec *opena } for index, oneOf := range s.OneOf { - // We should have a better way of avoiding duplicates. This is a hot fix, but does not scale. - if types[index] == "InputFormat coords" || types[index] == "OutputFormat coords" || types[index] == "ModelingCmd path" || types[index] == "ModelingCmd interaction" || types[index] == "ModelingCmd window" || types[index] == "OkModelingCmdResponse entity_id" { - continue + // Check if we already have this type defined. + iname := printProperty(types[index]) + if _, ok := data.Types[iname]; ok { + // We should name the type after the one of. + iname = printProperty(name + " " + types[index]) } // Check if we already have a schema for this one of. reference, ok := spec.Components.Schemas[types[index]] if !ok { - if err := data.generateSchemaType(types[index], oneOf.Value, spec); err != nil { + if err := data.generateSchemaType(iname, oneOf.Value, spec); err != nil { return err } } diff --git a/examples_test.go b/examples_test.go index 9968cf7..57b3a68 100644 --- a/examples_test.go +++ b/examples_test.go @@ -570,10 +570,13 @@ func ExampleModelingService_Cmd() { panic(err) } - if err := client.Modeling.Cmd(kittycad.ModelingCmdReq{Cmd: "", CmdID: kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8")}); err != nil { + result, err := client.Modeling.Cmd(kittycad.ModelingCmdReq{Cmd: "", CmdID: kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8")}) + if err != nil { panic(err) } + fmt.Printf("%#v", result) + } // CmdBatch: Submit many modeling operations. @@ -1679,6 +1682,7 @@ func ExampleExecutorService_CreateTerm() { // - `unlockedFramerate` // - `videoResHeight` // - `videoResWidth` +// - `webrtc` func ExampleModelingService_CommandsWs() { client, err := kittycad.NewClientFromEnv("your apps user agent") if err != nil { @@ -1686,7 +1690,7 @@ func ExampleModelingService_CommandsWs() { } // Create the websocket connection. - ws, err := client.Modeling.CommandsWs(123, true, 123, 123) + ws, err := client.Modeling.CommandsWs(123, true, 123, 123, true) if err != nil { panic(err) } diff --git a/kittycad.go.patch.json b/kittycad.go.patch.json index 8e030c1..8e36693 100644 --- a/kittycad.go.patch.json +++ b/kittycad.go.patch.json @@ -193,7 +193,7 @@ }, { "value": { - "example": "// Cmd: Submit one modeling operation.\n// \n// Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.\n// \n// \n// Parameters\n// \n// \t- `body`: A graphics command submitted to the KittyCAD engine via the Modeling API.\n// \n// Cmd: Submit one modeling operation.\n// Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.\n//\n// Parameters\n//\n// - `body`: A graphics command submitted to the KittyCAD engine via the Modeling API.\nfunc ExampleModelingService_Cmd() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Modeling.Cmd(kittycad.ModelingCmdReq{Cmd: \"\", CmdID: kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\")}); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", + "example": "// Cmd: Submit one modeling operation.\n// \n// Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.\n// \n// \n// Parameters\n// \n// \t- `body`: A graphics command submitted to the KittyCAD engine via the Modeling API.\n// \n// Cmd: Submit one modeling operation.\n// Response depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.\n//\n// Parameters\n//\n// - `body`: A graphics command submitted to the KittyCAD engine via the Modeling API.\nfunc ExampleModelingService_Cmd() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Modeling.Cmd(kittycad.ModelingCmdReq{Cmd: \"\", CmdID: kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\")})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#ModelingService.Cmd" }, "op": "add", @@ -609,7 +609,7 @@ }, { "value": { - "example": "// CommandsWs: Open a websocket which accepts modeling commands.\n// \n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n// \n// \n// Parameters\n// \n// \t- `fps`\n// \t- `unlockedFramerate`\n// \t- `videoResHeight`\n// \t- `videoResWidth`\n// \n// CommandsWs: Open a websocket which accepts modeling commands.\n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n//\n// Parameters\n//\n// - `fps`\n// - `unlockedFramerate`\n// - `videoResHeight`\n// - `videoResWidth`\nfunc ExampleModelingService_CommandsWs() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Create the websocket connection.\n\tws, err := client.Modeling.CommandsWs(123, true, 123, 123)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer ws.Close()\n\n\tdone := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(done)\n\t\tfor {\n\t\t\t_, message, err := ws.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"read:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"recv: %s\", message)\n\t\t}\n\t}()\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\tcase t := \u003c-ticker.C:\n\t\t\terr := ws.WriteMessage(websocket.TextMessage, []byte(t.String()))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase \u003c-interrupt:\n\t\t\tlog.Println(\"interrupt\")\n\n\t\t\t// Cleanly close the connection by sending a close message and then\n\t\t\t// waiting (with timeout) for the server to close the connection.\n\t\t\terr := ws.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write close:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase \u003c-done:\n\t\t\tcase \u003c-time.After(time.Second):\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n}\n", + "example": "// CommandsWs: Open a websocket which accepts modeling commands.\n// \n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n// \n// \n// Parameters\n// \n// \t- `fps`\n// \t- `unlockedFramerate`\n// \t- `videoResHeight`\n// \t- `videoResWidth`\n// \t- `webrtc`\n// \n// CommandsWs: Open a websocket which accepts modeling commands.\n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n//\n// Parameters\n//\n// - `fps`\n// - `unlockedFramerate`\n// - `videoResHeight`\n// - `videoResWidth`\n// - `webrtc`\nfunc ExampleModelingService_CommandsWs() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Create the websocket connection.\n\tws, err := client.Modeling.CommandsWs(123, true, 123, 123, true)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer ws.Close()\n\n\tdone := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(done)\n\t\tfor {\n\t\t\t_, message, err := ws.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"read:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"recv: %s\", message)\n\t\t}\n\t}()\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\tcase t := \u003c-ticker.C:\n\t\t\terr := ws.WriteMessage(websocket.TextMessage, []byte(t.String()))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase \u003c-interrupt:\n\t\t\tlog.Println(\"interrupt\")\n\n\t\t\t// Cleanly close the connection by sending a close message and then\n\t\t\t// waiting (with timeout) for the server to close the connection.\n\t\t\terr := ws.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write close:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase \u003c-done:\n\t\t\tcase \u003c-time.After(time.Second):\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n}\n", "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#ModelingService.CommandsWs" }, "op": "add", diff --git a/paths.go b/paths.go index 3e0e29a..b2c22b1 100644 --- a/paths.go +++ b/paths.go @@ -1195,7 +1195,7 @@ func (s *HiddenService) Logout() error { // Parameters // // - `body`: A graphics command submitted to the KittyCAD engine via the Modeling API. -func (s *ModelingService) Cmd(body ModelingCmdReq) error { +func (s *ModelingService) Cmd(body ModelingCmdReq) (*any, error) { // Create the url. path := "/modeling/cmd" uri := resolveRelative(s.client.server, path) @@ -1203,13 +1203,13 @@ func (s *ModelingService) Cmd(body ModelingCmdReq) error { // Encode the request body as json. b := new(bytes.Buffer) if err := json.NewEncoder(b).Encode(body); err != nil { - return fmt.Errorf("encoding json body request failed: %v", err) + return nil, fmt.Errorf("encoding json body request failed: %v", err) } // Create the request. req, err := http.NewRequest("POST", uri, b) if err != nil { - return fmt.Errorf("error creating request: %v", err) + return nil, fmt.Errorf("error creating request: %v", err) } // Add our headers. @@ -1218,17 +1218,26 @@ func (s *ModelingService) Cmd(body ModelingCmdReq) error { // Send the request. resp, err := s.client.client.Do(req) if err != nil { - return fmt.Errorf("error sending request: %v", err) + return nil, fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() // Check the response. if err := checkResponse(resp); err != nil { - return err + return nil, err } - // Return. - return nil + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded any + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil } @@ -3626,7 +3635,8 @@ func (s *ExecutorService) CreateTerm() (*websocket.Conn, error) { // - `unlockedFramerate` // - `videoResHeight` // - `videoResWidth` -func (s *ModelingService) CommandsWs(fps int, unlockedFramerate bool, videoResHeight int, videoResWidth int) (*websocket.Conn, error) { +// - `webrtc` +func (s *ModelingService) CommandsWs(fps int, unlockedFramerate bool, videoResHeight int, videoResWidth int, webrtc bool) (*websocket.Conn, error) { // Create the url. path := "/ws/modeling/commands" uri := resolveRelative(s.client.server, path) diff --git a/types.go b/types.go index 79d28d8..fadcace 100755 --- a/types.go +++ b/types.go @@ -2,6 +2,138 @@ package kittycad +// APICallQueryGroup: A response for a query on the API call table that is grouped by something. +type APICallQueryGroup struct { + // Count: + Count int `json:"count" yaml:"count" schema:"count,required"` + // Query: + Query string `json:"query" yaml:"query" schema:"query,required"` +} + +// APICallQueryGroupBy: The field of an API call to group by. +type APICallQueryGroupBy string + +const ( + // APICallQueryGroupByEmail: The email of the user that requested the API call. + APICallQueryGroupByEmail APICallQueryGroupBy = "email" + // APICallQueryGroupByMethod: The HTTP method of the API call. + APICallQueryGroupByMethod APICallQueryGroupBy = "method" + // APICallQueryGroupByEndpoint: The endpoint of the API call. + APICallQueryGroupByEndpoint APICallQueryGroupBy = "endpoint" + // APICallQueryGroupByUserID: The user ID of the user that requested the API call. + APICallQueryGroupByUserID APICallQueryGroupBy = "user_id" + // APICallQueryGroupByOrigin: The origin of the API call. This is parsed from the `Origin` header. + APICallQueryGroupByOrigin APICallQueryGroupBy = "origin" + // APICallQueryGroupByIpAddress: The IP address of the user making the API call. + APICallQueryGroupByIpAddress APICallQueryGroupBy = "ip_address" +) + +// APICallStatus: The status of an async API call. +type APICallStatus string + +const ( + // APICallStatusQueued: The async API call is queued. + APICallStatusQueued APICallStatus = "queued" + // APICallStatusUploaded: The async API call was uploaded to be converted. + APICallStatusUploaded APICallStatus = "uploaded" + // APICallStatusInProgress: The async API call is in progress. + APICallStatusInProgress APICallStatus = "in_progress" + // APICallStatusCompleted: The async API call has completed. + APICallStatusCompleted APICallStatus = "completed" + // APICallStatusFailed: The async API call has failed. + APICallStatusFailed APICallStatus = "failed" +) + +// APICallWithPrice: An API call with the price. +// This is a join of the `ApiCall` and `ApiCallPrice` tables. +type APICallWithPrice struct { + // CompletedAt: The date and time the API call completed billing. + CompletedAt Time `json:"completed_at" yaml:"completed_at" schema:"completed_at"` + // CreatedAt: The date and time the API call was created. + CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` + // Duration: The duration of the API call. + Duration int `json:"duration" yaml:"duration" schema:"duration"` + // Email: The user's email address. + Email string `json:"email" yaml:"email" schema:"email"` + // Endpoint: The endpoint requested by the API call. + Endpoint string `json:"endpoint" yaml:"endpoint" schema:"endpoint"` + // ID: The unique identifier for the API call. + ID UUID `json:"id" yaml:"id" schema:"id,required"` + // IPAddress: The ip address of the origin. + IPAddress IP `json:"ip_address" yaml:"ip_address" schema:"ip_address"` + // Litterbox: If the API call was spawned from the litterbox or not. + Litterbox bool `json:"litterbox" yaml:"litterbox" schema:"litterbox"` + // Method: The HTTP method requsted by the API call. + Method Method `json:"method" yaml:"method" schema:"method,required"` + // Minutes: The number of minutes the API call was billed for. + Minutes int `json:"minutes" yaml:"minutes" schema:"minutes"` + // Origin: The origin of the API call. + Origin string `json:"origin" yaml:"origin" schema:"origin"` + // Price: The price of the API call. + Price float64 `json:"price" yaml:"price" schema:"price"` + // RequestBody: The request body sent by the API call. + RequestBody string `json:"request_body" yaml:"request_body" schema:"request_body"` + // RequestQueryParams: The request query params sent by the API call. + RequestQueryParams string `json:"request_query_params" yaml:"request_query_params" schema:"request_query_params"` + // ResponseBody: The response body returned by the API call. We do not store this information if it is above a certain size. + ResponseBody string `json:"response_body" yaml:"response_body" schema:"response_body"` + // StartedAt: The date and time the API call started billing. + StartedAt Time `json:"started_at" yaml:"started_at" schema:"started_at"` + // StatusCode: The status code returned by the API call. + StatusCode int `json:"status_code" yaml:"status_code" schema:"status_code"` + // StripeInvoiceItemID: The Stripe invoice item ID of the API call if it is billable. + StripeInvoiceItemID string `json:"stripe_invoice_item_id" yaml:"stripe_invoice_item_id" schema:"stripe_invoice_item_id"` + // Token: The API token that made the API call. + Token UUID `json:"token" yaml:"token" schema:"token,required"` + // UpdatedAt: The date and time the API call was last updated. + UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` + // UserAgent: The user agent of the request. + UserAgent string `json:"user_agent" yaml:"user_agent" schema:"user_agent,required"` + // UserID: The ID of the user that made the API call. + UserID string `json:"user_id" yaml:"user_id" schema:"user_id"` +} + +// APICallWithPriceResultsPage: A single page of results +type APICallWithPriceResultsPage struct { + // Items: list of items on this page of results + Items []APICallWithPrice `json:"items" yaml:"items" schema:"items,required"` + // NextPage: token used to fetch the next page of results (if any) + NextPage string `json:"next_page" yaml:"next_page" schema:"next_page"` +} + +// APIError: An error. +type APIError struct { + // ErrorCode: The error code. + ErrorCode ErrorCode `json:"error_code" yaml:"error_code" schema:"error_code,required"` + // Message: The error message. + Message string `json:"message" yaml:"message" schema:"message,required"` +} + +// APIToken: An API token. +// These are used to authenticate users with Bearer authentication. +type APIToken struct { + // CreatedAt: The date and time the API token was created. + CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` + // ID: The unique identifier for the API token. + ID string `json:"id" yaml:"id" schema:"id"` + // IsValid: If the token is valid. We never delete API tokens, but we can mark them as invalid. We save them for ever to preserve the history of the API token. + IsValid bool `json:"is_valid" yaml:"is_valid" schema:"is_valid,required"` + // Token: The API token itself. + Token UUID `json:"token" yaml:"token" schema:"token,required"` + // UpdatedAt: The date and time the API token was last updated. + UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` + // UserID: The ID of the user that owns the API token. + UserID string `json:"user_id" yaml:"user_id" schema:"user_id"` +} + +// APITokenResultsPage: A single page of results +type APITokenResultsPage struct { + // Items: list of items on this page of results + Items []APIToken `json:"items" yaml:"items" schema:"items,required"` + // NextPage: token used to fetch the next page of results (if any) + NextPage string `json:"next_page" yaml:"next_page" schema:"next_page"` +} + // AccountProvider: An account provider. type AccountProvider string @@ -165,130 +297,6 @@ const ( AnnotationTypeT3D AnnotationType = "t3d" ) -// APICallQueryGroup: A response for a query on the API call table that is grouped by something. -type APICallQueryGroup struct { - // Count: - Count int `json:"count" yaml:"count" schema:"count,required"` - // Query: - Query string `json:"query" yaml:"query" schema:"query,required"` -} - -// APICallQueryGroupBy: The field of an API call to group by. -type APICallQueryGroupBy string - -const ( - // APICallQueryGroupByEmail: The email of the user that requested the API call. - APICallQueryGroupByEmail APICallQueryGroupBy = "email" - // APICallQueryGroupByMethod: The HTTP method of the API call. - APICallQueryGroupByMethod APICallQueryGroupBy = "method" - // APICallQueryGroupByEndpoint: The endpoint of the API call. - APICallQueryGroupByEndpoint APICallQueryGroupBy = "endpoint" - // APICallQueryGroupByUserID: The user ID of the user that requested the API call. - APICallQueryGroupByUserID APICallQueryGroupBy = "user_id" - // APICallQueryGroupByOrigin: The origin of the API call. This is parsed from the `Origin` header. - APICallQueryGroupByOrigin APICallQueryGroupBy = "origin" - // APICallQueryGroupByIpAddress: The IP address of the user making the API call. - APICallQueryGroupByIpAddress APICallQueryGroupBy = "ip_address" -) - -// APICallStatus: The status of an async API call. -type APICallStatus string - -const ( - // APICallStatusQueued: The async API call is queued. - APICallStatusQueued APICallStatus = "queued" - // APICallStatusUploaded: The async API call was uploaded to be converted. - APICallStatusUploaded APICallStatus = "uploaded" - // APICallStatusInProgress: The async API call is in progress. - APICallStatusInProgress APICallStatus = "in_progress" - // APICallStatusCompleted: The async API call has completed. - APICallStatusCompleted APICallStatus = "completed" - // APICallStatusFailed: The async API call has failed. - APICallStatusFailed APICallStatus = "failed" -) - -// APICallWithPrice: An API call with the price. -// This is a join of the `ApiCall` and `ApiCallPrice` tables. -type APICallWithPrice struct { - // CompletedAt: The date and time the API call completed billing. - CompletedAt Time `json:"completed_at" yaml:"completed_at" schema:"completed_at"` - // CreatedAt: The date and time the API call was created. - CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` - // Duration: The duration of the API call. - Duration int `json:"duration" yaml:"duration" schema:"duration"` - // Email: The user's email address. - Email string `json:"email" yaml:"email" schema:"email"` - // Endpoint: The endpoint requested by the API call. - Endpoint string `json:"endpoint" yaml:"endpoint" schema:"endpoint"` - // ID: The unique identifier for the API call. - ID UUID `json:"id" yaml:"id" schema:"id,required"` - // IPAddress: The ip address of the origin. - IPAddress IP `json:"ip_address" yaml:"ip_address" schema:"ip_address"` - // Litterbox: If the API call was spawned from the litterbox or not. - Litterbox bool `json:"litterbox" yaml:"litterbox" schema:"litterbox"` - // Method: The HTTP method requsted by the API call. - Method Method `json:"method" yaml:"method" schema:"method,required"` - // Minutes: The number of minutes the API call was billed for. - Minutes int `json:"minutes" yaml:"minutes" schema:"minutes"` - // Origin: The origin of the API call. - Origin string `json:"origin" yaml:"origin" schema:"origin"` - // Price: The price of the API call. - Price float64 `json:"price" yaml:"price" schema:"price"` - // RequestBody: The request body sent by the API call. - RequestBody string `json:"request_body" yaml:"request_body" schema:"request_body"` - // RequestQueryParams: The request query params sent by the API call. - RequestQueryParams string `json:"request_query_params" yaml:"request_query_params" schema:"request_query_params"` - // ResponseBody: The response body returned by the API call. We do not store this information if it is above a certain size. - ResponseBody string `json:"response_body" yaml:"response_body" schema:"response_body"` - // StartedAt: The date and time the API call started billing. - StartedAt Time `json:"started_at" yaml:"started_at" schema:"started_at"` - // StatusCode: The status code returned by the API call. - StatusCode int `json:"status_code" yaml:"status_code" schema:"status_code"` - // StripeInvoiceItemID: The Stripe invoice item ID of the API call if it is billable. - StripeInvoiceItemID string `json:"stripe_invoice_item_id" yaml:"stripe_invoice_item_id" schema:"stripe_invoice_item_id"` - // Token: The API token that made the API call. - Token UUID `json:"token" yaml:"token" schema:"token,required"` - // UpdatedAt: The date and time the API call was last updated. - UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` - // UserAgent: The user agent of the request. - UserAgent string `json:"user_agent" yaml:"user_agent" schema:"user_agent,required"` - // UserID: The ID of the user that made the API call. - UserID string `json:"user_id" yaml:"user_id" schema:"user_id"` -} - -// APICallWithPriceResultsPage: A single page of results -type APICallWithPriceResultsPage struct { - // Items: list of items on this page of results - Items []APICallWithPrice `json:"items" yaml:"items" schema:"items,required"` - // NextPage: token used to fetch the next page of results (if any) - NextPage string `json:"next_page" yaml:"next_page" schema:"next_page"` -} - -// APIToken: An API token. -// These are used to authenticate users with Bearer authentication. -type APIToken struct { - // CreatedAt: The date and time the API token was created. - CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` - // ID: The unique identifier for the API token. - ID string `json:"id" yaml:"id" schema:"id"` - // IsValid: If the token is valid. We never delete API tokens, but we can mark them as invalid. We save them for ever to preserve the history of the API token. - IsValid bool `json:"is_valid" yaml:"is_valid" schema:"is_valid,required"` - // Token: The API token itself. - Token UUID `json:"token" yaml:"token" schema:"token,required"` - // UpdatedAt: The date and time the API token was last updated. - UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` - // UserID: The ID of the user that owns the API token. - UserID string `json:"user_id" yaml:"user_id" schema:"user_id"` -} - -// APITokenResultsPage: A single page of results -type APITokenResultsPage struct { - // Items: list of items on this page of results - Items []APIToken `json:"items" yaml:"items" schema:"items,required"` - // NextPage: token used to fetch the next page of results (if any) - NextPage string `json:"next_page" yaml:"next_page" schema:"next_page"` -} - // AppClientInfo: Information about a third party app client. type AppClientInfo struct { // Url: The URL for consent. @@ -597,8 +605,14 @@ const ( CameraDragInteractionTypeZoom CameraDragInteractionType = "zoom" ) -// CardDetails: The card details of a payment method. -type CardDetails struct { +// Cancelled is the type definition for a Cancelled. +type Cancelled struct { + // WhatFailed: The ID of the command that failed, cancelling this command. + WhatFailed UUID `json:"what_failed" yaml:"what_failed" schema:"what_failed,required"` +} + +// CardDetails: The card details of a payment method. +type CardDetails struct { // Brand: Card brand. // // Can be `amex`, `diners`, `discover`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. @@ -1590,6 +1604,28 @@ const ( CurrencyZmw Currency = "zmw" ) +// CurveGetControlPoints: The response from the `CurveGetControlPoints` command. +type CurveGetControlPoints struct { + // ControlPoints: Control points in the curve. + ControlPoints []Point3D `json:"control_points" yaml:"control_points" schema:"control_points,required"` +} + +// CurveGetType: The response from the `CurveGetType` command. +type CurveGetType struct { + // CurveType: Curve type + CurveType CurveType `json:"curve_type" yaml:"curve_type" schema:"curve_type,required"` +} + +// CurveType: The type of Curve (embedded within path) +type CurveType string + +const ( + // CurveTypeLine represents the CurveType `"line"`. + CurveTypeLine CurveType = "line" + // CurveTypeNurbs represents the CurveType `"nurbs"`. + CurveTypeNurbs CurveType = "nurbs" +) + // Customer: The resource representing a payment "Customer". type Customer struct { // Address: The customer's address. @@ -1639,6 +1675,12 @@ type CustomerBalance struct { UserID string `json:"user_id" yaml:"user_id" schema:"user_id"` } +// Data is the type definition for a Data. +type Data struct { + // Files: The exported files + Files []RawFile `json:"files" yaml:"files" schema:"files,required"` +} + // DeviceAccessTokenRequestForm: The form for a device access token request. type DeviceAccessTokenRequestForm struct { // ClientID: The client ID. @@ -1823,14 +1865,6 @@ type EmailAuthenticationForm struct { Email string `json:"email" yaml:"email" schema:"email,required"` } -// EngineError: An error. -type EngineError struct { - // ErrorCode: The error code. - ErrorCode ErrorCode `json:"error_code" yaml:"error_code" schema:"error_code,required"` - // Message: The error message. - Message string `json:"message" yaml:"message" schema:"message,required"` -} - // EngineMetadata: Metadata about our currently running server. // This is mostly used for internal purposes and debugging. type EngineMetadata struct { @@ -1848,6 +1882,30 @@ type EngineMetadata struct { Pubsub Connection `json:"pubsub" yaml:"pubsub" schema:"pubsub,required"` } +// EntityGetAllChildUuids: The response from the `EntityGetAllChildUuids` command. +type EntityGetAllChildUuids struct { + // EntityIds: The UUIDs of the child entities. + EntityIds []UUID `json:"entity_ids" yaml:"entity_ids" schema:"entity_ids,required"` +} + +// EntityGetChildUuid: The response from the `EntityGetChildUuid` command. +type EntityGetChildUuid struct { + // EntityID: The UUID of the child entity. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` +} + +// EntityGetNumChildren: The response from the `EntityGetNumChildren` command. +type EntityGetNumChildren struct { + // Num: The number of children the entity has. + Num int `json:"num" yaml:"num" schema:"num,required"` +} + +// EntityGetParentID: The response from the `EntityGetParentId` command. +type EntityGetParentID struct { + // EntityID: The UUID of the parent entity. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` +} + // EntityType: The type of entity type EntityType string @@ -1868,6 +1926,8 @@ const ( EntityTypeEdge EntityType = "edge" // EntityTypeFace represents the EntityType `"face"`. EntityTypeFace EntityType = "face" + // EntityTypePlane represents the EntityType `"plane"`. + EntityTypePlane EntityType = "plane" ) // Environment: The environment the server is running in. @@ -1892,22 +1952,26 @@ type Error struct { RequestID string `json:"request_id" yaml:"request_id" schema:"request_id,required"` } -// ErrorCode: The type of errorcode. +// ErrorCode: The type of error sent by the KittyCAD API. type ErrorCode string const ( - // ErrorCodeBadRequest: User requested something impossible or invalid - ErrorCodeBadRequest ErrorCode = "bad_request" - // ErrorCodeInternalEngine: Engine failed to complete request, consider retrying + // ErrorCodeInternalEngine: Graphics engine failed to complete request, consider retrying ErrorCodeInternalEngine ErrorCode = "internal_engine" + // ErrorCodeInternalAPI: API failed to complete request, consider retrying + ErrorCodeInternalAPI ErrorCode = "internal_api" + // ErrorCodeBadRequest: User requested something geometrically or graphically impossible. Don't retry this request, as it's inherently impossible. Instead, read the error message and change your request. + ErrorCodeBadRequest ErrorCode = "bad_request" + // ErrorCodeInvalidJson: Client sent invalid JSON. + ErrorCodeInvalidJson ErrorCode = "invalid_json" + // ErrorCodeConnectionProblem: Problem sending data between client and KittyCAD API. + ErrorCodeConnectionProblem ErrorCode = "connection_problem" + // ErrorCodeMessageTypeNotAccepted: Client sent a Websocket message type which the KittyCAD API does not handle. + ErrorCodeMessageTypeNotAccepted ErrorCode = "message_type_not_accepted" + // ErrorCodeMessageTypeNotAcceptedForWebRTC: Client sent a Websocket message intended for WebRTC but it was configured as a WebRTC connection. + ErrorCodeMessageTypeNotAcceptedForWebRTC ErrorCode = "message_type_not_accepted_for_web_r_t_c" ) -// ErrorResponse: The error response. -type ErrorResponse struct { - // Errors: A list of errors. - Errors []EngineError `json:"errors" yaml:"errors" schema:"errors,required"` -} - // ExecutorMetadata: Metadata about our currently running server. // This is mostly used for internal purposes and debugging. type ExecutorMetadata struct { @@ -1919,6 +1983,12 @@ type ExecutorMetadata struct { GitHash string `json:"git_hash" yaml:"git_hash" schema:"git_hash,required"` } +// Export: The response from the `Export` endpoint. +type Export struct { + // Files: The files that were exported. + Files []ExportFile `json:"files" yaml:"files" schema:"files,required"` +} + // ExportFile: A file to be exported to the client. type ExportFile struct { // Contents: The contents of the file, base64 encoded. @@ -1972,6 +2042,26 @@ type ExtendedUserResultsPage struct { NextPage string `json:"next_page" yaml:"next_page" schema:"next_page"` } +// FailureWebSocketResponse: Unsuccessful Websocket response. +type FailureWebSocketResponse struct { + // Errors: The errors that occurred. + Errors []APIError `json:"errors" yaml:"errors" schema:"errors,required"` + // RequestID: Which request this is a response to. If the request was a modeling command, this is the modeling command ID. If no request ID was sent, this will be null. + RequestID UUID `json:"request_id" yaml:"request_id" schema:"request_id"` + // Success: Always false + Success bool `json:"success" yaml:"success" schema:"success,required"` +} + +// FbxStorage: Describes the storage format of an FBX file. +type FbxStorage string + +const ( + // FbxStorageAscii: ASCII FBX encoding. + FbxStorageAscii FbxStorage = "ascii" + // FbxStorageBinary: Binary FBX encoding. + FbxStorageBinary FbxStorage = "binary" +) + // FileCenterOfMass: A file center of mass result. type FileCenterOfMass struct { // CenterOfMass: The resulting center of mass. @@ -2072,7 +2162,21 @@ type FileDensity struct { type FileExportFormat string const ( - // FileExportFormatGltf: glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). + // FileExportFormatFbx: Autodesk Filmbox (FBX) format. + FileExportFormatFbx FileExportFormat = "fbx" + // FileExportFormatGlb: Binary glTF 2.0. + // + // This is a single binary with .glb extension. + // + // This is better if you want a compressed format as opposed to the human readable glTF that lacks compression. + FileExportFormatGlb FileExportFormat = "glb" + // FileExportFormatGltf: glTF 2.0. Embedded glTF 2.0 (pretty printed). + // + // Single JSON file with .gltf extension binary data encoded as base64 data URIs. + // + // The JSON contents are pretty printed. + // + // It is human readable, single file, and you can view the diff easily in a git commit. FileExportFormatGltf FileExportFormat = "gltf" // FileExportFormatObj: The OBJ file format. It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. FileExportFormatObj FileExportFormat = "obj" @@ -2088,6 +2192,8 @@ const ( type FileImportFormat string const ( + // FileImportFormatFbx: Autodesk Filmbox (FBX) format. + FileImportFormatFbx FileImportFormat = "fbx" // FileImportFormatGltf: glTF 2.0. FileImportFormatGltf FileImportFormat = "gltf" // FileImportFormatObj: The OBJ file format. It may or may not have an an attached material (mtl // mtllib) within the file, but we interact with it as if it does not. @@ -2209,6 +2315,52 @@ type Gateway struct { TlsTimeout int `json:"tls_timeout" yaml:"tls_timeout" schema:"tls_timeout"` } +// GetEntityType: The response from the `GetEntityType` command. +type GetEntityType struct { + // EntityType: The type of the entity. + EntityType EntityType `json:"entity_type" yaml:"entity_type" schema:"entity_type,required"` +} + +// GltfPresentation: Describes the presentation style of the glTF JSON. +type GltfPresentation string + +const ( + // GltfPresentationCompact: Condense the JSON into the smallest possible size. + GltfPresentationCompact GltfPresentation = "compact" + // GltfPresentationPretty: Expand the JSON into a more human readable format. + // + // This is the default setting. + GltfPresentationPretty GltfPresentation = "pretty" +) + +// GltfStorage: Describes the storage format of a glTF 2.0 scene. +type GltfStorage string + +const ( + // GltfStorageBinary: Binary glTF 2.0. + // + // This is a single binary with .glb extension. + GltfStorageBinary GltfStorage = "binary" + // GltfStorageStandard: Standard glTF 2.0. + // + // This is a JSON file with .gltf extension paired with a separate binary blob file with .bin extension. + GltfStorageStandard GltfStorage = "standard" + // GltfStorageEmbedded: Embedded glTF 2.0. + // + // Single JSON file with .gltf extension binary data encoded as base64 data URIs. + // + // This is the default setting. + GltfStorageEmbedded GltfStorage = "embedded" +) + +// HighlightSetEntity: The response from the `HighlightSetEntity` command. +type HighlightSetEntity struct { + // EntityID: The UUID of the entity that was highlighted. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id"` + // Sequence: If the client sent a sequence ID with its request, the backend sends it back. + Sequence int `json:"sequence" yaml:"sequence" schema:"sequence"` +} + // IceServer: Representation of an ICE server used for STUN/TURN Used to initiate WebRTC connections based on type IceServer struct { // Credential: Credentials for a given TURN server. @@ -2219,6 +2371,16 @@ type IceServer struct { Username string `json:"username" yaml:"username" schema:"username"` } +// ImageFormat: Enum containing the variety of image formats snapshots may be exported to. +type ImageFormat string + +const ( + // ImageFormatPng: .png format + ImageFormatPng ImageFormat = "png" + // ImageFormatJpeg: .jpeg format + ImageFormatJpeg ImageFormat = "jpeg" +) + // ImageType: An enumeration. type ImageType string @@ -2243,14 +2405,28 @@ type IndexInfo struct { Secure bool `json:"secure" yaml:"secure" schema:"secure"` } -// InputFormatGltf: Binary glTF 2.0. We refer to this as glTF since that is how our customers refer to it, but this can also import binary glTF (glb). -type InputFormatGltf struct { +// InputFormatCoords: Wavefront OBJ format. +type InputFormatCoords struct { + // Coords: Co-ordinate system of input data. + // + // Defaults to the [KittyCAD co-ordinate system]. + // + // [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html + Coords System `json:"coords" yaml:"coords" schema:"coords,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` + // Units: The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. + Units UnitLength `json:"units" yaml:"units" schema:"units,required"` } -// InputFormatStep: ISO 10303-21 (STEP) format. -type InputFormatStep struct { +// InputFormatFbx: Autodesk Filmbox (FBX) format. +type InputFormatFbx struct { + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// InputFormatGltf: Binary glTF 2.0. We refer to this as glTF since that is how our customers refer to it, but this can also import binary glTF (glb). +type InputFormatGltf struct { // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } @@ -2269,6 +2445,12 @@ type InputFormatObj struct { Units UnitLength `json:"units" yaml:"units" schema:"units,required"` } +// InputFormatStep: ISO 10303-21 (STEP) format. +type InputFormatStep struct { + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + // InputFormatUnits: *ST**ereo**L**ithography format. type InputFormatUnits struct { // Coords: Co-ordinate system of input data. @@ -2517,64 +2699,114 @@ const ( MethodExtension Method = "EXTENSION" ) -// ModelingCmdStartPath: Start a path. -type ModelingCmdStartPath struct { +// ModelingCmdAnimated: Hide or show an object +type ModelingCmdAnimated struct { + // Hidden: Whether or not the object should be hidden. + Hidden bool `json:"hidden" yaml:"hidden" schema:"hidden,required"` + // ObjectID: Which object to change + ObjectID UUID `json:"object_id" yaml:"object_id" schema:"object_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdTo: 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. -type ModelingCmdTo struct { - // Path: The ID of the command which created the path. - Path UUID `json:"path" yaml:"path" schema:"path,required"` - // Segment: Segment to append to the path. This segment will implicitly begin at the current "pen" location. - Segment any `json:"segment" yaml:"segment" schema:"segment,required"` +// ModelingCmdCameraDragEnd: Adds one or more entities (by UUID) to the selection. +type ModelingCmdCameraDragEnd struct { + // Entities: Which entities to select + Entities []UUID `json:"entities" yaml:"entities" schema:"entities,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdMovePathPen: Extrude a 2D solid. -type ModelingCmdMovePathPen struct { - // Cap: Whether to cap the extrusion with a face, or not. If true, the resulting solid will be closed on all sides, like a dice. If false, it will be open on one side, like a drinking glass. - Cap bool `json:"cap" yaml:"cap" schema:"cap,required"` - // Distance: How far off the plane to extrude - Distance float64 `json:"distance" yaml:"distance" schema:"distance,required"` - // Target: Which sketch to extrude. Must be a closed 2D solid. - Target UUID `json:"target" yaml:"target" schema:"target,required"` +// ModelingCmdCameraDragMove: Exit edit mode +type ModelingCmdCameraDragMove struct { // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdSegment: Camera drag started. -type ModelingCmdSegment struct { - // Interaction: The type of camera drag interaction. - Interaction CameraDragInteractionType `json:"interaction" yaml:"interaction" schema:"interaction,required"` +// ModelingCmdCameraDragStart: How many children does the entity have? +type ModelingCmdCameraDragStart struct { + // EntityID: ID of the entity being queried. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` - // Window: The initial mouse position. - Window Point2D `json:"window" yaml:"window" schema:"window,required"` } -// ModelingCmdExtendPath: Camera drag continued. -type ModelingCmdExtendPath struct { +// ModelingCmdCap: Camera drag ended. +type ModelingCmdCap struct { // Interaction: The type of camera drag interaction. Interaction CameraDragInteractionType `json:"interaction" yaml:"interaction" schema:"interaction,required"` - // Sequence: Logical timestamp. The client should increment this with every event in the current mouse drag. That way, if the events are being sent over an unordered channel, the API can ignore the older events. - Sequence int `json:"sequence" yaml:"sequence" schema:"sequence"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` - // Window: The current mouse position. + // Window: The final mouse position. Window Point2D `json:"window" yaml:"window" schema:"window,required"` } -// ModelingCmdCap: Camera drag ended. -type ModelingCmdCap struct { - // Interaction: The type of camera drag interaction. - Interaction CameraDragInteractionType `json:"interaction" yaml:"interaction" schema:"interaction,required"` +// ModelingCmdCenter: Replaces the current selection with these new entities (by UUID). Equivalent to doing SelectClear then SelectAdd. +type ModelingCmdCenter struct { + // Entities: Which entities to select + Entities []UUID `json:"entities" yaml:"entities" schema:"entities,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdChildIndex: Enable sketch mode on the given plane. +type ModelingCmdChildIndex struct { + // Animated: Animate the transition to sketch mode. + Animated bool `json:"animated" yaml:"animated" schema:"animated,required"` + // Ortho: Use an orthographic camera. + Ortho bool `json:"ortho" yaml:"ortho" schema:"ortho,required"` + // PlaneID: Sketch on this plane. + PlaneID UUID `json:"plane_id" yaml:"plane_id" schema:"plane_id,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdClosePath: Export the scene to a file. +type ModelingCmdClosePath struct { + // EntityIds: IDs of the entities to be exported. If this is empty, then all entities are exported. + EntityIds []UUID `json:"entity_ids" yaml:"entity_ids" schema:"entity_ids,required"` + // Format: The file format to export to. + Format any `json:"format" yaml:"format" schema:"format,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdDefaultCameraDisableSketchMode: Sends object to front or back. +type ModelingCmdDefaultCameraDisableSketchMode struct { + // Front: Bring to front = true, send to back = false. + Front bool `json:"front" yaml:"front" schema:"front,required"` + // ObjectID: Which object is being changed. + ObjectID UUID `json:"object_id" yaml:"object_id" schema:"object_id,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdDefaultCameraEnableSketchMode: Gets the edge opposite the given edge, along the given face. +type ModelingCmdDefaultCameraEnableSketchMode struct { + // EdgeID: Which edge you want the opposite of. + EdgeID UUID `json:"edge_id" yaml:"edge_id" schema:"edge_id,required"` + // FaceID: Which face is used to figure out the opposite edge? + FaceID UUID `json:"face_id" yaml:"face_id" schema:"face_id,required"` + // ObjectID: Which object is being queried. + ObjectID UUID `json:"object_id" yaml:"object_id" schema:"object_id,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdDefaultCameraLookAt: Find all IDs of selected entities +type ModelingCmdDefaultCameraLookAt struct { + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdDefaultCameraZoom: Update an annotation +type ModelingCmdDefaultCameraZoom struct { + // AnnotationID: Which annotation to update + AnnotationID UUID `json:"annotation_id" yaml:"annotation_id" schema:"annotation_id,required"` + // Options: If any of these fields are set, they will overwrite the previous options for the annotation. + Options AnnotationOptions `json:"options" yaml:"options" schema:"options,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` - // Window: The final mouse position. - Window Point2D `json:"window" yaml:"window" schema:"window,required"` } // ModelingCmdDistance: Change what the default camera is looking at. @@ -2589,108 +2821,150 @@ type ModelingCmdDistance struct { Vantage Point3D `json:"vantage" yaml:"vantage" schema:"vantage,required"` } -// ModelingCmdTarget: Enable sketch mode, where users can sketch 2D geometry. Users choose a plane to sketch on. -type ModelingCmdTarget struct { - // Animated: Should we animate or snap for the camera transition? - Animated bool `json:"animated" yaml:"animated" schema:"animated,required"` - // DistanceToPlane: How far to the sketching plane? - DistanceToPlane float64 `json:"distance_to_plane" yaml:"distance_to_plane" schema:"distance_to_plane,required"` - // Origin: What's the origin of the sketching plane? - Origin Point3D `json:"origin" yaml:"origin" schema:"origin,required"` - // Ortho: Should the camera use orthographic projection? In other words, should an object's size in the rendered image stay constant regardless of its distance from the camera. - Ortho bool `json:"ortho" yaml:"ortho" schema:"ortho,required"` +// ModelingCmdDistanceToPlane: What type of entity is this? +type ModelingCmdDistanceToPlane struct { + // EntityID: ID of the entity being queried. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` - // XAxis: Which 3D axis of the scene should be the X axis of the sketching plane? - XAxis Point3D `json:"x_axis" yaml:"x_axis" schema:"x_axis,required"` - // YAxis: Which 3D axis of the scene should be the Y axis of the sketching plane? - YAxis Point3D `json:"y_axis" yaml:"y_axis" schema:"y_axis,required"` } -// ModelingCmdExtrude: Disable sketch mode, from the default camera. -type ModelingCmdExtrude struct { +// ModelingCmdEditModeEnter: Query the given path +type ModelingCmdEditModeEnter struct { + // PathID: Which path to query + PathID UUID `json:"path_id" yaml:"path_id" schema:"path_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdPathID: Export the scene to a file. -type ModelingCmdPathID struct { - // EntityIds: IDs of the entities to be exported. If this is empty, then all entities are exported. - EntityIds []UUID `json:"entity_ids" yaml:"entity_ids" schema:"entity_ids,required"` - // Format: The file format to export to. - Format any `json:"format" yaml:"format" schema:"format,required"` +// ModelingCmdEditModeExit: Start dragging mouse. +type ModelingCmdEditModeExit struct { // Type: Type string `json:"type" yaml:"type" schema:"type,required"` + // Window: The mouse position. + Window Point2D `json:"window" yaml:"window" schema:"window,required"` } -// ModelingCmdClosePath: What is this entity's parent? -type ModelingCmdClosePath struct { - // EntityID: ID of the entity being queried. - EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` +// ModelingCmdEntityGetAllChildUuids: Take a snapshot. +type ModelingCmdEntityGetAllChildUuids struct { + // Format: What image format to return. + Format ImageFormat `json:"format" yaml:"format" schema:"format,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdCameraDragStart: What is the UUID of this entity's n-th child? -type ModelingCmdCameraDragStart struct { - // ChildIndex: Index into the entity's list of children. - ChildIndex int `json:"child_index" yaml:"child_index" schema:"child_index,required"` - // EntityID: ID of the entity being queried. - EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` +// ModelingCmdEntityGetChildUuid: Get type of a given curve. +type ModelingCmdEntityGetChildUuid struct { + // CurveID: Which curve to query. + CurveID UUID `json:"curve_id" yaml:"curve_id" schema:"curve_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdSequence: Exit edit mode -type ModelingCmdSequence struct { +// ModelingCmdEntityGetNumChildren: Send a mouse click event. Updates modified/selected entities. +type ModelingCmdEntityGetNumChildren struct { // Type: Type string `json:"type" yaml:"type" schema:"type,required"` + // Window: Where the mouse is + Window Point2D `json:"window" yaml:"window" schema:"window,required"` } -// ModelingCmdCameraDragMove: Modifies the selection by simulating a "mouse click" at the given x,y window coordinate Returns ID of whatever was selected. -type ModelingCmdCameraDragMove struct { - // SelectedAtWindow: Where in the window was selected - SelectedAtWindow Point2D `json:"selected_at_window" yaml:"selected_at_window" schema:"selected_at_window,required"` - // SelectionType: What entity was selected? - SelectionType SceneSelectionType `json:"selection_type" yaml:"selection_type" schema:"selection_type,required"` +// ModelingCmdEntityGetParentID: Set the active tool. +type ModelingCmdEntityGetParentID struct { + // Tool: What tool should be active. + Tool SceneToolType `json:"tool" yaml:"tool" schema:"tool,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdCameraDragEnd: Removes one or more entities (by UUID) from the selection. -type ModelingCmdCameraDragEnd struct { - // Entities: Which entities to unselect - Entities []UUID `json:"entities" yaml:"entities" schema:"entities,required"` +// ModelingCmdEntityID: Set the plane's color. +type ModelingCmdEntityID struct { + // Color: What color it should be. + Color Color `json:"color" yaml:"color" schema:"color,required"` + // PlaneID: Which plane is being changed. + PlaneID UUID `json:"plane_id" yaml:"plane_id" schema:"plane_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdCenter: Find all IDs of selected entities -type ModelingCmdCenter struct { +// ModelingCmdEntityIds: Set opacity of the entity. +type ModelingCmdEntityIds struct { + // EntityID: Which entity is being changed. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` + // Opacity: How transparent should it be? 0 or lower is totally transparent. 1 or greater is totally opaque. + Opacity float64 `json:"opacity" yaml:"opacity" schema:"opacity,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdDefaultCameraLookAt: Changes the current highlighted entity to whichever one is at the given window coordinate. If there's no entity at this location, clears the highlight. -type ModelingCmdDefaultCameraLookAt struct { - // SelectedAtWindow: Coordinates of the window being clicked - SelectedAtWindow Point2D `json:"selected_at_window" yaml:"selected_at_window" schema:"selected_at_window,required"` +// ModelingCmdExport: Make a plane. +type ModelingCmdExport struct { + // Clobber: If true, any existing drawables within the obj will be replaced (the object will be reset) + Clobber bool `json:"clobber" yaml:"clobber" schema:"clobber,required"` + // Origin: Origin of the plane + Origin Point3D `json:"origin" yaml:"origin" schema:"origin,required"` + // Size: What should the plane's span/extent? When rendered visually, this is both the width and height along X and Y axis respectively. + Size float64 `json:"size" yaml:"size" schema:"size,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` + // XAxis: What should the plane's X axis be? + XAxis Point3D `json:"x_axis" yaml:"x_axis" schema:"x_axis,required"` + // YAxis: What should the plane's Y axis be? + YAxis Point3D `json:"y_axis" yaml:"y_axis" schema:"y_axis,required"` +} + +// ModelingCmdExtendPath: Camera drag continued. +type ModelingCmdExtendPath struct { + // Interaction: The type of camera drag interaction. + Interaction CameraDragInteractionType `json:"interaction" yaml:"interaction" schema:"interaction,required"` // Sequence: Logical timestamp. The client should increment this with every event in the current mouse drag. That way, if the events are being sent over an unordered channel, the API can ignore the older events. Sequence int `json:"sequence" yaml:"sequence" schema:"sequence"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` + // Window: The current mouse position. + Window Point2D `json:"window" yaml:"window" schema:"window,required"` +} + +// ModelingCmdExtrude: Enable sketch mode, where users can sketch 2D geometry. Users choose a plane to sketch on. +type ModelingCmdExtrude struct { + // Animated: Should we animate or snap for the camera transition? + Animated bool `json:"animated" yaml:"animated" schema:"animated,required"` + // DistanceToPlane: How far to the sketching plane? + DistanceToPlane float64 `json:"distance_to_plane" yaml:"distance_to_plane" schema:"distance_to_plane,required"` + // Origin: What's the origin of the sketching plane? + Origin Point3D `json:"origin" yaml:"origin" schema:"origin,required"` + // Ortho: Should the camera use orthographic projection? In other words, should an object's size in the rendered image stay constant regardless of its distance from the camera. + Ortho bool `json:"ortho" yaml:"ortho" schema:"ortho,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` + // XAxis: Which 3D axis of the scene should be the X axis of the sketching plane? + XAxis Point3D `json:"x_axis" yaml:"x_axis" schema:"x_axis,required"` + // YAxis: Which 3D axis of the scene should be the Y axis of the sketching plane? + YAxis Point3D `json:"y_axis" yaml:"y_axis" schema:"y_axis,required"` } -// ModelingCmdUp: Changes the current highlighted entity to these entities. -type ModelingCmdUp struct { - // Entities: Highlight these entities. - Entities []UUID `json:"entities" yaml:"entities" schema:"entities,required"` +// ModelingCmdFormat: Fade the entity in or out. +type ModelingCmdFormat struct { + // DurationSeconds: How many seconds the animation should take. + DurationSeconds float64 `json:"duration_seconds" yaml:"duration_seconds" schema:"duration_seconds"` + // EntityID: Which entity is being changed. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` + // FadeIn: Fade in = true, fade out = false. + FadeIn bool `json:"fade_in" yaml:"fade_in" schema:"fade_in,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdVantage: Create a new annotation -type ModelingCmdVantage struct { +// ModelingCmdInteraction: What is this entity's parent? +type ModelingCmdInteraction struct { + // EntityID: ID of the entity being queried. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdMagnitude: Create a new annotation +type ModelingCmdMagnitude struct { // AnnotationType: What type of annotation to create. AnnotationType AnnotationType `json:"annotation_type" yaml:"annotation_type" schema:"annotation_type,required"` // Clobber: If true, any existing drawables within the obj will be replaced (the object will be reset) @@ -2701,36 +2975,60 @@ type ModelingCmdVantage struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdAnimated: Update an annotation -type ModelingCmdAnimated struct { - // AnnotationID: Which annotation to update - AnnotationID UUID `json:"annotation_id" yaml:"annotation_id" schema:"annotation_id,required"` - // Options: If any of these fields are set, they will overwrite the previous options for the annotation. - Options AnnotationOptions `json:"options" yaml:"options" schema:"options,required"` +// ModelingCmdModelingCmdEntityID: Get control points of a given curve. +type ModelingCmdModelingCmdEntityID struct { + // CurveID: Which curve to query. + CurveID UUID `json:"curve_id" yaml:"curve_id" schema:"curve_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdDistanceToPlane: Hide or show an object -type ModelingCmdDistanceToPlane struct { - // Hidden: Whether or not the object should be hidden. - Hidden bool `json:"hidden" yaml:"hidden" schema:"hidden,required"` - // ObjectID: Which object to change - ObjectID UUID `json:"object_id" yaml:"object_id" schema:"object_id,required"` +// ModelingCmdModelingCmdInteraction: Clear the selection +type ModelingCmdModelingCmdInteraction struct { // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdOrigin: What type of entity is this? -type ModelingCmdOrigin struct { - // EntityID: ID of the entity being queried. - EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` +// ModelingCmdModelingCmdPath: Closes a path, converting it to a 2D solid. +type ModelingCmdModelingCmdPath struct { + // PathID: Which path to close. + PathID UUID `json:"path_id" yaml:"path_id" schema:"path_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdOrtho: Gets all faces which use the given edge. -type ModelingCmdOrtho struct { +// ModelingCmdModelingCmdTarget: Add a gizmo showing the axes. +type ModelingCmdModelingCmdTarget struct { + // Clobber: If true, any existing drawables within the obj will be replaced (the object will be reset) + Clobber bool `json:"clobber" yaml:"clobber" schema:"clobber,required"` + // GizmoMode: If true, axes gizmo will be placed in the corner of the screen. If false, it will be placed at the origin of the scene. + GizmoMode bool `json:"gizmo_mode" yaml:"gizmo_mode" schema:"gizmo_mode,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdModelingCmdWindow: Removes one or more entities (by UUID) from the selection. +type ModelingCmdModelingCmdWindow struct { + // Entities: Which entities to unselect + Entities []UUID `json:"entities" yaml:"entities" schema:"entities,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdMovePathPen: Extrude a 2D solid. +type ModelingCmdMovePathPen struct { + // Cap: Whether to cap the extrusion with a face, or not. If true, the resulting solid will be closed on all sides, like a dice. If false, it will be open on one side, like a drinking glass. + Cap bool `json:"cap" yaml:"cap" schema:"cap,required"` + // Distance: How far off the plane to extrude + Distance float64 `json:"distance" yaml:"distance" schema:"distance,required"` + // Target: Which sketch to extrude. Must be a closed 2D solid. + Target UUID `json:"target" yaml:"target" schema:"target,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdOrigin: Gets all faces which use the given edge. +type ModelingCmdOrigin struct { // EdgeID: Which edge you want the faces of. EdgeID UUID `json:"edge_id" yaml:"edge_id" schema:"edge_id,required"` // ObjectID: Which object is being queried. @@ -2739,8 +3037,8 @@ type ModelingCmdOrtho struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdDefaultCameraEnableSketchMode: Gets all edges which are opposite the given edge, across all possible faces. -type ModelingCmdDefaultCameraEnableSketchMode struct { +// ModelingCmdOrtho: Gets all edges which are opposite the given edge, across all possible faces. +type ModelingCmdOrtho struct { // AlongVector: If given, ohnly faces parallel to this vector will be considered. AlongVector Point3D `json:"along_vector" yaml:"along_vector" schema:"along_vector"` // EdgeID: Which edge you want the opposites of. @@ -2751,20 +3049,124 @@ type ModelingCmdDefaultCameraEnableSketchMode struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdXAxis: Gets the edge opposite the given edge, along the given face. -type ModelingCmdXAxis struct { - // EdgeID: Which edge you want the opposite of. - EdgeID UUID `json:"edge_id" yaml:"edge_id" schema:"edge_id,required"` - // FaceID: Which face is used to figure out the opposite edge? - FaceID UUID `json:"face_id" yaml:"face_id" schema:"face_id,required"` - // ObjectID: Which object is being queried. - ObjectID UUID `json:"object_id" yaml:"object_id" schema:"object_id,required"` +// ModelingCmdPath: Move the path's "pen". +type ModelingCmdPath struct { + // Path: The ID of the command which created the path. + Path UUID `json:"path" yaml:"path" schema:"path,required"` + // To: Where the path's pen should be. + To Point3D `json:"to" yaml:"to" schema:"to,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdPathID: Disable sketch mode, from the default camera. +type ModelingCmdPathID struct { + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdReq: A graphics command submitted to the KittyCAD engine via the Modeling API. +type ModelingCmdReq struct { + // Cmd: Which command to submit to the Kittycad engine. + Cmd any `json:"cmd" yaml:"cmd" schema:"cmd,required"` + // CmdID: ID of command being submitted. + CmdID UUID `json:"cmd_id" yaml:"cmd_id" schema:"cmd_id,required"` +} + +// ModelingCmdReqBatch: A batch set of graphics commands submitted to the KittyCAD engine via the Modeling API. +type ModelingCmdReqBatch struct { + // Cmds: + Cmds map[string]ModelingCmdReq `json:"cmds" yaml:"cmds" schema:"cmds,required"` +} + +// ModelingCmdSegment: Camera drag started. +type ModelingCmdSegment struct { + // Interaction: The type of camera drag interaction. + Interaction CameraDragInteractionType `json:"interaction" yaml:"interaction" schema:"interaction,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` + // Window: The initial mouse position. + Window Point2D `json:"window" yaml:"window" schema:"window,required"` +} + +// ModelingCmdSelectedAtWindow: Continue dragging mouse. +type ModelingCmdSelectedAtWindow struct { + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` + // Window: The mouse position. + Window Point2D `json:"window" yaml:"window" schema:"window,required"` +} + +// ModelingCmdSelectionType: Stop dragging mouse. +type ModelingCmdSelectionType struct { + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` + // Window: The mouse position. + Window Point2D `json:"window" yaml:"window" schema:"window,required"` +} + +// ModelingCmdSequence: Enter edit mode +type ModelingCmdSequence struct { + // Target: The edit target + Target UUID `json:"target" yaml:"target" schema:"target,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdStartPath: Start a path. +type ModelingCmdStartPath struct { + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdTarget: Adjust zoom of the default camera. +type ModelingCmdTarget struct { + // Magnitude: Move the camera forward along the vector it's looking at, by this magnitudedefaultCameraZoom. Basically, how much should the camera move forward by. + Magnitude float64 `json:"magnitude" yaml:"magnitude" schema:"magnitude,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdTo: 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. +type ModelingCmdTo struct { + // Path: The ID of the command which created the path. + Path UUID `json:"path" yaml:"path" schema:"path,required"` + // Segment: Segment to append to the path. This segment will implicitly begin at the current "pen" location. + Segment any `json:"segment" yaml:"segment" schema:"segment,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdUp: Changes the current highlighted entity to whichever one is at the given window coordinate. If there's no entity at this location, clears the highlight. +type ModelingCmdUp struct { + // SelectedAtWindow: Coordinates of the window being clicked + SelectedAtWindow Point2D `json:"selected_at_window" yaml:"selected_at_window" schema:"selected_at_window,required"` + // Sequence: Logical timestamp. The client should increment this with every event in the current mouse drag. That way, if the events are being sent over an unordered channel, the API can ignore the older events. + Sequence int `json:"sequence" yaml:"sequence" schema:"sequence"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdVantage: Changes the current highlighted entity to these entities. +type ModelingCmdVantage struct { + // Entities: Highlight these entities. + Entities []UUID `json:"entities" yaml:"entities" schema:"entities,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// ModelingCmdWindow: What is the UUID of this entity's n-th child? +type ModelingCmdWindow struct { + // ChildIndex: Index into the entity's list of children. + ChildIndex int `json:"child_index" yaml:"child_index" schema:"child_index,required"` + // EntityID: ID of the entity being queried. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdYAxis: Gets the next adjacent edge for the given edge, along the given face. -type ModelingCmdYAxis struct { +// ModelingCmdXaxis: Gets the next adjacent edge for the given edge, along the given face. +type ModelingCmdXaxis struct { // EdgeID: Which edge you want the opposite of. EdgeID UUID `json:"edge_id" yaml:"edge_id" schema:"edge_id,required"` // FaceID: Which face is used to figure out the opposite edge? @@ -2775,8 +3177,8 @@ type ModelingCmdYAxis struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdDefaultCameraDisableSketchMode: Gets the previous adjacent edge for the given edge, along the given face. -type ModelingCmdDefaultCameraDisableSketchMode struct { +// ModelingCmdYaxis: Gets the previous adjacent edge for the given edge, along the given face. +type ModelingCmdYaxis struct { // EdgeID: Which edge you want the opposite of. EdgeID UUID `json:"edge_id" yaml:"edge_id" schema:"edge_id,required"` // FaceID: Which face is used to figure out the opposite edge? @@ -2787,20 +3189,6 @@ type ModelingCmdDefaultCameraDisableSketchMode struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// ModelingCmdReq: A graphics command submitted to the KittyCAD engine via the Modeling API. -type ModelingCmdReq struct { - // Cmd: Which command to submit to the Kittycad engine. - Cmd any `json:"cmd" yaml:"cmd" schema:"cmd,required"` - // CmdID: ID of command being submitted. - CmdID UUID `json:"cmd_id" yaml:"cmd_id" schema:"cmd_id,required"` -} - -// ModelingCmdReqBatch: A batch set of graphics commands submitted to the KittyCAD engine via the Modeling API. -type ModelingCmdReqBatch struct { - // Cmds: A set of commands to submit to the KittyCAD engine in a batch. - Cmds map[string]ModelingCmdReq `json:"cmds" yaml:"cmds" schema:"cmds,required"` -} - // ModelingError: Why a command submitted to the Modeling API failed. type ModelingError struct { // ErrorCode: A string error code which refers to a family of errors. E.g. "InvalidInput". @@ -2813,10 +3201,16 @@ type ModelingError struct { StatusCode int `json:"status_code" yaml:"status_code" schema:"status_code,required"` } -// ModelingOutcomeSuccess: Each successful command has some result. -type ModelingOutcomeSuccess struct { - // Success: A successful response from a modeling command. This can be one of several types of responses, depending on the command. - Success any `json:"success" yaml:"success" schema:"success,required"` +// ModelingOutcomeCancelled: Cancelled because it required the output of a previous command, which failed. +type ModelingOutcomeCancelled struct { + // Cancelled: + Cancelled Cancelled `json:"cancelled" yaml:"cancelled" schema:"cancelled,required"` +} + +// ModelingOutcomeError: It failed. Why? See 'struct Error' above. +type ModelingOutcomeError struct { + // Error: Why a command submitted to the Modeling API failed. + Error ModelingError `json:"error" yaml:"error" schema:"error,required"` } // ModelingOutcomeErrorError: Why a command submitted to the Modeling API failed. @@ -2831,30 +3225,26 @@ type ModelingOutcomeErrorError struct { StatusCode int `json:"status_code" yaml:"status_code" schema:"status_code,required"` } -// ModelingOutcomeError: It failed. Why? See 'struct Error' above. -type ModelingOutcomeError struct { - // Error: Why a command submitted to the Modeling API failed. - Error ModelingError `json:"error" yaml:"error" schema:"error,required"` -} - -// Cancelled is the type definition for a Cancelled. -type Cancelled struct { - // WhatFailed: The ID of the command that failed, cancelling this command. - WhatFailed UUID `json:"what_failed" yaml:"what_failed" schema:"what_failed,required"` -} - -// ModelingOutcomeCancelled: Cancelled because it required the output of a previous command, which failed. -type ModelingOutcomeCancelled struct { - // Cancelled: - Cancelled Cancelled `json:"cancelled" yaml:"cancelled" schema:"cancelled,required"` +// ModelingOutcomeSuccess: Each successful command has some result. +type ModelingOutcomeSuccess struct { + // Success: A successful response from a modeling command. This can be one of several types of responses, depending on the command. + Success any `json:"success" yaml:"success" schema:"success,required"` } // ModelingOutcomes: The result from a batch of modeling commands. type ModelingOutcomes struct { - // Outcomes: The results from each command in the batch. + // Outcomes: Outcomes map[string]any `json:"outcomes" yaml:"outcomes" schema:"outcomes,required"` } +// MouseClick: The response from the `MouseClick` command. +type MouseClick struct { + // EntitiesModified: Entities that are modified. + EntitiesModified []UUID `json:"entities_modified" yaml:"entities_modified" schema:"entities_modified,required"` + // EntitiesSelected: Entities that are selected. + EntitiesSelected []UUID `json:"entities_selected" yaml:"entities_selected" schema:"entities_selected,required"` +} + // NewAddress: The struct that is used to create a new record. This is automatically generated and has all the same fields as the main struct only it is missing the `id`. type NewAddress struct { // City: The city component. @@ -2891,88 +3281,128 @@ const ( Oauth2GrantTypeUrnietfparamsoauthgrantTypedeviceCode Oauth2GrantType = "urn:ietf:params:oauth:grant-type:device_code" ) +// OkModelingCmdResponseData: The response from the `Export` command. When this is being performed over a websocket, this is sent as binary not JSON. The binary data can be deserialized as `bincode` into a `Vec`. +type OkModelingCmdResponseData struct { + // Data: The response from the `Export` endpoint. + Data Export `json:"data" yaml:"data" schema:"data,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + // OkModelingCmdResponseEmpty: An empty response, used for any command that does not explicitly have a response defined here. type OkModelingCmdResponseEmpty struct { // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseFiles: The response from the `Export` command. When this is being performed over a websocket, this is sent as binary not JSON. The binary data can be deserialized as `bincode` into a `Vec`. -type OkModelingCmdResponseFiles struct { - // Files: The files that were exported. - Files []ExportFile `json:"files" yaml:"files" schema:"files,required"` +// OkModelingCmdResponseEntityGetAllChildUuids: The response from the `Solid3dGetNextAdjacentEdge` command. +type OkModelingCmdResponseEntityGetAllChildUuids struct { + // Data: The response from the `Solid3dGetNextAdjacentEdge` command. + Data Solid3DGetNextAdjacentEdge `json:"data" yaml:"data" schema:"data,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// OkModelingCmdResponseEntityGetChildUuid: The response from the `SelectGet` command. +type OkModelingCmdResponseEntityGetChildUuid struct { + // Data: The response from the `SelectGet` command. + Data SelectGet `json:"data" yaml:"data" schema:"data,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// OkModelingCmdResponseEntityGetNumChildren: The response from the `Solid3dGetAllEdgeFaces` command. +type OkModelingCmdResponseEntityGetNumChildren struct { + // Data: The response from the `Solid3dGetAllEdgeFaces` command. + Data Solid3DGetAllEdgeFaces `json:"data" yaml:"data" schema:"data,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// OkModelingCmdResponseEntityGetParentID: The response from the `Solid3dGetOppositeEdge` command. +type OkModelingCmdResponseEntityGetParentID struct { + // Data: The response from the `Solid3dGetOppositeEdge` command. + Data Solid3DGetOppositeEdge `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } // OkModelingCmdResponseExport: The response from the `SelectWithPoint` command. type OkModelingCmdResponseExport struct { - // EntityID: The UUID of the entity that was selected. - EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id"` + // Data: The response from the `SelectWithPoint` command. + Data SelectWithPoint `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseSelectWithPoint: The response from the `EntityGetChildUuid` command. -type OkModelingCmdResponseSelectWithPoint struct { - // EntityID: The UUID of the child entity. - EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` +// OkModelingCmdResponseGetEntityType: The response from the `Take Snapshot` command. +type OkModelingCmdResponseGetEntityType struct { + // Data: The response from the `TakeSnapshot` command. + Data TakeSnapshot `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseSequence: The response from the `EntityGetParentId` command. -type OkModelingCmdResponseSequence struct { - // EntityID: The UUID of the parent entity. - EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id,required"` +// OkModelingCmdResponseHighlightSetEntity: The response from the `EntityGetParentId` command. +type OkModelingCmdResponseHighlightSetEntity struct { + // Data: The response from the `EntityGetParentId` command. + Data EntityGetParentID `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseHighlightSetEntity: The response from the `EntityGetAllChildUuids` command. -type OkModelingCmdResponseHighlightSetEntity struct { - // EntityIds: The UUIDs of the child entities. - EntityIds []UUID `json:"entity_ids" yaml:"entity_ids" schema:"entity_ids,required"` +// OkModelingCmdResponseOkModelingCmdResponseData: The response from the `Path Get Info` command. +type OkModelingCmdResponseOkModelingCmdResponseData struct { + // Data: The response from the `PathGetInfo` command. + Data PathGetInfo `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseEntityGetChildUuid: The response from the `GetEntityType` command. -type OkModelingCmdResponseEntityGetChildUuid struct { - // EntityType: The type of the entity. - EntityType EntityType `json:"entity_type" yaml:"entity_type" schema:"entity_type,required"` +// OkModelingCmdResponseSelectGet: The response from the `CurveGetType` command. +type OkModelingCmdResponseSelectGet struct { + // Data: The response from the `CurveGetType` command. + Data CurveGetType `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseNum: The response from the `Solid3dGetAllEdgeFaces` command. -type OkModelingCmdResponseNum struct { - // Faces: The UUIDs of the faces. - Faces []UUID `json:"faces" yaml:"faces" schema:"faces,required"` +// OkModelingCmdResponseSelectWithPoint: The response from the `EntityGetChildUuid` command. +type OkModelingCmdResponseSelectWithPoint struct { + // Data: The response from the `EntityGetChildUuid` command. + Data EntityGetChildUuid `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseEntityGetNumChildren: The response from the `Solid3dGetAllOppositeEdges` command. -type OkModelingCmdResponseEntityGetNumChildren struct { - // Edges: The UUIDs of the edges. - Edges []UUID `json:"edges" yaml:"edges" schema:"edges,required"` +// OkWebSocketResponseDataData: Information about the ICE servers. +type OkWebSocketResponseDataData struct { + // Data: + Data Data `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseEntityGetParentID: The response from the `Solid3dGetPrevAdjacentEdge` command. -type OkModelingCmdResponseEntityGetParentID struct { - // Edge: The UUID of the edge. - Edge UUID `json:"edge" yaml:"edge" schema:"edge,required"` +// OkWebSocketResponseDataIceServerInfo: The trickle ICE candidate response. +type OkWebSocketResponseDataIceServerInfo struct { + // Data: + Data Data `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OkModelingCmdResponseEntityIds: The response from the `Solid3dGetNextAdjacentEdge` command. -type OkModelingCmdResponseEntityIds struct { - // Edge: The UUID of the edge. - Edge UUID `json:"edge" yaml:"edge" schema:"edge,required"` +// OkWebSocketResponseDataOkWebSocketResponseDataData: The exported files. +type OkWebSocketResponseDataOkWebSocketResponseDataData struct { + // Data: + Data Data `json:"data" yaml:"data" schema:"data,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// OkWebSocketResponseDataTrickleIce: The modeling command response. +type OkWebSocketResponseDataTrickleIce struct { + // Data: + Data Data `json:"data" yaml:"data" schema:"data,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } @@ -2995,15 +3425,31 @@ type OutputFile struct { Name string `json:"name" yaml:"name" schema:"name"` } -// OutputFormatStorage: glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). If you prefer ascii output, you can set that option for the export. -type OutputFormatStorage struct { +// OutputFormatCoords: *ST**ereo**L**ithography format. +type OutputFormatCoords struct { + // Coords: Co-ordinate system of output data. + // + // Defaults to the [KittyCAD co-ordinate system]. + // + // [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html + Coords System `json:"coords" yaml:"coords" schema:"coords,required"` + // Storage: Export storage. + Storage StlStorage `json:"storage" yaml:"storage" schema:"storage,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// OutputFormatFbx: glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). If you prefer ascii output, you can set that option for the export. +type OutputFormatFbx struct { + // Presentation: Specifies how the JSON will be presented. + Presentation GltfPresentation `json:"presentation" yaml:"presentation" schema:"presentation,required"` // Storage: Specifies which kind of glTF 2.0 will be exported. - Storage Storage `json:"storage" yaml:"storage" schema:"storage,required"` + Storage GltfStorage `json:"storage" yaml:"storage" schema:"storage,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// OutputFormatGltf: Wavefront OBJ format. +// OutputFormatGltf: ISO 10303-21 (STEP) format. type OutputFormatGltf struct { // Coords: Co-ordinate system of output data. // @@ -3015,8 +3461,22 @@ type OutputFormatGltf struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// OutputFormatObj: ISO 10303-21 (STEP) format. -type OutputFormatObj struct { +// OutputFormatOutputFormatStorage: The PLY Polygon File Format. +type OutputFormatOutputFormatStorage struct { + // Coords: Co-ordinate system of output data. + // + // Defaults to the [KittyCAD co-ordinate system]. + // + // [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html + Coords System `json:"coords" yaml:"coords" schema:"coords,required"` + // Storage: The storage for the output PLY file. + Storage PlyStorage `json:"storage" yaml:"storage" schema:"storage,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// OutputFormatPresentation: Wavefront OBJ format. +type OutputFormatPresentation struct { // Coords: Co-ordinate system of output data. // // Defaults to the [KittyCAD co-ordinate system]. @@ -3027,6 +3487,48 @@ type OutputFormatObj struct { Type string `json:"type" yaml:"type" schema:"type,required"` } +// OutputFormatStorage: Autodesk Filmbox (FBX) format. +type OutputFormatStorage struct { + // Storage: Specifies which kind of FBX will be exported. + Storage FbxStorage `json:"storage" yaml:"storage" schema:"storage,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + +// PathCommand: The path component command type (within a Path) +type PathCommand string + +const ( + // PathCommandMoveTo represents the PathCommand `"move_to"`. + PathCommandMoveTo PathCommand = "move_to" + // PathCommandLineTo represents the PathCommand `"line_to"`. + PathCommandLineTo PathCommand = "line_to" + // PathCommandBezCurveTo represents the PathCommand `"bez_curve_to"`. + PathCommandBezCurveTo PathCommand = "bez_curve_to" + // PathCommandNurbsCurveTo represents the PathCommand `"nurbs_curve_to"`. + PathCommandNurbsCurveTo PathCommand = "nurbs_curve_to" + // PathCommandAddArc represents the PathCommand `"add_arc"`. + PathCommandAddArc PathCommand = "add_arc" +) + +// PathGetInfo: The response from the `PathGetInfo` command. +type PathGetInfo struct { + // Segments: All segments in the path, in the order they were added. + Segments []PathSegmentInfo `json:"segments" yaml:"segments" schema:"segments,required"` +} + +// PathSegmentAngleEnd: A cubic bezier curve segment. Start at the end of the current line, go through control point 1 and 2, then end at a given point. +type PathSegmentAngleEnd struct { + // Control1: First control point. + Control1 Point3D `json:"control1" yaml:"control1" schema:"control1,required"` + // Control2: Second control point. + Control2 Point3D `json:"control2" yaml:"control2" schema:"control2,required"` + // End: Final control point. + End Point3D `json:"end" yaml:"end" schema:"end,required"` + // Type: + Type string `json:"type" yaml:"type" schema:"type,required"` +} + // PathSegmentEnd: A straight line segment. Goes from the current path "pen" to the given endpoint. type PathSegmentEnd struct { // End: End point of the line. @@ -3035,6 +3537,14 @@ type PathSegmentEnd struct { Type string `json:"type" yaml:"type" schema:"type,required"` } +// PathSegmentInfo: Info about a path segment +type PathSegmentInfo struct { + // Command: What is the path segment? + Command PathCommand `json:"command" yaml:"command" schema:"command,required"` + // CommandID: Which command created this path? This field is absent if the path command is not actually creating a path segment, e.g. moving the pen doesn't create a path segment. + CommandID UUID `json:"command_id" yaml:"command_id" schema:"command_id"` +} + // PathSegmentLine: A circular arc segment. type PathSegmentLine struct { // AngleEnd: Start of the arc along circle's perimeter. @@ -3049,18 +3559,6 @@ type PathSegmentLine struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// PathSegmentAngleEnd: A cubic bezier curve segment. Start at the end of the current line, go through control point 1 and 2, then end at a given point. -type PathSegmentAngleEnd struct { - // Control1: First control point. - Control1 Point3D `json:"control1" yaml:"control1" schema:"control1,required"` - // Control2: Second control point. - Control2 Point3D `json:"control2" yaml:"control2" schema:"control2,required"` - // End: Final control point. - End Point3D `json:"end" yaml:"end" schema:"end,required"` - // Type: - Type string `json:"type" yaml:"type" schema:"type,required"` -} - // PaymentIntent: A payment intent response. type PaymentIntent struct { // ClientSecret: The client secret is used for client-side retrieval using a publishable key. The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret. @@ -3114,6 +3612,18 @@ type PluginsInfo struct { Volume []string `json:"volume" yaml:"volume" schema:"volume"` } +// PlyStorage: The storage for the output PLY file. +type PlyStorage string + +const ( + // PlyStorageAscii: Write numbers in their ascii representation (e.g. -13, 6.28, etc.). Properties are separated by spaces and elements are separated by line breaks. + PlyStorageAscii PlyStorage = "ascii" + // PlyStorageBinaryLittleEndian: Encode payload as binary using little endian. + PlyStorageBinaryLittleEndian PlyStorage = "binary_little_endian" + // PlyStorageBinaryBigEndian: Encode payload as binary using big endian. + PlyStorageBinaryBigEndian PlyStorage = "binary_big_endian" +) + // Point2D: A point in 2D space type Point2D struct { // X: @@ -3173,30 +3683,14 @@ type RegistryServiceConfig struct { Mirrors []string `json:"mirrors" yaml:"mirrors" schema:"mirrors"` } -// RtcIceCandidate: ICECandidate represents a ice candidate -type RtcIceCandidate struct { - // Address: The address of the candidate. - Address string `json:"address" yaml:"address" schema:"address,required"` - // Component: The component of the candidate. - Component int `json:"component" yaml:"component" schema:"component,required"` - // Foundation: The foundation for the address. - Foundation string `json:"foundation" yaml:"foundation" schema:"foundation,required"` - // Port: The port used for the candidate. - Port int `json:"port" yaml:"port" schema:"port,required"` - // Priority: The priority of the candidate. - Priority int `json:"priority" yaml:"priority" schema:"priority,required"` - // Protocol: The protocol used for the candidate. - Protocol RtcIceProtocol `json:"protocol" yaml:"protocol" schema:"protocol,required"` - // RelatedAddress: The related address of the candidate. - RelatedAddress string `json:"related_address" yaml:"related_address" schema:"related_address,required"` - // RelatedPort: The related port of the candidate. - RelatedPort int `json:"related_port" yaml:"related_port" schema:"related_port,required"` - // StatsID: The stats ID. - StatsID string `json:"stats_id" yaml:"stats_id" schema:"stats_id,required"` - // TcpType: The TCP type of the candidate. - TcpType string `json:"tcp_type" yaml:"tcp_type" schema:"tcp_type,required"` - // Typ: The type of the candidate. - Typ RtcIceCandidateType `json:"typ" yaml:"typ" schema:"typ,required"` +// ResponseError: Error information from a response. +type ResponseError struct { + // ErrorCode: + ErrorCode string `json:"error_code" yaml:"error_code" schema:"error_code"` + // Message: + Message string `json:"message" yaml:"message" schema:"message,required"` + // RequestID: + RequestID string `json:"request_id" yaml:"request_id" schema:"request_id,required"` } // RtcIceCandidateInit: ICECandidateInit is used to serialize ice candidates @@ -3211,34 +3705,6 @@ type RtcIceCandidateInit struct { UsernameFragment string `json:"usernameFragment" yaml:"usernameFragment" schema:"usernameFragment"` } -// RtcIceCandidateType: ICECandidateType represents the type of the ICE candidate used. -type RtcIceCandidateType string - -const ( - // RtcIceCandidateTypeUnspecified: Unspecified indicates that the candidate type is unspecified. - RtcIceCandidateTypeUnspecified RtcIceCandidateType = "unspecified" - // RtcIceCandidateTypeHost: ICECandidateTypeHost indicates that the candidate is of Host type as described in . A candidate obtained by binding to a specific port from an IP address on the host. This includes IP addresses on physical interfaces and logical ones, such as ones obtained through VPNs. - RtcIceCandidateTypeHost RtcIceCandidateType = "host" - // RtcIceCandidateTypeSrflx: ICECandidateTypeSrflx indicates the the candidate is of Server Reflexive type as described . A candidate type whose IP address and port are a binding allocated by a NAT for an ICE agent after it sends a packet through the NAT to a server, such as a STUN server. - RtcIceCandidateTypeSrflx RtcIceCandidateType = "srflx" - // RtcIceCandidateTypePrflx: ICECandidateTypePrflx indicates that the candidate is of Peer Reflexive type. A candidate type whose IP address and port are a binding allocated by a NAT for an ICE agent after it sends a packet through the NAT to its peer. - RtcIceCandidateTypePrflx RtcIceCandidateType = "prflx" - // RtcIceCandidateTypeRelay: ICECandidateTypeRelay indicates the the candidate is of Relay type as described in . A candidate type obtained from a relay server, such as a TURN server. - RtcIceCandidateTypeRelay RtcIceCandidateType = "relay" -) - -// RtcIceProtocol: ICEProtocol indicates the transport protocol type that is used in the ice.URL structure. -type RtcIceProtocol string - -const ( - // RtcIceProtocolUnspecified: Unspecified indicates that the protocol is unspecified. - RtcIceProtocolUnspecified RtcIceProtocol = "unspecified" - // RtcIceProtocolUdp: UDP indicates the URL uses a UDP transport. - RtcIceProtocolUdp RtcIceProtocol = "udp" - // RtcIceProtocolTcp: TCP indicates the URL uses a TCP transport. - RtcIceProtocolTcp RtcIceProtocol = "tcp" -) - // RtcSdpType: SDPType describes the type of an SessionDescription. type RtcSdpType string @@ -3283,6 +3749,36 @@ const ( SceneSelectionTypeRemove SceneSelectionType = "remove" ) +// SceneToolType: The type of scene's active tool +type SceneToolType string + +const ( + // SceneToolTypeCameraRevolve represents the SceneToolType `"camera_revolve"`. + SceneToolTypeCameraRevolve SceneToolType = "camera_revolve" + // SceneToolTypeSelect represents the SceneToolType `"select"`. + SceneToolTypeSelect SceneToolType = "select" + // SceneToolTypeMove represents the SceneToolType `"move"`. + SceneToolTypeMove SceneToolType = "move" + // SceneToolTypeSketchLine represents the SceneToolType `"sketch_line"`. + SceneToolTypeSketchLine SceneToolType = "sketch_line" + // SceneToolTypeSketchCurve represents the SceneToolType `"sketch_curve"`. + SceneToolTypeSketchCurve SceneToolType = "sketch_curve" + // SceneToolTypeSketchCurveMod represents the SceneToolType `"sketch_curve_mod"`. + SceneToolTypeSketchCurveMod SceneToolType = "sketch_curve_mod" +) + +// SelectGet: The response from the `SelectGet` command. +type SelectGet struct { + // EntityIds: The UUIDs of the selected entities. + EntityIds []UUID `json:"entity_ids" yaml:"entity_ids" schema:"entity_ids,required"` +} + +// SelectWithPoint: The response from the `SelectWithPoint` command. +type SelectWithPoint struct { + // EntityID: The UUID of the entity that was selected. + EntityID UUID `json:"entity_id" yaml:"entity_id" schema:"entity_id"` +} + // Session: An authentication session. // For our UIs, these are automatically created by Next.js. type Session struct { @@ -3300,44 +3796,58 @@ type Session struct { UserID string `json:"user_id" yaml:"user_id" schema:"user_id"` } -// SnakeCaseResultOk: The result is Ok. -type SnakeCaseResultOk struct { - // Ok: A successful response from a modeling command. This can be one of several types of responses, depending on the command. - Ok any `json:"ok" yaml:"ok" schema:"ok,required"` +// Solid3DGetAllEdgeFaces: The response from the `Solid3dGetAllEdgeFaces` command. +type Solid3DGetAllEdgeFaces struct { + // Faces: The UUIDs of the faces. + Faces []UUID `json:"faces" yaml:"faces" schema:"faces,required"` +} + +// Solid3DGetAllOppositeEdges: The response from the `Solid3dGetAllOppositeEdges` command. +type Solid3DGetAllOppositeEdges struct { + // Edges: The UUIDs of the edges. + Edges []UUID `json:"edges" yaml:"edges" schema:"edges,required"` +} + +// Solid3DGetNextAdjacentEdge: The response from the `Solid3dGetNextAdjacentEdge` command. +type Solid3DGetNextAdjacentEdge struct { + // Edge: The UUID of the edge. + Edge UUID `json:"edge" yaml:"edge" schema:"edge,required"` } -// Err: The error response. -type Err struct { - // Errors: A list of errors. - Errors []EngineError `json:"errors" yaml:"errors" schema:"errors,required"` +// Solid3DGetOppositeEdge: The response from the `Solid3dGetOppositeEdge` command. +type Solid3DGetOppositeEdge struct { + // Edge: The UUID of the edge. + Edge UUID `json:"edge" yaml:"edge" schema:"edge,required"` } -// SnakeCaseResultErr: The result is Err. -type SnakeCaseResultErr struct { - // Err: The error response. - Err ErrorResponse `json:"err" yaml:"err" schema:"err,required"` +// Solid3DGetPrevAdjacentEdge: The response from the `Solid3dGetPrevAdjacentEdge` command. +type Solid3DGetPrevAdjacentEdge struct { + // Edge: The UUID of the edge. + Edge UUID `json:"edge" yaml:"edge" schema:"edge,required"` } -// Storage: Describes the storage format of a glTF 2.0 scene. -type Storage string +// StlStorage: Export storage. +type StlStorage string const ( - // StorageBinary: Binary glTF 2.0. - // - // This is a single binary with .glb extension. + // StlStorageAscii: Plaintext encoding. + StlStorageAscii StlStorage = "ascii" + // StlStorageBinary: Binary STL encoding. // // This is the default setting. - StorageBinary Storage = "binary" - // StorageStandard: Standard glTF 2.0. - // - // This is a JSON file with .gltf extension paired with a separate binary blob file with .bin extension. - StorageStandard Storage = "standard" - // StorageEmbedded: Embedded glTF 2.0. - // - // Single JSON file with .gltf extension binary data encoded as base64 data URIs. - StorageEmbedded Storage = "embedded" + StlStorageBinary StlStorage = "binary" ) +// SuccessWebSocketResponse: Successful Websocket response. +type SuccessWebSocketResponse struct { + // RequestID: Which request this is a response to. If the request was a modeling command, this is the modeling command ID. If no request ID was sent, this will be null. + RequestID UUID `json:"request_id" yaml:"request_id" schema:"request_id"` + // Resp: The data sent with a successful response. This will be flattened into a 'type' and 'data' field. + Resp any `json:"resp" yaml:"resp" schema:"resp,required"` + // Success: Always true + Success bool `json:"success" yaml:"success" schema:"success,required"` +} + // System: Co-ordinate system definition. // The `up` axis must be orthogonal to the `forward` axis. // @@ -3399,6 +3909,12 @@ const ( SystemInfoIsolationEnumProcess SystemInfoIsolationEnum = "process" ) +// TakeSnapshot: The response from the `TakeSnapshot` command. +type TakeSnapshot struct { + // Contents: Contents of the image. + Contents Base64 `json:"contents" yaml:"contents" schema:"contents,required"` +} + // UnitAngle: The valid types of angle formats. type UnitAngle string @@ -4092,24 +4608,16 @@ type VerificationToken struct { UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` } -// WebSocketMessagesCandidate: The trickle ICE candidate request. -type WebSocketMessagesCandidate struct { +// WebSocketRequestCandidate: The trickle ICE candidate request. +type WebSocketRequestCandidate struct { // Candidate: Information about the ICE candidate. Candidate RtcIceCandidateInit `json:"candidate" yaml:"candidate" schema:"candidate,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// WebSocketMessagesTrickleIce: The SDP offer request. -type WebSocketMessagesTrickleIce struct { - // Offer: The session description. - Offer RtcSessionDescription `json:"offer" yaml:"offer" schema:"offer,required"` - // Type: - Type string `json:"type" yaml:"type" schema:"type,required"` -} - -// WebSocketMessagesOffer: The modeling command request. -type WebSocketMessagesOffer struct { +// WebSocketRequestOffer: The modeling command request. +type WebSocketRequestOffer struct { // Cmd: Which command to submit to the Kittycad engine. Cmd any `json:"cmd" yaml:"cmd" schema:"cmd,required"` // CmdID: ID of command being submitted. @@ -4118,54 +4626,16 @@ type WebSocketMessagesOffer struct { Type string `json:"type" yaml:"type" schema:"type,required"` } -// WebSocketResponsesCandidate: The trickle ICE candidate response. -type WebSocketResponsesCandidate struct { - // Candidate: Information about the ICE candidate. - Candidate RtcIceCandidate `json:"candidate" yaml:"candidate" schema:"candidate,required"` - // Type: - Type string `json:"type" yaml:"type" schema:"type,required"` -} - -// WebSocketResponsesTrickleIce: The SDP answer response. -type WebSocketResponsesTrickleIce struct { - // Answer: The session description. - Answer RtcSessionDescription `json:"answer" yaml:"answer" schema:"answer,required"` - // Type: - Type string `json:"type" yaml:"type" schema:"type,required"` -} - -// WebSocketResponsesAnswer: The ICE server info response. -type WebSocketResponsesAnswer struct { - // IceServers: Information about the ICE servers. - IceServers []IceServer `json:"ice_servers" yaml:"ice_servers" schema:"ice_servers,required"` - // Type: - Type string `json:"type" yaml:"type" schema:"type,required"` -} - -// WebSocketResponsesSdpAnswer: The modeling command response. -type WebSocketResponsesSdpAnswer struct { - // CmdID: The ID of the command. - CmdID UUID `json:"cmd_id" yaml:"cmd_id" schema:"cmd_id,required"` - // Result: The result of the command. - Result any `json:"result" yaml:"result" schema:"result,required"` +// WebSocketRequestSdpOffer: The client-to-server Ping to ensure the WebSocket stays alive. +type WebSocketRequestSdpOffer struct { // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } -// WebSocketResponsesIceServers: The export command response, this is sent as binary. -type WebSocketResponsesIceServers struct { - // Files: The exported files. - Files []RawFile `json:"files" yaml:"files" schema:"files,required"` +// WebSocketRequestTrickleIce: The SDP offer request. +type WebSocketRequestTrickleIce struct { + // Offer: The session description. + Offer RtcSessionDescription `json:"offer" yaml:"offer" schema:"offer,required"` // Type: Type string `json:"type" yaml:"type" schema:"type,required"` } - -// ResponseError: Error information from a response. -type ResponseError struct { - // ErrorCode: - ErrorCode string `json:"error_code" yaml:"error_code" schema:"error_code"` - // Message: - Message string `json:"message" yaml:"message" schema:"message,required"` - // RequestID: - RequestID string `json:"request_id" yaml:"request_id" schema:"request_id,required"` -}