clashofclans.js 3.0.0-dev.9a00cd8 → 3.0.0-dev.c750a2f
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 +2 -4
- package/dist/client/Client.d.ts +1 -9
- package/dist/client/Client.js +1 -15
- package/dist/rest/RESTManager.d.ts +2 -8
- package/dist/rest/RESTManager.js +1 -15
- package/dist/struct/Clan.d.ts +1 -7
- package/dist/struct/Clan.js +0 -3
- package/dist/struct/ClanMember.d.ts +1 -3
- package/dist/struct/ClanMember.js +0 -1
- package/dist/struct/Player.d.ts +1 -3
- package/dist/struct/Player.js +0 -1
- package/dist/types/api.d.ts +0 -35
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
-
## 3.0.0 (
|
|
5
|
+
## 3.0.0 (15-10-222)
|
|
6
6
|
|
|
7
7
|
### Bug Fixes
|
|
8
8
|
|
|
@@ -12,9 +12,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
12
12
|
|
|
13
13
|
### Features
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
- Added `Client#getCapitalLeagues()` method.
|
|
17
|
-
- Added `Client#getClanCapitalRanks()` method.
|
|
15
|
+
- Support for clan capital raid seasons `Client#getCapitalRaidSeasons()`
|
|
18
16
|
|
|
19
17
|
### Breaking Changes
|
|
20
18
|
|
package/dist/client/Client.d.ts
CHANGED
|
@@ -112,10 +112,8 @@ export declare class Client extends EventEmitter {
|
|
|
112
112
|
getPlayers(playerTags: string[], options?: OverrideOptions): Promise<Player[]>;
|
|
113
113
|
/** Verify Player API token that can be found from the Game settings. */
|
|
114
114
|
verifyPlayerToken(playerTag: string, token: string, options?: OverrideOptions): Promise<boolean>;
|
|
115
|
-
/** Get
|
|
115
|
+
/** Get list of Leagues. */
|
|
116
116
|
getLeagues(options?: SearchOptions): Promise<League[]>;
|
|
117
|
-
/** Get a list of Capital Leagues. */
|
|
118
|
-
getCapitalLeagues(options?: SearchOptions): Promise<import("../types").APICapitalLeague[]>;
|
|
119
117
|
/** Get Legend League season Ids. */
|
|
120
118
|
getLeagueSeasons(options?: SearchOptions): Promise<string[]>;
|
|
121
119
|
/** Get Legend League season rankings by season Id. */
|
|
@@ -148,12 +146,6 @@ export declare class Client extends EventEmitter {
|
|
|
148
146
|
* For global ranking, use `global` as `locationId`.
|
|
149
147
|
*/
|
|
150
148
|
getVersusPlayerRanks(locationId: number | 'global', options?: SearchOptions): Promise<RankedPlayer[]>;
|
|
151
|
-
/**
|
|
152
|
-
* Get clan capital rankings for a specific location.
|
|
153
|
-
*
|
|
154
|
-
* For global ranking, use `global` as `locationId`.
|
|
155
|
-
*/
|
|
156
|
-
getClanCapitalRanks(locationId: number | 'global', options?: SearchOptions): Promise<import("../types").APIClanCapitalRanking[]>;
|
|
157
149
|
/** Get list of clan labels. */
|
|
158
150
|
getClanLabels(options?: SearchOptions): Promise<Label[]>;
|
|
159
151
|
/** Get list of player labels. */
|
package/dist/client/Client.js
CHANGED
|
@@ -181,16 +181,11 @@ class Client extends node_events_1.EventEmitter {
|
|
|
181
181
|
const { data } = await this.rest.verifyPlayerToken(playerTag, token, options);
|
|
182
182
|
return data.status === 'ok';
|
|
183
183
|
}
|
|
184
|
-
/** Get
|
|
184
|
+
/** Get list of Leagues. */
|
|
185
185
|
async getLeagues(options) {
|
|
186
186
|
const { data } = await this.rest.getLeagues(options);
|
|
187
187
|
return data.items.map((entry) => new struct_1.League(entry));
|
|
188
188
|
}
|
|
189
|
-
/** Get a list of Capital Leagues. */
|
|
190
|
-
async getCapitalLeagues(options) {
|
|
191
|
-
const { data } = await this.rest.getCapitalLeagues(options);
|
|
192
|
-
return data.items;
|
|
193
|
-
}
|
|
194
189
|
/** Get Legend League season Ids. */
|
|
195
190
|
async getLeagueSeasons(options) {
|
|
196
191
|
const { data } = await this.rest.getLeagueSeasons(Constants_1.LegendLeagueId, options);
|
|
@@ -247,15 +242,6 @@ class Client extends node_events_1.EventEmitter {
|
|
|
247
242
|
const { data } = await this.rest.getVersusPlayerRanks(locationId, options);
|
|
248
243
|
return data.items.map((entry) => new struct_1.RankedPlayer(this, entry));
|
|
249
244
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Get clan capital rankings for a specific location.
|
|
252
|
-
*
|
|
253
|
-
* For global ranking, use `global` as `locationId`.
|
|
254
|
-
*/
|
|
255
|
-
async getClanCapitalRanks(locationId, options) {
|
|
256
|
-
const { data } = await this.rest.getClanCapitalRanks(locationId, options);
|
|
257
|
-
return data.items;
|
|
258
|
-
}
|
|
259
245
|
/** Get list of clan labels. */
|
|
260
246
|
async getClanLabels(options) {
|
|
261
247
|
const { data } = await this.rest.getClanLabels(options);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import { Util } from '../util/Util';
|
|
4
|
-
import { APIClan, APIClanList, APIClanMemberList, APICapitalRaidSeasons, APIClanRankingList, APIClanVersusRankingList, APIClanWar, APIClanWarLeagueGroup, APIClanWarLog, APIGoldPassSeason, APILabelList, APILeague, APILeagueList, APILeagueSeasonList, APILocation, APILocationList, APIPlayer, APIPlayerRankingList, APIPlayerSeasonRankingList, APIPlayerVersusRankingList, APIVerifyToken, APIWarLeague, APIWarLeagueList, SearchOptions, ClanSearchOptions, RESTOptions, OverrideOptions, LoginOptions
|
|
4
|
+
import { APIClan, APIClanList, APIClanMemberList, APICapitalRaidSeasons, APIClanRankingList, APIClanVersusRankingList, APIClanWar, APIClanWarLeagueGroup, APIClanWarLog, APIGoldPassSeason, APILabelList, APILeague, APILeagueList, APILeagueSeasonList, APILocation, APILocationList, APIPlayer, APIPlayerRankingList, APIPlayerSeasonRankingList, APIPlayerVersusRankingList, APIVerifyToken, APIWarLeague, APIWarLeagueList, SearchOptions, ClanSearchOptions, RESTOptions, OverrideOptions, LoginOptions } from '../types';
|
|
5
5
|
import { RestEvents } from '../util/Constants';
|
|
6
6
|
import { RequestHandler } from './RequestHandler';
|
|
7
7
|
export interface IRestEvents {
|
|
@@ -72,14 +72,10 @@ export declare class RESTManager extends EventEmitter {
|
|
|
72
72
|
getPlayer(playerTag: string, options?: OverrideOptions): Promise<import("../types").Response<APIPlayer>>;
|
|
73
73
|
/** Verify Player API token that can be found from the Game settings. */
|
|
74
74
|
verifyPlayerToken(playerTag: string, token: string, options?: OverrideOptions): Promise<import("../types").Response<APIVerifyToken>>;
|
|
75
|
-
/** Get
|
|
75
|
+
/** Get list of Leagues. */
|
|
76
76
|
getLeagues(options?: SearchOptions): Promise<import("../types").Response<APILeagueList>>;
|
|
77
77
|
/** Get a League info. */
|
|
78
78
|
getLeague(leagueId: string | number, options?: OverrideOptions): Promise<import("../types").Response<APILeague>>;
|
|
79
|
-
/** Get a list of Capital leagues. */
|
|
80
|
-
getCapitalLeagues(options?: SearchOptions): Promise<import("../types").Response<APICapitalLeagueList>>;
|
|
81
|
-
/** Get a Capital League info. */
|
|
82
|
-
getCapitalLeague(leagueId: string | number, options?: OverrideOptions): Promise<import("../types").Response<APICapitalLeague>>;
|
|
83
79
|
/** Get Legend League season Ids. */
|
|
84
80
|
getLeagueSeasons(leagueId: number, options?: SearchOptions): Promise<import("../types").Response<APILeagueSeasonList>>;
|
|
85
81
|
/** Get Legend League season rankings by season Id. */
|
|
@@ -100,8 +96,6 @@ export declare class RESTManager extends EventEmitter {
|
|
|
100
96
|
getVersusClanRanks(locationId: number | string, options?: SearchOptions): Promise<import("../types").Response<APIClanVersusRankingList>>;
|
|
101
97
|
/** Get player versus rankings for a specific location. */
|
|
102
98
|
getVersusPlayerRanks(locationId: number | string, options?: SearchOptions): Promise<import("../types").Response<APIPlayerVersusRankingList>>;
|
|
103
|
-
/** Get clan capital rankings for a specific location. */
|
|
104
|
-
getClanCapitalRanks(locationId: number | string, options?: SearchOptions): Promise<import("../types").Response<APIClanCapitalRankingList>>;
|
|
105
99
|
/** Get list of clan labels. */
|
|
106
100
|
getClanLabels(options?: SearchOptions): Promise<import("../types").Response<APILabelList>>;
|
|
107
101
|
/** Get list of player labels. */
|
package/dist/rest/RESTManager.js
CHANGED
|
@@ -78,7 +78,7 @@ class RESTManager extends node_events_1.EventEmitter {
|
|
|
78
78
|
const opts = { method: 'POST', body: JSON.stringify({ token }), ...options };
|
|
79
79
|
return this.requestHandler.request(`/players/${Util_1.Util.encodeURI(playerTag)}/verifytoken`, opts);
|
|
80
80
|
}
|
|
81
|
-
/** Get
|
|
81
|
+
/** Get list of Leagues. */
|
|
82
82
|
getLeagues(options) {
|
|
83
83
|
const query = Util_1.Util.queryString(options);
|
|
84
84
|
return this.requestHandler.request(`/leagues${query}`, options);
|
|
@@ -87,15 +87,6 @@ class RESTManager extends node_events_1.EventEmitter {
|
|
|
87
87
|
getLeague(leagueId, options) {
|
|
88
88
|
return this.requestHandler.request(`/leagues/${leagueId}`, options);
|
|
89
89
|
}
|
|
90
|
-
/** Get a list of Capital leagues. */
|
|
91
|
-
getCapitalLeagues(options) {
|
|
92
|
-
const query = Util_1.Util.queryString(options);
|
|
93
|
-
return this.requestHandler.request(`/capitalleagues${query}`, options);
|
|
94
|
-
}
|
|
95
|
-
/** Get a Capital League info. */
|
|
96
|
-
getCapitalLeague(leagueId, options) {
|
|
97
|
-
return this.requestHandler.request(`/capitalleagues/${leagueId}`, options);
|
|
98
|
-
}
|
|
99
90
|
/** Get Legend League season Ids. */
|
|
100
91
|
getLeagueSeasons(leagueId, options) {
|
|
101
92
|
const query = Util_1.Util.queryString(options);
|
|
@@ -144,11 +135,6 @@ class RESTManager extends node_events_1.EventEmitter {
|
|
|
144
135
|
const query = Util_1.Util.queryString(options);
|
|
145
136
|
return this.requestHandler.request(`/locations/${locationId}/rankings/players-versus${query}`, options);
|
|
146
137
|
}
|
|
147
|
-
/** Get clan capital rankings for a specific location. */
|
|
148
|
-
getClanCapitalRanks(locationId, options) {
|
|
149
|
-
const query = Util_1.Util.queryString(options);
|
|
150
|
-
return this.requestHandler.request(`/locations/${locationId}/rankings/capitals${query}`, options);
|
|
151
|
-
}
|
|
152
138
|
/** Get list of clan labels. */
|
|
153
139
|
getClanLabels(options) {
|
|
154
140
|
const query = Util_1.Util.queryString(options);
|
package/dist/struct/Clan.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { APIClan, OverrideOptions } from '../types';
|
|
2
2
|
import { Client } from '../client/Client';
|
|
3
3
|
import { ChatLanguage } from './ChatLanguage';
|
|
4
4
|
import { ClanMember } from './ClanMember';
|
|
@@ -29,8 +29,6 @@ export declare class Clan {
|
|
|
29
29
|
level: number;
|
|
30
30
|
/** The clan's trophy count. */
|
|
31
31
|
points: number;
|
|
32
|
-
/** The clan's capital points. */
|
|
33
|
-
capitalPoints: number;
|
|
34
32
|
/** The clan's versus trophy count. */
|
|
35
33
|
versusPoints: number;
|
|
36
34
|
/** The minimum trophies required to apply to this clan. */
|
|
@@ -59,10 +57,6 @@ export declare class Clan {
|
|
|
59
57
|
labels: Label[];
|
|
60
58
|
/** The clan's Clan Capital information */
|
|
61
59
|
clanCapital: ClanCapital | null;
|
|
62
|
-
/** The clan's capital league. */
|
|
63
|
-
capitalLeague?: APICapitalLeague;
|
|
64
|
-
/** Whether the clan is family friendly. */
|
|
65
|
-
isFamilyFriendly: boolean;
|
|
66
60
|
/**
|
|
67
61
|
* List of clan members.
|
|
68
62
|
* - This property returns empty array for {@link Client.getClans} method.
|
package/dist/struct/Clan.js
CHANGED
|
@@ -35,9 +35,6 @@ class Clan {
|
|
|
35
35
|
this.memberCount = data.members;
|
|
36
36
|
this.labels = data.labels.map((label) => new Label_1.Label(label));
|
|
37
37
|
this.clanCapital = Object.keys(data.clanCapital).length > 0 ? new ClanCapital_1.ClanCapital(data.clanCapital) : null;
|
|
38
|
-
this.isFamilyFriendly = data.isFamilyFriendly;
|
|
39
|
-
this.capitalPoints = data.clanCapitalPoints;
|
|
40
|
-
this.capitalLeague = data.capitalLeague;
|
|
41
38
|
this.members = data.memberList?.map((mem) => new ClanMember_1.ClanMember(this.client, mem)) ?? []; // eslint-disable-line
|
|
42
39
|
}
|
|
43
40
|
/** Get {@link Player} info for every Player in the clan. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIClanMember,
|
|
1
|
+
import { APIClanMember, OverrideOptions } from '../types';
|
|
2
2
|
import { Client } from '../client/Client';
|
|
3
3
|
import { League } from './League';
|
|
4
4
|
export declare class ClanMember {
|
|
@@ -25,8 +25,6 @@ export declare class ClanMember {
|
|
|
25
25
|
donations: number;
|
|
26
26
|
/** The member's donation received count for this season. */
|
|
27
27
|
received: number;
|
|
28
|
-
/** The member's player house details. */
|
|
29
|
-
playerHouse?: APIPlayerHouse | null;
|
|
30
28
|
constructor(client: Client, data: APIClanMember);
|
|
31
29
|
/** Whether this clan member is in the clan. */
|
|
32
30
|
get isMember(): boolean;
|
|
@@ -18,7 +18,6 @@ class ClanMember {
|
|
|
18
18
|
this.clanRank = data.clanRank;
|
|
19
19
|
this.previousClanRank = data.previousClanRank;
|
|
20
20
|
this.donations = data.donations;
|
|
21
|
-
this.playerHouse = data.playerHouse ?? null;
|
|
22
21
|
this.received = data.donationsReceived;
|
|
23
22
|
}
|
|
24
23
|
/** Whether this clan member is in the clan. */
|
package/dist/struct/Player.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIPlayer,
|
|
1
|
+
import { APIPlayer, OverrideOptions } from '../types';
|
|
2
2
|
import { Client } from '../client/Client';
|
|
3
3
|
import { LegendStatistics } from './LegendStatistics';
|
|
4
4
|
import { Achievement } from './Achievement';
|
|
@@ -63,8 +63,6 @@ export declare class Player {
|
|
|
63
63
|
spells: Spell[];
|
|
64
64
|
/** An array of player's heroes (both home base and build base). */
|
|
65
65
|
heroes: Hero[];
|
|
66
|
-
/** The player's clan capital house details. */
|
|
67
|
-
playerHouse?: APIPlayerHouse | null;
|
|
68
66
|
constructor(client: Client, data: APIPlayer);
|
|
69
67
|
/** Whether this clan member is in the clan. */
|
|
70
68
|
get inClan(): boolean;
|
package/dist/struct/Player.js
CHANGED
|
@@ -40,7 +40,6 @@ class Player {
|
|
|
40
40
|
this.troops = data.troops.map((unit) => new Unit_1.Troop(data, unit));
|
|
41
41
|
this.spells = data.spells.map((unit) => new Unit_1.Spell(data, unit));
|
|
42
42
|
this.heroes = data.heroes.map((unit) => new Unit_1.Hero(data, unit));
|
|
43
|
-
this.playerHouse = data.playerHouse ?? null;
|
|
44
43
|
}
|
|
45
44
|
/** Whether this clan member is in the clan. */
|
|
46
45
|
get inClan() {
|
package/dist/types/api.d.ts
CHANGED
|
@@ -58,9 +58,6 @@ export interface APIClan {
|
|
|
58
58
|
labels: APILabel[];
|
|
59
59
|
memberList: APIClanMember[];
|
|
60
60
|
clanCapital: APIClanCapital;
|
|
61
|
-
isFamilyFriendly: boolean;
|
|
62
|
-
clanCapitalPoints: number;
|
|
63
|
-
capitalLeague?: APICapitalLeague;
|
|
64
61
|
}
|
|
65
62
|
export interface APIClanMember {
|
|
66
63
|
name: string;
|
|
@@ -74,13 +71,6 @@ export interface APIClanMember {
|
|
|
74
71
|
previousClanRank: number;
|
|
75
72
|
donations: number;
|
|
76
73
|
donationsReceived: number;
|
|
77
|
-
playerHouse?: APIPlayerHouse;
|
|
78
|
-
}
|
|
79
|
-
export interface APIPlayerHouse {
|
|
80
|
-
elements: {
|
|
81
|
-
type: string;
|
|
82
|
-
id: number;
|
|
83
|
-
}[];
|
|
84
74
|
}
|
|
85
75
|
export interface APIClanCapital {
|
|
86
76
|
capitalHallLevel?: number;
|
|
@@ -267,7 +257,6 @@ export interface APIPlayer {
|
|
|
267
257
|
heroes: APIPlayerItem[];
|
|
268
258
|
spells: APIPlayerItem[];
|
|
269
259
|
labels: APILabel[];
|
|
270
|
-
playerHouse?: APIPlayerHouse;
|
|
271
260
|
}
|
|
272
261
|
export interface APILegendStatistics {
|
|
273
262
|
previousSeason?: APISeason;
|
|
@@ -382,22 +371,6 @@ export interface APIPlayerVersusRanking {
|
|
|
382
371
|
previousRank: number;
|
|
383
372
|
clan?: APIPlayerClan;
|
|
384
373
|
}
|
|
385
|
-
export interface APIClanCapitalRanking {
|
|
386
|
-
clanLevel: number;
|
|
387
|
-
clanPoints: number;
|
|
388
|
-
location: APILocation;
|
|
389
|
-
members: number;
|
|
390
|
-
tag: string;
|
|
391
|
-
name: string;
|
|
392
|
-
rank: number;
|
|
393
|
-
previousRank: number;
|
|
394
|
-
badgeUrls: APIBadge;
|
|
395
|
-
clanCapitalPoints: number;
|
|
396
|
-
}
|
|
397
|
-
export interface APIClanCapitalRankingList {
|
|
398
|
-
items: APIClanCapitalRanking[];
|
|
399
|
-
paging: APIPaging;
|
|
400
|
-
}
|
|
401
374
|
/** /leagues */
|
|
402
375
|
export interface APILeagueList {
|
|
403
376
|
items: APILeague[];
|
|
@@ -431,14 +404,6 @@ export interface APIWarLeague {
|
|
|
431
404
|
id: number;
|
|
432
405
|
name: string;
|
|
433
406
|
}
|
|
434
|
-
export interface APICapitalLeague {
|
|
435
|
-
id: number;
|
|
436
|
-
name: string;
|
|
437
|
-
}
|
|
438
|
-
export interface APICapitalLeagueList {
|
|
439
|
-
items: APICapitalLeague[];
|
|
440
|
-
paging: APIPaging;
|
|
441
|
-
}
|
|
442
407
|
export interface APILabel {
|
|
443
408
|
id: number;
|
|
444
409
|
name: string;
|
package/package.json
CHANGED