From ae8eb02fa71b2d4203e48a5dae295ddeec6cb9ef Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Fri, 20 Oct 2023 16:41:01 -0700 Subject: [PATCH] Update api spec (#265) * YOYO NEW API SPEC! * I have generated the library! --------- Co-authored-by: github-actions[bot] --- kittycad.rs.patch.json | 2 +- kittycad/src/ai.rs | 12 +++--------- spec.json | 9 --------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/kittycad.rs.patch.json b/kittycad.rs.patch.json index 59405b4c..33b7d019 100644 --- a/kittycad.rs.patch.json +++ b/kittycad.rs.patch.json @@ -547,7 +547,7 @@ "op": "add", "path": "/paths/~1user~1text-to-cad/get/x-rust", "value": { - "example": "/// List text-to-CAD models you've generated.\n/// \n/// This will always return the STEP file contents as well as the format the user originally requested.\n/// This endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.\n/// The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.\n/// \n/// **Parameters:**\n/// \n/// - `limit: Option`: Maximum number of items returned by a single call\n/// - `no_contents: Option`: Do not return the model contents only return the metadata. By default, the model contents are returned.\n/// - `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option`\nasync fn example_ai_list_text_to_cad_models_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadResultsPage = client\n .ai()\n .list_text_to_cad_models_for_user(\n Some(4 as u32),\n Some(false),\n Some(\"some-string\".to_string()),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n\n\n/// - OR -\n\n/// Get a stream of results.\n///\n/// This allows you to paginate through all the items.\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_text_to_cad_models_for_user_stream(\n Some(4 as u32),\n Some(false),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n );\n loop {\n match stream.try_next().await {\n Ok(Some(item)) => {\n println!(\"{:?}\", item);\n }\n Ok(None) => {\n break;\n }\n Err(err) => {\n return Err(err.into());\n }\n }\n }\n\n Ok(())\n}\n", + "example": "/// List text-to-CAD models you've generated.\n/// \n/// This will always return the STEP file contents as well as the format the user originally requested.\n/// This endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.\n/// The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.\n/// \n/// **Parameters:**\n/// \n/// - `limit: Option`: Maximum number of items returned by a single call\n/// - `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option`\nasync fn example_ai_list_text_to_cad_models_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadResultsPage = client\n .ai()\n .list_text_to_cad_models_for_user(\n Some(4 as u32),\n Some(\"some-string\".to_string()),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n\n\n/// - OR -\n\n/// Get a stream of results.\n///\n/// This allows you to paginate through all the items.\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_text_to_cad_models_for_user_stream(\n Some(4 as u32),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n );\n loop {\n match stream.try_next().await {\n Ok(Some(item)) => {\n println!(\"{:?}\", item);\n }\n Ok(None) => {\n break;\n }\n Err(err) => {\n return Err(err.into());\n }\n }\n }\n\n Ok(())\n}\n", "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.list_text_to_cad_models_for_user" } }, diff --git a/kittycad/src/ai.rs b/kittycad/src/ai.rs index 520be7d5..ff663150 100644 --- a/kittycad/src/ai.rs +++ b/kittycad/src/ai.rs @@ -49,12 +49,11 @@ impl Ai { } } - #[doc = "List text-to-CAD models you've generated.\n\nThis will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.\nThe text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `no_contents: Option`: Do not return the model contents only return the metadata. By default, the model contents are returned.\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_text_to_cad_models_for_user_stream(\n Some(4 as u32),\n Some(false),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n );\n loop {\n match stream.try_next().await {\n Ok(Some(item)) => {\n println!(\"{:?}\", item);\n }\n Ok(None) => {\n break;\n }\n Err(err) => {\n return Err(err.into());\n }\n }\n }\n\n Ok(())\n}\n```"] + #[doc = "List text-to-CAD models you've generated.\n\nThis will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.\nThe text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_text_to_cad_models_for_user_stream(\n Some(4 as u32),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n );\n loop {\n match stream.try_next().await {\n Ok(Some(item)) => {\n println!(\"{:?}\", item);\n }\n Ok(None) => {\n break;\n }\n Err(err) => {\n return Err(err.into());\n }\n }\n }\n\n Ok(())\n}\n```"] #[tracing::instrument] pub async fn list_text_to_cad_models_for_user<'a>( &'a self, limit: Option, - no_contents: Option, page_token: Option, sort_by: Option, ) -> Result { @@ -68,10 +67,6 @@ impl Ai { query_params.push(("limit", format!("{}", p))); } - if let Some(p) = no_contents { - query_params.push(("no_contents", format!("{}", p))); - } - if let Some(p) = page_token { query_params.push(("page_token", p)); } @@ -100,13 +95,12 @@ impl Ai { } } - #[doc = "List text-to-CAD models you've generated.\n\nThis will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.\nThe text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `no_contents: Option`: Do not return the model contents only return the metadata. By default, the model contents are returned.\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_text_to_cad_models_for_user_stream(\n Some(4 as u32),\n Some(false),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n );\n loop {\n match stream.try_next().await {\n Ok(Some(item)) => {\n println!(\"{:?}\", item);\n }\n Ok(None) => {\n break;\n }\n Err(err) => {\n return Err(err.into());\n }\n }\n }\n\n Ok(())\n}\n```"] + #[doc = "List text-to-CAD models you've generated.\n\nThis will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by any KittyCAD user. It returns the text-to-CAD models for the authenticated user.\nThe text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_text_to_cad_models_for_user_stream(\n Some(4 as u32),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n );\n loop {\n match stream.try_next().await {\n Ok(Some(item)) => {\n println!(\"{:?}\", item);\n }\n Ok(None) => {\n break;\n }\n Err(err) => {\n return Err(err.into());\n }\n }\n }\n\n Ok(())\n}\n```"] #[tracing::instrument] #[cfg(not(feature = "js"))] pub fn list_text_to_cad_models_for_user_stream<'a>( &'a self, limit: Option, - no_contents: Option, sort_by: Option, ) -> impl futures::Stream> + Unpin @@ -114,7 +108,7 @@ impl Ai { use futures::{StreamExt, TryFutureExt, TryStreamExt}; use crate::types::paginate::Pagination; - self.list_text_to_cad_models_for_user(limit, no_contents, None, sort_by) + self.list_text_to_cad_models_for_user(limit, None, sort_by) .map_ok(move |result| { let items = futures::stream::iter(result.items().into_iter().map(Ok)); let next_pages = diff --git a/spec.json b/spec.json index ef31eac6..93ddd10d 100644 --- a/spec.json +++ b/spec.json @@ -6330,15 +6330,6 @@ "minimum": 1 } }, - { - "in": "query", - "name": "no_contents", - "description": "Do not return the model contents only return the metadata. By default, the model contents are returned.", - "schema": { - "nullable": true, - "type": "boolean" - } - }, { "in": "query", "name": "page_token",