From fc0735bd2b4ef91a6c89556850b432c4004e5a6d Mon Sep 17 00:00:00 2001 From: "zoo-github-actions-auth[bot]" <155849648+zoo-github-actions-auth[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:27:17 -0800 Subject: [PATCH] Update api spec (#658) * YOYO NEW API SPEC! * I have generated the library! --------- Co-authored-by: github-actions[bot] --- Cargo.lock | 6 +- kittycad/Cargo.toml | 4 +- kittycad/src/types.rs | 258 +++++++++++++++-- openapitor/tests/types/kittycad.rs.gen | 250 ++++++++++++++-- spec.json | 382 +++++++++++++++++++++---- 5 files changed, 778 insertions(+), 122 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 136bf5d4..595db636 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1025,9 +1025,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.14.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -1088,7 +1088,7 @@ dependencies = [ "futures", "futures-util", "http", - "itertools 0.14.0", + "itertools 0.13.0", "log", "mime_guess", "parse-display", diff --git a/kittycad/Cargo.toml b/kittycad/Cargo.toml index fc69eaa3..b1eb4ca4 100644 --- a/kittycad/Cargo.toml +++ b/kittycad/Cargo.toml @@ -10,7 +10,7 @@ license = "MIT" [dependencies] anyhow = "1" -async-trait = { version = "^0.1.85", optional = true } +async-trait = { version = "^0.1.53", optional = true } base64 = "0.22" bigdecimal = { version = "0.4", features = ["serde"] } bytes = { version = "1", features = ["serde"] } @@ -20,7 +20,7 @@ dirs = { version = "^5.0.1", optional = true } format_serde_error = { version = "^0.3.0", optional = true } futures = { version = "0.3.26", optional = true } http = { version = "1", optional = true } -itertools = "0.14.0" +itertools = "0.13.0" log = { version = "^0.4", features = ["serde"], optional = true } mime_guess = "2.0.4" parse-display = "0.10.0" diff --git a/kittycad/src/types.rs b/kittycad/src/types.rs index 4d18f0d0..0327adf5 100644 --- a/kittycad/src/types.rs +++ b/kittycad/src/types.rs @@ -539,6 +539,40 @@ pub enum AccountProvider { Tencent, } +#[doc = "The response from the `AddHoleFromOffset` command."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct AddHoleFromOffset { + #[doc = "If the offset path splits into multiple paths, this will contain the UUIDs of the \ + new paths. If the offset path remains as a single path, this will be empty, and the \ + resulting ID of the (single) new path will be the ID of the `AddHoleFromOffset` \ + command."] + pub entity_ids: Vec, +} + +impl std::fmt::Display for AddHoleFromOffset { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for AddHoleFromOffset { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![format!("{:?}", self.entity_ids).into()] + } + + fn headers() -> Vec> { + vec!["entity_ids".into()] + } +} + #[doc = "Data for adding a member to an org."] #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, @@ -5116,7 +5150,10 @@ impl tabled::Tabled for EntityLinearPatternTransform { #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, )] -pub struct EntityMakeHelix {} +pub struct EntityMakeHelix { + #[doc = "The UUID of the helix that was created."] + pub helix_id: uuid::Uuid, +} impl std::fmt::Display for EntityMakeHelix { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { @@ -5130,13 +5167,44 @@ impl std::fmt::Display for EntityMakeHelix { #[cfg(feature = "tabled")] impl tabled::Tabled for EntityMakeHelix { - const LENGTH: usize = 0; + const LENGTH: usize = 1; fn fields(&self) -> Vec> { - vec![] + vec![format!("{:?}", self.helix_id).into()] } fn headers() -> Vec> { - vec![] + vec!["helix_id".into()] + } +} + +#[doc = "The response from the `EntityMakeHelixFromParams` endpoint."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct EntityMakeHelixFromParams { + #[doc = "The UUID of the helix that was created."] + pub helix_id: uuid::Uuid, +} + +impl std::fmt::Display for EntityMakeHelixFromParams { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for EntityMakeHelixFromParams { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![format!("{:?}", self.helix_id).into()] + } + + fn headers() -> Vec> { + vec!["helix_id".into()] } } @@ -5144,7 +5212,10 @@ impl tabled::Tabled for EntityMakeHelix { #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, )] -pub struct EntityMirror {} +pub struct EntityMirror { + #[doc = "The UUIDs of the entities that were created."] + pub entity_ids: Vec, +} impl std::fmt::Display for EntityMirror { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { @@ -5158,13 +5229,13 @@ impl std::fmt::Display for EntityMirror { #[cfg(feature = "tabled")] impl tabled::Tabled for EntityMirror { - const LENGTH: usize = 0; + const LENGTH: usize = 1; fn fields(&self) -> Vec> { - vec![] + vec![format!("{:?}", self.entity_ids).into()] } fn headers() -> Vec> { - vec![] + vec!["entity_ids".into()] } } @@ -5172,7 +5243,10 @@ impl tabled::Tabled for EntityMirror { #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, )] -pub struct EntityMirrorAcrossEdge {} +pub struct EntityMirrorAcrossEdge { + #[doc = "The UUIDs of the entities that were created."] + pub entity_ids: Vec, +} impl std::fmt::Display for EntityMirrorAcrossEdge { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { @@ -5186,13 +5260,13 @@ impl std::fmt::Display for EntityMirrorAcrossEdge { #[cfg(feature = "tabled")] impl tabled::Tabled for EntityMirrorAcrossEdge { - const LENGTH: usize = 0; + const LENGTH: usize = 1; fn fields(&self) -> Vec> { - vec![] + vec![format!("{:?}", self.entity_ids).into()] } fn headers() -> Vec> { - vec![] + vec!["entity_ids".into()] } } @@ -5872,6 +5946,53 @@ impl tabled::Tabled for Extrude { } } +#[doc = "IDs for the extruded faces."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct ExtrudedFaceInfo { + #[doc = "The face made from the original 2D shape being extruded. If the solid is extruded \ + from a shape which already has an ID (e.g. extruding something which was sketched on \ + a face), this doesn't need to be sent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bottom: Option, + #[doc = "Any intermediate sides between the top and bottom."] + pub sides: Vec, + #[doc = "Top face of the extrusion (parallel and further away from the original 2D shape \ + being extruded)."] + pub top: uuid::Uuid, +} + +impl std::fmt::Display for ExtrudedFaceInfo { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for ExtrudedFaceInfo { + const LENGTH: usize = 3; + fn fields(&self) -> Vec> { + vec![ + if let Some(bottom) = &self.bottom { + format!("{:?}", bottom).into() + } else { + String::new().into() + }, + format!("{:?}", self.sides).into(), + format!("{:?}", self.top).into(), + ] + } + + fn headers() -> Vec> { + vec!["bottom".into(), "sides".into(), "top".into()] + } +} + #[doc = "Possible types of faces which can be extruded from a 3D solid."] #[derive( serde :: Serialize, @@ -9671,6 +9792,10 @@ pub enum ModelingCmd { Extrude { #[doc = "How far off the plane to extrude"] distance: f64, + #[doc = "Which IDs should the new faces have? If this isn't given, the engine will \ + generate IDs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + faces: Option, #[doc = "Which sketch to extrude. Must be a closed 2D solid."] target: uuid::Uuid, }, @@ -9949,8 +10074,29 @@ pub enum ModelingCmd { length: f64, #[doc = "Number of revolutions."] revolutions: f64, - #[doc = "Start angle (in degrees)."] - start_angle: Angle, + #[doc = "Start angle."] + #[serde(default, skip_serializing_if = "Option::is_none")] + start_angle: Option, + }, + #[doc = "Create a helix using the specified parameters."] + #[serde(rename = "entity_make_helix_from_params")] + EntityMakeHelixFromParams { + #[doc = "Axis of the helix. The helix will be created around and in the direction of this \ + axis."] + axis: Point3D, + #[doc = "Center of the helix at the base of the helix."] + center: Point3D, + #[doc = "Is the helix rotation clockwise?"] + is_clockwise: bool, + #[doc = "Length of the helix."] + length: f64, + #[doc = "Radius of the helix."] + radius: f64, + #[doc = "Number of revolutions."] + revolutions: f64, + #[doc = "Start angle."] + #[serde(default, skip_serializing_if = "Option::is_none")] + start_angle: Option, }, #[doc = "Mirror the input entities over the specified axis. (Currently only supports sketches)"] #[serde(rename = "entity_mirror")] @@ -10634,6 +10780,14 @@ pub enum ModelingCmd { #[doc = "The distance to offset the path (positive for outset, negative for inset)"] offset: f64, }, + #[doc = "Add a hole to a closed path by offsetting it a uniform distance inward."] + #[serde(rename = "add_hole_from_offset")] + AddHoleFromOffset { + #[doc = "The closed path to add a hole to."] + object_id: uuid::Uuid, + #[doc = "The distance to offset the path (positive for outset, negative for inset)"] + offset: f64, + }, } #[doc = "A graphics command submitted to the KittyCAD engine via the Modeling API."] @@ -11065,21 +11219,6 @@ pub enum OkModelingCmdResponse { #[doc = "The response from the `DefaultCameraPerspectiveSettings` endpoint."] data: DefaultCameraPerspectiveSettings, }, - #[serde(rename = "entity_make_helix")] - EntityMakeHelix { - #[doc = "The response from the `EntityMakeHelix` endpoint."] - data: EntityMakeHelix, - }, - #[serde(rename = "entity_mirror")] - EntityMirror { - #[doc = "The response from the `EntityMirror` endpoint."] - data: EntityMirror, - }, - #[serde(rename = "entity_mirror_across_edge")] - EntityMirrorAcrossEdge { - #[doc = "The response from the `EntityMirrorAcrossEdge` endpoint."] - data: EntityMirrorAcrossEdge, - }, #[serde(rename = "select_add")] SelectAdd { #[doc = "The response from the `SelectAdd` endpoint."] @@ -11381,6 +11520,11 @@ pub enum OkModelingCmdResponse { #[doc = "The response from the `MakeOffsetPath` command."] data: MakeOffsetPath, }, + #[serde(rename = "add_hole_from_offset")] + AddHoleFromOffset { + #[doc = "The response from the `AddHoleFromOffset` command."] + data: AddHoleFromOffset, + }, #[serde(rename = "default_camera_focus_on")] DefaultCameraFocusOn { #[doc = "The response from the `DefaultCameraFocusOn` command."] @@ -11567,6 +11711,26 @@ pub enum OkModelingCmdResponse { #[doc = "The response from the `EntityCircularPattern` command."] data: EntityCircularPattern, }, + #[serde(rename = "entity_mirror")] + EntityMirror { + #[doc = "The response from the `EntityMirror` endpoint."] + data: EntityMirror, + }, + #[serde(rename = "entity_mirror_across_edge")] + EntityMirrorAcrossEdge { + #[doc = "The response from the `EntityMirrorAcrossEdge` endpoint."] + data: EntityMirrorAcrossEdge, + }, + #[serde(rename = "entity_make_helix")] + EntityMakeHelix { + #[doc = "The response from the `EntityMakeHelix` endpoint."] + data: EntityMakeHelix, + }, + #[serde(rename = "entity_make_helix_from_params")] + EntityMakeHelixFromParams { + #[doc = "The response from the `EntityMakeHelixFromParams` endpoint."] + data: EntityMakeHelixFromParams, + }, #[serde(rename = "solid3d_get_extrusion_face_info")] Solid3DGetExtrusionFaceInfo { #[doc = "Extrusion face info struct (useful for maintaining mappings between source path \ @@ -14685,6 +14849,42 @@ impl tabled::Tabled for ShortlinkResultsPage { } } +#[doc = "IDs for a side face, extruded from the path of some sketch/2D shape."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct SideFace { + #[doc = "Desired ID for the resulting face."] + pub face_id: uuid::Uuid, + #[doc = "ID of the path this face is being extruded from."] + pub path_id: uuid::Uuid, +} + +impl std::fmt::Display for SideFace { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for SideFace { + const LENGTH: usize = 2; + fn fields(&self) -> Vec> { + vec![ + format!("{:?}", self.face_id).into(), + format!("{:?}", self.path_id).into(), + ] + } + + fn headers() -> Vec> { + vec!["face_id".into(), "path_id".into()] + } +} + #[doc = "The response from the `SketchModeDisable` endpoint."] #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, diff --git a/openapitor/tests/types/kittycad.rs.gen b/openapitor/tests/types/kittycad.rs.gen index 1b125f72..0a0f2be8 100644 --- a/openapitor/tests/types/kittycad.rs.gen +++ b/openapitor/tests/types/kittycad.rs.gen @@ -534,6 +534,37 @@ pub enum AccountProvider { Tencent, } +#[doc = "The response from the `AddHoleFromOffset` command."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct AddHoleFromOffset { + #[doc = "If the offset path splits into multiple paths, this will contain the UUIDs of the new paths. If the offset path remains as a single path, this will be empty, and the resulting ID of the (single) new path will be the ID of the `AddHoleFromOffset` command."] + pub entity_ids: Vec, +} + +impl std::fmt::Display for AddHoleFromOffset { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for AddHoleFromOffset { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![format!("{:?}", self.entity_ids).into()] + } + + fn headers() -> Vec> { + vec!["entity_ids".into()] + } +} + #[doc = "Data for adding a member to an org."] #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, @@ -5034,7 +5065,10 @@ impl tabled::Tabled for EntityLinearPatternTransform { #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, )] -pub struct EntityMakeHelix {} +pub struct EntityMakeHelix { + #[doc = "The UUID of the helix that was created."] + pub helix_id: uuid::Uuid, +} impl std::fmt::Display for EntityMakeHelix { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { @@ -5048,13 +5082,44 @@ impl std::fmt::Display for EntityMakeHelix { #[cfg(feature = "tabled")] impl tabled::Tabled for EntityMakeHelix { - const LENGTH: usize = 0; + const LENGTH: usize = 1; fn fields(&self) -> Vec> { - vec![] + vec![format!("{:?}", self.helix_id).into()] } fn headers() -> Vec> { - vec![] + vec!["helix_id".into()] + } +} + +#[doc = "The response from the `EntityMakeHelixFromParams` endpoint."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct EntityMakeHelixFromParams { + #[doc = "The UUID of the helix that was created."] + pub helix_id: uuid::Uuid, +} + +impl std::fmt::Display for EntityMakeHelixFromParams { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for EntityMakeHelixFromParams { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![format!("{:?}", self.helix_id).into()] + } + + fn headers() -> Vec> { + vec!["helix_id".into()] } } @@ -5062,7 +5127,10 @@ impl tabled::Tabled for EntityMakeHelix { #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, )] -pub struct EntityMirror {} +pub struct EntityMirror { + #[doc = "The UUIDs of the entities that were created."] + pub entity_ids: Vec, +} impl std::fmt::Display for EntityMirror { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { @@ -5076,13 +5144,13 @@ impl std::fmt::Display for EntityMirror { #[cfg(feature = "tabled")] impl tabled::Tabled for EntityMirror { - const LENGTH: usize = 0; + const LENGTH: usize = 1; fn fields(&self) -> Vec> { - vec![] + vec![format!("{:?}", self.entity_ids).into()] } fn headers() -> Vec> { - vec![] + vec!["entity_ids".into()] } } @@ -5090,7 +5158,10 @@ impl tabled::Tabled for EntityMirror { #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, )] -pub struct EntityMirrorAcrossEdge {} +pub struct EntityMirrorAcrossEdge { + #[doc = "The UUIDs of the entities that were created."] + pub entity_ids: Vec, +} impl std::fmt::Display for EntityMirrorAcrossEdge { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { @@ -5104,13 +5175,13 @@ impl std::fmt::Display for EntityMirrorAcrossEdge { #[cfg(feature = "tabled")] impl tabled::Tabled for EntityMirrorAcrossEdge { - const LENGTH: usize = 0; + const LENGTH: usize = 1; fn fields(&self) -> Vec> { - vec![] + vec![format!("{:?}", self.entity_ids).into()] } fn headers() -> Vec> { - vec![] + vec!["entity_ids".into()] } } @@ -5784,6 +5855,50 @@ impl tabled::Tabled for Extrude { } } +#[doc = "IDs for the extruded faces."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct ExtrudedFaceInfo { + #[doc = "The face made from the original 2D shape being extruded. If the solid is extruded from a shape which already has an ID (e.g. extruding something which was sketched on a face), this doesn't need to be sent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bottom: Option, + #[doc = "Any intermediate sides between the top and bottom."] + pub sides: Vec, + #[doc = "Top face of the extrusion (parallel and further away from the original 2D shape being extruded)."] + pub top: uuid::Uuid, +} + +impl std::fmt::Display for ExtrudedFaceInfo { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for ExtrudedFaceInfo { + const LENGTH: usize = 3; + fn fields(&self) -> Vec> { + vec![ + if let Some(bottom) = &self.bottom { + format!("{:?}", bottom).into() + } else { + String::new().into() + }, + format!("{:?}", self.sides).into(), + format!("{:?}", self.top).into(), + ] + } + + fn headers() -> Vec> { + vec!["bottom".into(), "sides".into(), "top".into()] + } +} + #[doc = "Possible types of faces which can be extruded from a 3D solid."] #[derive( serde :: Serialize, @@ -9517,6 +9632,9 @@ pub enum ModelingCmd { Extrude { #[doc = "How far off the plane to extrude"] distance: f64, + #[doc = "Which IDs should the new faces have? If this isn't given, the engine will generate IDs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + faces: Option, #[doc = "Which sketch to extrude. Must be a closed 2D solid."] target: uuid::Uuid, }, @@ -9768,8 +9886,28 @@ pub enum ModelingCmd { length: f64, #[doc = "Number of revolutions."] revolutions: f64, - #[doc = "Start angle (in degrees)."] - start_angle: Angle, + #[doc = "Start angle."] + #[serde(default, skip_serializing_if = "Option::is_none")] + start_angle: Option, + }, + #[doc = "Create a helix using the specified parameters."] + #[serde(rename = "entity_make_helix_from_params")] + EntityMakeHelixFromParams { + #[doc = "Axis of the helix. The helix will be created around and in the direction of this axis."] + axis: Point3D, + #[doc = "Center of the helix at the base of the helix."] + center: Point3D, + #[doc = "Is the helix rotation clockwise?"] + is_clockwise: bool, + #[doc = "Length of the helix."] + length: f64, + #[doc = "Radius of the helix."] + radius: f64, + #[doc = "Number of revolutions."] + revolutions: f64, + #[doc = "Start angle."] + #[serde(default, skip_serializing_if = "Option::is_none")] + start_angle: Option, }, #[doc = "Mirror the input entities over the specified axis. (Currently only supports sketches)"] #[serde(rename = "entity_mirror")] @@ -10398,6 +10536,14 @@ pub enum ModelingCmd { #[doc = "The distance to offset the path (positive for outset, negative for inset)"] offset: f64, }, + #[doc = "Add a hole to a closed path by offsetting it a uniform distance inward."] + #[serde(rename = "add_hole_from_offset")] + AddHoleFromOffset { + #[doc = "The closed path to add a hole to."] + object_id: uuid::Uuid, + #[doc = "The distance to offset the path (positive for outset, negative for inset)"] + offset: f64, + }, } #[doc = "A graphics command submitted to the KittyCAD engine via the Modeling API."] @@ -10826,21 +10972,6 @@ pub enum OkModelingCmdResponse { #[doc = "The response from the `DefaultCameraPerspectiveSettings` endpoint."] data: DefaultCameraPerspectiveSettings, }, - #[serde(rename = "entity_make_helix")] - EntityMakeHelix { - #[doc = "The response from the `EntityMakeHelix` endpoint."] - data: EntityMakeHelix, - }, - #[serde(rename = "entity_mirror")] - EntityMirror { - #[doc = "The response from the `EntityMirror` endpoint."] - data: EntityMirror, - }, - #[serde(rename = "entity_mirror_across_edge")] - EntityMirrorAcrossEdge { - #[doc = "The response from the `EntityMirrorAcrossEdge` endpoint."] - data: EntityMirrorAcrossEdge, - }, #[serde(rename = "select_add")] SelectAdd { #[doc = "The response from the `SelectAdd` endpoint."] @@ -11141,6 +11272,11 @@ pub enum OkModelingCmdResponse { #[doc = "The response from the `MakeOffsetPath` command."] data: MakeOffsetPath, }, + #[serde(rename = "add_hole_from_offset")] + AddHoleFromOffset { + #[doc = "The response from the `AddHoleFromOffset` command."] + data: AddHoleFromOffset, + }, #[serde(rename = "default_camera_focus_on")] DefaultCameraFocusOn { #[doc = "The response from the `DefaultCameraFocusOn` command."] @@ -11326,6 +11462,26 @@ pub enum OkModelingCmdResponse { #[doc = "The response from the `EntityCircularPattern` command."] data: EntityCircularPattern, }, + #[serde(rename = "entity_mirror")] + EntityMirror { + #[doc = "The response from the `EntityMirror` endpoint."] + data: EntityMirror, + }, + #[serde(rename = "entity_mirror_across_edge")] + EntityMirrorAcrossEdge { + #[doc = "The response from the `EntityMirrorAcrossEdge` endpoint."] + data: EntityMirrorAcrossEdge, + }, + #[serde(rename = "entity_make_helix")] + EntityMakeHelix { + #[doc = "The response from the `EntityMakeHelix` endpoint."] + data: EntityMakeHelix, + }, + #[serde(rename = "entity_make_helix_from_params")] + EntityMakeHelixFromParams { + #[doc = "The response from the `EntityMakeHelixFromParams` endpoint."] + data: EntityMakeHelixFromParams, + }, #[serde(rename = "solid3d_get_extrusion_face_info")] Solid3DGetExtrusionFaceInfo { #[doc = "Extrusion face info struct (useful for maintaining mappings between source path segment ids and extrusion faces)"] @@ -14397,6 +14553,42 @@ impl tabled::Tabled for ShortlinkResultsPage { } } +#[doc = "IDs for a side face, extruded from the path of some sketch/2D shape."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct SideFace { + #[doc = "Desired ID for the resulting face."] + pub face_id: uuid::Uuid, + #[doc = "ID of the path this face is being extruded from."] + pub path_id: uuid::Uuid, +} + +impl std::fmt::Display for SideFace { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for SideFace { + const LENGTH: usize = 2; + fn fields(&self) -> Vec> { + vec![ + format!("{:?}", self.face_id).into(), + format!("{:?}", self.path_id).into(), + ] + } + + fn headers() -> Vec> { + vec!["face_id".into(), "path_id".into()] + } +} + #[doc = "The response from the `SketchModeDisable` endpoint."] #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, diff --git a/spec.json b/spec.json index 9bf45664..a6aeaabd 100644 --- a/spec.json +++ b/spec.json @@ -14793,6 +14793,23 @@ } ] }, + "AddHoleFromOffset": { + "description": "The response from the `AddHoleFromOffset` command.", + "type": "object", + "properties": { + "entity_ids": { + "description": "If the offset path splits into multiple paths, this will contain the UUIDs of the new paths. If the offset path remains as a single path, this will be empty, and the resulting ID of the (single) new path will be the ID of the `AddHoleFromOffset` command.", + "type": "array", + "items": { + "type": "string", + "format": "uuid" + } + } + }, + "required": [ + "entity_ids" + ] + }, "AddOrgMember": { "description": "Data for adding a member to an org.", "type": "object", @@ -18334,15 +18351,65 @@ }, "EntityMakeHelix": { "description": "The response from the `EntityMakeHelix` endpoint.", - "type": "object" + "type": "object", + "properties": { + "helix_id": { + "description": "The UUID of the helix that was created.", + "type": "string", + "format": "uuid" + } + }, + "required": [ + "helix_id" + ] + }, + "EntityMakeHelixFromParams": { + "description": "The response from the `EntityMakeHelixFromParams` endpoint.", + "type": "object", + "properties": { + "helix_id": { + "description": "The UUID of the helix that was created.", + "type": "string", + "format": "uuid" + } + }, + "required": [ + "helix_id" + ] }, "EntityMirror": { "description": "The response from the `EntityMirror` endpoint.", - "type": "object" + "type": "object", + "properties": { + "entity_ids": { + "description": "The UUIDs of the entities that were created.", + "type": "array", + "items": { + "type": "string", + "format": "uuid" + } + } + }, + "required": [ + "entity_ids" + ] }, "EntityMirrorAcrossEdge": { "description": "The response from the `EntityMirrorAcrossEdge` endpoint.", - "type": "object" + "type": "object", + "properties": { + "entity_ids": { + "description": "The UUIDs of the entities that were created.", + "type": "array", + "items": { + "type": "string", + "format": "uuid" + } + } + }, + "required": [ + "entity_ids" + ] }, "EntitySetOpacity": { "description": "The response from the `EntitySetOpacity` endpoint.", @@ -18733,6 +18800,34 @@ "description": "The response from the `Extrude` endpoint.", "type": "object" }, + "ExtrudedFaceInfo": { + "description": "IDs for the extruded faces.", + "type": "object", + "properties": { + "bottom": { + "nullable": true, + "description": "The face made from the original 2D shape being extruded. If the solid is extruded from a shape which already has an ID (e.g. extruding something which was sketched on a face), this doesn't need to be sent.", + "type": "string", + "format": "uuid" + }, + "sides": { + "description": "Any intermediate sides between the top and bottom.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SideFace" + } + }, + "top": { + "description": "Top face of the extrusion (parallel and further away from the original 2D shape being extruded).", + "type": "string", + "format": "uuid" + } + }, + "required": [ + "sides", + "top" + ] + }, "ExtrusionFaceCapType": { "description": "Possible types of faces which can be extruded from a 3D solid.", "oneOf": [ @@ -21623,6 +21718,15 @@ } ] }, + "faces": { + "nullable": true, + "description": "Which IDs should the new faces have? If this isn't given, the engine will generate IDs.", + "allOf": [ + { + "$ref": "#/components/schemas/ExtrudedFaceInfo" + } + ] + }, "target": { "description": "Which sketch to extrude. Must be a closed 2D solid.", "allOf": [ @@ -22530,7 +22634,11 @@ "format": "double" }, "start_angle": { - "description": "Start angle (in degrees).", + "description": "Start angle.", + "default": { + "unit": "degrees", + "value": 0.0 + }, "allOf": [ { "$ref": "#/components/schemas/Angle" @@ -22549,7 +22657,77 @@ "is_clockwise", "length", "revolutions", - "start_angle", + "type" + ] + }, + { + "description": "Create a helix using the specified parameters.", + "type": "object", + "properties": { + "axis": { + "description": "Axis of the helix. The helix will be created around and in the direction of this axis.", + "allOf": [ + { + "$ref": "#/components/schemas/Point3d" + } + ] + }, + "center": { + "description": "Center of the helix at the base of the helix.", + "allOf": [ + { + "$ref": "#/components/schemas/Point3d" + } + ] + }, + "is_clockwise": { + "description": "Is the helix rotation clockwise?", + "type": "boolean" + }, + "length": { + "description": "Length of the helix.", + "allOf": [ + { + "$ref": "#/components/schemas/LengthUnit" + } + ] + }, + "radius": { + "description": "Radius of the helix.", + "type": "number", + "format": "double" + }, + "revolutions": { + "description": "Number of revolutions.", + "type": "number", + "format": "double" + }, + "start_angle": { + "description": "Start angle.", + "default": { + "unit": "degrees", + "value": 0.0 + }, + "allOf": [ + { + "$ref": "#/components/schemas/Angle" + } + ] + }, + "type": { + "type": "string", + "enum": [ + "entity_make_helix_from_params" + ] + } + }, + "required": [ + "axis", + "center", + "is_clockwise", + "length", + "radius", + "revolutions", "type" ] }, @@ -24837,6 +25015,36 @@ "offset", "type" ] + }, + { + "description": "Add a hole to a closed path by offsetting it a uniform distance inward.", + "type": "object", + "properties": { + "object_id": { + "description": "The closed path to add a hole to.", + "type": "string", + "format": "uuid" + }, + "offset": { + "description": "The distance to offset the path (positive for outset, negative for inset)", + "allOf": [ + { + "$ref": "#/components/schemas/LengthUnit" + } + ] + }, + "type": { + "type": "string", + "enum": [ + "add_hole_from_offset" + ] + } + }, + "required": [ + "object_id", + "offset", + "type" + ] } ] }, @@ -25199,60 +25407,6 @@ "type" ] }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/EntityMakeHelix" - }, - "type": { - "type": "string", - "enum": [ - "entity_make_helix" - ] - } - }, - "required": [ - "data", - "type" - ] - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/EntityMirror" - }, - "type": { - "type": "string", - "enum": [ - "entity_mirror" - ] - } - }, - "required": [ - "data", - "type" - ] - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/EntityMirrorAcrossEdge" - }, - "type": { - "type": "string", - "enum": [ - "entity_mirror_across_edge" - ] - } - }, - "required": [ - "data", - "type" - ] - }, { "type": "object", "properties": { @@ -26333,6 +26487,24 @@ "type" ] }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AddHoleFromOffset" + }, + "type": { + "type": "string", + "enum": [ + "add_hole_from_offset" + ] + } + }, + "required": [ + "data", + "type" + ] + }, { "type": "object", "properties": { @@ -26999,6 +27171,78 @@ "type" ] }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/EntityMirror" + }, + "type": { + "type": "string", + "enum": [ + "entity_mirror" + ] + } + }, + "required": [ + "data", + "type" + ] + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/EntityMirrorAcrossEdge" + }, + "type": { + "type": "string", + "enum": [ + "entity_mirror_across_edge" + ] + } + }, + "required": [ + "data", + "type" + ] + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/EntityMakeHelix" + }, + "type": { + "type": "string", + "enum": [ + "entity_make_helix" + ] + } + }, + "required": [ + "data", + "type" + ] + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/EntityMakeHelixFromParams" + }, + "type": { + "type": "string", + "enum": [ + "entity_make_helix_from_params" + ] + } + }, + "required": [ + "data", + "type" + ] + }, { "type": "object", "properties": { @@ -29334,6 +29578,26 @@ "items" ] }, + "SideFace": { + "description": "IDs for a side face, extruded from the path of some sketch/2D shape.", + "type": "object", + "properties": { + "face_id": { + "description": "Desired ID for the resulting face.", + "type": "string", + "format": "uuid" + }, + "path_id": { + "description": "ID of the path this face is being extruded from.", + "type": "string", + "format": "uuid" + } + }, + "required": [ + "face_id", + "path_id" + ] + }, "SketchModeDisable": { "description": "The response from the `SketchModeDisable` endpoint.", "type": "object"