clashofclans.js 2.0.0-dev.dedb83d → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -5
- package/README.md +4 -3
- package/dist/client/Client.d.ts +5 -3
- package/dist/client/Client.js +14 -9
- package/dist/client/EventManager.d.ts +12 -12
- package/dist/client/EventManager.js +45 -26
- package/dist/rest/HTTPError.d.ts +1 -3
- package/dist/rest/HTTPError.js +1 -3
- package/dist/rest/RESTManager.d.ts +49 -144
- package/dist/rest/RESTManager.js +25 -1
- package/dist/rest/RequestHandler.d.ts +14 -7
- package/dist/rest/RequestHandler.js +39 -18
- package/dist/rest/Throttler.d.ts +0 -4
- package/dist/struct/Clan.d.ts +2 -1
- package/dist/struct/Clan.js +2 -2
- package/dist/struct/ClanMember.d.ts +2 -1
- package/dist/struct/ClanMember.js +2 -2
- package/dist/struct/ClanWarLeagueGroup.d.ts +5 -3
- package/dist/struct/ClanWarLeagueGroup.js +8 -7
- package/dist/struct/Player.d.ts +2 -1
- package/dist/struct/Player.js +7 -5
- package/dist/struct/PlayerClan.d.ts +2 -1
- package/dist/struct/PlayerClan.js +2 -2
- package/dist/struct/Unit.d.ts +37 -4
- package/dist/struct/Unit.js +49 -9
- package/dist/types/index.d.ts +2 -4
- package/dist/util/raw.json +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,15 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
## 2.0.
|
|
5
|
+
## 2.0.1 (2021-11-27)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- IP retrieval method and Event Loop ([#70](https://github.com/clashperk/clashofclans.js/issues/70)) ([82b84ba](https://github.com/clashperk/clashofclans.js/commit/82b84ba5d96505c43b75e53aa07f547ef0b77778))
|
|
10
|
+
|
|
11
|
+
## 2.0.0 (2021-11-26)
|
|
6
12
|
|
|
7
13
|
This new version is a complete TypeScript rewrite to convert everything from plain (literal JSON) objects to class (constructor) objects and support a lot more features.
|
|
8
14
|
|
|
9
15
|
### Features
|
|
10
16
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
17
|
+
- HTTP Request Request Retries ([#26](https://github.com/clashperk/clashofclans.js/issues/26)) ([94585f3](https://github.com/clashperk/clashofclans.js/commit/94585f3a84a7175b2d07872f9eb9e42372b95e12))
|
|
18
|
+
- Event Manager and Custom Events ([#37](https://github.com/clashperk/clashofclans.js/issues/37)) ([5027ae6](https://github.com/clashperk/clashofclans.js/commit/5027ae663a8e07175e17384c7e5706f4a1a7afb4))
|
|
13
19
|
- Email Password Login ([#31](https://github.com/clashperk/clashofclans.js/issues/31)) ([4153cd3](https://github.com/clashperk/clashofclans.js/commit/4153cd37ea0e1c71550b9e892105b84d5a407e23))
|
|
14
|
-
-
|
|
20
|
+
- Queue Throttler and Batch Throttler ([#34](https://github.com/clashperk/clashofclans.js/issues/34)) ([3a8f051](https://github.com/clashperk/clashofclans.js/commit/3a8f051552e93b98f89bc7d524acdecddf242718))
|
|
15
21
|
- Override Request Options ([#36](https://github.com/clashperk/clashofclans.js/issues/36)) ([42d7fdd](https://github.com/clashperk/clashofclans.js/commit/42d7fdd36262cc46f23b731f8cffb9daea19d3b0))
|
|
16
|
-
-
|
|
22
|
+
- Internal Caching Options ([#53](https://github.com/clashperk/clashofclans.js/issues/53)) ([984451d](https://github.com/clashperk/clashofclans.js/commit/30ea3240c11866008d0dae514468c0fdbb34ffd0))
|
|
23
|
+
- Additional Properties for Player Units ([#65](https://github.com/clashperk/clashofclans.js/pull/65)) ([aa1696](https://github.com/clashperk/clashofclans.js/commit/aa1696243d96d4fed0250b4282c60522a6482343))
|
|
24
|
+
|
|
25
|
+
### Links
|
|
26
|
+
|
|
27
|
+
- Documentation
|
|
28
|
+
https://clashofclans.js.org/docs
|
|
29
|
+
|
|
30
|
+
- Guide
|
|
31
|
+
https://clashofclans.js.org/guide
|
|
32
|
+
|
|
33
|
+
- Updating to v2.0.0
|
|
34
|
+
https://clashofclans.js.org/docs/updating-to-v2
|
package/README.md
CHANGED
|
@@ -39,12 +39,13 @@ const client = new Client();
|
|
|
39
39
|
```js
|
|
40
40
|
const { Client, BatchThrottler } = require('clashofclans.js');
|
|
41
41
|
const client = new Client({
|
|
42
|
+
cache: true,
|
|
42
43
|
retryLimit: 1,
|
|
43
|
-
restRequestTimeout:
|
|
44
|
-
throttler: new BatchThrottler(
|
|
44
|
+
restRequestTimeout: 5000,
|
|
45
|
+
throttler: new BatchThrottler(20)
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
client.events.addClans(['#8P2QG08P']);
|
|
48
|
+
client.events.addClans(['#8QU8J9LP', '#8P2QG08P']);
|
|
48
49
|
client.events.setClanEvent({
|
|
49
50
|
name: 'clanDescriptionChange',
|
|
50
51
|
filter: (oldClan, newClan) => {
|
package/dist/client/Client.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare class Client extends EventEmitter {
|
|
|
21
21
|
constructor(options?: ClientOptions);
|
|
22
22
|
/** Contains various general-purpose utility methods. */
|
|
23
23
|
get util(): typeof Util;
|
|
24
|
+
/** Whether the API is in maintenance break. */
|
|
25
|
+
get inMaintenance(): boolean;
|
|
24
26
|
/**
|
|
25
27
|
* Initialize the client to create keys.
|
|
26
28
|
* @example
|
|
@@ -76,7 +78,7 @@ export declare class Client extends EventEmitter {
|
|
|
76
78
|
private _getClanWars;
|
|
77
79
|
/** Get information about clan war league. */
|
|
78
80
|
getClanWarLeagueGroup(clanTag: string, options?: OverrideOptions): Promise<ClanWarLeagueGroup>;
|
|
79
|
-
/** Get
|
|
81
|
+
/** Get info about a CWL round by WarTag. */
|
|
80
82
|
getClanWarLeagueRound(warTag: string | {
|
|
81
83
|
warTag: string;
|
|
82
84
|
clanTag?: string;
|
|
@@ -99,9 +101,9 @@ export declare class Client extends EventEmitter {
|
|
|
99
101
|
getClanRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedClan[]>;
|
|
100
102
|
/** Get player rankings for a specific location. */
|
|
101
103
|
getPlayerRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedPlayer[]>;
|
|
102
|
-
/** Get clan versus rankings for a specific location */
|
|
104
|
+
/** Get clan versus rankings for a specific location. */
|
|
103
105
|
getVersusClanRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedClan[]>;
|
|
104
|
-
/** Get player versus rankings for a specific location */
|
|
106
|
+
/** Get player versus rankings for a specific location. */
|
|
105
107
|
getVersusPlayerRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedPlayer[]>;
|
|
106
108
|
/** Get list of clan labels. */
|
|
107
109
|
getClanLabels(options?: SearchOptions): Promise<Label[]>;
|
package/dist/client/Client.js
CHANGED
|
@@ -25,6 +25,11 @@ class Client extends events_1.EventEmitter {
|
|
|
25
25
|
get util() {
|
|
26
26
|
return Util_1.Util;
|
|
27
27
|
}
|
|
28
|
+
/** Whether the API is in maintenance break. */
|
|
29
|
+
get inMaintenance() {
|
|
30
|
+
// @ts-expect-error
|
|
31
|
+
return this.events._inMaintenance;
|
|
32
|
+
}
|
|
28
33
|
/**
|
|
29
34
|
* Initialize the client to create keys.
|
|
30
35
|
* @example
|
|
@@ -88,7 +93,7 @@ class Client extends events_1.EventEmitter {
|
|
|
88
93
|
}
|
|
89
94
|
catch (e) {
|
|
90
95
|
if (e instanceof HTTPError_1.HTTPError && [200, 403].includes(e.status)) {
|
|
91
|
-
return this.getLeagueWar({ clanTag: args.clanTag, round: args.round });
|
|
96
|
+
return this.getLeagueWar({ clanTag: args.clanTag, round: args.round }, options);
|
|
92
97
|
}
|
|
93
98
|
throw e;
|
|
94
99
|
}
|
|
@@ -117,7 +122,7 @@ class Client extends events_1.EventEmitter {
|
|
|
117
122
|
.map((round) => round.warTags)
|
|
118
123
|
.flat()
|
|
119
124
|
.reverse();
|
|
120
|
-
const wars = await this.util.allSettled(warTags.map((warTag) => this.getClanWarLeagueRound({ warTag, clanTag: args.clanTag }, { ignoreRateLimit: true })));
|
|
125
|
+
const wars = await this.util.allSettled(warTags.map((warTag) => this.getClanWarLeagueRound({ warTag, clanTag: args.clanTag }, { ...options, ignoreRateLimit: true })));
|
|
121
126
|
if (args.round && args.round in Constants_1.CWL_ROUNDS) {
|
|
122
127
|
return wars.find((war) => war.state === state) ?? null;
|
|
123
128
|
}
|
|
@@ -126,7 +131,7 @@ class Client extends events_1.EventEmitter {
|
|
|
126
131
|
async _getCurrentLeagueWars(clanTag, options) {
|
|
127
132
|
const data = await this.getClanWarLeagueGroup(clanTag, options);
|
|
128
133
|
// @ts-expect-error
|
|
129
|
-
return data._getCurrentWars(clanTag);
|
|
134
|
+
return data._getCurrentWars(clanTag, options);
|
|
130
135
|
}
|
|
131
136
|
async _getClanWars(clanTag, options) {
|
|
132
137
|
const date = new Date().getUTCDate();
|
|
@@ -134,11 +139,11 @@ class Client extends events_1.EventEmitter {
|
|
|
134
139
|
return [await this.getClanWar(clanTag, options)];
|
|
135
140
|
}
|
|
136
141
|
try {
|
|
137
|
-
return this._getCurrentLeagueWars(clanTag);
|
|
142
|
+
return this._getCurrentLeagueWars(clanTag, options);
|
|
138
143
|
}
|
|
139
144
|
catch (e) {
|
|
140
145
|
if (e instanceof HTTPError_1.HTTPError && [404].includes(e.status)) {
|
|
141
|
-
return [await this.getClanWar(clanTag)];
|
|
146
|
+
return [await this.getClanWar(clanTag, options)];
|
|
142
147
|
}
|
|
143
148
|
throw e;
|
|
144
149
|
}
|
|
@@ -148,7 +153,7 @@ class Client extends events_1.EventEmitter {
|
|
|
148
153
|
const { data } = await this.rest.getClanWarLeagueGroup(clanTag, options);
|
|
149
154
|
return new struct_1.ClanWarLeagueGroup(this, data);
|
|
150
155
|
}
|
|
151
|
-
/** Get
|
|
156
|
+
/** Get info about a CWL round by WarTag. */
|
|
152
157
|
async getClanWarLeagueRound(warTag, options) {
|
|
153
158
|
const args = typeof warTag === 'string' ? { warTag } : { warTag: warTag.warTag, clanTag: warTag.clanTag };
|
|
154
159
|
const { data, maxAge, status, path } = await this.rest.getClanWarLeagueRound(args.warTag, options);
|
|
@@ -164,7 +169,7 @@ class Client extends events_1.EventEmitter {
|
|
|
164
169
|
}
|
|
165
170
|
/** Verify Player API token that can be found from the Game settings. */
|
|
166
171
|
async verifyPlayerToken(playerTag, token, options) {
|
|
167
|
-
const { data } = await this.rest.
|
|
172
|
+
const { data } = await this.rest.verifyPlayerToken(playerTag, token, options);
|
|
168
173
|
return data.status === 'ok';
|
|
169
174
|
}
|
|
170
175
|
/** Get list of Leagues. */
|
|
@@ -203,12 +208,12 @@ class Client extends events_1.EventEmitter {
|
|
|
203
208
|
const { data } = await this.rest.getPlayerRanks(locationId, options);
|
|
204
209
|
return data.items.map((entry) => new struct_1.RankedPlayer(this, entry));
|
|
205
210
|
}
|
|
206
|
-
/** Get clan versus rankings for a specific location */
|
|
211
|
+
/** Get clan versus rankings for a specific location. */
|
|
207
212
|
async getVersusClanRanks(locationId, options) {
|
|
208
213
|
const { data } = await this.rest.getVersusClanRanks(locationId, options);
|
|
209
214
|
return data.items.map((entry) => new struct_1.RankedClan(entry));
|
|
210
215
|
}
|
|
211
|
-
/** Get player versus rankings for a specific location */
|
|
216
|
+
/** Get player versus rankings for a specific location. */
|
|
212
217
|
async getVersusPlayerRanks(locationId, options) {
|
|
213
218
|
const { data } = await this.rest.getVersusPlayerRanks(locationId, options);
|
|
214
219
|
return data.items.map((entry) => new struct_1.RankedPlayer(this, entry));
|
|
@@ -15,18 +15,18 @@ export declare class EventManager {
|
|
|
15
15
|
constructor(client: Client);
|
|
16
16
|
/** Initialize the Event Manager to start pulling. */
|
|
17
17
|
init(): Promise<string[]>;
|
|
18
|
-
/** Add
|
|
19
|
-
addClans(
|
|
20
|
-
/** Delete
|
|
21
|
-
deleteClans(
|
|
22
|
-
/** Add
|
|
23
|
-
addPlayers(
|
|
24
|
-
/** Delete
|
|
25
|
-
deletePlayers(
|
|
26
|
-
/** Add
|
|
27
|
-
addWars(
|
|
28
|
-
/** Delete
|
|
29
|
-
deleteWars(
|
|
18
|
+
/** Add clan tags to clan events. */
|
|
19
|
+
addClans(tags: string[] | string): this;
|
|
20
|
+
/** Delete clan tags from clan events. */
|
|
21
|
+
deleteClans(tags: string[] | string): this;
|
|
22
|
+
/** Add player tags for player events. */
|
|
23
|
+
addPlayers(tags: string[] | string): this;
|
|
24
|
+
/** Delete player tags from player events. */
|
|
25
|
+
deletePlayers(tags: string[] | string): this;
|
|
26
|
+
/** Add clan tags for war events. */
|
|
27
|
+
addWars(tags: string[] | string): this;
|
|
28
|
+
/** Delete clan tags from war events. */
|
|
29
|
+
deleteWars(tags: string[] | string): this;
|
|
30
30
|
/**
|
|
31
31
|
* Set your own custom clan event.
|
|
32
32
|
*
|
|
@@ -31,45 +31,52 @@ class EventManager {
|
|
|
31
31
|
this.warUpdateHandler();
|
|
32
32
|
return Promise.resolve(this.client.eventNames());
|
|
33
33
|
}
|
|
34
|
-
/** Add
|
|
35
|
-
addClans(
|
|
36
|
-
for (const tag of tags) {
|
|
34
|
+
/** Add clan tags to clan events. */
|
|
35
|
+
addClans(tags) {
|
|
36
|
+
for (const tag of Array.isArray(tags) ? tags : [tags]) {
|
|
37
37
|
this._clanTags.add(this.client.util.parseTag(tag));
|
|
38
38
|
}
|
|
39
39
|
return this;
|
|
40
40
|
}
|
|
41
|
-
/** Delete
|
|
42
|
-
deleteClans(
|
|
43
|
-
for (const tag of tags) {
|
|
44
|
-
this.
|
|
41
|
+
/** Delete clan tags from clan events. */
|
|
42
|
+
deleteClans(tags) {
|
|
43
|
+
for (const tag of Array.isArray(tags) ? tags : [tags]) {
|
|
44
|
+
const key = this.client.util.parseTag(tag);
|
|
45
|
+
this._clans.delete(key);
|
|
46
|
+
this._clanTags.delete(key);
|
|
45
47
|
}
|
|
46
48
|
return this;
|
|
47
49
|
}
|
|
48
|
-
/** Add
|
|
49
|
-
addPlayers(
|
|
50
|
-
for (const tag of tags) {
|
|
50
|
+
/** Add player tags for player events. */
|
|
51
|
+
addPlayers(tags) {
|
|
52
|
+
for (const tag of Array.isArray(tags) ? tags : [tags]) {
|
|
51
53
|
this._playerTags.add(this.client.util.parseTag(tag));
|
|
52
54
|
}
|
|
53
55
|
return this;
|
|
54
56
|
}
|
|
55
|
-
/** Delete
|
|
56
|
-
deletePlayers(
|
|
57
|
-
for (const tag of tags) {
|
|
58
|
-
this.
|
|
57
|
+
/** Delete player tags from player events. */
|
|
58
|
+
deletePlayers(tags) {
|
|
59
|
+
for (const tag of Array.isArray(tags) ? tags : [tags]) {
|
|
60
|
+
const key = this.client.util.parseTag(tag);
|
|
61
|
+
this._players.delete(key);
|
|
62
|
+
this._playerTags.delete(key);
|
|
59
63
|
}
|
|
60
64
|
return this;
|
|
61
65
|
}
|
|
62
|
-
/** Add
|
|
63
|
-
addWars(
|
|
64
|
-
for (const tag of tags) {
|
|
66
|
+
/** Add clan tags for war events. */
|
|
67
|
+
addWars(tags) {
|
|
68
|
+
for (const tag of Array.isArray(tags) ? tags : [tags]) {
|
|
65
69
|
this._warTags.add(this.client.util.parseTag(tag));
|
|
66
70
|
}
|
|
67
71
|
return this;
|
|
68
72
|
}
|
|
69
|
-
/** Delete
|
|
70
|
-
deleteWars(
|
|
71
|
-
for (const tag of tags) {
|
|
72
|
-
this.
|
|
73
|
+
/** Delete clan tags from war events. */
|
|
74
|
+
deleteWars(tags) {
|
|
75
|
+
for (const tag of Array.isArray(tags) ? tags : [tags]) {
|
|
76
|
+
const key = this.client.util.parseTag(tag);
|
|
77
|
+
this._wars.delete(`${key}:${1}`);
|
|
78
|
+
this._wars.delete(`${key}:${2}`);
|
|
79
|
+
this._warTags.delete(key);
|
|
73
80
|
}
|
|
74
81
|
return this;
|
|
75
82
|
}
|
|
@@ -100,6 +107,10 @@ class EventManager {
|
|
|
100
107
|
* @returns
|
|
101
108
|
*/
|
|
102
109
|
setClanEvent(event) {
|
|
110
|
+
if (!event.name)
|
|
111
|
+
throw new Error('Event name is required.');
|
|
112
|
+
if (typeof event.filter !== 'function')
|
|
113
|
+
throw new Error('Filter function is required.');
|
|
103
114
|
this._events.clans.push(event);
|
|
104
115
|
return this;
|
|
105
116
|
}
|
|
@@ -109,6 +120,10 @@ class EventManager {
|
|
|
109
120
|
* In order to emit the custom event, you must have this filter function that returns a boolean.
|
|
110
121
|
*/
|
|
111
122
|
setWarEvent(event) {
|
|
123
|
+
if (!event.name)
|
|
124
|
+
throw new Error('Event name is required.');
|
|
125
|
+
if (typeof event.filter !== 'function')
|
|
126
|
+
throw new Error('Filter function is required.');
|
|
112
127
|
this._events.wars.push(event);
|
|
113
128
|
return this;
|
|
114
129
|
}
|
|
@@ -118,6 +133,10 @@ class EventManager {
|
|
|
118
133
|
* In order to emit the custom event, you must have this filter function that returns a boolean.
|
|
119
134
|
*/
|
|
120
135
|
setPlayerEvent(event) {
|
|
136
|
+
if (!event.name)
|
|
137
|
+
throw new Error('Event name is required.');
|
|
138
|
+
if (typeof event.filter !== 'function')
|
|
139
|
+
throw new Error('Filter function is required.');
|
|
121
140
|
this._events.players.push(event);
|
|
122
141
|
return this;
|
|
123
142
|
}
|
|
@@ -127,7 +146,7 @@ class EventManager {
|
|
|
127
146
|
const res = await this.client.rest.getClans({ maxMembers: Math.floor(Math.random() * 40) + 10, limit: 1 });
|
|
128
147
|
if (res.status === 200 && this._inMaintenance) {
|
|
129
148
|
this._inMaintenance = Boolean(false);
|
|
130
|
-
const duration =
|
|
149
|
+
const duration = Date.now() - this._maintenanceStartTime.getTime();
|
|
131
150
|
this._maintenanceStartTime = null;
|
|
132
151
|
this.client.emit(Constants_1.EVENTS.MAINTENANCE_END, duration);
|
|
133
152
|
}
|
|
@@ -144,7 +163,7 @@ class EventManager {
|
|
|
144
163
|
const end = Util_1.Util.getSeasonEndTime().getTime() - Date.now();
|
|
145
164
|
// Why this? setTimeout can be up to 24.8 days or 2147483647ms [(2^31 - 1) Max 32bit Integer]
|
|
146
165
|
if (end > 24 * 60 * 60 * 1000) {
|
|
147
|
-
setTimeout(this.seasonEndHandler.bind(this), 60 * 60 * 1000)
|
|
166
|
+
setTimeout(this.seasonEndHandler.bind(this), 60 * 60 * 1000);
|
|
148
167
|
}
|
|
149
168
|
else if (end > 0) {
|
|
150
169
|
setTimeout(() => {
|
|
@@ -222,8 +241,8 @@ class EventManager {
|
|
|
222
241
|
const clanWars = await this.client._getClanWars(tag).catch(() => null);
|
|
223
242
|
if (!clanWars?.length)
|
|
224
243
|
return null;
|
|
225
|
-
clanWars.forEach(async (war,
|
|
226
|
-
const key = `${tag}:${
|
|
244
|
+
clanWars.forEach(async (war, index) => {
|
|
245
|
+
const key = `${tag}:${index}`;
|
|
227
246
|
const cached = this._wars.get(key);
|
|
228
247
|
if (!cached)
|
|
229
248
|
return this._wars.set(key, war);
|
|
@@ -238,7 +257,7 @@ class EventManager {
|
|
|
238
257
|
}
|
|
239
258
|
}
|
|
240
259
|
// check for war end
|
|
241
|
-
if (
|
|
260
|
+
if (index === 1 && cached.warTag !== war.warTag) {
|
|
242
261
|
const data = await this.client.getLeagueWar({ clanTag: tag, round: 'PREVIOUS_ROUND' }).catch(() => null);
|
|
243
262
|
if (data && data.warTag === cached.warTag) {
|
|
244
263
|
for (const { name, filter } of this._events.wars) {
|
package/dist/rest/HTTPError.d.ts
CHANGED
package/dist/rest/HTTPError.js
CHANGED
|
@@ -2,150 +2,55 @@ import { RequestHandler, SearchOptions, ClanSearchOptions, ClientOptions, Overri
|
|
|
2
2
|
import { APIClan, APIClanList, APIClanMemberList, APIClanRankingList, APIClanVersusRankingList, APIClanWar, APIClanWarLeagueGroup, APIClanWarLog, APIGoldPassSeason, APILabelList, APILeague, APILeagueList, APILeagueSeasonList, APILocation, APILocationList, APIPlayer, APIPlayerRankingList, APIPlayerSeasonRankingList, APIPlayerVersusRankingList, APIVerifyToken, APIWarLeague, APIWarLeagueList } from '../types';
|
|
3
3
|
/** Represents a REST Manager of the client. */
|
|
4
4
|
export declare class RESTManager {
|
|
5
|
+
/** Request Handler for the RESTManager. */
|
|
5
6
|
readonly handler: RequestHandler;
|
|
6
7
|
constructor(options?: ClientOptions);
|
|
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
|
-
postPlayerToken(playerTag: string, token: string, options?: OverrideOptions): Promise<{
|
|
56
|
-
data: APIVerifyToken;
|
|
57
|
-
maxAge: number;
|
|
58
|
-
status: number;
|
|
59
|
-
path: string;
|
|
60
|
-
}>;
|
|
61
|
-
getLeagues(options?: SearchOptions): Promise<{
|
|
62
|
-
data: APILeagueList;
|
|
63
|
-
maxAge: number;
|
|
64
|
-
status: number;
|
|
65
|
-
path: string;
|
|
66
|
-
}>;
|
|
67
|
-
getLeague(leagueId: string | number, options?: OverrideOptions): Promise<{
|
|
68
|
-
data: APILeague;
|
|
69
|
-
maxAge: number;
|
|
70
|
-
status: number;
|
|
71
|
-
path: string;
|
|
72
|
-
}>;
|
|
73
|
-
getLeagueSeasons(leagueId: number, options?: SearchOptions): Promise<{
|
|
74
|
-
data: APILeagueSeasonList;
|
|
75
|
-
maxAge: number;
|
|
76
|
-
status: number;
|
|
77
|
-
path: string;
|
|
78
|
-
}>;
|
|
79
|
-
getSeasonRankings(leagueId: number, seasonId: string, options?: SearchOptions): Promise<{
|
|
80
|
-
data: APIPlayerSeasonRankingList;
|
|
81
|
-
maxAge: number;
|
|
82
|
-
status: number;
|
|
83
|
-
path: string;
|
|
84
|
-
}>;
|
|
85
|
-
getWarLeagues(options?: SearchOptions): Promise<{
|
|
86
|
-
data: APIWarLeagueList;
|
|
87
|
-
maxAge: number;
|
|
88
|
-
status: number;
|
|
89
|
-
path: string;
|
|
90
|
-
}>;
|
|
91
|
-
getWarLeague(leagueId: number, options?: OverrideOptions): Promise<{
|
|
92
|
-
data: APIWarLeague;
|
|
93
|
-
maxAge: number;
|
|
94
|
-
status: number;
|
|
95
|
-
path: string;
|
|
96
|
-
}>;
|
|
97
|
-
getLocations(options?: SearchOptions): Promise<{
|
|
98
|
-
data: APILocationList;
|
|
99
|
-
maxAge: number;
|
|
100
|
-
status: number;
|
|
101
|
-
path: string;
|
|
102
|
-
}>;
|
|
103
|
-
getLocation(locationId: number, options?: OverrideOptions): Promise<{
|
|
104
|
-
data: APILocation;
|
|
105
|
-
maxAge: number;
|
|
106
|
-
status: number;
|
|
107
|
-
path: string;
|
|
108
|
-
}>;
|
|
109
|
-
getClanRanks(locationId: number | string, options?: SearchOptions): Promise<{
|
|
110
|
-
data: APIClanRankingList;
|
|
111
|
-
maxAge: number;
|
|
112
|
-
status: number;
|
|
113
|
-
path: string;
|
|
114
|
-
}>;
|
|
115
|
-
getPlayerRanks(locationId: number | string, options?: SearchOptions): Promise<{
|
|
116
|
-
data: APIPlayerRankingList;
|
|
117
|
-
maxAge: number;
|
|
118
|
-
status: number;
|
|
119
|
-
path: string;
|
|
120
|
-
}>;
|
|
121
|
-
getVersusClanRanks(locationId: number | string, options?: SearchOptions): Promise<{
|
|
122
|
-
data: APIClanVersusRankingList;
|
|
123
|
-
maxAge: number;
|
|
124
|
-
status: number;
|
|
125
|
-
path: string;
|
|
126
|
-
}>;
|
|
127
|
-
getVersusPlayerRanks(locationId: number | string, options?: SearchOptions): Promise<{
|
|
128
|
-
data: APIPlayerVersusRankingList;
|
|
129
|
-
maxAge: number;
|
|
130
|
-
status: number;
|
|
131
|
-
path: string;
|
|
132
|
-
}>;
|
|
133
|
-
getClanLabels(options?: SearchOptions): Promise<{
|
|
134
|
-
data: APILabelList;
|
|
135
|
-
maxAge: number;
|
|
136
|
-
status: number;
|
|
137
|
-
path: string;
|
|
138
|
-
}>;
|
|
139
|
-
getPlayerLabels(options?: SearchOptions): Promise<{
|
|
140
|
-
data: APILabelList;
|
|
141
|
-
maxAge: number;
|
|
142
|
-
status: number;
|
|
143
|
-
path: string;
|
|
144
|
-
}>;
|
|
145
|
-
getGoldPassSeason(options?: OverrideOptions): Promise<{
|
|
146
|
-
data: APIGoldPassSeason;
|
|
147
|
-
maxAge: number;
|
|
148
|
-
status: number;
|
|
149
|
-
path: string;
|
|
150
|
-
}>;
|
|
8
|
+
/** Search all clans by name and/or filtering the results using various criteria. */
|
|
9
|
+
getClans(options: ClanSearchOptions): Promise<import("./RequestHandler").Response<APIClanList>>;
|
|
10
|
+
/** Get information about a clan. */
|
|
11
|
+
getClan(clanTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClan>>;
|
|
12
|
+
/** Get list of clan members. */
|
|
13
|
+
getClanMembers(clanTag: string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIClanMemberList>>;
|
|
14
|
+
/** Get clan war log. */
|
|
15
|
+
getClanWarLog(clanTag: string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIClanWarLog>>;
|
|
16
|
+
/** Get info about currently running war in the clan. */
|
|
17
|
+
getCurrentWar(clanTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClanWar>>;
|
|
18
|
+
/** Get information about clan war league. */
|
|
19
|
+
getClanWarLeagueGroup(clanTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClanWarLeagueGroup>>;
|
|
20
|
+
/** Get info about a CWL round by WarTag. */
|
|
21
|
+
getClanWarLeagueRound(warTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClanWar>>;
|
|
22
|
+
/** Get information about a player by tag. */
|
|
23
|
+
getPlayer(playerTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIPlayer>>;
|
|
24
|
+
/** Verify Player API token that can be found from the Game settings. */
|
|
25
|
+
verifyPlayerToken(playerTag: string, token: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIVerifyToken>>;
|
|
26
|
+
/** Get list of Leagues. */
|
|
27
|
+
getLeagues(options?: SearchOptions): Promise<import("./RequestHandler").Response<APILeagueList>>;
|
|
28
|
+
/** Get a League info. */
|
|
29
|
+
getLeague(leagueId: string | number, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APILeague>>;
|
|
30
|
+
/** Get Legend League season Ids. */
|
|
31
|
+
getLeagueSeasons(leagueId: number, options?: SearchOptions): Promise<import("./RequestHandler").Response<APILeagueSeasonList>>;
|
|
32
|
+
/** Get Legend League season rankings by season Id. */
|
|
33
|
+
getSeasonRankings(leagueId: number, seasonId: string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIPlayerSeasonRankingList>>;
|
|
34
|
+
/** Get list of Clan War Leagues. */
|
|
35
|
+
getWarLeagues(options?: SearchOptions): Promise<import("./RequestHandler").Response<APIWarLeagueList>>;
|
|
36
|
+
/** Get info about a Clan War League. */
|
|
37
|
+
getWarLeague(leagueId: number, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIWarLeague>>;
|
|
38
|
+
/** Get list of Locations. */
|
|
39
|
+
getLocations(options?: SearchOptions): Promise<import("./RequestHandler").Response<APILocationList>>;
|
|
40
|
+
/** Get info about a Location. */
|
|
41
|
+
getLocation(locationId: number, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APILocation>>;
|
|
42
|
+
/** Get clan rankings for a specific location. */
|
|
43
|
+
getClanRanks(locationId: number | string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIClanRankingList>>;
|
|
44
|
+
/** Get player rankings for a specific location. */
|
|
45
|
+
getPlayerRanks(locationId: number | string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIPlayerRankingList>>;
|
|
46
|
+
/** Get clan versus rankings for a specific location. */
|
|
47
|
+
getVersusClanRanks(locationId: number | string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIClanVersusRankingList>>;
|
|
48
|
+
/** Get player versus rankings for a specific location. */
|
|
49
|
+
getVersusPlayerRanks(locationId: number | string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIPlayerVersusRankingList>>;
|
|
50
|
+
/** Get list of clan labels. */
|
|
51
|
+
getClanLabels(options?: SearchOptions): Promise<import("./RequestHandler").Response<APILabelList>>;
|
|
52
|
+
/** Get list of player labels. */
|
|
53
|
+
getPlayerLabels(options?: SearchOptions): Promise<import("./RequestHandler").Response<APILabelList>>;
|
|
54
|
+
/** Get info about gold pass season. */
|
|
55
|
+
getGoldPassSeason(options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIGoldPassSeason>>;
|
|
151
56
|
}
|