Skip to content

Commit

Permalink
Update generated code (#1897)
Browse files Browse the repository at this point in the history
* Update generated code for v1157

* Update generated code for v1158

* Update generated code for v1159

* Update generated code for v1160

* Update generated code for v1162

* Update generated code for v1163

* Update generated code for v1166

* Update generated code for v1167

* Update generated code for v1169

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <[email protected]>
  • Loading branch information
stripe-openapi[bot] and prathmesh-stripe authored Aug 1, 2024
1 parent cc5e657 commit c152a51
Show file tree
Hide file tree
Showing 13 changed files with 576 additions and 52 deletions.
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

0 comments on commit c152a51

Please sign in to comment.