From 9ae0d4390c3a2410660ff1e9f01afa7111b58dae Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 20 Jul 2021 20:25:05 -0400 Subject: [PATCH] Codegen for openapi adfc63f --- charge/client.go | 32 +++++++++++-------- issuing_transaction.go | 11 +++++++ quote.go | 7 ++-- quote/client.go | 4 +-- taxrate/client.go | 72 +++++++++++++++++++++++------------------- 5 files changed, 73 insertions(+), 53 deletions(-) diff --git a/charge/client.go b/charge/client.go index 50d28ae03f..980bcfb36d 100644 --- a/charge/client.go +++ b/charge/client.go @@ -1,6 +1,10 @@ -// Package charge provides API functions related to charges. // -// For more details, see: https://stripe.com/docs/api/go#charges. +// +// File generated from our OpenAPI spec +// +// + +// Package charge provides the /charges APIs package charge import ( @@ -10,7 +14,7 @@ import ( "github.com/stripe/stripe-go/v72/form" ) -// Client is used to invoke APIs related to charges. +// Client is used to invoke /charges APIs. type Client struct { B stripe.Backend Key string @@ -28,12 +32,12 @@ func (c Client) New(params *stripe.ChargeParams) (*stripe.Charge, error) { return charge, err } -// Get retrieves a charge. +// Get returns the details of a charge. func Get(id string, params *stripe.ChargeParams) (*stripe.Charge, error) { return getC().Get(id, params) } -// Get retrieves a charge. +// Get returns the details of a charge. func (c Client) Get(id string, params *stripe.ChargeParams) (*stripe.Charge, error) { path := stripe.FormatURLPath("/v1/charges/%s", id) charge := &stripe.Charge{} @@ -41,12 +45,12 @@ func (c Client) Get(id string, params *stripe.ChargeParams) (*stripe.Charge, err return charge, err } -// Update updates a charge. +// Update updates a charge's properties. func Update(id string, params *stripe.ChargeParams) (*stripe.Charge, error) { return getC().Update(id, params) } -// Update updates a charge. +// Update updates a charge's properties. func (c Client) Update(id string, params *stripe.ChargeParams) (*stripe.Charge, error) { path := stripe.FormatURLPath("/v1/charges/%s", id) charge := &stripe.Charge{} @@ -54,12 +58,12 @@ func (c Client) Update(id string, params *stripe.ChargeParams) (*stripe.Charge, return charge, err } -// Capture captures a charge that's not yet captured. +// Capture is the method for the `POST /v1/charges/{charge}/capture` API. func Capture(id string, params *stripe.CaptureParams) (*stripe.Charge, error) { return getC().Capture(id, params) } -// Capture captures a charge that's not yet captured. +// Capture is the method for the `POST /v1/charges/{charge}/capture` API. func (c Client) Capture(id string, params *stripe.CaptureParams) (*stripe.Charge, error) { path := stripe.FormatURLPath("/v1/charges/%s/capture", id) charge := &stripe.Charge{} @@ -67,12 +71,12 @@ func (c Client) Capture(id string, params *stripe.CaptureParams) (*stripe.Charge return charge, err } -// List returns an iterator that iterates all charges. +// List returns a list of charges. func List(params *stripe.ChargeListParams) *Iter { return getC().List(params) } -// List returns an iterator that iterates all charges. +// List returns a list of charges. func (c Client) List(listParams *stripe.ChargeListParams) *Iter { return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { @@ -99,9 +103,9 @@ func (i *Iter) Charge() *stripe.Charge { return i.Current().(*stripe.Charge) } -// ChargeList returns the current list object which the iterator is currently -// using. List objects will change as new API calls are made to continue -// pagination. +// ChargeList 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) ChargeList() *stripe.ChargeList { return i.List().(*stripe.ChargeList) } diff --git a/issuing_transaction.go b/issuing_transaction.go index d6059f45c4..6a31e39e4d 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -38,6 +38,16 @@ const ( IssuingTransactionTypeRefund IssuingTransactionType = "refund" ) +// The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. +type IssuingTransactionWallet string + +// List of values that IssuingTransactionWallet can take +const ( + IssuingTransactionWalletApplePay IssuingTransactionWallet = "apple_pay" + IssuingTransactionWalletGooglePay IssuingTransactionWallet = "google_pay" + IssuingTransactionWalletSamsungPay IssuingTransactionWallet = "samsung_pay" +) + // IssuingTransactionParams is the set of parameters that can be used when creating or updating an issuing transaction. type IssuingTransactionParams struct { Params `form:"*"` @@ -129,6 +139,7 @@ type IssuingTransaction struct { Object string `json:"object"` PurchaseDetails *IssuingTransactionPurchaseDetails `json:"purchase_details"` Type IssuingTransactionType `json:"type"` + Wallet IssuingTransactionWallet `json:"wallet"` } // IssuingTransactionList is a list of issuing transactions as retrieved from a list endpoint. diff --git a/quote.go b/quote.go index 6eba5e76cb..c347161a48 100644 --- a/quote.go +++ b/quote.go @@ -6,11 +6,8 @@ package stripe -import ( - "encoding/json" - - "github.com/stripe/stripe-go/v72/form" -) +import "encoding/json" +import "github.com/stripe/stripe-go/v72/form" // The status of the most recent automated tax calculation for this quote. type QuoteAutomaticTaxStatus string diff --git a/quote/client.go b/quote/client.go index 7fafeda3b4..ca5b770168 100644 --- a/quote/client.go +++ b/quote/client.go @@ -4,7 +4,7 @@ // // -// Package quote provides the /quotes/{quote}/computed_upfront_line_items APIs +// Package quote provides the /quotes APIs package quote import ( @@ -14,7 +14,7 @@ import ( "github.com/stripe/stripe-go/v72/form" ) -// Client is used to invoke /quotes/{quote}/computed_upfront_line_items APIs. +// Client is used to invoke /quotes APIs. type Client struct { B stripe.Backend PDFBackend stripe.Backend diff --git a/taxrate/client.go b/taxrate/client.go index 071686e0a7..7ebad76d73 100644 --- a/taxrate/client.go +++ b/taxrate/client.go @@ -1,3 +1,9 @@ +// +// +// File generated from our OpenAPI spec +// +// + // Package taxrate provides the /tax_rates APIs package taxrate @@ -14,16 +20,16 @@ type Client struct { Key string } -// New creates a new tr. +// New creates a new tax rate. func New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) { return getC().New(params) } -// New creates a new tr. +// New creates a new tax rate. func (c Client) New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) { - tr := &stripe.TaxRate{} - err := c.B.Call(http.MethodPost, "/v1/tax_rates", c.Key, params, tr) - return tr, err + taxrate := &stripe.TaxRate{} + err := c.B.Call(http.MethodPost, "/v1/tax_rates", c.Key, params, taxrate) + return taxrate, err } // Get returns the details of a tax rate. @@ -34,9 +40,9 @@ func Get(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) { // Get returns the details of a tax rate. func (c Client) Get(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) { path := stripe.FormatURLPath("/v1/tax_rates/%s", id) - tr := &stripe.TaxRate{} - err := c.B.Call(http.MethodGet, path, c.Key, params, tr) - return tr, err + taxrate := &stripe.TaxRate{} + err := c.B.Call(http.MethodGet, path, c.Key, params, taxrate) + return taxrate, err } // Update updates a tax rate's properties. @@ -47,9 +53,9 @@ func Update(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) { // Update updates a tax rate's properties. func (c Client) Update(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) { path := stripe.FormatURLPath("/v1/tax_rates/%s", id) - tr := &stripe.TaxRate{} - err := c.B.Call(http.MethodPost, path, c.Key, params, tr) - return tr, err + taxrate := &stripe.TaxRate{} + err := c.B.Call(http.MethodPost, path, c.Key, params, taxrate) + return taxrate, err } // Del removes a tax rate. @@ -60,44 +66,46 @@ func Del(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) { // Del removes a tax rate. func (c Client) Del(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) { path := stripe.FormatURLPath("/v1/tax_rates/%s", id) - tr := &stripe.TaxRate{} - err := c.B.Call(http.MethodDelete, path, c.Key, params, tr) - return tr, err + taxrate := &stripe.TaxRate{} + err := c.B.Call(http.MethodDelete, path, c.Key, params, taxrate) + return taxrate, err } -// List returns a list of trs. +// List returns a list of tax rates. func List(params *stripe.TaxRateListParams) *Iter { return getC().List(params) } -// List returns a list of trs. +// List returns a list of tax rates. func (c Client) List(listParams *stripe.TaxRateListParams) *Iter { - return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.TaxRateList{} - err := c.B.CallRaw(http.MethodGet, "/v1/tax_rates", c.Key, b, p, list) - - ret := make([]interface{}, len(list.Data)) - for i, v := range list.Data { - ret[i] = v - } - - return ret, list, err - })} + return &Iter{ + Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { + list := &stripe.TaxRateList{} + err := c.B.CallRaw(http.MethodGet, "/v1/tax_rates", 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 trs. +// Iter is an iterator for tax rates. type Iter struct { *stripe.Iter } -// TaxRate returns the tr which the iterator is currently pointing to. +// TaxRate returns the tax rate which the iterator is currently pointing to. func (i *Iter) TaxRate() *stripe.TaxRate { return i.Current().(*stripe.TaxRate) } -// TaxRateList returns the current list object which the iterator is currently -// using. List objects will change as new API calls are made to continue -// pagination. +// TaxRateList 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) TaxRateList() *stripe.TaxRateList { return i.List().(*stripe.TaxRateList) }