-
Notifications
You must be signed in to change notification settings - Fork 8
/
opendota.go
67 lines (61 loc) · 2.37 KB
/
opendota.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
60
61
62
63
64
65
66
67
package opendota
import (
"net/http"
"github.com/dghubble/sling"
)
const openDotaAPI = "https://api.opendota.com/api/"
// Client for making Open Dota API requests
type Client struct {
sling *sling.Sling
BenchmarkService *BenchmarkService
DistributionService *DistributionService
ExplorerService *ExplorerService
HealthService *HealthService
HeroService *HeroService
HeroStatService *HeroStatService
LeagueService *LeagueService
LiveService *LiveService
MatchService *MatchService
MetadataService *MetadataService
PlayerService *PlayerService
ProMatchService *ProMatchService
ProPlayerService *ProPlayerService
PublicMatchService *PublicMatchService
RankingService *RankingService
RecordService *RecordService
ReplayService *ReplayService
ScenariosService *ScenariosService
SchemaService *SchemaService
SearchService *SearchService
StatusService *StatusService
TeamService *TeamService
}
// NewClient returns a new Client.
func NewClient(httpClient *http.Client) *Client {
base := sling.New().Client(httpClient).Base(openDotaAPI)
return &Client{
sling: base,
BenchmarkService: newBenchmarkService(base.New()),
DistributionService: newDistributionService(base.New()),
ExplorerService: newExplorerService(base.New()),
HealthService: newHealthService(base.New()),
HeroService: newHeroService(base.New()),
HeroStatService: newHeroStatService(base.New()),
LeagueService: newLeagueService(base.New()),
LiveService: newLiveService(base.New()),
MatchService: newMatchService(base.New()),
MetadataService: newMetadataService(base.New()),
PlayerService: newPlayerService(base.New()),
ProMatchService: newProMatchService(base.New()),
ProPlayerService: newProPlayerService(base.New()),
PublicMatchService: newPublicMatchService(base.New()),
RankingService: newRankingService(base.New()),
RecordService: newRecordService(base.New()),
ReplayService: newReplayService(base.New()),
ScenariosService: newScenariosService(base.New()),
SchemaService: newSchemaService(base.New()),
SearchService: newSearchService(base.New()),
StatusService: newStatusService(base.New()),
TeamService: newTeamService(base.New()),
}
}