Skip to content

Commit

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

* I have generated the library!

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent a005deb commit abafe1e
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 0 deletions.
53 changes: 53 additions & 0 deletions kittycad/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8817,6 +8817,39 @@ impl tabled::Tabled for MakeAxesGizmo {
}
}

#[doc = "The response from the `MakeOffsetPath` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct MakeOffsetPath {
#[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 `MakeOffsetPath` command."]
pub entity_ids: Vec<uuid::Uuid>,
}

impl std::fmt::Display for MakeOffsetPath {
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 MakeOffsetPath {
const LENGTH: usize = 1;
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
vec![format!("{:?}", self.entity_ids).into()]
}

fn headers() -> Vec<std::borrow::Cow<'static, str>> {
vec!["entity_ids".into()]
}
}

#[doc = "The response from the `MakePlane` endpoint."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
Expand Down Expand Up @@ -10565,6 +10598,21 @@ pub enum ModelingCmd {
#[doc = "Get the number of objects in the scene"]
#[serde(rename = "get_num_objects")]
GetNumObjects {},
#[doc = "Make a new path by offsetting an object by a given distance. The new path's ID will \
be the ID of this command."]
#[serde(rename = "make_offset_path")]
MakeOffsetPath {
#[doc = "If the object is a solid, this is the ID of the face to base the offset on. If \
given, and `object_id` refers to a solid, then this face on the solid will be \
offset. If given but `object_id` doesn't refer to a solid, responds with an \
error. If not given, then `object_id` itself will be offset directly."]
#[serde(default, skip_serializing_if = "Option::is_none")]
face_id: Option<uuid::Uuid>,
#[doc = "The object that will be offset (can be a path, sketch, or a solid)"]
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."]
Expand Down Expand Up @@ -11302,6 +11350,11 @@ pub enum OkModelingCmdResponse {
#[doc = "The response from the `GetNumObjects` command."]
data: GetNumObjects,
},
#[serde(rename = "make_offset_path")]
MakeOffsetPath {
#[doc = "The response from the `MakeOffsetPath` command."]
data: MakeOffsetPath,
},
#[serde(rename = "default_camera_focus_on")]
DefaultCameraFocusOn {
#[doc = "The response from the `DefaultCameraFocusOn` command."]
Expand Down
47 changes: 47 additions & 0 deletions openapitor/tests/types/kittycad.rs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -8676,6 +8676,37 @@ impl tabled::Tabled for MakeAxesGizmo {
}
}

#[doc = "The response from the `MakeOffsetPath` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct MakeOffsetPath {
#[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 `MakeOffsetPath` command."]
pub entity_ids: Vec<uuid::Uuid>,
}

impl std::fmt::Display for MakeOffsetPath {
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 MakeOffsetPath {
const LENGTH: usize = 1;
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
vec![format!("{:?}", self.entity_ids).into()]
}

fn headers() -> Vec<std::borrow::Cow<'static, str>> {
vec!["entity_ids".into()]
}
}

#[doc = "The response from the `MakePlane` endpoint."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
Expand Down Expand Up @@ -10341,6 +10372,17 @@ pub enum ModelingCmd {
#[doc = "Get the number of objects in the scene"]
#[serde(rename = "get_num_objects")]
GetNumObjects {},
#[doc = "Make a new path by offsetting an object by a given distance. The new path's ID will be the ID of this command."]
#[serde(rename = "make_offset_path")]
MakeOffsetPath {
#[doc = "If the object is a solid, this is the ID of the face to base the offset on. If given, and `object_id` refers to a solid, then this face on the solid will be offset. If given but `object_id` doesn't refer to a solid, responds with an error. If not given, then `object_id` itself will be offset directly."]
#[serde(default, skip_serializing_if = "Option::is_none")]
face_id: Option<uuid::Uuid>,
#[doc = "The object that will be offset (can be a path, sketch, or a solid)"]
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."]
Expand Down Expand Up @@ -11074,6 +11116,11 @@ pub enum OkModelingCmdResponse {
#[doc = "The response from the `GetNumObjects` command."]
data: GetNumObjects,
},
#[serde(rename = "make_offset_path")]
MakeOffsetPath {
#[doc = "The response from the `MakeOffsetPath` command."]
data: MakeOffsetPath,
},
#[serde(rename = "default_camera_focus_on")]
DefaultCameraFocusOn {
#[doc = "The response from the `DefaultCameraFocusOn` command."]
Expand Down
71 changes: 71 additions & 0 deletions spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -20802,6 +20802,23 @@
"description": "The response from the `MakeAxesGizmo` endpoint.",
"type": "object"
},
"MakeOffsetPath": {
"description": "The response from the `MakeOffsetPath` 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 `MakeOffsetPath` command.",
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
}
},
"required": [
"entity_ids"
]
},
"MakePlane": {
"description": "The response from the `MakePlane` endpoint.",
"type": "object"
Expand Down Expand Up @@ -24634,6 +24651,42 @@
"required": [
"type"
]
},
{
"description": "Make a new path by offsetting an object by a given distance. The new path's ID will be the ID of this command.",
"type": "object",
"properties": {
"face_id": {
"nullable": true,
"description": "If the object is a solid, this is the ID of the face to base the offset on. If given, and `object_id` refers to a solid, then this face on the solid will be offset. If given but `object_id` doesn't refer to a solid, responds with an error. If not given, then `object_id` itself will be offset directly.",
"type": "string",
"format": "uuid"
},
"object_id": {
"description": "The object that will be offset (can be a path, sketch, or a solid)",
"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": [
"make_offset_path"
]
}
},
"required": [
"object_id",
"offset",
"type"
]
}
]
},
Expand Down Expand Up @@ -26094,6 +26147,24 @@
"type"
]
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/MakeOffsetPath"
},
"type": {
"type": "string",
"enum": [
"make_offset_path"
]
}
},
"required": [
"data",
"type"
]
},
{
"type": "object",
"properties": {
Expand Down

0 comments on commit abafe1e

Please sign in to comment.