Skip to content

Commit

Permalink
Update api spec (#260)
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
jessfraz and github-actions[bot] authored Oct 12, 2023
1 parent 8e43662 commit 7e087ec
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion kittycad.rs.patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "/info/x-rust",
"value": {
"client": "// Authenticate via an API token.\nlet client = kittycad::Client::new(\"$TOKEN\");\n\n// - OR -\n\n// Authenticate with your token and host parsed from the environment variables:\n// `KITTYCAD_API_TOKEN`.\nlet client = kittycad::Client::new_from_env();",
"install": "[dependencies]\nkittycad = \"0.2.32\""
"install": "[dependencies]\nkittycad = \"0.2.33\""
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion kittycad/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "kittycad"
description = "A fully generated & opinionated API client for the KittyCAD API."
version = "0.2.32"
version = "0.2.33"
documentation = "https://docs.rs/kittycad"
readme = "README.md"
repository = "https://github.com/KittyCAD/kittycad.rs/tree/main/kittycad"
Expand Down
2 changes: 1 addition & 1 deletion kittycad/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ To install the library, add the following to your `Cargo.toml` file.

```toml
[dependencies]
kittycad = "0.2.32"
kittycad = "0.2.33"
```

## Basic example
Expand Down
2 changes: 1 addition & 1 deletion kittycad/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//!
//! ```toml
//! [dependencies]
//! kittycad = "0.2.32"
//! kittycad = "0.2.33"
//! ```
//!
//! ## Basic example
Expand Down
52 changes: 52 additions & 0 deletions kittycad/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6812,6 +6812,14 @@ pub enum ModelingCmd {
#[doc = "ID of the entity being queried."]
entity_id: uuid::Uuid,
},
#[doc = "Add a hole to a Solid2d object before extruding it."]
#[serde(rename = "solid2d_add_hole")]
Solid2DAddHole {
#[doc = "The id of the path to use as the inner profile (hole)."]
hole_id: uuid::Uuid,
#[doc = "Which object to add the hole to."]
object_id: uuid::Uuid,
},
#[doc = "Gets all faces which use the given edge."]
#[serde(rename = "solid3d_get_all_edge_faces")]
Solid3DGetAllEdgeFaces {
Expand Down Expand Up @@ -7121,6 +7129,42 @@ pub enum ModelingCmd {
GetSketchModePlane {},
}

#[doc = "A graphics command submitted to the KittyCAD engine via the Modeling API."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ModelingCmdReq {
#[doc = "Which command to submit to the Kittycad engine."]
pub cmd: ModelingCmd,
#[doc = "ID of command being submitted."]
pub cmd_id: uuid::Uuid,
}

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

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

#[doc = "The response from the `MouseClick` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
Expand Down Expand Up @@ -11419,6 +11463,14 @@ pub enum WebSocketRequest {
#[doc = "ID of command being submitted."]
cmd_id: uuid::Uuid,
},
#[doc = "A sequence of modeling requests. If any request fails, following requests will not \
be tried."]
#[serde(rename = "modeling_cmd_batch_req")]
ModelingCmdBatchReq {
#[doc = "A sequence of modeling requests. If any request fails, following requests will \
not be tried."]
requests: Vec<ModelingCmdReq>,
},
#[doc = "The client-to-server Ping to ensure the WebSocket stays alive."]
#[serde(rename = "ping")]
Ping {},
Expand Down
50 changes: 50 additions & 0 deletions openapitor/tests/types/kittycad.rs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -6685,6 +6685,14 @@ pub enum ModelingCmd {
#[doc = "ID of the entity being queried."]
entity_id: uuid::Uuid,
},
#[doc = "Add a hole to a Solid2d object before extruding it."]
#[serde(rename = "solid2d_add_hole")]
Solid2DAddHole {
#[doc = "The id of the path to use as the inner profile (hole)."]
hole_id: uuid::Uuid,
#[doc = "Which object to add the hole to."]
object_id: uuid::Uuid,
},
#[doc = "Gets all faces which use the given edge."]
#[serde(rename = "solid3d_get_all_edge_faces")]
Solid3DGetAllEdgeFaces {
Expand Down Expand Up @@ -6977,6 +6985,42 @@ pub enum ModelingCmd {
GetSketchModePlane {},
}

#[doc = "A graphics command submitted to the KittyCAD engine via the Modeling API."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ModelingCmdReq {
#[doc = "Which command to submit to the Kittycad engine."]
pub cmd: ModelingCmd,
#[doc = "ID of command being submitted."]
pub cmd_id: uuid::Uuid,
}

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

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

#[doc = "The response from the `MouseClick` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
Expand Down Expand Up @@ -11233,6 +11277,12 @@ pub enum WebSocketRequest {
#[doc = "ID of command being submitted."]
cmd_id: uuid::Uuid,
},
#[doc = "A sequence of modeling requests. If any request fails, following requests will not be tried."]
#[serde(rename = "modeling_cmd_batch_req")]
ModelingCmdBatchReq {
#[doc = "A sequence of modeling requests. If any request fails, following requests will not be tried."]
requests: Vec<ModelingCmdReq>,
},
#[doc = "The client-to-server Ping to ensure the WebSocket stays alive."]
#[serde(rename = "ping")]
Ping {},
Expand Down
76 changes: 76 additions & 0 deletions spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -12559,6 +12559,33 @@
"type"
]
},
{
"description": "Add a hole to a Solid2d object before extruding it.",
"type": "object",
"properties": {
"hole_id": {
"description": "The id of the path to use as the inner profile (hole).",
"type": "string",
"format": "uuid"
},
"object_id": {
"description": "Which object to add the hole to.",
"type": "string",
"format": "uuid"
},
"type": {
"type": "string",
"enum": [
"solid2d_add_hole"
]
}
},
"required": [
"hole_id",
"object_id",
"type"
]
},
{
"description": "Gets all faces which use the given edge.",
"type": "object",
Expand Down Expand Up @@ -13646,6 +13673,32 @@
"type": "string",
"format": "uuid"
},
"ModelingCmdReq": {
"description": "A graphics command submitted to the KittyCAD engine via the Modeling API.",
"type": "object",
"properties": {
"cmd": {
"description": "Which command to submit to the Kittycad engine.",
"allOf": [
{
"$ref": "#/components/schemas/ModelingCmd"
}
]
},
"cmd_id": {
"description": "ID of command being submitted.",
"allOf": [
{
"$ref": "#/components/schemas/ModelingCmdId"
}
]
}
},
"required": [
"cmd",
"cmd_id"
]
},
"MouseClick": {
"description": "The response from the `MouseClick` command.",
"type": "object",
Expand Down Expand Up @@ -17689,6 +17742,29 @@
"type"
]
},
{
"description": "A sequence of modeling requests. If any request fails, following requests will not be tried.",
"type": "object",
"properties": {
"requests": {
"description": "A sequence of modeling requests. If any request fails, following requests will not be tried.",
"type": "array",
"items": {
"$ref": "#/components/schemas/ModelingCmdReq"
}
},
"type": {
"type": "string",
"enum": [
"modeling_cmd_batch_req"
]
}
},
"required": [
"requests",
"type"
]
},
{
"description": "The client-to-server Ping to ensure the WebSocket stays alive.",
"type": "object",
Expand Down

0 comments on commit 7e087ec

Please sign in to comment.