-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
44 lines (37 loc) · 805 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
43
44
package stabilityai
import (
"context"
"log"
)
// Option is an option type for the client.
type Option func(*Client)
// WithContext sets the context for the client.
func WithContext(ctx context.Context) Option {
return func(c *Client) {
c.ctx = ctx
}
}
// WithAPIHost sets the API host for the client.
func WithAPIHost(host string) Option {
return func(c *Client) {
c.host = host
}
}
// WithAPIKey sets the API key for the client.
func WithAPIKey(apikey string) Option {
return func(c *Client) {
c.apikey = apikey
}
}
// WithEngine sets the engine for the client.
func WithEngine(engine string) Option {
return func(c *Client) {
c.engine = engine
}
}
// WithLogger sets the logger for the client.
func WithLogger(l *log.Logger) Option {
return func(c *Client) {
c.log = l
}
}