Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update api spec #579

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kittycad.rs.patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,15 @@
"op": "add",
"path": "/paths/~1org~1payment~1subscriptions/post/x-rust",
"value": {
"example": "/// Create the subscription for an org.\n/// \n/// This endpoint requires authentication by an org admin. It creates the subscription for the authenticated user's org.\nasync fn example_payments_create_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Create the subscription for an org.\n/// \n/// This endpoint requires authentication by an org admin. It creates the subscription for the authenticated user's org.\nasync fn example_payments_create_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/payments/struct.Payments.html#method.create_org_subscription"
}
},
{
"op": "add",
"path": "/paths/~1org~1payment~1subscriptions/put/x-rust",
"value": {
"example": "/// Update the subscription for an org.\n/// \n/// This endpoint requires authentication by an org admin. It updates the subscription for the authenticated user's org.\nasync fn example_payments_update_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Update the subscription for an org.\n/// \n/// This endpoint requires authentication by an org admin. It updates the subscription for the authenticated user's org.\nasync fn example_payments_update_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/payments/struct.Payments.html#method.update_org_subscription"
}
},
Expand Down Expand Up @@ -955,15 +955,15 @@
"op": "add",
"path": "/paths/~1user~1payment~1subscriptions/post/x-rust",
"value": {
"example": "/// Create the subscription for a user.\n/// \n/// This endpoint requires authentication by any Zoo user. It creates the subscription for the user.\nasync fn example_payments_create_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Create the subscription for a user.\n/// \n/// This endpoint requires authentication by any Zoo user. It creates the subscription for the user.\nasync fn example_payments_create_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/payments/struct.Payments.html#method.create_user_subscription"
}
},
{
"op": "add",
"path": "/paths/~1user~1payment~1subscriptions/put/x-rust",
"value": {
"example": "/// Update the user's subscription.\n/// \n/// This endpoint requires authentication by any Zoo user. It updates the subscription for the user.\nasync fn example_payments_update_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Update the user's subscription.\n/// \n/// This endpoint requires authentication by any Zoo user. It updates the subscription for the user.\nasync fn example_payments_update_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"libDocsLink": "https://docs.rs/kittycad/latest/kittycad/payments/struct.Payments.html#method.update_user_subscription"
}
},
Expand Down
8 changes: 4 additions & 4 deletions kittycad/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl Payments {
}
}

#[doc = "Update the subscription for an org.\n\nThis endpoint requires authentication by an org admin. It updates the subscription for the authenticated user's org.\n\n```rust,no_run\nasync fn example_payments_update_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[doc = "Update the subscription for an org.\n\nThis endpoint requires authentication by an org admin. It updates the subscription for the authenticated user's org.\n\n```rust,no_run\nasync fn example_payments_update_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[tracing::instrument]
pub async fn update_org_subscription<'a>(
&'a self,
Expand Down Expand Up @@ -385,7 +385,7 @@ impl Payments {
}
}

#[doc = "Create the subscription for an org.\n\nThis endpoint requires authentication by an org admin. It creates the subscription for the authenticated user's org.\n\n```rust,no_run\nasync fn example_payments_create_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[doc = "Create the subscription for an org.\n\nThis endpoint requires authentication by an org admin. It creates the subscription for the authenticated user's org.\n\n```rust,no_run\nasync fn example_payments_create_org_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_org_subscription(&kittycad::types::ZooProductSubscriptionsOrgRequest {\n modeling_app: Some(kittycad::types::ModelingAppOrganizationSubscriptionTier::Enterprise),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[tracing::instrument]
pub async fn create_org_subscription<'a>(
&'a self,
Expand Down Expand Up @@ -847,7 +847,7 @@ impl Payments {
}
}

#[doc = "Update the user's subscription.\n\nThis endpoint requires authentication by any Zoo user. It updates the subscription for the user.\n\n```rust,no_run\nasync fn example_payments_update_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[doc = "Update the user's subscription.\n\nThis endpoint requires authentication by any Zoo user. It updates the subscription for the user.\n\n```rust,no_run\nasync fn example_payments_update_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .update_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[tracing::instrument]
pub async fn update_user_subscription<'a>(
&'a self,
Expand Down Expand Up @@ -878,7 +878,7 @@ impl Payments {
}
}

#[doc = "Create the subscription for a user.\n\nThis endpoint requires authentication by any Zoo user. It creates the subscription for the user.\n\n```rust,no_run\nasync fn example_payments_create_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[doc = "Create the subscription for a user.\n\nThis endpoint requires authentication by any Zoo user. It creates the subscription for the user.\n\n```rust,no_run\nasync fn example_payments_create_user_subscription() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::ZooProductSubscriptions = client\n .payments()\n .create_user_subscription(&kittycad::types::ZooProductSubscriptionsUserRequest {\n modeling_app: Some(kittycad::types::ModelingAppIndividualSubscriptionTier::Pro),\n pay_annually: Some(false),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[tracing::instrument]
pub async fn create_user_subscription<'a>(
&'a self,
Expand Down
72 changes: 56 additions & 16 deletions kittycad/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9355,6 +9355,9 @@ pub enum ModelingAppShareLinks {
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ModelingAppSubscriptionTier {
#[doc = "Annual discount. The percentage off the monthly price if the user pays annually."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub annual_discount: Option<u32>,
#[doc = "A description of the tier."]
pub description: String,
#[doc = "Features that are included in the subscription."]
Expand Down Expand Up @@ -9396,9 +9399,14 @@ impl std::fmt::Display for ModelingAppSubscriptionTier {

#[cfg(feature = "tabled")]
impl tabled::Tabled for ModelingAppSubscriptionTier {
const LENGTH: usize = 10;
const LENGTH: usize = 11;
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
vec![
if let Some(annual_discount) = &self.annual_discount {
format!("{:?}", annual_discount).into()
} else {
String::new().into()
},
self.description.clone().into(),
if let Some(features) = &self.features {
format!("{:?}", features).into()
Expand Down Expand Up @@ -9426,6 +9434,7 @@ impl tabled::Tabled for ModelingAppSubscriptionTier {

fn headers() -> Vec<std::borrow::Cow<'static, str>> {
vec![
"annual_discount".into(),
"description".into(),
"features".into(),
"name".into(),
Expand Down Expand Up @@ -18585,6 +18594,9 @@ impl tabled::Tabled for WebSocketResponse {
serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
)]
pub struct ZooProductSubscription {
#[doc = "Annual discount. The percentage off the monthly price if the user pays annually."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub annual_discount: Option<u32>,
#[doc = "A description of the tier."]
pub description: String,
#[doc = "Features that are included in the subscription."]
Expand Down Expand Up @@ -18626,9 +18638,14 @@ impl std::fmt::Display for ZooProductSubscription {

#[cfg(feature = "tabled")]
impl tabled::Tabled for ZooProductSubscription {
const LENGTH: usize = 10;
const LENGTH: usize = 11;
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
vec![
if let Some(annual_discount) = &self.annual_discount {
format!("{:?}", annual_discount).into()
} else {
String::new().into()
},
self.description.clone().into(),
if let Some(features) = &self.features {
format!("{:?}", features).into()
Expand Down Expand Up @@ -18656,6 +18673,7 @@ impl tabled::Tabled for ZooProductSubscription {

fn headers() -> Vec<std::borrow::Cow<'static, str>> {
vec![
"annual_discount".into(),
"description".into(),
"features".into(),
"name".into(),
Expand Down Expand Up @@ -18709,6 +18727,10 @@ pub struct ZooProductSubscriptionsOrgRequest {
#[doc = "A modeling app subscription."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub modeling_app: Option<ModelingAppOrganizationSubscriptionTier>,
#[doc = "If the customer chooses to pay annually or monthly, we can add that here. The annual \
discount will apply if there is a discount for the subscription."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pay_annually: Option<bool>,
}

impl std::fmt::Display for ZooProductSubscriptionsOrgRequest {
Expand All @@ -18723,17 +18745,24 @@ impl std::fmt::Display for ZooProductSubscriptionsOrgRequest {

#[cfg(feature = "tabled")]
impl tabled::Tabled for ZooProductSubscriptionsOrgRequest {
const LENGTH: usize = 1;
const LENGTH: usize = 2;
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
vec![if let Some(modeling_app) = &self.modeling_app {
format!("{:?}", modeling_app).into()
} else {
String::new().into()
}]
vec![
if let Some(modeling_app) = &self.modeling_app {
format!("{:?}", modeling_app).into()
} else {
String::new().into()
},
if let Some(pay_annually) = &self.pay_annually {
format!("{:?}", pay_annually).into()
} else {
String::new().into()
},
]
}

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

Expand All @@ -18745,6 +18774,10 @@ pub struct ZooProductSubscriptionsUserRequest {
#[doc = "A modeling app subscription."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub modeling_app: Option<ModelingAppIndividualSubscriptionTier>,
#[doc = "If the customer chooses to pay annually or monthly, we can add that here. The annual \
discount will apply if there is a discount for the subscription."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pay_annually: Option<bool>,
}

impl std::fmt::Display for ZooProductSubscriptionsUserRequest {
Expand All @@ -18759,17 +18792,24 @@ impl std::fmt::Display for ZooProductSubscriptionsUserRequest {

#[cfg(feature = "tabled")]
impl tabled::Tabled for ZooProductSubscriptionsUserRequest {
const LENGTH: usize = 1;
const LENGTH: usize = 2;
fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
vec![if let Some(modeling_app) = &self.modeling_app {
format!("{:?}", modeling_app).into()
} else {
String::new().into()
}]
vec![
if let Some(modeling_app) = &self.modeling_app {
format!("{:?}", modeling_app).into()
} else {
String::new().into()
},
if let Some(pay_annually) = &self.pay_annually {
format!("{:?}", pay_annually).into()
} else {
String::new().into()
},
]
}

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

Expand Down
Loading