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

Implement Expandable::into_id #536

Merged
merged 1 commit into from
May 4, 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ they stay up to date, preventing errors error deserialization errors like (https
- The main user-facing change will be `StripeError::Stripe(RequestError)` -> `StripeError::Stripe(ApiErrors, StatusCode)` since the autogenerated `ApiErrors`
does not include the status code.
- The `id` method on `Expandable<T>` now returns a reference: `&T::Id`. All id types implement `Clone` so
to achieve the previous behavior, use `.id().clone()`.
to achieve the previous behavior, use `.id().clone()`. You can also obtain the id without cloning by consuming an `Expandable<T>` with `into_id`.
- `*Id` types no longer derive `default`. The previous default was an empty string, which will never be a valid id
- Removed the `AsRef<str>` implementation for enums, use `as_str` instead.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,9 @@ impl stripe_types::Object for BillingPortalConfiguration {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(BillingPortalConfigurationId);
4 changes: 4 additions & 0 deletions generated/stripe_billing/src/billing_portal_session/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ impl stripe_types::Object for BillingPortalSession {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(BillingPortalSessionId);
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,9 @@ impl stripe_types::Object for PortalFlowsSubscriptionUpdateConfirmItem {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(PortalFlowsSubscriptionUpdateConfirmItemId);
4 changes: 4 additions & 0 deletions generated/stripe_billing/src/usage_record/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,9 @@ impl stripe_types::Object for UsageRecord {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(UsageRecordId);
4 changes: 4 additions & 0 deletions generated/stripe_checkout/src/checkout_session/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,10 @@ impl stripe_types::Object for CheckoutSession {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(CheckoutSessionId);
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down
4 changes: 4 additions & 0 deletions generated/stripe_connect/src/apps_secret/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,9 @@ impl stripe_types::Object for AppsSecret {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(AppsSecretId);
4 changes: 4 additions & 0 deletions generated/stripe_connect/src/country_spec/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,9 @@ impl stripe_types::Object for CountrySpec {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(CountrySpecId);
4 changes: 4 additions & 0 deletions generated/stripe_core/src/token/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,9 @@ impl stripe_types::Object for Token {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(TokenId);
4 changes: 4 additions & 0 deletions generated/stripe_fraud/src/deleted_radar_value_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@ impl stripe_types::Object for DeletedRadarValueList {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
4 changes: 4 additions & 0 deletions generated/stripe_fraud/src/deleted_radar_value_list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@ impl stripe_types::Object for DeletedRadarValueListItem {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
4 changes: 4 additions & 0 deletions generated/stripe_fraud/src/radar_early_fraud_warning/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,9 @@ impl stripe_types::Object for RadarEarlyFraudWarning {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(RadarEarlyFraudWarningId);
4 changes: 4 additions & 0 deletions generated/stripe_fraud/src/radar_value_list/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ impl stripe_types::Object for RadarValueList {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(RadarValueListId);
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down
4 changes: 4 additions & 0 deletions generated/stripe_fraud/src/radar_value_list_item/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,9 @@ impl stripe_types::Object for RadarValueListItem {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(RadarValueListItemId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/apple_pay_domain/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,9 @@ impl stripe_types::Object for ApplePayDomain {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ApplePayDomainId);
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,9 @@ impl stripe_types::Object for BankConnectionsResourceTransactionRefresh {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(BankConnectionsResourceTransactionRefreshId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/climate_order/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,5 +436,9 @@ impl stripe_types::Object for ClimateOrder {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ClimateOrderId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/climate_product/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,9 @@ impl stripe_types::Object for ClimateProduct {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ClimateProductId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/climate_supplier/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,9 @@ impl stripe_types::Object for ClimateSupplier {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ClimateSupplierId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/deleted_apple_pay_domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@ impl stripe_types::Object for DeletedApplePayDomain {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/deleted_webhook_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@ impl stripe_types::Object for DeletedWebhookEndpoint {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/ephemeral_key/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,9 @@ impl stripe_types::Object for EphemeralKey {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(EphemeralKeyId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/exchange_rate/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,9 @@ impl stripe_types::Object for ExchangeRate {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ExchangeRateId);
Original file line number Diff line number Diff line change
Expand Up @@ -755,5 +755,9 @@ impl stripe_types::Object for FinancialConnectionsAccount {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(FinancialConnectionsAccountId);
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,9 @@ impl stripe_types::Object for FinancialConnectionsAccountOwner {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(FinancialConnectionsAccountOwnerId);
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,9 @@ impl stripe_types::Object for FinancialConnectionsAccountOwnership {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(FinancialConnectionsAccountOwnershipId);
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ impl stripe_types::Object for FinancialConnectionsSession {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(FinancialConnectionsSessionId);
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,9 @@ impl stripe_types::Object for FinancialConnectionsTransaction {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(FinancialConnectionsTransactionId);
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ impl stripe_types::Object for IdentityVerificationReport {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(IdentityVerificationReportId);
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ impl stripe_types::Object for IdentityVerificationSession {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(IdentityVerificationSessionId);
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/reporting_report_run/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,9 @@ impl stripe_types::Object for ReportingReportRun {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ReportingReportRunId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/reporting_report_type/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,9 @@ impl stripe_types::Object for ReportingReportType {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ReportingReportTypeId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/scheduled_query_run/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,9 @@ impl stripe_types::Object for ScheduledQueryRun {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(ScheduledQueryRunId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/tax_calculation/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,9 @@ impl stripe_types::Object for TaxCalculation {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(TaxCalculationId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/tax_calculation_line_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,9 @@ impl stripe_types::Object for TaxCalculationLineItem {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(TaxCalculationLineItemId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/tax_registration/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,9 @@ impl stripe_types::Object for TaxRegistration {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(TaxRegistrationId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/tax_transaction/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,5 +284,9 @@ impl stripe_types::Object for TaxTransaction {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(TaxTransactionId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/tax_transaction_line_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,9 @@ impl stripe_types::Object for TaxTransactionLineItem {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(TaxTransactionLineItemId);
4 changes: 4 additions & 0 deletions generated/stripe_misc/src/webhook_endpoint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,9 @@ impl stripe_types::Object for WebhookEndpoint {
fn id(&self) -> &Self::Id {
&self.id
}

fn into_id(self) -> Self::Id {
self.id
}
}
stripe_types::def_id!(WebhookEndpointId);
Loading
Loading