-
Notifications
You must be signed in to change notification settings - Fork 22
/
configuration.go
50 lines (42 loc) · 1.03 KB
/
configuration.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
45
46
47
48
49
50
// Mux Go - Copyright 2019 Mux Inc.
// NOTE: This file is auto generated. Do not edit this file manually.
package muxgo
import (
"time"
)
type Configuration struct {
basePath string `json:"basePath,omitempty"`
host string `json:"host,omitempty"`
userAgent string `json:"userAgent,omitempty"`
username string
password string
timeout time.Duration
}
// ConfigurationOption configures the Mux API Client.
type ConfigurationOption func(*Configuration)
func NewConfiguration(opts ...ConfigurationOption) *Configuration {
cfg := &Configuration{
basePath: "https://api.mux.com",
userAgent: "Mux Go | 5.9.0",
}
for _, opt := range opts {
opt(cfg)
}
return cfg
}
func WithBasicAuth(username, password string) ConfigurationOption {
return func(c *Configuration) {
c.username = username
c.password = password
}
}
func WithTimeout(t time.Duration) ConfigurationOption {
return func(c *Configuration) {
c.timeout = t
}
}
func WithHost(host string) ConfigurationOption {
return func(c *Configuration) {
c.host = host
}
}