-
Notifications
You must be signed in to change notification settings - Fork 2
/
options.go
42 lines (34 loc) · 982 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package paddle
import (
"github.com/PaddleHQ/paddle-go-sdk/v3/internal/client"
)
// Option is a function that configures the Paddle SDK.
type Option func(*options)
// options contains the configuration for the Paddle SDK.
type options struct {
// APIKey is the Paddle API key.
APIKey string
// BaseURL is the base URL for the Paddle API.
BaseURL string
// Client is the HTTP client used to make requests to the Paddle API.
Client client.HTTPDoer
}
// WithAPIKey returns an option that sets the Paddle API key.
func WithAPIKey(apiKey string) Option {
return func(o *options) {
o.APIKey = apiKey
}
}
// WithBaseURL returns an option that sets the base URL for the Paddle API.
func WithBaseURL(baseURL string) Option {
return func(o *options) {
o.BaseURL = baseURL
}
}
// WithClient returns an option that sets the HTTP client used to make requests
// to the Paddle API.
func WithClient(c client.HTTPDoer) Option {
return func(o *options) {
o.Client = c
}
}