-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.go
59 lines (50 loc) · 1.51 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
51
52
53
54
55
56
57
58
59
/*
* ApproveAPISwagger
*
* The simple API to request a user's approval on anything via email + sms.
*
* API version: 1.0.1
* Contact: dev@approveapi.com
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package approveapi
import (
"net/http"
"golang.org/x/oauth2"
)
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type BasicAuth struct {
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
}
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
Key string
Prefix string
}
type Authentication struct {
APIKey *APIKey
BasicAuth *BasicAuth
OAuth2 *oauth2.TokenSource
AccessToken *string
}
type Configuration struct {
BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Authentication Authentication `json:"authentication,omitempty"`
HTTPClient *http.Client
}
func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "https://approve.sh",
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.5/go",
}
return cfg
}
func (c *Configuration) AddDefaultHeader(key string, value string) {
c.DefaultHeader[key] = value
}