forked from arlyon/async-stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate latest changes from OpenApi spec
- Loading branch information
Showing
5 changed files
with
142 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "v751" | ||
"version": "v755" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// ====================================== | ||
// This file was automatically generated. | ||
// ====================================== | ||
|
||
use crate::client::{Client, Response}; | ||
use crate::ids::{CustomerId}; | ||
use crate::params::{Expand, Expandable, Object, Timestamp}; | ||
use crate::resources::{Customer}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// The resource representing a Stripe "CustomerSessionResourceCustomerSession". | ||
#[derive(Clone, Debug, Default, Deserialize, Serialize)] | ||
pub struct CustomerSession { | ||
|
||
/// The client secret of this customer session. | ||
/// | ||
/// Used on the client to set up secure access to the given `customer`. The client secret can be used to provide access to `customer` from your frontend. | ||
/// It should not be stored, logged, or exposed to anyone other than the relevant customer. | ||
/// Make sure that you have TLS enabled on any page that includes the client secret. | ||
pub client_secret: String, | ||
|
||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub components: Option<CustomerSessionResourceComponents>, | ||
|
||
/// Time at which the object was created. | ||
/// | ||
/// Measured in seconds since the Unix epoch. | ||
pub created: Timestamp, | ||
|
||
/// The customer the customer session was created for. | ||
pub customer: Expandable<Customer>, | ||
|
||
/// The timestamp at which this customer session will expire. | ||
pub expires_at: Timestamp, | ||
|
||
/// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. | ||
pub livemode: bool, | ||
} | ||
|
||
impl CustomerSession { | ||
|
||
/// Creates a customer session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources. | ||
pub fn create(client: &Client, params: CreateCustomerSession<'_>) -> Response<CustomerSession> { | ||
client.post_form("/customer_sessions", ¶ms) | ||
} | ||
} | ||
|
||
impl Object for CustomerSession { | ||
type Id = (); | ||
fn id(&self) -> Self::Id {} | ||
fn object(&self) -> &'static str { | ||
"customer_session" | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, Default, Deserialize, Serialize)] | ||
pub struct CustomerSessionResourceComponents { | ||
|
||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub buy_button: Option<CustomerSessionResourceComponentsResourceBuyButton>, | ||
|
||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub pricing_table: Option<CustomerSessionResourceComponentsResourcePricingTable>, | ||
} | ||
|
||
#[derive(Clone, Debug, Default, Deserialize, Serialize)] | ||
pub struct CustomerSessionResourceComponentsResourceBuyButton { | ||
|
||
/// Whether the buy button is enabled. | ||
pub enabled: bool, | ||
} | ||
|
||
#[derive(Clone, Debug, Default, Deserialize, Serialize)] | ||
pub struct CustomerSessionResourceComponentsResourcePricingTable { | ||
|
||
/// Whether the pricing table is enabled. | ||
pub enabled: bool, | ||
} | ||
|
||
/// The parameters for `CustomerSession::create`. | ||
#[derive(Clone, Debug, Serialize)] | ||
pub struct CreateCustomerSession<'a> { | ||
|
||
/// Configuration for each component. | ||
/// | ||
/// 1 component must be enabled. | ||
pub components: CreateCustomerSessionComponents, | ||
|
||
/// The ID of an existing customer for which to create the customer session. | ||
pub customer: CustomerId, | ||
|
||
/// Specifies which fields in the response should be expanded. | ||
#[serde(skip_serializing_if = "Expand::is_empty")] | ||
pub expand: &'a [&'a str], | ||
} | ||
|
||
impl<'a> CreateCustomerSession<'a> { | ||
pub fn new(components: CreateCustomerSessionComponents, customer: CustomerId) -> Self { | ||
CreateCustomerSession { | ||
components, | ||
customer, | ||
expand: Default::default(), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, Default, Deserialize, Serialize)] | ||
pub struct CreateCustomerSessionComponents { | ||
|
||
/// Configuration for buy button. | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub buy_button: Option<CreateCustomerSessionComponentsBuyButton>, | ||
|
||
/// Configuration for the pricing table. | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub pricing_table: Option<CreateCustomerSessionComponentsPricingTable>, | ||
} | ||
|
||
#[derive(Clone, Debug, Default, Deserialize, Serialize)] | ||
pub struct CreateCustomerSessionComponentsBuyButton { | ||
|
||
/// Whether the buy button is enabled. | ||
pub enabled: bool, | ||
} | ||
|
||
#[derive(Clone, Debug, Default, Deserialize, Serialize)] | ||
pub struct CreateCustomerSessionComponentsPricingTable { | ||
|
||
/// Whether the pricing table is enabled. | ||
pub enabled: bool, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters