-
Notifications
You must be signed in to change notification settings - Fork 2
/
kettle.go
50 lines (41 loc) · 1.32 KB
/
kettle.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
package kettle
import (
"net/http"
"github.com/dghubble/sling"
)
// Client is a Steam client for making Steam API requests
type Client struct {
sling *sling.Sling
Store *StoreService
IPlayerService *IPlayerService
ISteamAppsService *ISteamAppsService
ISteamNewsService *ISteamNewsService
ISteamUserService *ISteamUserService
ISteamUserStatsService *ISteamUserStatsService
}
// NewClient returns a new Client
func NewClient(httpClient *http.Client, key string) *Client {
b := sling.New().Client(httpClient)
apiBase := b.New().Base("https://api.steampowered.com/")
apiBase.QueryStruct(struct {
Key string `url:"key"`
}{
Key: key,
})
return &Client{
sling: b,
Store: newStoreService(b.New().Base("https://store.steampowered.com/")),
IPlayerService: newIPlayerService(apiBase.New()),
ISteamAppsService: newISteamAppsService(apiBase.New()),
ISteamNewsService: newISteamNewsService(apiBase.New()),
ISteamUserService: newISteamUserService(apiBase.New()),
ISteamUserStatsService: newISteamUserStatsService(apiBase.New()),
}
}
// BoolAsAnInt is a bool that needs to be an int when transferred to an endpoint
type BoolAsAnInt int
// Option available for BoolAsAnInt
const (
False = BoolAsAnInt(0)
True = BoolAsAnInt(1)
)