Skip to content

Commit 55c46f8

Browse files
Update api spec (#677)
* YOYO NEW API SPEC! * I have generated the library! --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 86859e7 commit 55c46f8

File tree

7 files changed

+544
-82
lines changed

7 files changed

+544
-82
lines changed

Cargo.lock

+10-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kittycad.rs.patch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"op": "add",
116116
"path": "/paths/~1auth~1email~1callback/get/x-rust",
117117
"value": {
118-
"example": "/// Listen for callbacks for email verification for users.\n/// \n/// **Parameters:**\n/// \n/// - `callback_url: Option<String>`: The URL to redirect back to after we have authenticated.\n/// - `email: &'astr`: The user's email. (required)\n/// - `token: &'astr`: The verification token. (required)\nasync fn example_hidden_auth_email_callback() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n client\n .hidden()\n .auth_email_callback(\n Some(\"https://example.com/foo/bar\".to_string()),\n \"[email protected]\",\n \"some-string\",\n )\n .await?;\n Ok(())\n}\n",
118+
"example": "/// Listen for callbacks for email authentication for users.\n/// \n/// **Parameters:**\n/// \n/// - `callback_url: Option<String>`: The URL to redirect back to after we have authenticated.\n/// - `email: &'astr`: The user's email. (required)\n/// - `token: &'astr`: The verification token. (required)\nasync fn example_hidden_auth_email_callback() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n client\n .hidden()\n .auth_email_callback(\n Some(\"https://example.com/foo/bar\".to_string()),\n \"[email protected]\",\n \"some-string\",\n )\n .await?;\n Ok(())\n}\n",
119119
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/hidden/struct.Hidden.html#method.auth_email_callback"
120120
}
121121
},

kittycad/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ async-trait = { version = "^0.1.53", optional = true }
1414
base64 = "0.22"
1515
bigdecimal = { version = "0.4", features = ["serde"] }
1616
bytes = { version = "1", features = ["serde"] }
17-
clap = { version = "4.5.26", features = ["cargo", "derive", "env", "unicode"], optional = true }
18-
data-encoding = "^2.7.0"
19-
dirs = { version = "^6.0.0", optional = true }
17+
clap = { version = "4.2.4", features = ["cargo", "derive", "env", "unicode"], optional = true }
18+
data-encoding = "^2.3.2"
19+
dirs = { version = "^5.0.1", optional = true }
2020
format_serde_error = { version = "^0.3.0", optional = true }
2121
futures = { version = "0.3.26", optional = true }
2222
http = { version = "1", optional = true }
23-
itertools = "0.14.0"
23+
itertools = "0.13.0"
2424
log = { version = "^0.4", features = ["serde"], optional = true }
2525
mime_guess = "2.0.4"
2626
parse-display = "0.10.0"
@@ -44,7 +44,7 @@ uuid = { version = "1", features = ["serde", "v4", "v7"] }
4444

4545
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
4646
chrono = { version = "0.4", default-features = false, features = ["now", "serde", "std"] }
47-
tokio = { version = "1.43.0", features = ["rt", "macros"] }
47+
tokio = { version = "1.38.0", features = ["rt", "macros"] }
4848

4949
[target.'cfg(target_arch = "wasm32")'.dependencies]
5050
chrono = { version = "0.4", default-features = false, features = ["serde", "std"] }
@@ -54,7 +54,7 @@ expectorate = "1"
5454
futures-util = "^0.3.26"
5555
pretty_assertions = "1"
5656
rand = "0.8"
57-
tokio = { version = "1.43.0", features = ["rt", "macros"] }
57+
tokio = { version = "1.38.0", features = ["rt", "macros"] }
5858
tokio-tungstenite = "0.24"
5959

6060
[features]

kittycad/src/hidden.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Hidden {
4343
}
4444
}
4545

46-
#[doc = "Listen for callbacks for email verification for users.\n\n**Parameters:**\n\n- `callback_url: Option<String>`: The URL to redirect back to after we have authenticated.\n- `email: &'astr`: The user's email. (required)\n- `token: &'astr`: The verification token. (required)\n\n```rust,no_run\nasync fn example_hidden_auth_email_callback() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n client\n .hidden()\n .auth_email_callback(\n Some(\"https://example.com/foo/bar\".to_string()),\n \"[email protected]\",\n \"some-string\",\n )\n .await?;\n Ok(())\n}\n```"]
46+
#[doc = "Listen for callbacks for email authentication for users.\n\n**Parameters:**\n\n- `callback_url: Option<String>`: The URL to redirect back to after we have authenticated.\n- `email: &'astr`: The user's email. (required)\n- `token: &'astr`: The verification token. (required)\n\n```rust,no_run\nasync fn example_hidden_auth_email_callback() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n client\n .hidden()\n .auth_email_callback(\n Some(\"https://example.com/foo/bar\".to_string()),\n \"[email protected]\",\n \"some-string\",\n )\n .await?;\n Ok(())\n}\n```"]
4747
#[tracing::instrument]
4848
pub async fn auth_email_callback<'a>(
4949
&'a self,

kittycad/src/types.rs

+168-14
Original file line numberDiff line numberDiff line change
@@ -3054,6 +3054,74 @@ impl tabled::Tabled for Color {
30543054
}
30553055
}
30563056

3057+
#[doc = "Container that holds a translate, rotate and scale."]
3058+
#[derive(
3059+
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3060+
)]
3061+
pub struct ComponentTransform {
3062+
#[doc = "Rotate component of the transform. The rotation is specified as an axis and an angle \
3063+
(xyz are the components of the axis, w is the angle in degrees)."]
3064+
#[serde(default, skip_serializing_if = "Option::is_none")]
3065+
pub rotate_angle_axis: Option<String>,
3066+
#[doc = "Rotate component of the transform. The rotation is specified as a roll, pitch, yaw."]
3067+
#[serde(default, skip_serializing_if = "Option::is_none")]
3068+
pub rotate_rpy: Option<String>,
3069+
#[doc = "Scale component of the transform."]
3070+
#[serde(default, skip_serializing_if = "Option::is_none")]
3071+
pub scale: Option<String>,
3072+
#[doc = "Translate component of the transform."]
3073+
#[serde(default, skip_serializing_if = "Option::is_none")]
3074+
pub translate: Option<String>,
3075+
}
3076+
3077+
impl std::fmt::Display for ComponentTransform {
3078+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3079+
write!(
3080+
f,
3081+
"{}",
3082+
serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3083+
)
3084+
}
3085+
}
3086+
3087+
#[cfg(feature = "tabled")]
3088+
impl tabled::Tabled for ComponentTransform {
3089+
const LENGTH: usize = 4;
3090+
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3091+
vec![
3092+
if let Some(rotate_angle_axis) = &self.rotate_angle_axis {
3093+
format!("{:?}", rotate_angle_axis).into()
3094+
} else {
3095+
String::new().into()
3096+
},
3097+
if let Some(rotate_rpy) = &self.rotate_rpy {
3098+
format!("{:?}", rotate_rpy).into()
3099+
} else {
3100+
String::new().into()
3101+
},
3102+
if let Some(scale) = &self.scale {
3103+
format!("{:?}", scale).into()
3104+
} else {
3105+
String::new().into()
3106+
},
3107+
if let Some(translate) = &self.translate {
3108+
format!("{:?}", translate).into()
3109+
} else {
3110+
String::new().into()
3111+
},
3112+
]
3113+
}
3114+
3115+
fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3116+
vec![
3117+
"rotate_angle_axis".into(),
3118+
"rotate_rpy".into(),
3119+
"scale".into(),
3120+
"translate".into(),
3121+
]
3122+
}
3123+
}
3124+
30573125
#[doc = "Metadata about a pub-sub connection.\n\nThis is mostly used for internal purposes and \
30583126
debugging."]
30593127
#[derive(
@@ -5150,10 +5218,7 @@ impl tabled::Tabled for EntityLinearPatternTransform {
51505218
#[derive(
51515219
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
51525220
)]
5153-
pub struct EntityMakeHelix {
5154-
#[doc = "The UUID of the helix that was created."]
5155-
pub helix_id: uuid::Uuid,
5156-
}
5221+
pub struct EntityMakeHelix {}
51575222

51585223
impl std::fmt::Display for EntityMakeHelix {
51595224
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
@@ -5167,25 +5232,50 @@ impl std::fmt::Display for EntityMakeHelix {
51675232

51685233
#[cfg(feature = "tabled")]
51695234
impl tabled::Tabled for EntityMakeHelix {
5170-
const LENGTH: usize = 1;
5235+
const LENGTH: usize = 0;
51715236
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5172-
vec![format!("{:?}", self.helix_id).into()]
5237+
vec![]
51735238
}
51745239

51755240
fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5176-
vec!["helix_id".into()]
5241+
vec![]
51775242
}
51785243
}
51795244

5180-
#[doc = "The response from the `EntityMakeHelixFromParams` endpoint."]
5245+
#[doc = "The response from the `EntityMakeHelixFromEdge` endpoint."]
51815246
#[derive(
51825247
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
51835248
)]
5184-
pub struct EntityMakeHelixFromParams {
5185-
#[doc = "The UUID of the helix that was created."]
5186-
pub helix_id: uuid::Uuid,
5249+
pub struct EntityMakeHelixFromEdge {}
5250+
5251+
impl std::fmt::Display for EntityMakeHelixFromEdge {
5252+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5253+
write!(
5254+
f,
5255+
"{}",
5256+
serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5257+
)
5258+
}
5259+
}
5260+
5261+
#[cfg(feature = "tabled")]
5262+
impl tabled::Tabled for EntityMakeHelixFromEdge {
5263+
const LENGTH: usize = 0;
5264+
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5265+
vec![]
5266+
}
5267+
5268+
fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5269+
vec![]
5270+
}
51875271
}
51885272

5273+
#[doc = "The response from the `EntityMakeHelixFromParams` endpoint."]
5274+
#[derive(
5275+
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5276+
)]
5277+
pub struct EntityMakeHelixFromParams {}
5278+
51895279
impl std::fmt::Display for EntityMakeHelixFromParams {
51905280
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
51915281
write!(
@@ -5198,13 +5288,13 @@ impl std::fmt::Display for EntityMakeHelixFromParams {
51985288

51995289
#[cfg(feature = "tabled")]
52005290
impl tabled::Tabled for EntityMakeHelixFromParams {
5201-
const LENGTH: usize = 1;
5291+
const LENGTH: usize = 0;
52025292
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5203-
vec![format!("{:?}", self.helix_id).into()]
5293+
vec![]
52045294
}
52055295

52065296
fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5207-
vec!["helix_id".into()]
5297+
vec![]
52085298
}
52095299
}
52105300

@@ -10098,6 +10188,24 @@ pub enum ModelingCmd {
1009810188
#[serde(default, skip_serializing_if = "Option::is_none")]
1009910189
start_angle: Option<Angle>,
1010010190
},
10191+
#[doc = "Create a helix using the specified parameters."]
10192+
#[serde(rename = "entity_make_helix_from_edge")]
10193+
EntityMakeHelixFromEdge {
10194+
#[doc = "Edge about which to make the helix."]
10195+
edge_id: uuid::Uuid,
10196+
#[doc = "Is the helix rotation clockwise?"]
10197+
is_clockwise: bool,
10198+
#[doc = "Length of the helix. If None, the length of the edge will be used instead."]
10199+
#[serde(default, skip_serializing_if = "Option::is_none")]
10200+
length: Option<f64>,
10201+
#[doc = "Radius of the helix."]
10202+
radius: f64,
10203+
#[doc = "Number of revolutions."]
10204+
revolutions: f64,
10205+
#[doc = "Start angle."]
10206+
#[serde(default, skip_serializing_if = "Option::is_none")]
10207+
start_angle: Option<Angle>,
10208+
},
1010110209
#[doc = "Mirror the input entities over the specified axis. (Currently only supports sketches)"]
1010210210
#[serde(rename = "entity_mirror")]
1010310211
EntityMirror {
@@ -10765,6 +10873,14 @@ pub enum ModelingCmd {
1076510873
#[doc = "Get the number of objects in the scene"]
1076610874
#[serde(rename = "get_num_objects")]
1076710875
GetNumObjects {},
10876+
#[doc = "Set the transform of an object."]
10877+
#[serde(rename = "set_object_transform")]
10878+
SetObjectTransform {
10879+
#[doc = "Id of the object whose transform is to be set."]
10880+
object_id: uuid::Uuid,
10881+
#[doc = "List of transforms to be applied to the object."]
10882+
transforms: Vec<ComponentTransform>,
10883+
},
1076810884
#[doc = "Make a new path by offsetting an object by a given distance. The new path's ID will \
1076910885
be the ID of this command."]
1077010886
#[serde(rename = "make_offset_path")]
@@ -11520,6 +11636,11 @@ pub enum OkModelingCmdResponse {
1152011636
#[doc = "The response from the `MakeOffsetPath` command."]
1152111637
data: MakeOffsetPath,
1152211638
},
11639+
#[serde(rename = "set_object_transform")]
11640+
SetObjectTransform {
11641+
#[doc = "The response from the `SetObjectTransform` command."]
11642+
data: SetObjectTransform,
11643+
},
1152311644
#[serde(rename = "add_hole_from_offset")]
1152411645
AddHoleFromOffset {
1152511646
#[doc = "The response from the `AddHoleFromOffset` command."]
@@ -11731,6 +11852,11 @@ pub enum OkModelingCmdResponse {
1173111852
#[doc = "The response from the `EntityMakeHelixFromParams` endpoint."]
1173211853
data: EntityMakeHelixFromParams,
1173311854
},
11855+
#[serde(rename = "entity_make_helix_from_edge")]
11856+
EntityMakeHelixFromEdge {
11857+
#[doc = "The response from the `EntityMakeHelixFromEdge` endpoint."]
11858+
data: EntityMakeHelixFromEdge,
11859+
},
1173411860
#[serde(rename = "solid3d_get_extrusion_face_info")]
1173511861
Solid3DGetExtrusionFaceInfo {
1173611862
#[doc = "Extrusion face info struct (useful for maintaining mappings between source path \
@@ -14584,6 +14710,34 @@ impl tabled::Tabled for SetDefaultSystemProperties {
1458414710
}
1458514711
}
1458614712

14713+
#[doc = "The response from the `SetObjectTransform` command."]
14714+
#[derive(
14715+
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
14716+
)]
14717+
pub struct SetObjectTransform {}
14718+
14719+
impl std::fmt::Display for SetObjectTransform {
14720+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
14721+
write!(
14722+
f,
14723+
"{}",
14724+
serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
14725+
)
14726+
}
14727+
}
14728+
14729+
#[cfg(feature = "tabled")]
14730+
impl tabled::Tabled for SetObjectTransform {
14731+
const LENGTH: usize = 0;
14732+
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
14733+
vec![]
14734+
}
14735+
14736+
fn headers() -> Vec<std::borrow::Cow<'static, str>> {
14737+
vec![]
14738+
}
14739+
}
14740+
1458714741
#[doc = "The response from the `SetSceneUnits` endpoint."]
1458814742
#[derive(
1458914743
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,

0 commit comments

Comments
 (0)