Skip to content

Commit

Permalink
Update api spec (#417)
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 39c3e70 commit 3042ffc
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 18 deletions.
15 changes: 3 additions & 12 deletions 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.3.2\""
"install": "[dependencies]\nkittycad = \"0.3.3\""
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions 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.3.2"
version = "0.3.3"
documentation = "https://docs.rs/kittycad"
readme = "README.md"
repository = "https://github.com/KittyCAD/kittycad.rs/tree/main/kittycad"
Expand All @@ -21,7 +21,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 = "^0.2.8", optional = true }
itertools = "0.13.0"
itertools = "0.12.1"
log = { version = "^0.4", features = ["serde"], optional = true }
mime_guess = "2.0.4"
parse-display = "0.9.0"
Expand All @@ -32,7 +32,7 @@ reqwest-conditional-middleware = { version = "0.2.1", optional = true }
reqwest-middleware = { version = "0.2.2", optional = true }
reqwest-retry = { version = "0.2.2", optional = true }
reqwest-tracing = { version = "0.4.4", features = ["opentelemetry_0_17"], optional = true }
schemars = { version = "0.8.20", features = ["bigdecimal04", "bytes", "chrono", "url", "uuid1"] }
schemars = { version = "0.8.16", features = ["bigdecimal04", "bytes", "chrono", "url", "uuid1"] }
serde = { version = "1", features = ["derive"] }
serde_bytes = "0.11"
serde_json = "1"
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.3.2"
kittycad = "0.3.3"
```

## 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.3.2"
//! kittycad = "0.3.3"
//! ```
//!
//! ## Basic example
Expand Down
74 changes: 74 additions & 0 deletions kittycad/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9491,6 +9491,18 @@ pub enum OkModelingCmdResponse {
#[doc = "The response from the `DefaultCameraZoom` command."]
data: DefaultCameraZoom,
},
#[doc = "The response to the 'ZoomToFit' endpoint"]
#[serde(rename = "zoom_to_fit")]
ZoomToFit {
#[doc = "The response from the `ZoomToFit` command."]
data: ZoomToFit,
},
#[doc = "The response to the 'ViewIsometric' endpoint"]
#[serde(rename = "view_isometric")]
ViewIsometric {
#[doc = "The response from the `ViewIsometric` command."]
data: ViewIsometric,
},
#[doc = "The response to the 'GetNumObjects' endpoint"]
#[serde(rename = "get_num_objects")]
GetNumObjects {
Expand Down Expand Up @@ -15274,6 +15286,37 @@ impl tabled::Tabled for VerificationTokenResponse {
}
}

#[doc = "The response from the `ViewIsometric` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ViewIsometric {
#[doc = "Camera settings"]
pub settings: CameraSettings,
}

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

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

#[doc = "The volume response."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
Expand Down Expand Up @@ -15651,3 +15694,34 @@ pub enum ZooTool {
#[display("diff_chrome_extension")]
DiffChromeExtension,
}

#[doc = "The response from the `ZoomToFit` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ZoomToFit {
#[doc = "Camera settings"]
pub settings: CameraSettings,
}

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

fn headers() -> Vec<std::borrow::Cow<'static, str>> {
vec!["settings".into()]
}
}
74 changes: 74 additions & 0 deletions openapitor/tests/types/kittycad.rs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -9305,6 +9305,18 @@ pub enum OkModelingCmdResponse {
#[doc = "The response from the `DefaultCameraZoom` command."]
data: DefaultCameraZoom,
},
#[doc = "The response to the 'ZoomToFit' endpoint"]
#[serde(rename = "zoom_to_fit")]
ZoomToFit {
#[doc = "The response from the `ZoomToFit` command."]
data: ZoomToFit,
},
#[doc = "The response to the 'ViewIsometric' endpoint"]
#[serde(rename = "view_isometric")]
ViewIsometric {
#[doc = "The response from the `ViewIsometric` command."]
data: ViewIsometric,
},
#[doc = "The response to the 'GetNumObjects' endpoint"]
#[serde(rename = "get_num_objects")]
GetNumObjects {
Expand Down Expand Up @@ -15020,6 +15032,37 @@ impl tabled::Tabled for VerificationTokenResponse {
}
}

#[doc = "The response from the `ViewIsometric` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ViewIsometric {
#[doc = "Camera settings"]
pub settings: CameraSettings,
}

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

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

#[doc = "The volume response."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
Expand Down Expand Up @@ -15387,3 +15430,34 @@ pub enum ZooTool {
#[display("diff_chrome_extension")]
DiffChromeExtension,
}

#[doc = "The response from the `ZoomToFit` command."]
#[derive(
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ZoomToFit {
#[doc = "Camera settings"]
pub settings: CameraSettings,
}

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

fn headers() -> Vec<std::borrow::Cow<'static, str>> {
vec!["settings".into()]
}
}
72 changes: 72 additions & 0 deletions spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -21787,6 +21787,44 @@
"type"
]
},
{
"description": "The response to the 'ZoomToFit' endpoint",
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/ZoomToFit"
},
"type": {
"type": "string",
"enum": [
"zoom_to_fit"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The response to the 'ViewIsometric' endpoint",
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/ViewIsometric"
},
"type": {
"type": "string",
"enum": [
"view_isometric"
]
}
},
"required": [
"data",
"type"
]
},
{
"description": "The response to the 'GetNumObjects' endpoint",
"type": "object",
Expand Down Expand Up @@ -27201,6 +27239,23 @@
"updated_at"
]
},
"ViewIsometric": {
"description": "The response from the `ViewIsometric` command.",
"type": "object",
"properties": {
"settings": {
"description": "Camera settings",
"allOf": [
{
"$ref": "#/components/schemas/CameraSettings"
}
]
}
},
"required": [
"settings"
]
},
"Volume": {
"description": "The volume response.",
"type": "object",
Expand Down Expand Up @@ -27588,6 +27643,23 @@
]
}
]
},
"ZoomToFit": {
"description": "The response from the `ZoomToFit` command.",
"type": "object",
"properties": {
"settings": {
"description": "Camera settings",
"allOf": [
{
"$ref": "#/components/schemas/CameraSettings"
}
]
}
},
"required": [
"settings"
]
}
},
"responses": {
Expand Down

0 comments on commit 3042ffc

Please sign in to comment.