Documentation ¶
Index ¶
- Variables
- func Dedup(ctx context.Context, key string, logf func(string, ...any), ...) (winner bool, err error)
- func IsLiveKey(key string) bool
- func MakeID(parts ...string) string
- func Slurp[I Identifiable](ctx context.Context, c *Client, method, path string, f Form) ([]I, error)
- type Client
- type Error
- type Form
- type ID
- type Identifiable
- type Iterator
- type JustID
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("stripe: not found")
Functions ¶
Types ¶
type Client ¶
type Client struct { APIKey string BaseURL string HTTPClient *http.Client AccountID string Logf func(format string, args ...any) // KeyPrefix is prepended to all idempotentcy keys. Use a new key prefix // after deleting test data. It is not recommended for use with live mode. KeyPrefix string }
type Error ¶
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
Form maps a string key to a list of values. It is intended for use when building request bodies for Stripe requests.
func (*Form) Add ¶
Add creates a key and value from args and adds the value to the key. The key is constructed from all values in args up until the final, which will be used as the value.
Values are converted to strings according to fmt.Sprint rules, with the exception of time.Time values, which are converted to unix time (seconds since epoch).
Example mapping:
f.Add("tiers", 0, "up_to", 3) // => "tiers[0][up_to]=3" f.Add("metadata", "link", "http://example.com") // => "metadata[link]=http://example.com" f.Add("product[name]", "foo") // => "product[name]=foo" f.Add("started", time.Unix(10, 0)) // => "started=10"
func (*Form) Encode ¶
Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") sorted by key.
func (*Form) SetIdempotencyKey ¶
type Identifiable ¶
type Identifiable interface {
ProviderID() string
}
type Iterator ¶
type Iterator[I Identifiable] struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.