Skip to content

Commit

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

* Update generated code for v1171

* Update generated code for v1172

* Update generated code for v1173

* Update generated code for v1174

* Update generated code for v1175

* Update generated code for v1176

* Update generated code for v1177

* Update generated code for v1179

* Update generated code for v1180

* Update generated code for v1182

* Update generated code for v1183

* Update generated code for v1184

* Update generated code for v1186

* Update generated code for v1187

* Update generated code for v1188

* Update generated code for v1189

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
  • Loading branch information
stripe-openapi[bot] authored Aug 8, 2024
1 parent 9d05472 commit a0cf5db
Show file tree
Hide file tree
Showing 25 changed files with 1,063 additions and 735 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1169
v1189
14 changes: 7 additions & 7 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,11 +944,11 @@ type AccountSettingsInvoicesParams struct {

// Settings that apply across payment methods for charging on the account.
type AccountSettingsPaymentsParams struct {
// The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge.
// The default text that appears on statements for non-card charges outside of Japan. For card charges, if you don't set a `statement_descriptor_prefix`, this text is also used as the statement descriptor prefix. In that case, if concatenating the statement descriptor suffix causes the combined statement descriptor to exceed 22 characters, we truncate the `statement_descriptor` text to limit the full descriptor to 22 characters. For more information about statement descriptors and their requirements, see the [account settings documentation](https://docs.stripe.com/get-started/account/statement-descriptors).
StatementDescriptor *string `form:"statement_descriptor"`
// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only).
// The Kana variation of `statement_descriptor` used for charges in Japan. Japanese statement descriptors have [special requirements](https://docs.stripe.com/get-started/account/statement-descriptors#set-japanese-statement-descriptors).
StatementDescriptorKana *string `form:"statement_descriptor_kana"`
// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only).
// The Kanji variation of `statement_descriptor` used for charges in Japan. Japanese statement descriptors have [special requirements](https://docs.stripe.com/get-started/account/statement-descriptors#set-japanese-statement-descriptors).
StatementDescriptorKanji *string `form:"statement_descriptor_kanji"`
}

Expand Down Expand Up @@ -1476,13 +1476,13 @@ type AccountSettingsInvoices struct {
type AccountSettingsPayments struct {
// The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge.
StatementDescriptor string `json:"statement_descriptor"`
// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only)
// The Kana variation of `statement_descriptor` used for charges in Japan. Japanese statement descriptors have [special requirements](https://docs.stripe.com/get-started/account/statement-descriptors#set-japanese-statement-descriptors).
StatementDescriptorKana string `json:"statement_descriptor_kana"`
// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only)
// The Kanji variation of `statement_descriptor` used for charges in Japan. Japanese statement descriptors have [special requirements](https://docs.stripe.com/get-started/account/statement-descriptors#set-japanese-statement-descriptors).
StatementDescriptorKanji string `json:"statement_descriptor_kanji"`
// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion.
// The Kana variation of `statement_descriptor_prefix` used for card charges in Japan. Japanese statement descriptors have [special requirements](https://docs.stripe.com/get-started/account/statement-descriptors#set-japanese-statement-descriptors).
StatementDescriptorPrefixKana string `json:"statement_descriptor_prefix_kana"`
// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion.
// The Kanji variation of `statement_descriptor_prefix` used for card charges in Japan. Japanese statement descriptors have [special requirements](https://docs.stripe.com/get-started/account/statement-descriptors#set-japanese-statement-descriptors).
StatementDescriptorPrefixKanji string `json:"statement_descriptor_prefix_kanji"`
}
type AccountSettingsPayoutsSchedule struct {
Expand Down
128 changes: 128 additions & 0 deletions billing/alert/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package alert provides the /billing/alerts APIs
package alert

import (
"net/http"

stripe "github.com/stripe/stripe-go/v79"
"github.com/stripe/stripe-go/v79/form"
)

// Client is used to invoke /billing/alerts APIs.
type Client struct {
B stripe.Backend
Key string
}

// Creates a billing alert
func New(params *stripe.BillingAlertParams) (*stripe.BillingAlert, error) {
return getC().New(params)
}

// Creates a billing alert
func (c Client) New(params *stripe.BillingAlertParams) (*stripe.BillingAlert, error) {
alert := &stripe.BillingAlert{}
err := c.B.Call(http.MethodPost, "/v1/billing/alerts", c.Key, params, alert)
return alert, err
}

// Retrieves a billing alert given an ID
func Get(id string, params *stripe.BillingAlertParams) (*stripe.BillingAlert, error) {
return getC().Get(id, params)
}

// Retrieves a billing alert given an ID
func (c Client) Get(id string, params *stripe.BillingAlertParams) (*stripe.BillingAlert, error) {
path := stripe.FormatURLPath("/v1/billing/alerts/%s", id)
alert := &stripe.BillingAlert{}
err := c.B.Call(http.MethodGet, path, c.Key, params, alert)
return alert, err
}

// Reactivates this alert, allowing it to trigger again.
func Activate(id string, params *stripe.BillingAlertActivateParams) (*stripe.BillingAlert, error) {
return getC().Activate(id, params)
}

// Reactivates this alert, allowing it to trigger again.
func (c Client) Activate(id string, params *stripe.BillingAlertActivateParams) (*stripe.BillingAlert, error) {
path := stripe.FormatURLPath("/v1/billing/alerts/%s/activate", id)
alert := &stripe.BillingAlert{}
err := c.B.Call(http.MethodPost, path, c.Key, params, alert)
return alert, err
}

// Archives this alert, removing it from the list view and APIs. This is non-reversible.
func Archive(id string, params *stripe.BillingAlertArchiveParams) (*stripe.BillingAlert, error) {
return getC().Archive(id, params)
}

// Archives this alert, removing it from the list view and APIs. This is non-reversible.
func (c Client) Archive(id string, params *stripe.BillingAlertArchiveParams) (*stripe.BillingAlert, error) {
path := stripe.FormatURLPath("/v1/billing/alerts/%s/archive", id)
alert := &stripe.BillingAlert{}
err := c.B.Call(http.MethodPost, path, c.Key, params, alert)
return alert, err
}

// Deactivates this alert, preventing it from triggering.
func Deactivate(id string, params *stripe.BillingAlertDeactivateParams) (*stripe.BillingAlert, error) {
return getC().Deactivate(id, params)
}

// Deactivates this alert, preventing it from triggering.
func (c Client) Deactivate(id string, params *stripe.BillingAlertDeactivateParams) (*stripe.BillingAlert, error) {
path := stripe.FormatURLPath("/v1/billing/alerts/%s/deactivate", id)
alert := &stripe.BillingAlert{}
err := c.B.Call(http.MethodPost, path, c.Key, params, alert)
return alert, err
}

// Lists billing active and inactive alerts
func List(params *stripe.BillingAlertListParams) *Iter {
return getC().List(params)
}

// Lists billing active and inactive alerts
func (c Client) List(listParams *stripe.BillingAlertListParams) *Iter {
return &Iter{
Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {
list := &stripe.BillingAlertList{}
err := c.B.CallRaw(http.MethodGet, "/v1/billing/alerts", c.Key, b, p, list)

ret := make([]interface{}, len(list.Data))
for i, v := range list.Data {
ret[i] = v
}

return ret, list, err
}),
}
}

// Iter is an iterator for billing alerts.
type Iter struct {
*stripe.Iter
}

// BillingAlert returns the billing alert which the iterator is currently pointing to.
func (i *Iter) BillingAlert() *stripe.BillingAlert {
return i.Current().(*stripe.BillingAlert)
}

// BillingAlertList returns the current list object which the iterator is
// currently using. List objects will change as new API calls are made to
// continue pagination.
func (i *Iter) BillingAlertList() *stripe.BillingAlertList {
return i.List().(*stripe.BillingAlertList)
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}
96 changes: 96 additions & 0 deletions billing_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,94 @@ const (
BillingAlertUsageThresholdConfigRecurrenceOneTime BillingAlertUsageThresholdConfigRecurrence = "one_time"
)

// Lists billing active and inactive alerts
type BillingAlertListParams struct {
ListParams `form:"*"`
// Filter results to only include this type of alert.
AlertType *string `form:"alert_type"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
// Filter results to only include alerts with the given meter.
Meter *string `form:"meter"`
}

// AddExpand appends a new field to expand.
func (p *BillingAlertListParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// Filters to limit the scope of an alert.
type BillingAlertFilterParams struct {
// Limit the scope to this alert only to this customer.
Customer *string `form:"customer"`
}

// The configuration of the usage threshold.
type BillingAlertUsageThresholdConfigParams struct {
// Defines at which value the alert will fire.
GTE *int64 `form:"gte"`
// The [Billing Meter](https://stripe.com/api/billing/meter) ID whose usage is monitored.
Meter *string `form:"meter"`
// Whether the alert should only fire only once, or once per billing cycle.
Recurrence *string `form:"recurrence"`
}

// Creates a billing alert
type BillingAlertParams struct {
Params `form:"*"`
// The type of alert to create.
AlertType *string `form:"alert_type"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
// Filters to limit the scope of an alert.
Filter *BillingAlertFilterParams `form:"filter"`
// The title of the alert.
Title *string `form:"title"`
// The configuration of the usage threshold.
UsageThresholdConfig *BillingAlertUsageThresholdConfigParams `form:"usage_threshold_config"`
}

// AddExpand appends a new field to expand.
func (p *BillingAlertParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// Reactivates this alert, allowing it to trigger again.
type BillingAlertActivateParams struct {
Params `form:"*"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
}

// AddExpand appends a new field to expand.
func (p *BillingAlertActivateParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// Archives this alert, removing it from the list view and APIs. This is non-reversible.
type BillingAlertArchiveParams struct {
Params `form:"*"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
}

// AddExpand appends a new field to expand.
func (p *BillingAlertArchiveParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// Deactivates this alert, preventing it from triggering.
type BillingAlertDeactivateParams struct {
Params `form:"*"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
}

// AddExpand appends a new field to expand.
func (p *BillingAlertDeactivateParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// 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
Expand All @@ -50,6 +138,7 @@ type BillingAlertUsageThresholdConfig 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.
type BillingAlert struct {
APIResource
// 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).
Expand All @@ -67,3 +156,10 @@ type BillingAlert struct {
// 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"`
}

// BillingAlertList is a list of Alerts as retrieved from a list endpoint.
type BillingAlertList struct {
APIResource
ListMeta
Data []*BillingAlert `json:"data"`
}
6 changes: 3 additions & 3 deletions card.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
CardAvailablePayoutMethodStandard CardAvailablePayoutMethod = "standard"
)

// Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
// Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `Girocard`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
type CardBrand string

// List of values that CardBrand can take
Expand Down Expand Up @@ -315,11 +315,11 @@ type Card struct {
AddressZipCheck CardAddressZipCheck `json:"address_zip_check"`
// A set of available payout methods for this card. Only values from this set should be passed as the `method` when creating a payout.
AvailablePayoutMethods []CardAvailablePayoutMethod `json:"available_payout_methods"`
// Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
// Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `Girocard`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
Brand CardBrand `json:"brand"`
// Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
Country string `json:"country"`
// Three-letter [ISO code for currency](https://stripe.com/docs/payouts). Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.
// Three-letter [ISO code for currency](https://www.iso.org/iso-4217-currency-codes.html) in lowercase. Must be a [supported currency](https://docs.stripe.com/currencies). Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.
Currency Currency `json:"currency"`
// The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
Customer *Customer `json:"customer"`
Expand Down
Loading

0 comments on commit a0cf5db

Please sign in to comment.