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 generated code #1897

Merged
merged 10 commits into from
Aug 1, 2024
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1155
v1169
69 changes: 69 additions & 0 deletions billing_alert.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
//
// File generated from our OpenAPI spec
//
//

package stripe

// Defines the type of the alert.
type BillingAlertAlertType string

// List of values that BillingAlertAlertType can take
const (
BillingAlertAlertTypeUsageThreshold BillingAlertAlertType = "usage_threshold"
)

// Status of the alert. This can be active, inactive or archived.
type BillingAlertStatus string

// List of values that BillingAlertStatus can take
const (
BillingAlertStatusActive BillingAlertStatus = "active"
BillingAlertStatusArchived BillingAlertStatus = "archived"
BillingAlertStatusInactive BillingAlertStatus = "inactive"
)

// Defines how the alert will behave.
type BillingAlertUsageThresholdConfigRecurrence string

// List of values that BillingAlertUsageThresholdConfigRecurrence can take
const (
BillingAlertUsageThresholdConfigRecurrenceOneTime BillingAlertUsageThresholdConfigRecurrence = "one_time"
)

// Limits the scope of the alert to a specific [customer](https://stripe.com/docs/api/customers).
type BillingAlertFilter struct {
// Limit the scope of the alert to this customer ID
Customer *Customer `json:"customer"`
}

// Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://stripe.com/docs/api/billing/meter).
type BillingAlertUsageThresholdConfig struct {
// The value at which this alert will trigger.
GTE int64 `json:"gte"`
// The [Billing Meter](https://stripe.com/api/billing/meter) ID whose usage is monitored.
Meter *BillingMeter `json:"meter"`
// Defines how the alert will behave.
Recurrence BillingAlertUsageThresholdConfigRecurrence `json:"recurrence"`
}

// A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
type BillingAlert struct {
// Defines the type of the alert.
AlertType BillingAlertAlertType `json:"alert_type"`
// Limits the scope of the alert to a specific [customer](https://stripe.com/docs/api/customers).
Filter *BillingAlertFilter `json:"filter"`
// Unique identifier for the object.
ID string `json:"id"`
// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Livemode bool `json:"livemode"`
// String representing the object's type. Objects of the same type share the same value.
Object string `json:"object"`
// Status of the alert. This can be active, inactive or archived.
Status BillingAlertStatus `json:"status"`
// Title of the alert.
Title string `json:"title"`
// Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://stripe.com/docs/api/billing/meter).
UsageThresholdConfig *BillingAlertUsageThresholdConfig `json:"usage_threshold_config"`
}
22 changes: 22 additions & 0 deletions billing_alerttriggered.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
//
// File generated from our OpenAPI spec
//
//

package stripe

type BillingAlertTriggered struct {
// A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
Alert *BillingAlert `json:"alert"`
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created int64 `json:"created"`
// ID of customer for which the alert triggered
Customer string `json:"customer"`
// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Livemode bool `json:"livemode"`
// String representing the object's type. Objects of the same type share the same value.
Object string `json:"object"`
// The value triggering the alert
Value int64 `json:"value"`
}
21 changes: 21 additions & 0 deletions billing_meter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package stripe

import "encoding/json"

// The method for mapping a meter event to a customer.
type BillingMeterCustomerMappingType string

Expand Down Expand Up @@ -175,3 +177,22 @@ type BillingMeterList struct {
ListMeta
Data []*BillingMeter `json:"data"`
}

// UnmarshalJSON handles deserialization of a BillingMeter.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (b *BillingMeter) UnmarshalJSON(data []byte) error {
if id, ok := ParseID(data); ok {
b.ID = id
return nil
}

type billingMeter BillingMeter
var v billingMeter
if err := json.Unmarshal(data, &v); err != nil {
return err
}

*b = BillingMeter(v)
return nil
}
4 changes: 1 addition & 3 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,6 @@ type ChargePaymentMethodDetailsCardWallet struct {
type ChargePaymentMethodDetailsCard struct {
// The authorized amount.
AmountAuthorized int64 `json:"amount_authorized"`
// Authorization code on the charge.
AuthorizationCode string `json:"authorization_code"`
// Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
Brand PaymentMethodCardBrand `json:"brand"`
// When using manual capture, a future timestamp at which the charge will be automatically refunded if uncaptured.
Expand Down Expand Up @@ -1309,7 +1307,7 @@ type Charge struct {
// ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes).
BalanceTransaction *BalanceTransaction `json:"balance_transaction"`
BillingDetails *ChargeBillingDetails `json:"billing_details"`
// The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined.
// The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined. This only works for card payments.
CalculatedStatementDescriptor string `json:"calculated_statement_descriptor"`
// If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured.
Captured bool `json:"captured"`
Expand Down
Loading
Loading