Skip to content

Commit

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

* closes #215

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

* updates

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

---------

Signed-off-by: Jess Frazelle <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
jessfraz and github-actions[bot] authored Aug 1, 2023
1 parent 277183f commit b752dfb
Show file tree
Hide file tree
Showing 16 changed files with 1,682 additions and 879 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run make generate
run: |
make generate || true
make generate
shell: bash
env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
Expand Down
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.2.12
0.2.13
24 changes: 12 additions & 12 deletions kittycad.rs.patch.json

Large diffs are not rendered by default.

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.12"
version = "0.2.13"
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.12"
kittycad = "0.2.13"
```

## Basic example
Expand Down
82 changes: 70 additions & 12 deletions kittycad/src/file.rs

Large diffs are not rendered by default.

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.12"
//! kittycad = "0.2.13"
//! ```
//!
//! ## Basic example
Expand Down
4 changes: 2 additions & 2 deletions kittycad/src/modeling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl Modeling {
Self { client }
}

#[doc = "Submit one modeling operation.\n\nResponse depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.\n\n```rust,no_run\nuse std::str::FromStr;\nasync fn example_modeling_cmd() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: serde_json::Value = client\n .modeling()\n .cmd(&kittycad::types::ModelingCmdReq {\n cmd: kittycad::types::ModelingCmd::ModelingCmdCameraDragEnd(\n kittycad::types::ModelingCmdCameraDragEnd {\n camera_drag_end: kittycad::types::CameraDragEnd {\n interaction: kittycad::types::CameraDragInteractionType::Zoom,\n window: kittycad::types::Point2D {\n x: 3.14 as f64,\n y: 3.14 as f64,\n },\n },\n },\n ),\n cmd_id: uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n file_id: \"some-string\".to_string(),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[doc = "Submit one modeling operation.\n\nResponse depends on which command was submitted, so unfortunately the OpenAPI schema can't generate the right response type.\n\n```rust,no_run\nuse std::str::FromStr;\nasync fn example_modeling_cmd() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: serde_json::Value = client\n .modeling()\n .cmd(&kittycad::types::ModelingCmdReq {\n cmd: kittycad::types::ModelingCmd::ModelingCmdExport(kittycad::types::ModelingCmdExport {\n export: kittycad::types::Export {\n format: kittycad::types::OutputFormat::Gltf {\n storage: kittycad::types::Storage::Embedded,\n },\n },\n }),\n cmd_id: uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n file_id: \"some-string\".to_string(),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[tracing::instrument]
pub async fn cmd<'a>(
&'a self,
Expand All @@ -39,7 +39,7 @@ impl Modeling {
}
}

#[doc = "Submit many modeling operations.\n\n```rust,no_run\nuse std::str::FromStr;\nasync fn example_modeling_cmd_batch() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ModelingOutcomes = client\n .modeling()\n .cmd_batch(&kittycad::types::ModelingCmdReqBatch {\n cmds: std::collections::HashMap::from([(\n \"some-key\".to_string(),\n kittycad::types::ModelingCmdReq {\n cmd: kittycad::types::ModelingCmd::ModelingCmdCameraDragEnd(\n kittycad::types::ModelingCmdCameraDragEnd {\n camera_drag_end: kittycad::types::CameraDragEnd {\n interaction: kittycad::types::CameraDragInteractionType::Zoom,\n window: kittycad::types::Point2D {\n x: 3.14 as f64,\n y: 3.14 as f64,\n },\n },\n },\n ),\n cmd_id: uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n file_id: \"some-string\".to_string(),\n },\n )]),\n file_id: \"some-string\".to_string(),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[doc = "Submit many modeling operations.\n\n```rust,no_run\nuse std::str::FromStr;\nasync fn example_modeling_cmd_batch() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ModelingOutcomes = client\n .modeling()\n .cmd_batch(&kittycad::types::ModelingCmdReqBatch {\n cmds: std::collections::HashMap::from([(\n \"some-key\".to_string(),\n kittycad::types::ModelingCmdReq {\n cmd: kittycad::types::ModelingCmd::ModelingCmdExport(\n kittycad::types::ModelingCmdExport {\n export: kittycad::types::Export {\n format: kittycad::types::OutputFormat::Gltf {\n storage: kittycad::types::Storage::Embedded,\n },\n },\n },\n ),\n cmd_id: uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n file_id: \"some-string\".to_string(),\n },\n )]),\n file_id: \"some-string\".to_string(),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[tracing::instrument]
pub async fn cmd_batch<'a>(
&'a self,
Expand Down
6 changes: 5 additions & 1 deletion kittycad/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ async fn test_create_file_volume() {

let result = client
.file()
.create_volume(crate::types::FileImportFormat::Obj, &body.to_vec().into())
.create_volume(
Some(crate::types::UnitVolume::M3),
crate::types::FileImportFormat::Obj,
&body.to_vec().into(),
)
.await
.unwrap();

Expand Down
Loading

0 comments on commit b752dfb

Please sign in to comment.