-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbunq.go
41 lines (35 loc) · 875 Bytes
/
bunq.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
package bunq
import (
"crypto/rsa"
"net/http"
"github.com/satori/go.uuid"
)
const (
baseURL = "https://api.bunq.com"
apiVersion = "v1"
clientVersion = "1.0.0"
userAgent = "go-bunq/" + clientVersion
)
// Client is the API client for the public bunq API.
type Client struct {
HTTPClient *http.Client
BaseURL string
APIKey string
Token string
PrivateKey *rsa.PrivateKey
}
// NewClient returns a new Client.
func NewClient() *Client {
return &Client{
HTTPClient: http.DefaultClient,
BaseURL: baseURL,
}
}
func setCommonHeaders(r *http.Request) {
r.Header.Set("Cache-Control", "no-cache")
r.Header.Set("User-Agent", userAgent)
r.Header.Set("X-Bunq-Client-Request-Id", uuid.NewV4().String())
r.Header.Set("X-Bunq-Geolocation", "0 0 0 0 NL")
r.Header.Set("X-Bunq-Language", "en_US")
r.Header.Set("X-Bunq-Region", "en_US")
}