Breaking change on some `Del` functions in stripe-go 25.0.0

115 views
Skip to first unread message

Brandur

unread,
Aug 21, 2017, 3:48:22 PM8/21/17
to Stripe API Announcements
Hello list,

Through an accident of history, many of the Go library's
delete functions took a single `id` argument:

    func Del(id string) (*Customer, error) {
        ...
    }

This was in contrast to other API operations which take a
second typed parameter struct:

    func Get(id string, params *CustomerParams) (*stripe.Customer, error) {
        ...
    }

Although mainly intended to facilitate create/update
values, that second parameter also enables special options
to be passed with an API call like `Stripe-Account` and
`Idempotency-Key`. Its absence on some delete methods meant
that these options were effectively unavailable for those
operations.

Today we released stripe-go 25.0.0 which introduces a
breaking change [1] by adding a parameters argument to all
delete functions that were missing one (thank you Remi for
doing the work). For example:

    func Del(id string, params *CustomerParams) (*Customer, error) {
        ...
    }

In all cases `params` is allowed to be `nil`, so a simple
fix when you're upgrading will be to just add `nil`
argument to any functions that are producing a compilation
error.

Sorry about the extra churn this causes. We made the change
because although it'll be an upgrade annoyance, it'll help
new users significantly by conforming to the principle of
least astonishment [2].

Brandur
Stripe API Engineering


Reply all
Reply to author
Forward
0 new messages