Skip to content

Commit

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

* updates

Signed-off-by: Jess Frazelle <[email protected]>

* updates

Signed-off-by: Jess Frazelle <[email protected]>

* I have generated the library!

---------

Signed-off-by: Jess Frazelle <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jess Frazelle <[email protected]>
  • Loading branch information
3 people committed Jul 9, 2024
1 parent d863f82 commit 546d460
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 23 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 VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.7
0.3.8
4 changes: 2 additions & 2 deletions 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.7\""
"install": "[dependencies]\nkittycad = \"0.3.8\""
}
},
{
Expand Down Expand Up @@ -123,7 +123,7 @@
"op": "add",
"path": "/paths/~1async~1operations~1{id}/get/x-rust",
"value": {
"example": "/// Get an async operation.\n/// \n/// Get the status and output of an async operation.\n/// This endpoint requires authentication by any Zoo user. It returns details of the requested async operation for the user.\n/// If the user is not authenticated to view the specified async operation, then it is not returned.\n/// Only Zoo employees with the proper access can view async operations for other users.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The ID of the async operation. (required)\nasync fn example_api_calls_get_async_operation() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::AsyncApiCallOutput = client\n .api_calls()\n .get_async_operation(\"some-string\")\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Get an async operation.\n/// \n/// Get the status and output of an async operation.\n/// This endpoint requires authentication by any Zoo user. It returns details of the requested async operation for the user.\n/// If the user is not authenticated to view the specified async operation, then it is not returned.\n/// Only Zoo employees with the proper access can view async operations for other users.\n/// \n/// **Parameters:**\n/// \n/// - `id: uuid::Uuid`: The ID of the async operation. (required)\nuse std::str::FromStr;\nasync fn example_api_calls_get_async_operation() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::AsyncApiCallOutput = client\n .api_calls()\n .get_async_operation(uuid::Uuid::from_str(\n \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/api_calls/struct.ApiCalls.html#method.get_async_operation"
}
},
Expand Down
8 changes: 4 additions & 4 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.7"
version = "0.3.8"
documentation = "https://docs.rs/kittycad"
readme = "README.md"
repository = "https://github.com/KittyCAD/kittycad.rs/tree/main/kittycad"
Expand All @@ -10,11 +10,11 @@ license = "MIT"

[dependencies]
anyhow = "1"
async-trait = { version = "^0.1.81", optional = true }
async-trait = { version = "^0.1.53", optional = true }
base64 = "0.22"
bigdecimal = { version = "0.4", features = ["serde"] }
bytes = { version = "1", features = ["serde"] }
clap = { version = "4.5.9", features = ["cargo", "derive", "env", "unicode"], optional = true }
clap = { version = "4.2.4", features = ["cargo", "derive", "env", "unicode"], optional = true }
chrono = { version = "0.4", default-features = false, features = ["serde", "std"] }
data-encoding = "^2.3.2"
dirs = { version = "^5.0.1", optional = true }
Expand All @@ -25,7 +25,7 @@ itertools = "0.13.0"
log = { version = "^0.4", features = ["serde"], optional = true }
mime_guess = "2.0.4"
parse-display = "0.9.1"
phonenumber = "0.3.6"
phonenumber = "0.3.5"
rand = { version = "0.8", optional = true }
reqwest = { version = "0.11.27", default-features = false, features = ["json", "multipart", "rustls-tls"], optional = true }
reqwest-conditional-middleware = { version = "0.2.1", optional = true }
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.7"
kittycad = "0.3.8"
```

## Basic example
Expand Down
19 changes: 10 additions & 9 deletions kittycad/src/api_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,24 +323,25 @@ impl ApiCalls {
endpoint requires authentication by any Zoo user. It returns details of the requested \
async operation for the user.\nIf the user is not authenticated to view the specified \
async operation, then it is not returned.\nOnly Zoo employees with the proper access \
can view async operations for other users.\n\n**Parameters:**\n\n- `id: &'astr`: The \
ID of the async operation. (required)\n\n```rust,no_run\nasync fn \
example_api_calls_get_async_operation() -> anyhow::Result<()> {\n let client = \
kittycad::Client::new_from_env();\n let result: \
kittycad::types::AsyncApiCallOutput = client\n .api_calls()\n \
.get_async_operation(\"some-string\")\n .await?;\n println!(\"{:?}\", \
result);\n Ok(())\n}\n```"]
can view async operations for other users.\n\n**Parameters:**\n\n- `id: uuid::Uuid`: \
The ID of the async operation. (required)\n\n```rust,no_run\nuse \
std::str::FromStr;\nasync fn example_api_calls_get_async_operation() -> \
anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let \
result: kittycad::types::AsyncApiCallOutput = client\n .api_calls()\n \
.get_async_operation(uuid::Uuid::from_str(\n \
\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n \
println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[tracing::instrument]
pub async fn get_async_operation<'a>(
&'a self,
id: &'a str,
id: uuid::Uuid,
) -> Result<crate::types::AsyncApiCallOutput, crate::types::error::Error> {
let mut req = self.client.client.request(
http::Method::GET,
format!(
"{}/{}",
self.client.base_url,
"async/operations/{id}".replace("{id}", id)
"async/operations/{id}".replace("{id}", &format!("{}", id))
),
);
req = req.bearer_auth(&self.client.token);
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.7"
//! kittycad = "0.3.8"
//! ```
//!
//! ## Basic example
Expand Down
8 changes: 5 additions & 3 deletions kittycad/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::str::FromStr;

#[cfg(not(feature = "js"))]
use futures::TryStreamExt;
use pretty_assertions::assert_eq;
Expand Down Expand Up @@ -84,7 +86,7 @@ async fn test_get_status_of_async_operation() {

let _result = client
.api_calls()
.get_async_operation("23a9759f-ee9b-47de-9a55-deb1ed035793")
.get_async_operation(uuid::Uuid::from_str("23a9759f-ee9b-47de-9a55-deb1ed035793").unwrap())
.await
.unwrap();
}
Expand All @@ -95,7 +97,7 @@ async fn serialize_one_of() {

let result = client
.api_calls()
.get_async_operation("23a9759f-ee9b-47de-9a55-deb1ed035793")
.get_async_operation(uuid::Uuid::from_str("23a9759f-ee9b-47de-9a55-deb1ed035793").unwrap())
.await
.unwrap();

Expand All @@ -112,7 +114,7 @@ async fn tabled_one_of() {

let result = client
.api_calls()
.get_async_operation("23a9759f-ee9b-47de-9a55-deb1ed035793")
.get_async_operation(uuid::Uuid::from_str("23a9759f-ee9b-47de-9a55-deb1ed035793").unwrap())
.await
.unwrap();

Expand Down
3 changes: 2 additions & 1 deletion spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,8 @@
"description": "The ID of the async operation.",
"required": true,
"schema": {
"type": "string"
"type": "string",
"format": "uuid"
}
}
],
Expand Down

0 comments on commit 546d460

Please sign in to comment.