-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclients.go
44 lines (37 loc) · 1.43 KB
/
clients.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
package battlenet
import (
"net/http"
"github.com/munsy/battlenet/http/account"
"github.com/munsy/battlenet/http/d3"
"github.com/munsy/battlenet/http/sc2"
"github.com/munsy/battlenet/http/wow"
)
const version = "beta"
// AccountClient returns a new client for accessing the Battle.net Account API.
func AccountClient(s *Settings, token string) (*account.Client, error) {
if nil != s {
return account.New(s.Client, s.Region, s.Locale, token, version)
}
return account.New(http.DefaultClient, Regions.US, Locale.AmericanEnglish, token, version)
}
// D3Client returns a new client for accessing the Diablo III API.
func D3Client(s *Settings, key string) (*d3.Client, error) {
if nil != s {
return d3.New(s.Client, s.Region, s.Locale, key, version)
}
return d3.New(http.DefaultClient, Regions.US, Locale.AmericanEnglish, key, version)
}
// SC2Client returns a new client for accessing the Starcraft II API.
func SC2Client(s *Settings, key string) (*sc2.Client, error) {
if nil != s {
return sc2.New(s.Client, s.Region, s.Locale, key, version)
}
return sc2.New(http.DefaultClient, Regions.US, Locale.AmericanEnglish, key, version)
}
// WoWClient returns a new client for accessing the World of Warcraft API.
func WoWClient(s *Settings, key string) (*wow.Client, error) {
if nil != s {
return wow.New(s.Client, s.Region, s.Locale, key, version)
}
return wow.New(http.DefaultClient, Regions.US, Locale.AmericanEnglish, key, version)
}