-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
134 lines (113 loc) · 4.41 KB
/
main.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/megyland/clash-go/clash"
"net/http"
)
func main() {
client := clash.NewClient(new(http.Client), "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiIsImtpZCI6IjI4YTMxOGY3LTAwMDAtYTFlYi03ZmExLTJjNzQzM2M2Y2NhNSJ9.eyJpc3MiOiJzdXBlcmNlbGwiLCJhdWQiOiJzdXBlcmNlbGw6Z2FtZWFwaSIsImp0aSI6ImJhZDA1NTAxLWVhNWQtNDI3Yy1iM2MwLTBkNzUxMDQ4NjNhMiIsImlhdCI6MTU2MjQyMzEyMCwic3ViIjoiZGV2ZWxvcGVyLzkyMjFmZjM1LWRkNjctNTQ0ZC00ZTI5LTQ4ZThlOTgwZmZjNSIsInNjb3BlcyI6WyJjbGFzaCJdLCJsaW1pdHMiOlt7InRpZXIiOiJkZXZlbG9wZXIvc2lsdmVyIiwidHlwZSI6InRocm90dGxpbmcifSx7ImNpZHJzIjpbIjEwOS4xNC4xMTQuMTczIl0sInR5cGUiOiJjbGllbnQifV19.s0qxcdluiJr3MifW_E6jOEq6ZTY6-Nc-SYB_3lsQAmfO5c9GMkCQQv1ZpArUmIkzc0sbrDO2-KYt8VdsnU3dWg")
/*player, _, err := client.Players.Get(context.Background(), "#8UCG8C0U")
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(player))*/
/*clan, _, err := client.Clans.Get(context.Background(), "#28GQRLV2J")
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(clan))*/
/*opt := &clash.SearchOptions{
Name: "Team4Playing",
Options: clash.Options{Limit: 1},
}
clanResults, _, err := client.Clans.Search(context.Background(), opt)
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(clanResults))*/
/*clanMembers, _, err := client.Clans.GetMembers(context.Background(), "#28GQRLV2J", &clash.Options{Limit: 1})
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(clanMembers))*/
// TODO: Test with a public clan
/*warLog, _, err := client.Clans.GetWarLog(context.Background(), "#28GQRLV2J", &clash.Options{Limit: 3})
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(warLog))*/
// TODO: Test with a public clan
/*currentWar, _, err := client.Clans.GetCurrentWar(context.Background(), "#28GQRLV2J")
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(currentWar))*/
// TODO: Test with a public clan
/*currentWarLeagueGroup, _, err := client.Clans.GetCurrentWarLeagueGroup(context.Background(), "#28GQRLV2J")
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(currentWarLeagueGroup))*/
// TODO: Test with a public clan
/*currentWarLeagueWar, _, err := client.Clans.GetClanLeagueWar(context.Background(), "#28GQRLV2J")
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(currentWarLeagueWar))*/
/*locationList, _, err := client.Locations.List(context.Background(), nil)
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(locationList))*/
/*location, _, err := client.Locations.Get(context.Background(), "32000087")
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(location))*/
/*locationRankingClan, _, err := client.Locations.GetClanRankings(context.Background(), "32000087", &clash.Options{Limit: 10})
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(locationRankingClan))*/
/*locationRankingPlayer, _, err := client.Locations.GetPlayerRankings(context.Background(), "32000087", &clash.Options{Limit: 10})
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(locationRankingPlayer))*/
/*locationRankingClanVersus, _, err := client.Locations.GetClanVersusRankings(context.Background(), "32000087", &clash.Options{Limit: 10})
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(locationRankingClanVersus))*/
/*locationRankingPlayerVersus, _, err := client.Locations.GetPlayerVersusRankings(context.Background(), "32000087", &clash.Options{Limit: 10})
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(locationRankingPlayerVersus))*/
/*leagues, _, err := client.Leagues.List(context.Background(), nil)
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(leagues))*/
/*league, _, err := client.Leagues.Get(context.Background(), "29000000")
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(league))*/
leagueSeason, _, err := client.Leagues.GetLeagueSeason(context.Background(), "29000022", nil)
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(leagueSeason))
seasonPlayersRanking, _, err := client.Leagues.GetLeagueSeasonRankings(context.Background(), "29000022", "2019-02", nil)
if err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Println(prettyPrint(seasonPlayersRanking))
}
func prettyPrint(i interface{}) string {
s, _ := json.MarshalIndent(i, "", "\t")
return string(s)
}