clashofclans.js 2.0.1-dev.82b84ba → 2.0.2
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 +18 -4
- package/dist/client/Client.d.ts +26 -10
- package/dist/client/Client.js +26 -11
- package/dist/rest/HTTPError.d.ts +7 -2
- package/dist/rest/HTTPError.js +3 -3
- package/dist/rest/RESTManager.d.ts +4 -4
- package/dist/rest/RESTManager.js +5 -6
- package/dist/struct/Clan.d.ts +1 -1
- package/dist/struct/Clan.js +1 -1
- package/dist/struct/ClanWarLeagueGroup.d.ts +1 -1
- package/dist/struct/ClanWarLeagueGroup.js +1 -1
- package/dist/struct/PlayerClan.d.ts +7 -3
- package/dist/struct/PlayerClan.js +2 -2
- package/dist/struct/Ranking.d.ts +25 -5
- package/dist/struct/Ranking.js +21 -5
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,16 +2,30 @@
|
|
|
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.2 (2021-11-30)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- Return `null` for `RankedPlayer.clan` if they are not in the clan. ([#73](https://github.com/clashperk/clashofclans.js/pull/73)) ([ba82327](https://github.com/clashperk/clashofclans.js/commit/ba8232740f4ca9af2bcc7971aca3574612ef25b6))
|
|
10
|
+
- `OverrideOptions` added for `Client#getClans` and `RESTManager#getClans` ([#73](https://github.com/clashperk/clashofclans.js/pull/73)) ([ba82327](https://github.com/clashperk/clashofclans.js/commit/ba8232740f4ca9af2bcc7971aca3574612ef25b6))
|
|
11
|
+
- `SeasonRankedPlayer` class for legend league ranking. ([#73](https://github.com/clashperk/clashofclans.js/pull/73)) ([ba82327](https://github.com/clashperk/clashofclans.js/commit/ba8232740f4ca9af2bcc7971aca3574612ef25b6))
|
|
12
|
+
|
|
13
|
+
## 2.0.1 (2021-11-27)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- IP retrieval method and Event Loop ([#70](https://github.com/clashperk/clashofclans.js/issues/70)) ([82b84ba](https://github.com/clashperk/clashofclans.js/commit/82b84ba5d96505c43b75e53aa07f547ef0b77778))
|
|
18
|
+
|
|
5
19
|
## 2.0.0 (2021-11-26)
|
|
6
20
|
|
|
7
21
|
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
22
|
|
|
9
23
|
### Features
|
|
10
24
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
25
|
+
- HTTP Request Request Retries ([#26](https://github.com/clashperk/clashofclans.js/issues/26)) ([94585f3](https://github.com/clashperk/clashofclans.js/commit/94585f3a84a7175b2d07872f9eb9e42372b95e12))
|
|
26
|
+
- Event Manager and Custom Events ([#37](https://github.com/clashperk/clashofclans.js/issues/37)) ([5027ae6](https://github.com/clashperk/clashofclans.js/commit/5027ae663a8e07175e17384c7e5706f4a1a7afb4))
|
|
13
27
|
- Email Password Login ([#31](https://github.com/clashperk/clashofclans.js/issues/31)) ([4153cd3](https://github.com/clashperk/clashofclans.js/commit/4153cd37ea0e1c71550b9e892105b84d5a407e23))
|
|
14
|
-
-
|
|
28
|
+
- Queue Throttler and Batch Throttler ([#34](https://github.com/clashperk/clashofclans.js/issues/34)) ([3a8f051](https://github.com/clashperk/clashofclans.js/commit/3a8f051552e93b98f89bc7d524acdecddf242718))
|
|
15
29
|
- Override Request Options ([#36](https://github.com/clashperk/clashofclans.js/issues/36)) ([42d7fdd](https://github.com/clashperk/clashofclans.js/commit/42d7fdd36262cc46f23b731f8cffb9daea19d3b0))
|
|
16
30
|
- Internal Caching Options ([#53](https://github.com/clashperk/clashofclans.js/issues/53)) ([984451d](https://github.com/clashperk/clashofclans.js/commit/30ea3240c11866008d0dae514468c0fdbb34ffd0))
|
|
17
|
-
-
|
|
31
|
+
- Additional Properties for Player Units ([#65](https://github.com/clashperk/clashofclans.js/pull/65)) ([aa1696](https://github.com/clashperk/clashofclans.js/commit/aa1696243d96d4fed0250b4282c60522a6482343))
|
package/dist/client/Client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { RESTManager } from '../rest/RESTManager';
|
|
|
5
5
|
import { EventManager } from './EventManager';
|
|
6
6
|
import { EventEmitter } from 'events';
|
|
7
7
|
import { Util } from '../util/Util';
|
|
8
|
-
import { Clan, ClanMember, ClanWar, ClanWarLog, League, Location, Player, WarLeague, RankedClan, RankedPlayer, Label, GoldPassSeason, ClanWarLeagueGroup } from '../struct';
|
|
8
|
+
import { Clan, ClanMember, ClanWar, ClanWarLog, League, Location, Player, WarLeague, RankedClan, RankedPlayer, Label, SeasonRankedPlayer, GoldPassSeason, ClanWarLeagueGroup } from '../struct';
|
|
9
9
|
/**
|
|
10
10
|
* Represents Clash of Clans API Client.
|
|
11
11
|
* ```js
|
|
@@ -35,8 +35,8 @@ export declare class Client extends EventEmitter {
|
|
|
35
35
|
/** Set Clash of Clans API keys. */
|
|
36
36
|
setKeys(keys: string[]): this;
|
|
37
37
|
/** Search all clans by name and/or filtering the results using various criteria. */
|
|
38
|
-
getClans(
|
|
39
|
-
/** Get
|
|
38
|
+
getClans(query: ClanSearchOptions, options?: OverrideOptions): Promise<Clan[]>;
|
|
39
|
+
/** Get info about a clan. */
|
|
40
40
|
getClan(clanTag: string, options?: OverrideOptions): Promise<Clan>;
|
|
41
41
|
/** Get list of clan members. */
|
|
42
42
|
getClanMembers(clanTag: string, options?: SearchOptions): Promise<ClanMember[]>;
|
|
@@ -76,14 +76,14 @@ export declare class Client extends EventEmitter {
|
|
|
76
76
|
}, options?: OverrideOptions): Promise<ClanWar | null>;
|
|
77
77
|
private _getCurrentLeagueWars;
|
|
78
78
|
private _getClanWars;
|
|
79
|
-
/** Get
|
|
79
|
+
/** Get info about clan war league. */
|
|
80
80
|
getClanWarLeagueGroup(clanTag: string, options?: OverrideOptions): Promise<ClanWarLeagueGroup>;
|
|
81
81
|
/** Get info about a CWL round by WarTag. */
|
|
82
82
|
getClanWarLeagueRound(warTag: string | {
|
|
83
83
|
warTag: string;
|
|
84
84
|
clanTag?: string;
|
|
85
85
|
}, options?: OverrideOptions): Promise<ClanWar>;
|
|
86
|
-
/** Get
|
|
86
|
+
/** Get info about a player by tag. */
|
|
87
87
|
getPlayer(playerTag: string, options?: OverrideOptions): Promise<Player>;
|
|
88
88
|
/** Verify Player API token that can be found from the Game settings. */
|
|
89
89
|
verifyPlayerToken(playerTag: string, token: string, options?: OverrideOptions): Promise<boolean>;
|
|
@@ -92,18 +92,34 @@ export declare class Client extends EventEmitter {
|
|
|
92
92
|
/** Get Legend League season Ids. */
|
|
93
93
|
getLeagueSeasons(options?: SearchOptions): Promise<string[]>;
|
|
94
94
|
/** Get Legend League season rankings by season Id. */
|
|
95
|
-
getSeasonRankings(seasonId: string, options?: SearchOptions): Promise<
|
|
95
|
+
getSeasonRankings(seasonId: string, options?: SearchOptions): Promise<SeasonRankedPlayer[]>;
|
|
96
96
|
/** Get list of Clan War Leagues. */
|
|
97
97
|
getWarLeagues(options?: SearchOptions): Promise<WarLeague[]>;
|
|
98
98
|
/** Get list of Locations. */
|
|
99
99
|
getLocations(options?: SearchOptions): Promise<Location[]>;
|
|
100
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Get clan rankings for a specific location.
|
|
102
|
+
*
|
|
103
|
+
* For global ranking, use `global` as `locationId`.
|
|
104
|
+
*/
|
|
101
105
|
getClanRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedClan[]>;
|
|
102
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Get player rankings for a specific location.
|
|
108
|
+
*
|
|
109
|
+
* For global ranking, use `global` as `locationId`.
|
|
110
|
+
*/
|
|
103
111
|
getPlayerRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedPlayer[]>;
|
|
104
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Get clan versus rankings for a specific location.
|
|
114
|
+
*
|
|
115
|
+
* For global ranking, use `global` as `locationId`.
|
|
116
|
+
*/
|
|
105
117
|
getVersusClanRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedClan[]>;
|
|
106
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* Get player versus rankings for a specific location.
|
|
120
|
+
*
|
|
121
|
+
* For global ranking, use `global` as `locationId`.
|
|
122
|
+
*/
|
|
107
123
|
getVersusPlayerRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedPlayer[]>;
|
|
108
124
|
/** Get list of clan labels. */
|
|
109
125
|
getClanLabels(options?: SearchOptions): Promise<Label[]>;
|
package/dist/client/Client.js
CHANGED
|
@@ -47,12 +47,12 @@ class Client extends events_1.EventEmitter {
|
|
|
47
47
|
return this;
|
|
48
48
|
}
|
|
49
49
|
/** Search all clans by name and/or filtering the results using various criteria. */
|
|
50
|
-
async getClans(options) {
|
|
51
|
-
const { data } = await this.rest.getClans(options);
|
|
50
|
+
async getClans(query, options) {
|
|
51
|
+
const { data } = await this.rest.getClans(query, options);
|
|
52
52
|
// @ts-expect-error
|
|
53
53
|
return data.items.map((clan) => new struct_1.Clan(this, clan));
|
|
54
54
|
}
|
|
55
|
-
/** Get
|
|
55
|
+
/** Get info about a clan. */
|
|
56
56
|
async getClan(clanTag, options) {
|
|
57
57
|
const { data } = await this.rest.getClan(clanTag, options);
|
|
58
58
|
return new struct_1.Clan(this, data);
|
|
@@ -148,7 +148,7 @@ class Client extends events_1.EventEmitter {
|
|
|
148
148
|
throw e;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
/** Get
|
|
151
|
+
/** Get info about clan war league. */
|
|
152
152
|
async getClanWarLeagueGroup(clanTag, options) {
|
|
153
153
|
const { data } = await this.rest.getClanWarLeagueGroup(clanTag, options);
|
|
154
154
|
return new struct_1.ClanWarLeagueGroup(this, data);
|
|
@@ -162,7 +162,7 @@ class Client extends events_1.EventEmitter {
|
|
|
162
162
|
}
|
|
163
163
|
return new struct_1.ClanWar(this, data, { warTag: args.warTag, clanTag: args.clanTag, maxAge });
|
|
164
164
|
}
|
|
165
|
-
/** Get
|
|
165
|
+
/** Get info about a player by tag. */
|
|
166
166
|
async getPlayer(playerTag, options) {
|
|
167
167
|
const { data } = await this.rest.getPlayer(playerTag, options);
|
|
168
168
|
return new struct_1.Player(this, data);
|
|
@@ -185,8 +185,7 @@ class Client extends events_1.EventEmitter {
|
|
|
185
185
|
/** Get Legend League season rankings by season Id. */
|
|
186
186
|
async getSeasonRankings(seasonId, options) {
|
|
187
187
|
const { data } = await this.rest.getSeasonRankings(Constants_1.LEGEND_LEAGUE_ID, seasonId, options);
|
|
188
|
-
|
|
189
|
-
return data.items.map((entry) => new struct_1.RankedPlayer(entry));
|
|
188
|
+
return data.items.map((entry) => new struct_1.SeasonRankedPlayer(this, entry));
|
|
190
189
|
}
|
|
191
190
|
/** Get list of Clan War Leagues. */
|
|
192
191
|
async getWarLeagues(options) {
|
|
@@ -198,22 +197,38 @@ class Client extends events_1.EventEmitter {
|
|
|
198
197
|
const { data } = await this.rest.getLocations(options);
|
|
199
198
|
return data.items.map((entry) => new struct_1.Location(entry));
|
|
200
199
|
}
|
|
201
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* Get clan rankings for a specific location.
|
|
202
|
+
*
|
|
203
|
+
* For global ranking, use `global` as `locationId`.
|
|
204
|
+
*/
|
|
202
205
|
async getClanRanks(locationId, options) {
|
|
203
206
|
const { data } = await this.rest.getClanRanks(locationId, options);
|
|
204
207
|
return data.items.map((entry) => new struct_1.RankedClan(entry));
|
|
205
208
|
}
|
|
206
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Get player rankings for a specific location.
|
|
211
|
+
*
|
|
212
|
+
* For global ranking, use `global` as `locationId`.
|
|
213
|
+
*/
|
|
207
214
|
async getPlayerRanks(locationId, options) {
|
|
208
215
|
const { data } = await this.rest.getPlayerRanks(locationId, options);
|
|
209
216
|
return data.items.map((entry) => new struct_1.RankedPlayer(this, entry));
|
|
210
217
|
}
|
|
211
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* Get clan versus rankings for a specific location.
|
|
220
|
+
*
|
|
221
|
+
* For global ranking, use `global` as `locationId`.
|
|
222
|
+
*/
|
|
212
223
|
async getVersusClanRanks(locationId, options) {
|
|
213
224
|
const { data } = await this.rest.getVersusClanRanks(locationId, options);
|
|
214
225
|
return data.items.map((entry) => new struct_1.RankedClan(entry));
|
|
215
226
|
}
|
|
216
|
-
/**
|
|
227
|
+
/**
|
|
228
|
+
* Get player versus rankings for a specific location.
|
|
229
|
+
*
|
|
230
|
+
* For global ranking, use `global` as `locationId`.
|
|
231
|
+
*/
|
|
217
232
|
async getVersusPlayerRanks(locationId, options) {
|
|
218
233
|
const { data } = await this.rest.getVersusPlayerRanks(locationId, options);
|
|
219
234
|
return data.items.map((entry) => new struct_1.RankedPlayer(this, entry));
|
package/dist/rest/HTTPError.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/** Represents an HTTP Error. */
|
|
2
2
|
export declare class HTTPError extends Error {
|
|
3
|
-
/** The message of this
|
|
3
|
+
/** The message of this errored request. */
|
|
4
4
|
message: string;
|
|
5
5
|
/** The HTTP method of this request. */
|
|
6
6
|
method: string;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The reason of this errored request.
|
|
9
|
+
*
|
|
10
|
+
* Expected values are `notFound`, `notInWar`, `accessDenied`, `accessDenied.invalidIp`, `privateWarLog`,
|
|
11
|
+
* `badRequest`, `requestThrottled`, `serviceUnavailable`, `requestAborted` and `unknownException`.
|
|
12
|
+
*/
|
|
8
13
|
reason: string;
|
|
9
14
|
/** The HTTP status code of this request. */
|
|
10
15
|
status: number;
|
package/dist/rest/HTTPError.js
CHANGED
|
@@ -12,10 +12,10 @@ const messages = {
|
|
|
12
12
|
};
|
|
13
13
|
const reasons = {
|
|
14
14
|
503: 'serviceUnavailable',
|
|
15
|
-
429: '
|
|
15
|
+
429: 'requestThrottled',
|
|
16
16
|
400: 'badRequest',
|
|
17
|
-
403: '
|
|
18
|
-
500: '
|
|
17
|
+
403: 'accessDenied',
|
|
18
|
+
500: 'unknownException',
|
|
19
19
|
404: 'notFound',
|
|
20
20
|
504: 'requestAborted'
|
|
21
21
|
};
|
|
@@ -6,8 +6,8 @@ export declare class RESTManager {
|
|
|
6
6
|
readonly handler: RequestHandler;
|
|
7
7
|
constructor(options?: ClientOptions);
|
|
8
8
|
/** Search all clans by name and/or filtering the results using various criteria. */
|
|
9
|
-
getClans(
|
|
10
|
-
/** Get
|
|
9
|
+
getClans(query: ClanSearchOptions, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClanList>>;
|
|
10
|
+
/** Get info about a clan. */
|
|
11
11
|
getClan(clanTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClan>>;
|
|
12
12
|
/** Get list of clan members. */
|
|
13
13
|
getClanMembers(clanTag: string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIClanMemberList>>;
|
|
@@ -15,11 +15,11 @@ export declare class RESTManager {
|
|
|
15
15
|
getClanWarLog(clanTag: string, options?: SearchOptions): Promise<import("./RequestHandler").Response<APIClanWarLog>>;
|
|
16
16
|
/** Get info about currently running war in the clan. */
|
|
17
17
|
getCurrentWar(clanTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClanWar>>;
|
|
18
|
-
/** Get
|
|
18
|
+
/** Get info about clan war league. */
|
|
19
19
|
getClanWarLeagueGroup(clanTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClanWarLeagueGroup>>;
|
|
20
20
|
/** Get info about a CWL round by WarTag. */
|
|
21
21
|
getClanWarLeagueRound(warTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIClanWar>>;
|
|
22
|
-
/** Get
|
|
22
|
+
/** Get info about a player by tag. */
|
|
23
23
|
getPlayer(playerTag: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIPlayer>>;
|
|
24
24
|
/** Verify Player API token that can be found from the Game settings. */
|
|
25
25
|
verifyPlayerToken(playerTag: string, token: string, options?: OverrideOptions): Promise<import("./RequestHandler").Response<APIVerifyToken>>;
|
package/dist/rest/RESTManager.js
CHANGED
|
@@ -9,11 +9,10 @@ class RESTManager {
|
|
|
9
9
|
this.handler = new RequestHandler_1.RequestHandler(options);
|
|
10
10
|
}
|
|
11
11
|
/** Search all clans by name and/or filtering the results using various criteria. */
|
|
12
|
-
getClans(options) {
|
|
13
|
-
|
|
14
|
-
return this.handler.request(`/clans?${query}`);
|
|
12
|
+
getClans(query, options) {
|
|
13
|
+
return this.handler.request(`/clans?${Util_1.Util.queryString(query)}`, options);
|
|
15
14
|
}
|
|
16
|
-
/** Get
|
|
15
|
+
/** Get info about a clan. */
|
|
17
16
|
getClan(clanTag, options) {
|
|
18
17
|
return this.handler.request(`/clans/${Util_1.Util.encodeTag(clanTag)}`, options);
|
|
19
18
|
}
|
|
@@ -31,7 +30,7 @@ class RESTManager {
|
|
|
31
30
|
getCurrentWar(clanTag, options) {
|
|
32
31
|
return this.handler.request(`/clans/${Util_1.Util.encodeTag(clanTag)}/currentwar`, options);
|
|
33
32
|
}
|
|
34
|
-
/** Get
|
|
33
|
+
/** Get info about clan war league. */
|
|
35
34
|
getClanWarLeagueGroup(clanTag, options) {
|
|
36
35
|
return this.handler.request(`/clans/${Util_1.Util.encodeTag(clanTag)}/currentwar/leaguegroup`, options);
|
|
37
36
|
}
|
|
@@ -39,7 +38,7 @@ class RESTManager {
|
|
|
39
38
|
getClanWarLeagueRound(warTag, options) {
|
|
40
39
|
return this.handler.request(`/clanwarleagues/wars/${Util_1.Util.encodeTag(warTag)}`, options);
|
|
41
40
|
}
|
|
42
|
-
/** Get
|
|
41
|
+
/** Get info about a player by tag. */
|
|
43
42
|
getPlayer(playerTag, options) {
|
|
44
43
|
return this.handler.request(`/players/${Util_1.Util.encodeTag(playerTag)}`, options);
|
|
45
44
|
}
|
package/dist/struct/Clan.d.ts
CHANGED
|
@@ -59,6 +59,6 @@ export declare class Clan {
|
|
|
59
59
|
*/
|
|
60
60
|
members: ClanMember[];
|
|
61
61
|
constructor(client: Client, data: APIClan);
|
|
62
|
-
/** Get {@link Player}
|
|
62
|
+
/** Get {@link Player} info for every Player in the clan. */
|
|
63
63
|
fetchMembers(options?: OverrideOptions): Promise<Player[]>;
|
|
64
64
|
}
|
package/dist/struct/Clan.js
CHANGED
|
@@ -34,7 +34,7 @@ class Clan {
|
|
|
34
34
|
this.labels = data.labels.map((label) => new Label_1.Label(label));
|
|
35
35
|
this.members = data.memberList?.map((mem) => new ClanMember_1.ClanMember(this.client, mem)) ?? []; // eslint-disable-line
|
|
36
36
|
}
|
|
37
|
-
/** Get {@link Player}
|
|
37
|
+
/** Get {@link Player} info for every Player in the clan. */
|
|
38
38
|
async fetchMembers(options) {
|
|
39
39
|
return (await Promise.allSettled(this.members.map((m) => this.client.getPlayer(m.tag, { ...options, ignoreRateLimit: true }))))
|
|
40
40
|
.filter((res) => res.status === 'fulfilled')
|
|
@@ -28,7 +28,7 @@ export declare class ClanWarLeagueClan {
|
|
|
28
28
|
/** An array of members that are in the CWL group. */
|
|
29
29
|
members: ClanWarLeagueClanMember[];
|
|
30
30
|
constructor(client: Client, data: APIClanWarLeagueClan);
|
|
31
|
-
/** Get {@link Player}
|
|
31
|
+
/** Get {@link Player} info for every members that are in the CWL group. */
|
|
32
32
|
fetchMembers(options?: OverrideOptions): Promise<Player[]>;
|
|
33
33
|
}
|
|
34
34
|
/** Represents a Round of CWL Group. */
|
|
@@ -21,7 +21,7 @@ class ClanWarLeagueClan {
|
|
|
21
21
|
this.badge = new Badge_1.Badge(data.badgeUrls);
|
|
22
22
|
this.members = data.members.map((mem) => new ClanWarLeagueClanMember(mem));
|
|
23
23
|
}
|
|
24
|
-
/** Get {@link Player}
|
|
24
|
+
/** Get {@link Player} info for every members that are in the CWL group. */
|
|
25
25
|
async fetchMembers(options) {
|
|
26
26
|
return (await Promise.allSettled(this.members.map((m) => this.client.getPlayer(m.tag, { ...options, ignoreRateLimit: true }))))
|
|
27
27
|
.filter((res) => res.status === 'fulfilled')
|
|
@@ -2,15 +2,19 @@ import { OverrideOptions } from '../rest/RequestHandler';
|
|
|
2
2
|
import { Client } from '../client/Client';
|
|
3
3
|
import { APIPlayerClan } from '../types';
|
|
4
4
|
import { Badge } from './Badge';
|
|
5
|
-
/** Represents a
|
|
5
|
+
/** Represents a Player's clan. */
|
|
6
6
|
export declare class PlayerClan {
|
|
7
7
|
private readonly _client;
|
|
8
8
|
/** Name of the clan. */
|
|
9
9
|
name: string;
|
|
10
10
|
/** Tag of the clan. */
|
|
11
11
|
tag: string;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Level of this clan.
|
|
14
|
+
*
|
|
15
|
+
* This property is not available for ranked player's clan.
|
|
16
|
+
*/
|
|
17
|
+
level: number | null;
|
|
14
18
|
/** Badge of this clan. */
|
|
15
19
|
badge: Badge;
|
|
16
20
|
constructor(_client: Client, data: APIPlayerClan);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlayerClan = void 0;
|
|
4
4
|
const Badge_1 = require("./Badge");
|
|
5
|
-
/** Represents a
|
|
5
|
+
/** Represents a Player's clan. */
|
|
6
6
|
class PlayerClan {
|
|
7
7
|
constructor(_client, data) {
|
|
8
8
|
this._client = _client;
|
|
9
9
|
this.name = data.name;
|
|
10
10
|
this.tag = data.tag;
|
|
11
|
-
this.level = data.clanLevel;
|
|
11
|
+
this.level = data.clanLevel ?? null; // eslint-disable-line
|
|
12
12
|
this.badge = new Badge_1.Badge(data.badgeUrls);
|
|
13
13
|
}
|
|
14
14
|
/** Fetch detailed clan info for the player's clan. */
|
package/dist/struct/Ranking.d.ts
CHANGED
|
@@ -4,7 +4,27 @@ import { Client } from '../client/Client';
|
|
|
4
4
|
import { Location } from './Location';
|
|
5
5
|
import { League } from './League';
|
|
6
6
|
import { Badge } from './Badge';
|
|
7
|
-
/** Represents the
|
|
7
|
+
/** Represents the Player of seasonal legend league leader-board ranking. */
|
|
8
|
+
export declare class SeasonRankedPlayer {
|
|
9
|
+
/** The player's name. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** The player's tag. */
|
|
12
|
+
tag: string;
|
|
13
|
+
/** The player's experience level. */
|
|
14
|
+
expLevel: number;
|
|
15
|
+
/** The player's trophy count. */
|
|
16
|
+
trophies: number;
|
|
17
|
+
/** The player's attack wins. */
|
|
18
|
+
attackWins: number;
|
|
19
|
+
/** The player's defense wins. */
|
|
20
|
+
defenseWins: number;
|
|
21
|
+
/** The player's rank in the clan leader-board. */
|
|
22
|
+
rank: number;
|
|
23
|
+
/** The player's clan. */
|
|
24
|
+
clan: PlayerClan | null;
|
|
25
|
+
constructor(client: Client, data: Omit<APIPlayerRanking, 'league'>);
|
|
26
|
+
}
|
|
27
|
+
/** Represents the Player of location based leader-board ranking. */
|
|
8
28
|
export declare class RankedPlayer {
|
|
9
29
|
/** The player's name. */
|
|
10
30
|
name: string;
|
|
@@ -24,15 +44,15 @@ export declare class RankedPlayer {
|
|
|
24
44
|
versusBattleWins: number | null;
|
|
25
45
|
/** The player's rank in the clan leader-board. */
|
|
26
46
|
rank: number;
|
|
27
|
-
/** The player's rank before the last leader-board change. */
|
|
28
|
-
previousRank: number;
|
|
47
|
+
/** The player's rank before the last leader-board change. If retrieving info for legend league season, this will be `null`. */
|
|
48
|
+
previousRank: number | null;
|
|
29
49
|
/** The player's clan. */
|
|
30
|
-
clan: PlayerClan;
|
|
50
|
+
clan: PlayerClan | null;
|
|
31
51
|
/** The player's league. If retrieving info for versus leader-boards, this will be `null`. */
|
|
32
52
|
league: League | null;
|
|
33
53
|
constructor(client: Client, data: APIPlayerRanking | APIPlayerVersusRanking);
|
|
34
54
|
}
|
|
35
|
-
/** Represents the
|
|
55
|
+
/** Represents the Clan of location based leader-board ranking. */
|
|
36
56
|
export declare class RankedClan {
|
|
37
57
|
/** The clan's name. */
|
|
38
58
|
name: string;
|
package/dist/struct/Ranking.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RankedClan = exports.RankedPlayer = void 0;
|
|
3
|
+
exports.RankedClan = exports.RankedPlayer = exports.SeasonRankedPlayer = void 0;
|
|
4
4
|
const Constants_1 = require("../util/Constants");
|
|
5
5
|
const PlayerClan_1 = require("./PlayerClan");
|
|
6
6
|
const Location_1 = require("./Location");
|
|
7
7
|
const League_1 = require("./League");
|
|
8
8
|
const Badge_1 = require("./Badge");
|
|
9
|
-
/** Represents the
|
|
9
|
+
/** Represents the Player of seasonal legend league leader-board ranking. */
|
|
10
|
+
class SeasonRankedPlayer {
|
|
11
|
+
constructor(client, data) {
|
|
12
|
+
this.name = data.name;
|
|
13
|
+
this.tag = data.tag;
|
|
14
|
+
this.rank = data.rank;
|
|
15
|
+
this.expLevel = data.expLevel;
|
|
16
|
+
this.trophies = data.trophies;
|
|
17
|
+
this.attackWins = data.attackWins;
|
|
18
|
+
this.defenseWins = data.defenseWins;
|
|
19
|
+
// @ts-expect-error
|
|
20
|
+
this.clan = data.clan ? new PlayerClan_1.PlayerClan(client, data.clan) : null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.SeasonRankedPlayer = SeasonRankedPlayer;
|
|
24
|
+
/** Represents the Player of location based leader-board ranking. */
|
|
10
25
|
class RankedPlayer {
|
|
11
26
|
constructor(client, data) {
|
|
12
27
|
this.name = data.name;
|
|
@@ -23,14 +38,15 @@ class RankedPlayer {
|
|
|
23
38
|
// @ts-expect-error
|
|
24
39
|
this.versusBattleWins = data.versusBattleWins ?? null;
|
|
25
40
|
this.rank = data.rank;
|
|
26
|
-
this.previousRank = data.previousRank;
|
|
27
|
-
|
|
41
|
+
this.previousRank = data.previousRank ?? null; // eslint-disable-line
|
|
42
|
+
// @ts-expect-error
|
|
43
|
+
this.clan = data.clan ? new PlayerClan_1.PlayerClan(client, data.clan) : null;
|
|
28
44
|
// @ts-expect-error
|
|
29
45
|
this.league = data.trophies ? new League_1.League(data.league ?? Constants_1.UNRANKED_LEAGUE_DATA) : null; // eslint-disable-line
|
|
30
46
|
}
|
|
31
47
|
}
|
|
32
48
|
exports.RankedPlayer = RankedPlayer;
|
|
33
|
-
/** Represents the
|
|
49
|
+
/** Represents the Clan of location based leader-board ranking. */
|
|
34
50
|
class RankedClan {
|
|
35
51
|
constructor(data) {
|
|
36
52
|
this.name = data.name;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -266,7 +266,7 @@ export interface APIPlayerRanking {
|
|
|
266
266
|
defenseWins: number;
|
|
267
267
|
rank: number;
|
|
268
268
|
previousRank: number;
|
|
269
|
-
clan
|
|
269
|
+
clan?: Omit<APIPlayerClan, 'clanLevel'>;
|
|
270
270
|
league: APILeague;
|
|
271
271
|
}
|
|
272
272
|
/** /locations/{locationId}/rankings/clans-versus */
|
|
@@ -298,7 +298,7 @@ export interface APIPlayerVersusRanking {
|
|
|
298
298
|
versusBattleWins: number;
|
|
299
299
|
rank: number;
|
|
300
300
|
previousRank: number;
|
|
301
|
-
clan
|
|
301
|
+
clan?: APIPlayerClan;
|
|
302
302
|
}
|
|
303
303
|
/** /leagues */
|
|
304
304
|
export interface APILeagueList {
|