clashofclans.js 2.3.0 → 2.4.0-dev.e127930

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.
@@ -4,10 +4,8 @@ import { Badge } from './Badge';
4
4
  /**
5
5
  * Represents War Log Clan.
6
6
  *
7
- * :::caution
8
7
  * If this is called via {@link ClanWarLog.opponent}, then {@link WarLogClan.attackCount} and {@link WarLogClan.expEarned} will be `null`.
9
8
  * For CWL entries {@link WarLogClan.name} and {@link WarLogClan.tag} are `null`.
10
- * :::
11
9
  */
12
10
  export declare class WarLogClan {
13
11
  /** The clan's name. This property is `null` CWL entries. */
@@ -6,10 +6,8 @@ const Badge_1 = require("./Badge");
6
6
  /**
7
7
  * Represents War Log Clan.
8
8
  *
9
- * :::caution
10
9
  * If this is called via {@link ClanWarLog.opponent}, then {@link WarLogClan.attackCount} and {@link WarLogClan.expEarned} will be `null`.
11
10
  * For CWL entries {@link WarLogClan.name} and {@link WarLogClan.tag} are `null`.
12
- * :::
13
11
  */
14
12
  class WarLogClan {
15
13
  constructor(data) {
@@ -1,16 +1,17 @@
1
1
  import { APIIcon } from '../types';
2
2
  /** Represents a Clash of Clans Icon. */
3
3
  export declare class Icon {
4
- private readonly _data;
5
4
  /** The default icon URL. */
6
5
  url: string;
7
- constructor(data: APIIcon);
8
6
  /** The medium icon URL. */
9
- get medium(): string;
10
- /** The tiny icon URL. */
11
- get tiny(): string;
7
+ medium: string;
12
8
  /** The small icon URL. */
13
- get small(): string;
14
- /** Get unique hash of this Badge. */
15
- get hash(): string;
9
+ small: string;
10
+ /** The tiny icon URL. */
11
+ tiny: string;
12
+ constructor(data: APIIcon);
13
+ /** Get unique file name of this Icon. */
14
+ get fileName(): string;
15
+ /** Sizes of this Icon. */
16
+ get sizes(): string[];
16
17
  }
@@ -4,24 +4,18 @@ exports.Icon = void 0;
4
4
  /** Represents a Clash of Clans Icon. */
5
5
  class Icon {
6
6
  constructor(data) {
7
- Object.defineProperty(this, '_data', { value: data });
8
7
  this.url = data.medium ?? data.small;
8
+ Object.defineProperty(this, 'medium', { value: data.medium ?? data.small });
9
+ Object.defineProperty(this, 'tiny', { value: data.tiny ?? data.small });
10
+ Object.defineProperty(this, 'small', { value: data.small });
9
11
  }
10
- /** The medium icon URL. */
11
- get medium() {
12
- return this._data.medium ?? this._data.small;
13
- }
14
- /** The tiny icon URL. */
15
- get tiny() {
16
- return this._data.tiny ?? this._data.small;
17
- }
18
- /** The small icon URL. */
19
- get small() {
20
- return this._data.small;
21
- }
22
- /** Get unique hash of this Badge. */
23
- get hash() {
12
+ /** Get unique file name of this Icon. */
13
+ get fileName() {
24
14
  return this.url.split('/').pop();
25
15
  }
16
+ /** Sizes of this Icon. */
17
+ get sizes() {
18
+ return [this.medium, this.small, this.tiny].map((url) => /\/(\d+)\//g.exec(url)[1]);
19
+ }
26
20
  }
27
21
  exports.Icon = Icon;
@@ -1,10 +1,9 @@
1
- import { OverrideOptions } from '../rest/RequestHandler';
1
+ import { APIPlayer, OverrideOptions } from '../types';
2
2
  import { LegendStatistics } from './LegendStatistics';
3
3
  import { Achievement } from './Achievement';
4
4
  import { Hero, Spell, Troop } from './Unit';
5
5
  import { PlayerClan } from './PlayerClan';
6
6
  import { Client } from '../client/Client';
7
- import { APIPlayer } from '../types';
8
7
  import { League } from './League';
9
8
  import { Label } from './Label';
10
9
  /** Represents a Clash of Clans Player. */
@@ -1,6 +1,5 @@
1
- import { OverrideOptions } from '../rest/RequestHandler';
1
+ import { OverrideOptions, APIPlayerClan } from '../types';
2
2
  import { Client } from '../client/Client';
3
- import { APIPlayerClan } from '../types';
4
3
  import { Badge } from './Badge';
5
4
  /** Represents a Player's clan. */
6
5
  export declare class PlayerClan {
@@ -0,0 +1,351 @@
1
+ export interface APIPaging {
2
+ cursors?: APICursors;
3
+ }
4
+ export interface APICursors {
5
+ after?: string;
6
+ before?: string;
7
+ }
8
+ export interface APIIcon {
9
+ small: string;
10
+ /** Tiny Icon is not available for Labels. */
11
+ tiny?: string;
12
+ /** Medium Icon is not available for Unranked Icon. */
13
+ medium?: string;
14
+ }
15
+ export interface APIBadge {
16
+ small: string;
17
+ large: string;
18
+ medium: string;
19
+ }
20
+ export interface APISeason {
21
+ id: string;
22
+ rank: number;
23
+ trophies: number;
24
+ }
25
+ /** /clans?name={name}&limit={limit} */
26
+ export interface APIClanList {
27
+ items: Omit<APIClan, 'memberList'>[];
28
+ paging: APIPaging;
29
+ }
30
+ export interface APIChatLanguage {
31
+ name: string;
32
+ id: number;
33
+ languageCode: string;
34
+ }
35
+ /** /clans/{clanTag} */
36
+ export interface APIClan {
37
+ tag: string;
38
+ name: string;
39
+ type: 'open' | 'inviteOnly' | 'closed';
40
+ description: string;
41
+ location?: APILocation;
42
+ chatLanguage?: APIChatLanguage;
43
+ badgeUrls: APIBadge;
44
+ clanLevel: number;
45
+ clanPoints: number;
46
+ clanVersusPoints: number;
47
+ requiredTrophies: number;
48
+ requiredTownhallLevel?: number;
49
+ warFrequency: 'always' | 'moreThanOncePerWeek' | 'oncePerWeek' | 'lessThanOncePerWeek' | 'never' | 'unknown';
50
+ warWinStreak: number;
51
+ warWins: number;
52
+ warTies?: number;
53
+ warLosses?: number;
54
+ isWarLogPublic: boolean;
55
+ warLeague?: APIWarLeague;
56
+ members: number;
57
+ labels: APILabel[];
58
+ memberList: APIClanMember[];
59
+ }
60
+ export interface APIClanMember {
61
+ name: string;
62
+ tag: string;
63
+ role: 'member' | 'admin' | 'coLeader' | 'leader';
64
+ expLevel: number;
65
+ league: APILeague;
66
+ trophies: number;
67
+ versusTrophies?: number;
68
+ clanRank: number;
69
+ previousClanRank: number;
70
+ donations: number;
71
+ donationsReceived: number;
72
+ }
73
+ /** /clans/{clanTag}/members */
74
+ export interface APIClanMemberList {
75
+ items: APIClanMember[];
76
+ paging: APIPaging;
77
+ }
78
+ /** /clans/{clanTag}/currentwar and /clanwarleagues/wars/{warTag} */
79
+ export interface APIClanWar {
80
+ state: 'notInWar' | 'preparation' | 'inWar' | 'warEnded';
81
+ teamSize: number;
82
+ startTime: string;
83
+ preparationStartTime: string;
84
+ endTime: string;
85
+ clan: APIWarClan;
86
+ opponent: APIWarClan;
87
+ /** This property is not available for CWL */
88
+ attacksPerMember?: number;
89
+ }
90
+ export interface APIWarClan {
91
+ tag: string;
92
+ name: string;
93
+ badgeUrls: APIBadge;
94
+ clanLevel: number;
95
+ attacks: number;
96
+ stars: number;
97
+ destructionPercentage: number;
98
+ members: APIClanWarMember[];
99
+ }
100
+ export interface APIClanWarMember {
101
+ tag: string;
102
+ name: string;
103
+ mapPosition: number;
104
+ townhallLevel: number;
105
+ opponentAttacks: number;
106
+ bestOpponentAttack?: APIClanWarAttack;
107
+ attacks?: APIClanWarAttack[];
108
+ }
109
+ export interface APIClanWarAttack {
110
+ order: number;
111
+ attackerTag: string;
112
+ defenderTag: string;
113
+ stars: number;
114
+ duration: number;
115
+ destructionPercentage: number;
116
+ }
117
+ export interface APIWarLogClan {
118
+ tag?: string;
119
+ name?: string;
120
+ badgeUrls: APIBadge;
121
+ clanLevel: number;
122
+ attacks?: number;
123
+ stars: number;
124
+ destructionPercentage: number;
125
+ expEarned?: number;
126
+ }
127
+ export interface APIClanWarLogEntry {
128
+ result: 'win' | 'lose' | 'tie' | null;
129
+ endTime: string;
130
+ teamSize: number;
131
+ attacksPerMember?: number;
132
+ clan: APIWarLogClan;
133
+ opponent: APIWarLogClan;
134
+ }
135
+ /** /clans/{clanTag}/warlog */
136
+ export interface APIClanWarLog {
137
+ items: APIClanWarLogEntry[];
138
+ paging: APIPaging;
139
+ }
140
+ /** /clans/{clanTag}/currentwar/leaguegroup */
141
+ export interface APIClanWarLeagueGroup {
142
+ state: 'preparation' | 'inWar' | 'warEnded';
143
+ season: string;
144
+ clans: APIClanWarLeagueClan[];
145
+ rounds: APIClanWarLeagueRound[];
146
+ }
147
+ export interface APIClanWarLeagueClan {
148
+ name: string;
149
+ tag: string;
150
+ clanLevel: number;
151
+ badgeUrls: APIBadge;
152
+ members: APIClanWarLeagueClanMember[];
153
+ }
154
+ export interface APIClanWarLeagueClanMember {
155
+ name: string;
156
+ tag: string;
157
+ townHallLevel: number;
158
+ }
159
+ export interface APIClanWarLeagueRound {
160
+ warTags: string[];
161
+ }
162
+ /** /players/{playerTag} */
163
+ export interface APIPlayer {
164
+ name: string;
165
+ tag: string;
166
+ townHallLevel: number;
167
+ townHallWeaponLevel?: number;
168
+ expLevel: number;
169
+ trophies: number;
170
+ bestTrophies: number;
171
+ warStars: number;
172
+ attackWins: number;
173
+ defenseWins: number;
174
+ builderHallLevel?: number;
175
+ versusTrophies?: number;
176
+ bestVersusTrophies?: number;
177
+ versusBattleWins?: number;
178
+ donations: number;
179
+ donationsReceived: number;
180
+ role?: string;
181
+ warPreference?: 'in' | 'out';
182
+ clan?: APIPlayerClan;
183
+ league?: APILeague;
184
+ legendStatistics?: APILegendStatistics;
185
+ achievements: APIPlayerAchievement[];
186
+ troops: APIPlayerItem[];
187
+ heroes: APIPlayerItem[];
188
+ spells: APIPlayerItem[];
189
+ labels: APILabel[];
190
+ }
191
+ export interface APILegendStatistics {
192
+ previousSeason?: APISeason;
193
+ previousVersusSeason?: APISeason;
194
+ bestVersusSeason?: APISeason;
195
+ currentSeason?: APISeason;
196
+ bestSeason?: APISeason;
197
+ legendTrophies: number;
198
+ }
199
+ export interface APIPlayerClan {
200
+ tag: string;
201
+ name: string;
202
+ clanLevel: number;
203
+ badgeUrls: APIBadge;
204
+ }
205
+ export interface APIPlayerAchievement {
206
+ name: string;
207
+ stars: number;
208
+ value: number;
209
+ target: number;
210
+ info: string;
211
+ completionInfo: string | null;
212
+ village: 'home' | 'builderBase';
213
+ }
214
+ export interface APIPlayerItem {
215
+ name: string;
216
+ level: number;
217
+ maxLevel: number;
218
+ superTroopIsActive?: boolean;
219
+ village: 'home' | 'builderBase';
220
+ }
221
+ /** /players/{playerTag}/verifytoken */
222
+ export interface APIVerifyToken {
223
+ tag: string;
224
+ token: string;
225
+ status: 'ok' | 'invalid';
226
+ }
227
+ /** /locations */
228
+ export interface APILocationList {
229
+ items: APILocation[];
230
+ paging: APIPaging;
231
+ }
232
+ /** /locations/{locationId} */
233
+ export interface APILocation {
234
+ localizedName?: string;
235
+ id: number;
236
+ name: string;
237
+ isCountry: boolean;
238
+ countryCode?: string;
239
+ }
240
+ /** /locations/{locationId}/rankings/clans */
241
+ export interface APIClanRankingList {
242
+ items: APIClanRanking[];
243
+ paging: APIPaging;
244
+ }
245
+ export interface APIClanRanking {
246
+ clanLevel: number;
247
+ clanPoints: number;
248
+ location: APILocation;
249
+ members: number;
250
+ tag: string;
251
+ name: string;
252
+ rank: number;
253
+ previousRank: number;
254
+ badgeUrls: APIBadge;
255
+ }
256
+ /** /locations/{locationId}/rankings/players */
257
+ export interface APIPlayerRankingList {
258
+ items: APIPlayerRanking[];
259
+ paging: APIPaging;
260
+ }
261
+ export interface APIPlayerRanking {
262
+ tag: string;
263
+ name: string;
264
+ expLevel: number;
265
+ trophies: number;
266
+ attackWins: number;
267
+ defenseWins: number;
268
+ rank: number;
269
+ previousRank: number;
270
+ clan?: Omit<APIPlayerClan, 'clanLevel'>;
271
+ league: APILeague;
272
+ }
273
+ /** /locations/{locationId}/rankings/clans-versus */
274
+ export interface APIClanVersusRankingList {
275
+ items: APIClanVersusRanking[];
276
+ paging: APIPaging;
277
+ }
278
+ export interface APIClanVersusRanking {
279
+ clanLevel: number;
280
+ location: APILocation;
281
+ members: number;
282
+ tag: string;
283
+ name: string;
284
+ rank: number;
285
+ previousRank: number;
286
+ badgeUrls: APIBadge;
287
+ clanVersusPoints: number;
288
+ }
289
+ /** /locations/{locationId}/rankings/players-versus */
290
+ export interface APIPlayerVersusRankingList {
291
+ items: APIPlayerVersusRanking[];
292
+ paging: APIPaging;
293
+ }
294
+ export interface APIPlayerVersusRanking {
295
+ tag: string;
296
+ name: string;
297
+ expLevel: number;
298
+ versusTrophies: number;
299
+ versusBattleWins: number;
300
+ rank: number;
301
+ previousRank: number;
302
+ clan?: APIPlayerClan;
303
+ }
304
+ /** /leagues */
305
+ export interface APILeagueList {
306
+ items: APILeague[];
307
+ paging: APIPaging;
308
+ }
309
+ /** /leagues/{leagueId} */
310
+ export interface APILeague {
311
+ id: number;
312
+ name: string;
313
+ iconUrls: APIIcon;
314
+ }
315
+ /** /leagues/{leagueId}/seasons/{seasonId} */
316
+ export interface APIPlayerSeasonRankingList {
317
+ items: Omit<APIPlayerRanking, 'league'>[];
318
+ paging: APIPaging;
319
+ }
320
+ /** /leagues/{leagueId}/seasons */
321
+ export interface APILeagueSeasonList {
322
+ items: {
323
+ id: string;
324
+ }[];
325
+ paging: APIPaging;
326
+ }
327
+ /** /warleagues */
328
+ export interface APIWarLeagueList {
329
+ items: APIWarLeague[];
330
+ paging: APIPaging;
331
+ }
332
+ /** /warleagues/{leagueId} */
333
+ export interface APIWarLeague {
334
+ id: number;
335
+ name: string;
336
+ }
337
+ export interface APILabel {
338
+ id: number;
339
+ name: string;
340
+ iconUrls: APIIcon;
341
+ }
342
+ /** /labels/clans and /labels/players */
343
+ export interface APILabelList {
344
+ items: APILabel[];
345
+ paging: APIPaging;
346
+ }
347
+ /** /goldpass/seasons/current */
348
+ export interface APIGoldPassSeason {
349
+ startTime: string;
350
+ endTime: string;
351
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });