-
Notifications
You must be signed in to change notification settings - Fork 2
/
apps.go
42 lines (32 loc) · 920 Bytes
/
apps.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
package kettle
import (
"net/http"
"github.com/dghubble/sling"
)
// ISteamAppsService provides a method for accessing steam app info
type ISteamAppsService struct {
sling *sling.Sling
}
func newISteamAppsService(sling *sling.Sling) *ISteamAppsService {
return &ISteamAppsService{
sling: sling.Path("ISteamApps/"),
}
}
type appListResponse struct {
AppList appList `json:"applist"`
}
type appList struct {
Apps []App `json:"apps"`
}
// App is an app on steam from ISteamAppsService.GetAppList
type App struct {
AppID int64 `json:"appid"`
Name string `json:"name"`
}
// GetAppList returns a list of all apps on steam
// https://wiki.teamfortress.com/wiki/WebAPI/GetAppList
func (s *ISteamAppsService) GetAppList() ([]App, *http.Response, error) {
response := new(appListResponse)
resp, err := s.sling.New().Get("GetAppList/v2/").ReceiveSuccess(response)
return response.AppList.Apps, resp, err
}