Skip to content

Commit

Permalink
Merge pull request #536 from mzeitlin11/expandable_into_id
Browse files Browse the repository at this point in the history
Implement Expandable::into_id
  • Loading branch information
mzeitlin11 committed May 4, 2024
2 parents 020065b + fe4d659 commit 4f29e69
Show file tree
Hide file tree
Showing 146 changed files with 626 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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);
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
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
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
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
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
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
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
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);
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);
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);
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);
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
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);
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
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
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
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
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
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
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
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
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
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
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);

0 comments on commit 4f29e69

Please sign in to comment.