diff --git a/creditnote.go b/creditnote.go index 2fdb71c8c6..b47b83e8b4 100644 --- a/creditnote.go +++ b/creditnote.go @@ -1,3 +1,9 @@ +// +// +// File generated from our OpenAPI spec +// +// + package stripe import "encoding/json" @@ -57,9 +63,8 @@ type CreditNoteListParams struct { // CreditNoteLineItemListParams is the set of parameters that can be used when listing credit note line items. type CreditNoteLineItemListParams struct { ListParams `form:"*"` - // ID is the credit note ID to list line items for. - ID *string `form:"-"` // Goes in the URL + ID *string `form:"-"` // Included in URL } // CreditNoteLineItemListPreviewParams is the set of parameters that can be used when previewing a credit note's line items @@ -163,18 +168,18 @@ type CreditNoteList struct { // UnmarshalJSON handles deserialization of a CreditNote. // This custom unmarshaling is needed because the resulting // property may be an id or the full struct if it was expanded. -func (i *CreditNote) UnmarshalJSON(data []byte) error { +func (c *CreditNote) UnmarshalJSON(data []byte) error { if id, ok := ParseID(data); ok { - i.ID = id + c.ID = id return nil } - type note CreditNote - var v note + type creditNote CreditNote + var v creditNote if err := json.Unmarshal(data, &v); err != nil { return err } - *i = CreditNote(v) + *c = CreditNote(v) return nil } diff --git a/creditnote/client.go b/creditnote/client.go index 672a1ef1f0..d54585c18f 100644 --- a/creditnote/client.go +++ b/creditnote/client.go @@ -1,3 +1,9 @@ +// +// +// File generated from our OpenAPI spec +// +// + // Package creditnote provides the /credit_notes APIs package creditnote @@ -8,7 +14,7 @@ import ( "github.com/stripe/stripe-go/v72/form" ) -// Client is the client used to invoke /credit_notes APIs. +// Client is used to invoke /credit_notes APIs. type Client struct { B stripe.Backend Key string @@ -21,9 +27,15 @@ func New(params *stripe.CreditNoteParams) (*stripe.CreditNote, error) { // New creates a new credit note. func (c Client) New(params *stripe.CreditNoteParams) (*stripe.CreditNote, error) { - cn := &stripe.CreditNote{} - err := c.B.Call(http.MethodPost, "/v1/credit_notes", c.Key, params, cn) - return cn, err + creditnote := &stripe.CreditNote{} + err := c.B.Call( + http.MethodPost, + "/v1/credit_notes", + c.Key, + params, + creditnote, + ) + return creditnote, err } // Get returns the details of a credit note. @@ -34,47 +46,53 @@ func Get(id string, params *stripe.CreditNoteParams) (*stripe.CreditNote, error) // Get returns the details of a credit note. func (c Client) Get(id string, params *stripe.CreditNoteParams) (*stripe.CreditNote, error) { path := stripe.FormatURLPath("/v1/credit_notes/%s", id) - cn := &stripe.CreditNote{} - err := c.B.Call(http.MethodGet, path, c.Key, params, cn) - return cn, err + creditnote := &stripe.CreditNote{} + err := c.B.Call(http.MethodGet, path, c.Key, params, creditnote) + return creditnote, err } -// Update updates a credit note. +// Update updates a credit note's properties. func Update(id string, params *stripe.CreditNoteParams) (*stripe.CreditNote, error) { return getC().Update(id, params) } -// Update updates a credit note. +// Update updates a credit note's properties. func (c Client) Update(id string, params *stripe.CreditNoteParams) (*stripe.CreditNote, error) { path := stripe.FormatURLPath("/v1/credit_notes/%s", id) - cn := &stripe.CreditNote{} - err := c.B.Call(http.MethodPost, path, c.Key, params, cn) - return cn, err + creditnote := &stripe.CreditNote{} + err := c.B.Call(http.MethodPost, path, c.Key, params, creditnote) + return creditnote, err } -// Preview previews a credit note. +// Preview is the method for the `GET /v1/credit_notes/preview` API. func Preview(params *stripe.CreditNotePreviewParams) (*stripe.CreditNote, error) { return getC().Preview(params) } -// Preview previews a credit note. +// Preview is the method for the `GET /v1/credit_notes/preview` API. func (c Client) Preview(params *stripe.CreditNotePreviewParams) (*stripe.CreditNote, error) { - cn := &stripe.CreditNote{} - err := c.B.Call(http.MethodGet, "/v1/credit_notes/preview", c.Key, params, cn) - return cn, err -} - -// VoidCreditNote voids a credit note. + creditnote := &stripe.CreditNote{} + err := c.B.Call( + http.MethodGet, + "/v1/credit_notes/preview", + c.Key, + params, + creditnote, + ) + return creditnote, err +} + +// VoidCreditNote is the method for the `POST /v1/credit_notes/{id}/void` API. func VoidCreditNote(id string, params *stripe.CreditNoteVoidParams) (*stripe.CreditNote, error) { return getC().VoidCreditNote(id, params) } -// VoidCreditNote voids a credit note. +// VoidCreditNote is the method for the `POST /v1/credit_notes/{id}/void` API. func (c Client) VoidCreditNote(id string, params *stripe.CreditNoteVoidParams) (*stripe.CreditNote, error) { path := stripe.FormatURLPath("/v1/credit_notes/%s/void", id) - cn := &stripe.CreditNote{} - err := c.B.Call(http.MethodPost, path, c.Key, params, cn) - return cn, err + creditnote := &stripe.CreditNote{} + err := c.B.Call(http.MethodPost, path, c.Key, params, creditnote) + return creditnote, err } // List returns a list of credit notes. @@ -84,17 +102,19 @@ func List(params *stripe.CreditNoteListParams) *Iter { // List returns a list of credit notes. func (c Client) List(listParams *stripe.CreditNoteListParams) *Iter { - return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.CreditNoteList{} - err := c.B.CallRaw(http.MethodGet, "/v1/credit_notes", c.Key, b, p, list) + return &Iter{ + Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { + list := &stripe.CreditNoteList{} + err := c.B.CallRaw(http.MethodGet, "/v1/credit_notes", c.Key, b, p, list) - ret := make([]interface{}, len(list.Data)) - for i, v := range list.Data { - ret[i] = v - } + ret := make([]interface{}, len(list.Data)) + for i, v := range list.Data { + ret[i] = v + } - return ret, list, err - })} + return ret, list, err + }), + } } // Iter is an iterator for credit notes. @@ -102,7 +122,7 @@ type Iter struct { *stripe.Iter } -// CreditNote returns the cn which the iterator is currently pointing to. +// CreditNote returns the credit note which the iterator is currently pointing to. func (i *Iter) CreditNote() *stripe.CreditNote { return i.Current().(*stripe.CreditNote) } @@ -114,48 +134,55 @@ func (i *Iter) CreditNoteList() *stripe.CreditNoteList { return i.List().(*stripe.CreditNoteList) } -// ListLines returns a list of credit note line items on a credit note. +// ListLines is the method for the `GET /v1/credit_notes/{credit_note}/lines` API. func ListLines(params *stripe.CreditNoteLineItemListParams) *LineItemIter { return getC().ListLines(params) } -// ListLines returns a list of credit note line items on a credit note. +// ListLines is the method for the `GET /v1/credit_notes/{credit_note}/lines` API. func (c Client) ListLines(listParams *stripe.CreditNoteLineItemListParams) *LineItemIter { - path := stripe.FormatURLPath("/v1/credit_notes/%s/lines", stripe.StringValue(listParams.ID)) - return &LineItemIter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.CreditNoteLineItemList{} - err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list) - - ret := make([]interface{}, len(list.Data)) - for i, v := range list.Data { - ret[i] = v - } - - return ret, list, err - })} -} - -// ListPreviewLines returns a list of lines on a previewed credit note. + path := stripe.FormatURLPath( + "/v1/credit_notes/%s/lines", + stripe.StringValue(listParams.ID), + ) + return &LineItemIter{ + Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { + list := &stripe.CreditNoteLineItemList{} + err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list) + + ret := make([]interface{}, len(list.Data)) + for i, v := range list.Data { + ret[i] = v + } + + return ret, list, err + }), + } +} + +// ListPreviewLines is the method for the `GET /v1/credit_notes/preview/lines` API. func ListPreviewLines(params *stripe.CreditNoteLineItemListPreviewParams) *LineItemIter { return getC().ListPreviewLines(params) } -// ListPreviewLines returns a list of lines on a previewed credit note. +// ListPreviewLines is the method for the `GET /v1/credit_notes/preview/lines` API. func (c Client) ListPreviewLines(listParams *stripe.CreditNoteLineItemListPreviewParams) *LineItemIter { - return &LineItemIter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.CreditNoteLineItemList{} - err := c.B.CallRaw(http.MethodGet, "/v1/credit_notes/preview/lines", c.Key, b, p, list) + return &LineItemIter{ + Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { + list := &stripe.CreditNoteLineItemList{} + err := c.B.CallRaw(http.MethodGet, "/v1/credit_notes/preview/lines", c.Key, b, p, list) - ret := make([]interface{}, len(list.Data)) - for i, v := range list.Data { - ret[i] = v - } + ret := make([]interface{}, len(list.Data)) + for i, v := range list.Data { + ret[i] = v + } - return ret, list, err - })} + return ret, list, err + }), + } } -// LineItemIter is an iterator for credit note line items on a credit note. +// LineItemIter is an iterator for credit note line items. type LineItemIter struct { *stripe.Iter } diff --git a/creditnotelineitem.go b/creditnotelineitem.go index 724d12e3c4..fd8c6c5b1b 100644 --- a/creditnotelineitem.go +++ b/creditnotelineitem.go @@ -1,15 +1,21 @@ +// +// +// File generated from our OpenAPI spec +// +// + package stripe -// CreditNoteLineItemType is the list of allowed values for the credit note line item's type. +// The type of the credit note line item, one of `invoice_line_item` or `custom_line_item`. When the type is `invoice_line_item` there is an additional `invoice_line_item` property on the resource the value of which is the id of the credited line item on the invoice. type CreditNoteLineItemType string -// List of values that CreditNoteType can take. +// List of values that CreditNoteLineItemType can take const ( CreditNoteLineItemTypeCustomLineItem CreditNoteLineItemType = "custom_line_item" CreditNoteLineItemTypeInvoiceLineItem CreditNoteLineItemType = "invoice_line_item" ) -// CreditNoteLineItemDiscountAmount represents the amount of discount calculated per discount for this line item. +// The integer amount in %s representing the discount being credited for this line item. type CreditNoteLineItemDiscountAmount struct { Amount int64 `json:"amount"` Discount *Discount `json:"discount"` @@ -34,7 +40,7 @@ type CreditNoteLineItem struct { UnitAmountDecimal float64 `json:"unit_amount_decimal,string"` } -// CreditNoteLineItemList is a list of credit note line items as retrieved from a list endpoint. +// CreditNoteLineItemList is a list of CreditNoteLineItems as retrieved from a list endpoint. type CreditNoteLineItemList struct { APIResource ListMeta diff --git a/issuing/dispute/client.go b/issuing/dispute/client.go index 53c01051b9..644740b475 100644 --- a/issuing/dispute/client.go +++ b/issuing/dispute/client.go @@ -1,6 +1,10 @@ -// Package dispute provides API functions related to issuing disputes. // -// For more details, see: https://stripe.com/docs/api/go#issuing_disputes +// +// File generated from our OpenAPI spec +// +// + +// Package dispute provides the /issuing/disputes APIs package dispute import ( @@ -24,7 +28,13 @@ func New(params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) { // New creates a new issuing dispute. func (c Client) New(params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) { dispute := &stripe.IssuingDispute{} - err := c.B.Call(http.MethodPost, "/v1/issuing/disputes", c.Key, params, dispute) + err := c.B.Call( + http.MethodPost, + "/v1/issuing/disputes", + c.Key, + params, + dispute, + ) return dispute, err } @@ -41,12 +51,12 @@ func (c Client) Get(id string, params *stripe.IssuingDisputeParams) (*stripe.Iss return dispute, err } -// Update updates an issuing dispute. +// Update updates an issuing dispute's properties. func Update(id string, params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) { return getC().Update(id, params) } -// Update updates an issuing dispute. +// Update updates an issuing dispute's properties. func (c Client) Update(id string, params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) { path := stripe.FormatURLPath("/v1/issuing/disputes/%s", id) dispute := &stripe.IssuingDispute{} @@ -54,12 +64,12 @@ func (c Client) Update(id string, params *stripe.IssuingDisputeParams) (*stripe. return dispute, err } -// Submit dismisses a dispute in the customer's favor. +// Submit is the method for the `POST /v1/issuing/disputes/{dispute}/submit` API. func Submit(id string, params *stripe.IssuingDisputeSubmitParams) (*stripe.IssuingDispute, error) { return getC().Submit(id, params) } -// Submit dismisses a dispute in the customer's favor. +// Submit is the method for the `POST /v1/issuing/disputes/{dispute}/submit` API. func (c Client) Submit(id string, params *stripe.IssuingDisputeSubmitParams) (*stripe.IssuingDispute, error) { path := stripe.FormatURLPath("/v1/issuing/disputes/%s/submit", id) dispute := &stripe.IssuingDispute{} @@ -74,17 +84,19 @@ func List(params *stripe.IssuingDisputeListParams) *Iter { // List returns a list of issuing disputes. func (c Client) List(listParams *stripe.IssuingDisputeListParams) *Iter { - return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.IssuingDisputeList{} - err := c.B.CallRaw(http.MethodGet, "/v1/issuing/disputes", 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.IssuingDisputeList{} + err := c.B.CallRaw(http.MethodGet, "/v1/issuing/disputes", 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 issuing disputes. diff --git a/issuing_card.go b/issuing_card.go index 0b3b6deced..4fc73e74bf 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -1,3 +1,9 @@ +// +// +// File generated from our OpenAPI spec +// +// + package stripe import "encoding/json" @@ -159,7 +165,6 @@ type IssuingCardParams struct { SpendingControls *IssuingCardSpendingControlsParams `form:"spending_controls"` Status *string `form:"status"` Type *string `form:"type"` - // The following parameter is only supported when updating a card CancellationReason *string `form:"cancellation_reason"` } @@ -206,12 +211,10 @@ type IssuingCardSpendingControls struct { SpendingLimits []*IssuingCardSpendingControlsSpendingLimit `json:"spending_limits"` SpendingLimitsCurrency Currency `json:"spending_limits_currency"` } - type IssuingCardWalletsApplePay struct { Eligible bool `json:"eligible"` IneligibleReason IssuingCardWalletsApplePayIneligibleReason `json:"ineligible_reason"` } - type IssuingCardWalletsGooglePay struct { Eligible bool `json:"eligible"` IneligibleReason IssuingCardWalletsGooglePayIneligibleReason `json:"ineligible_reason"` diff --git a/issuing_dispute.go b/issuing_dispute.go index 16612713c5..db193c06e5 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -1,3 +1,9 @@ +// +// +// File generated from our OpenAPI spec +// +// + package stripe import "encoding/json" @@ -143,9 +149,11 @@ type IssuingDisputeEvidenceOtherParams struct { type IssuingDisputeEvidenceServiceNotAsDescribedParams struct { AdditionalDocumentation *string `form:"additional_documentation"` CanceledAt *int64 `form:"canceled_at"` + CancellationReason *string `form:"cancellation_reason"` Explanation *string `form:"explanation"` ProductDescription *string `form:"product_description"` ProductType *string `form:"product_type"` + ReceivedAt *int64 `form:"received_at"` } // IssuingDisputeEvidenceParams is the set of parameters for the evidence on an issuing dispute @@ -170,6 +178,8 @@ type IssuingDisputeParams struct { // IssuingDisputeListParams is the set of parameters that can be used when listing issuing dispute. type IssuingDisputeListParams struct { ListParams `form:"*"` + Created *int64 `form:"created"` + CreatedRange *RangeQueryParams `form:"created"` Status *string `form:"status"` Transaction *string `form:"transaction"` } @@ -240,9 +250,11 @@ type IssuingDisputeEvidenceOther struct { type IssuingDisputeEvidenceServiceNotAsDescribed struct { AdditionalDocumentation *File `json:"additional_documentation"` CanceledAt int64 `json:"canceled_at"` + CancellationReason string `json:"cancellation_reason"` Explanation string `json:"explanation"` ProductDescription string `json:"product_description"` ProductType IssuingDisputeEvidenceServiceNotAsDescribedProductType `json:"product_type"` + ReceivedAt int64 `json:"received_at"` } // IssuingDisputeEvidence is the resource representing the evidence of an issuing dispute. diff --git a/paymentintent.go b/paymentintent.go index cf519a95f8..e7213dfdfe 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -306,6 +306,9 @@ type PaymentIntentPaymentMethodOptionsCardParams struct { // If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. type PaymentIntentPaymentMethodOptionsCardPresentParams struct{} +// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. +type PaymentIntentPaymentMethodOptionsGiropayParams struct{} + // If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. type PaymentIntentPaymentMethodOptionsIdealParams struct{} @@ -359,6 +362,7 @@ type PaymentIntentPaymentMethodOptionsParams struct { Boleto *PaymentIntentPaymentMethodOptionsBoletoParams `form:"boleto"` Card *PaymentIntentPaymentMethodOptionsCardParams `form:"card"` CardPresent *PaymentIntentPaymentMethodOptionsCardPresentParams `form:"card_present"` + Giropay *PaymentIntentPaymentMethodOptionsGiropayParams `form:"giropay"` Ideal *PaymentIntentPaymentMethodOptionsIdealParams `form:"ideal"` InteracPresent *PaymentIntentPaymentMethodOptionsInteracPresentParams `form:"interac_present"` Klarna *PaymentIntentPaymentMethodOptionsKlarnaParams `form:"klarna"` @@ -566,6 +570,7 @@ type PaymentIntentPaymentMethodOptionsCard struct { // PaymentIntentPaymentMethodOptionsCardPresent is the set of Card Present-specific options associated // with that payment intent. type PaymentIntentPaymentMethodOptionsCardPresent struct{} +type PaymentIntentPaymentMethodOptionsGiropay struct{} // PaymentIntentPaymentMethodOptionsIdeal is the set of Ideal-specific options associated // with that payment intent. @@ -618,6 +623,7 @@ type PaymentIntentPaymentMethodOptions struct { Boleto *PaymentIntentPaymentMethodOptionsBoleto `json:"boleto"` Card *PaymentIntentPaymentMethodOptionsCard `json:"card"` CardPresent *PaymentIntentPaymentMethodOptionsCardPresent `json:"card_present"` + Giropay *PaymentIntentPaymentMethodOptionsGiropay `json:"giropay"` Ideal *PaymentIntentPaymentMethodOptionsIdeal `json:"ideal"` InteracPresent *PaymentIntentPaymentMethodOptionsInteracPresent `json:"interac_present"` Klarna *PaymentIntentPaymentMethodOptionsKlarna `json:"klarna"` diff --git a/plan.go b/plan.go index dfcb2ee9cc..e4ac9e6ec0 100644 --- a/plan.go +++ b/plan.go @@ -1,10 +1,15 @@ +// +// +// File generated from our OpenAPI spec +// +// + package stripe import ( "encoding/json" - "strconv" - "github.com/stripe/stripe-go/v72/form" + "strconv" ) // PlanInterval is the list of allowed values for a plan's interval. @@ -111,16 +116,19 @@ type PlanTierParams struct { FlatAmountDecimal *float64 `form:"flat_amount_decimal,high_precision"` UnitAmount *int64 `form:"unit_amount"` UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` - UpTo *int64 `form:"-"` // handled in custom AppendTo - UpToInf *bool `form:"-"` // handled in custom AppendTo + UpTo *int64 `form:"-"` // See custom AppendTo + UpToInf *bool `form:"-"` // See custom AppendTo } -// AppendTo implements custom up_to serialisation logic for tiers configuration +// AppendTo implements custom encoding logic for PlanTierParams. func (p *PlanTierParams) AppendTo(body *form.Values, keyParts []string) { if BoolValue(p.UpToInf) { body.Add(form.FormatKey(append(keyParts, "up_to")), "inf") } else { - body.Add(form.FormatKey(append(keyParts, "up_to")), strconv.FormatInt(Int64Value(p.UpTo), 10)) + body.Add( + form.FormatKey(append(keyParts, "up_to")), + strconv.FormatInt(Int64Value(p.UpTo), 10), + ) } } @@ -155,6 +163,7 @@ type Plan struct { Livemode bool `json:"livemode"` Metadata map[string]string `json:"metadata"` Nickname string `json:"nickname"` + Object string `json:"object"` Product *Product `json:"product"` Tiers []*PlanTier `json:"tiers"` TiersMode string `json:"tiers_mode"` @@ -188,9 +197,9 @@ type PlanList struct { // UnmarshalJSON handles deserialization of a Plan. // This custom unmarshaling is needed because the resulting // property may be an id or the full struct if it was expanded. -func (s *Plan) UnmarshalJSON(data []byte) error { +func (p *Plan) UnmarshalJSON(data []byte) error { if id, ok := ParseID(data); ok { - s.ID = id + p.ID = id return nil } @@ -200,6 +209,6 @@ func (s *Plan) UnmarshalJSON(data []byte) error { return err } - *s = Plan(v) + *p = Plan(v) return nil } diff --git a/terminal/reader/client.go b/terminal/reader/client.go index 697431c047..1936a7a768 100644 --- a/terminal/reader/client.go +++ b/terminal/reader/client.go @@ -1,4 +1,10 @@ -// Package reader provides API functions related to terminal readers +// +// +// File generated from our OpenAPI spec +// +// + +// Package reader provides the /terminal/readers APIs package reader import ( @@ -22,7 +28,13 @@ func New(params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { // New creates a new terminal reader. func (c Client) New(params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { reader := &stripe.TerminalReader{} - err := c.B.Call(http.MethodPost, "/v1/terminal/readers", c.Key, params, reader) + err := c.B.Call( + http.MethodPost, + "/v1/terminal/readers", + c.Key, + params, + reader, + ) return reader, err } @@ -39,12 +51,12 @@ func (c Client) Get(id string, params *stripe.TerminalReaderGetParams) (*stripe. return reader, err } -// Update updates a terminal reader. +// Update updates a terminal reader's properties. func Update(id string, params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { return getC().Update(id, params) } -// Update updates a terminal reader. +// Update updates a terminal reader's properties. func (c Client) Update(id string, params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { path := stripe.FormatURLPath("/v1/terminal/readers/%s", id) reader := &stripe.TerminalReader{} @@ -52,12 +64,12 @@ func (c Client) Update(id string, params *stripe.TerminalReaderParams) (*stripe. return reader, err } -// Del removes a reader. +// Del removes a terminal reader. func Del(id string, params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { return getC().Del(id, params) } -// Del removes a reader. +// Del removes a terminal reader. func (c Client) Del(id string, params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { path := stripe.FormatURLPath("/v1/terminal/readers/%s", id) reader := &stripe.TerminalReader{} @@ -72,17 +84,19 @@ func List(params *stripe.TerminalReaderListParams) *Iter { // List returns a list of terminal readers. func (c Client) List(listParams *stripe.TerminalReaderListParams) *Iter { - return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.TerminalReaderList{} - err := c.B.CallRaw(http.MethodGet, "/v1/terminal/readers", 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.TerminalReaderList{} + err := c.B.CallRaw(http.MethodGet, "/v1/terminal/readers", 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 terminal readers. diff --git a/topup/client.go b/topup/client.go index 0951a8f021..68effddf12 100644 --- a/topup/client.go +++ b/topup/client.go @@ -1,3 +1,10 @@ +// +// +// File generated from our OpenAPI spec +// +// + +// Package topup provides the /topups APIs package topup import ( @@ -51,12 +58,12 @@ func (c Client) Update(id string, params *stripe.TopupParams) (*stripe.Topup, er return topup, err } -// Cancel cancels a topup. +// Cancel is the method for the `POST /v1/topups/{topup}/cancel` API. func Cancel(id string, params *stripe.TopupParams) (*stripe.Topup, error) { return getC().Cancel(id, params) } -// Cancel cancels a topup. +// Cancel is the method for the `POST /v1/topups/{topup}/cancel` API. func (c Client) Cancel(id string, params *stripe.TopupParams) (*stripe.Topup, error) { path := stripe.FormatURLPath("/v1/topups/%s/cancel", id) topup := &stripe.Topup{} @@ -71,17 +78,19 @@ func List(params *stripe.TopupListParams) *Iter { // List returns a list of topups. func (c Client) List(listParams *stripe.TopupListParams) *Iter { - return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { - list := &stripe.TopupList{} - err := c.B.CallRaw(http.MethodGet, "/v1/topups", 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.TopupList{} + err := c.B.CallRaw(http.MethodGet, "/v1/topups", 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 topups. @@ -89,14 +98,14 @@ type Iter struct { *stripe.Iter } -// Topup returns the topup item which the iterator is currently pointing to. +// Topup returns the topup which the iterator is currently pointing to. func (i *Iter) Topup() *stripe.Topup { return i.Current().(*stripe.Topup) } -// TopupList returns the current list object which the iterator is currently -// using. List objects will change as new API calls are made to continue -// pagination. +// TopupList 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) TopupList() *stripe.TopupList { return i.List().(*stripe.TopupList) }