Skip to content

Commit

Permalink
Update api spec (#576)
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 003f6db commit 0ec8b29
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 33 deletions.
10 changes: 5 additions & 5 deletions kittycad.rs.patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -1083,39 +1083,39 @@
"op": "add",
"path": "/paths/~1users-extended~1{id}/get/x-rust",
"value": {
"example": "/// Get extended information about a user.\n/// \n/// To get information about yourself, use `/users-extended/me` as the endpoint. By doing so you will get the user information for the authenticated user.\n/// \n/// Alternatively, to get information about the authenticated user, use `/user/extended` endpoint.\n/// \n/// To get information about any Zoo user, you must be a Zoo employee.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user ID. (required)\nasync fn example_users_get_extended() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ExtendedUser = client.users().get_extended(\"some-string\").await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Get extended information about a user.\n/// \n/// To get information about yourself, use `/users-extended/me` as the endpoint. By doing so you will get the user information for the authenticated user.\n/// \n/// Alternatively, to get information about the authenticated user, use `/user/extended` endpoint.\n/// \n/// To get information about any Zoo user, you must be a Zoo employee.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user's identifier (uuid or email). (required)\nasync fn example_users_get_extended() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ExtendedUser = client.users().get_extended(\"some-string\").await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/users/struct.Users.html#method.get_extended"
}
},
{
"op": "add",
"path": "/paths/~1users~1{id}/get/x-rust",
"value": {
"example": "/// Get a user.\n/// \n/// To get information about yourself, use `/users/me` as the endpoint. By doing so you will get the user information for the authenticated user.\n/// \n/// Alternatively, to get information about the authenticated user, use `/user` endpoint.\n/// \n/// To get information about any Zoo user, you must be a Zoo employee.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user ID. (required)\nasync fn example_users_get() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::User = client.users().get(\"some-string\").await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Get a user.\n/// \n/// To get information about yourself, use `/users/me` as the endpoint. By doing so you will get the user information for the authenticated user.\n/// \n/// Alternatively, to get information about the authenticated user, use `/user` endpoint.\n/// \n/// To get information about any Zoo user, you must be a Zoo employee.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user's identifier (uuid or email). (required)\nasync fn example_users_get() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::User = client.users().get(\"some-string\").await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/users/struct.Users.html#method.get"
}
},
{
"op": "add",
"path": "/paths/~1users~1{id}~1api-calls/get/x-rust",
"value": {
"example": "/// List API calls for a user.\n/// \n/// This endpoint requires authentication by any Zoo user. It returns the API calls for the authenticated user if \"me\" is passed as the user id.\n/// \n/// Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.\n/// \n/// If the authenticated user is a Zoo employee, then the API calls are returned for the user specified by the user id.\n/// \n/// The API calls are returned in order of creation, with the most recently created API calls first.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user ID. (required)\n/// - `limit: Option<u32>`: Maximum number of items returned by a single call\n/// - `page_token: Option<String>`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option<crate::types::CreatedAtSortMode>`\nasync fn example_api_calls_list_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ApiCallWithPriceResultsPage = client\n .api_calls()\n .list_for_user(\n \"some-string\",\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_api_calls_list_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut api_calls = client.api_calls();\n let mut stream = api_calls.list_for_user_stream(\n \"some-string\",\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",
"example": "/// List API calls for a user.\n/// \n/// This endpoint requires authentication by any Zoo user. It returns the API calls for the authenticated user if \"me\" is passed as the user id.\n/// \n/// Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.\n/// \n/// If the authenticated user is a Zoo employee, then the API calls are returned for the user specified by the user id.\n/// \n/// The API calls are returned in order of creation, with the most recently created API calls first.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user's identifier (uuid or email). (required)\n/// - `limit: Option<u32>`: Maximum number of items returned by a single call\n/// - `page_token: Option<String>`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option<crate::types::CreatedAtSortMode>`\nasync fn example_api_calls_list_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ApiCallWithPriceResultsPage = client\n .api_calls()\n .list_for_user(\n \"some-string\",\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_api_calls_list_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut api_calls = client.api_calls();\n let mut stream = api_calls.list_for_user_stream(\n \"some-string\",\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/api_calls/struct.ApiCalls.html#method.list_for_user"
}
},
{
"op": "add",
"path": "/paths/~1users~1{id}~1payment~1balance/get/x-rust",
"value": {
"example": "/// Get balance for an user.\n/// \n/// This endpoint requires authentication by a Zoo employee. It gets the balance information for the specified user.\n/// \n/// **Parameters:**\n/// \n/// - `id: uuid::Uuid`: The user ID. (required)\nuse std::str::FromStr;\nasync fn example_payments_get_balance_for_any_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::CustomerBalance = client\n .payments()\n .get_balance_for_any_user(uuid::Uuid::from_str(\n \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Get balance for an user.\n/// \n/// This endpoint requires authentication by a Zoo employee. It gets the balance information for the specified user.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user's identifier (uuid or email). (required)\nasync fn example_payments_get_balance_for_any_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::CustomerBalance = client\n .payments()\n .get_balance_for_any_user(\"some-string\")\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/payments/struct.Payments.html#method.get_balance_for_any_user"
}
},
{
"op": "add",
"path": "/paths/~1users~1{id}~1payment~1balance/put/x-rust",
"value": {
"example": "/// Update balance for an user.\n/// \n/// This endpoint requires authentication by a Zoo employee. It updates the balance information for the specified user.\n/// \n/// **Parameters:**\n/// \n/// - `id: uuid::Uuid`: The user ID. (required)\nuse std::str::FromStr;\nasync fn example_payments_update_balance_for_any_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::CustomerBalance = client\n .payments()\n .update_balance_for_any_user(\n uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n &kittycad::types::UpdatePaymentBalance {\n monthly_credits_remaining: Some(3.14 as f64),\n pre_pay_cash_remaining: Some(3.14 as f64),\n pre_pay_credits_remaining: Some(3.14 as f64),\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Update balance for an user.\n/// \n/// This endpoint requires authentication by a Zoo employee. It updates the balance information for the specified user.\n/// \n/// **Parameters:**\n/// \n/// - `id: &'astr`: The user's identifier (uuid or email). (required)\nasync fn example_payments_update_balance_for_any_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::CustomerBalance = client\n .payments()\n .update_balance_for_any_user(\n \"some-string\",\n &kittycad::types::UpdatePaymentBalance {\n monthly_credits_remaining: Some(3.14 as f64),\n pre_pay_cash_remaining: Some(3.14 as f64),\n pre_pay_credits_remaining: Some(3.14 as f64),\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/payments/struct.Payments.html#method.update_balance_for_any_user"
}
},
Expand Down
4 changes: 2 additions & 2 deletions kittycad/src/api_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ impl ApiCalls {
}
}

#[doc = "List API calls for a user.\n\nThis endpoint requires authentication by any Zoo user. It returns the API calls for the authenticated user if \"me\" is passed as the user id.\n\nAlternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.\n\nIf the authenticated user is a Zoo employee, then the API calls are returned for the user specified by the user id.\n\nThe API calls are returned in order of creation, with the most recently created API calls first.\n\n**Parameters:**\n\n- `id: &'astr`: The user ID. (required)\n- `limit: Option<u32>`: Maximum number of items returned by a single call\n- `page_token: Option<String>`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option<crate::types::CreatedAtSortMode>`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_api_calls_list_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut api_calls = client.api_calls();\n let mut stream = api_calls.list_for_user_stream(\n \"some-string\",\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```"]
#[doc = "List API calls for a user.\n\nThis endpoint requires authentication by any Zoo user. It returns the API calls for the authenticated user if \"me\" is passed as the user id.\n\nAlternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.\n\nIf the authenticated user is a Zoo employee, then the API calls are returned for the user specified by the user id.\n\nThe API calls are returned in order of creation, with the most recently created API calls first.\n\n**Parameters:**\n\n- `id: &'astr`: The user's identifier (uuid or email). (required)\n- `limit: Option<u32>`: Maximum number of items returned by a single call\n- `page_token: Option<String>`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option<crate::types::CreatedAtSortMode>`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_api_calls_list_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut api_calls = client.api_calls();\n let mut stream = api_calls.list_for_user_stream(\n \"some-string\",\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_for_user<'a>(
&'a self,
Expand Down Expand Up @@ -727,7 +727,7 @@ impl ApiCalls {
}
}

#[doc = "List API calls for a user.\n\nThis endpoint requires authentication by any Zoo user. It returns the API calls for the authenticated user if \"me\" is passed as the user id.\n\nAlternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.\n\nIf the authenticated user is a Zoo employee, then the API calls are returned for the user specified by the user id.\n\nThe API calls are returned in order of creation, with the most recently created API calls first.\n\n**Parameters:**\n\n- `id: &'astr`: The user ID. (required)\n- `limit: Option<u32>`: Maximum number of items returned by a single call\n- `page_token: Option<String>`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option<crate::types::CreatedAtSortMode>`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_api_calls_list_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut api_calls = client.api_calls();\n let mut stream = api_calls.list_for_user_stream(\n \"some-string\",\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```"]
#[doc = "List API calls for a user.\n\nThis endpoint requires authentication by any Zoo user. It returns the API calls for the authenticated user if \"me\" is passed as the user id.\n\nAlternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.\n\nIf the authenticated user is a Zoo employee, then the API calls are returned for the user specified by the user id.\n\nThe API calls are returned in order of creation, with the most recently created API calls first.\n\n**Parameters:**\n\n- `id: &'astr`: The user's identifier (uuid or email). (required)\n- `limit: Option<u32>`: Maximum number of items returned by a single call\n- `page_token: Option<String>`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option<crate::types::CreatedAtSortMode>`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_api_calls_list_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut api_calls = client.api_calls();\n let mut stream = api_calls.list_for_user_stream(\n \"some-string\",\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_for_user_stream<'a>(
Expand Down
Loading

0 comments on commit 0ec8b29

Please sign in to comment.