clashofclans.js 3.4.1-dev.2517a97 → 3.4.2-dev.559ce53

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.
@@ -112,8 +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 a list of Leagues. */
116
- getLeagues(options?: SearchOptions): Promise<import("../types").APILeague[]>;
115
+ /** Get a list of League Tiers. */
116
+ getLeaguesTiers(options?: SearchOptions): Promise<import("../types").APILeagueTier[]>;
117
117
  /** Get a list of Leagues. */
118
118
  getBuilderBaseLeagues(options?: SearchOptions): Promise<import("../types").APIBuilderBaseLeague[]>;
119
119
  /** Get a list of Capital Leagues. */
@@ -185,9 +185,9 @@ class Client extends node_events_1.EventEmitter {
185
185
  const { body } = await this.rest.verifyPlayerToken(playerTag, token, options);
186
186
  return body.status === 'ok';
187
187
  }
188
- /** Get a list of Leagues. */
189
- async getLeagues(options) {
190
- const { body } = await this.rest.getLeagues(options);
188
+ /** Get a list of League Tiers. */
189
+ async getLeaguesTiers(options) {
190
+ const { body } = await this.rest.getLeagueTiers(options);
191
191
  return body.items;
192
192
  }
193
193
  /** Get a list of Leagues. */
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'node:events';
3
- import { APIBuilderBaseLeague, APIBuilderBaseLeagueList, APICapitalLeague, APICapitalLeagueList, APICapitalRaidSeasons, APIClan, APIClanBuilderBaseRankingList, APIClanCapitalRankingList, APIClanList, APIClanMemberList, APIClanRankingList, APIClanWar, APIClanWarLeagueGroup, APIClanWarLogList, APIGoldPassSeason, APILabelList, APILeague, APILeagueList, APILeagueSeasonList, APILocation, APILocationList, APIPlayer, APIPlayerBuilderBaseRankingList, APIPlayerRankingList, APIPlayerSeasonRankingList, APIVerifyToken, APIWarLeague, APIWarLeagueList, ClanSearchOptions, LoginOptions, OverrideOptions, RESTOptions, SearchOptions } from '../types';
3
+ import { APIBuilderBaseLeague, APIBuilderBaseLeagueList, APICapitalLeague, APICapitalLeagueList, APICapitalRaidSeasons, APIClan, APIClanBuilderBaseRankingList, APIClanCapitalRankingList, APIClanList, APIClanMemberList, APIClanRankingList, APIClanWar, APIClanWarLeagueGroup, APIClanWarLogList, APIGoldPassSeason, APILabelList, APILeagueSeasonList, APILeagueTier, APILeagueTierList, APILocation, APILocationList, APIPlayer, APIPlayerBuilderBaseRankingList, APIPlayerRankingList, APIPlayerSeasonRankingList, APIVerifyToken, APIWarLeague, APIWarLeagueList, ClanSearchOptions, LoginOptions, OverrideOptions, RESTOptions, SearchOptions } from '../types';
4
4
  import { RestEvents } from '../util/Constants';
5
5
  import { Util } from '../util/Util';
6
6
  import { RequestHandler } from './RequestHandler';
@@ -72,10 +72,10 @@ export declare class RESTManager extends EventEmitter {
72
72
  getPlayer(playerTag: string, options?: OverrideOptions): Promise<import("../types").Result<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").Result<APIVerifyToken>>;
75
- /** Get a list of Leagues. */
76
- getLeagues(options?: SearchOptions): Promise<import("../types").Result<APILeagueList>>;
77
- /** Get a League info. */
78
- getLeague(leagueId: string | number, options?: OverrideOptions): Promise<import("../types").Result<APILeague>>;
75
+ /** Get a list of League Tiers. */
76
+ getLeagueTiers(options?: SearchOptions): Promise<import("../types").Result<APILeagueTierList>>;
77
+ /** Get a League tier info. */
78
+ getLeagueTier(leagueId: string | number, options?: OverrideOptions): Promise<import("../types").Result<APILeagueTier>>;
79
79
  /** Get a list of builder base leagues. */
80
80
  getBuilderBaseLeagues(options?: SearchOptions): Promise<import("../types").Result<APIBuilderBaseLeagueList>>;
81
81
  /** Get a builder base league info. */
@@ -81,14 +81,14 @@ class RESTManager extends node_events_1.EventEmitter {
81
81
  ...options
82
82
  });
83
83
  }
84
- /** Get a list of Leagues. */
85
- getLeagues(options) {
84
+ /** Get a list of League Tiers. */
85
+ getLeagueTiers(options) {
86
86
  const query = Util_1.Util.queryString(options);
87
- return this.requestHandler.request(`/leagues${query}`, options);
87
+ return this.requestHandler.request(`/leaguetiers${query}`, options);
88
88
  }
89
- /** Get a League info. */
90
- getLeague(leagueId, options) {
91
- return this.requestHandler.request(`/leagues/${leagueId}`, options);
89
+ /** Get a League tier info. */
90
+ getLeagueTier(leagueId, options) {
91
+ return this.requestHandler.request(`/leaguetiers/${leagueId}`, options);
92
92
  }
93
93
  /** Get a list of builder base leagues. */
94
94
  getBuilderBaseLeagues(options) {
@@ -1,5 +1,5 @@
1
1
  import { Client } from '../client/Client';
2
- import { APIClanMember, APILeague, APIPlayerHouse, OverrideOptions } from '../types';
2
+ import { APIClanMember, APILeagueTier, APIPlayerHouse, OverrideOptions } from '../types';
3
3
  import { League } from './League';
4
4
  export declare class ClanMember {
5
5
  /** The member's name. */
@@ -15,7 +15,7 @@ export declare class ClanMember {
15
15
  /** The member's current League. */
16
16
  league: League;
17
17
  /** The member's current Builder Base League. */
18
- builderBaseLeague: Omit<APILeague, 'iconUrls'> | null;
18
+ builderBaseLeague: Omit<APILeagueTier, 'iconUrls'> | null;
19
19
  /** The member's trophy count. */
20
20
  trophies: number;
21
21
  /** The member's builder base trophy count. */
@@ -19,7 +19,7 @@ class ClanMember {
19
19
  this.role = data.role.replace('admin', 'elder');
20
20
  this.expLevel = data.expLevel;
21
21
  // eslint-disable-next-line
22
- this.league = new League_1.League(data.league ?? Constants_1.UnrankedLeagueData);
22
+ this.league = new League_1.League(data.leagueTier ?? Constants_1.UnrankedLeagueData);
23
23
  this.trophies = data.trophies;
24
24
  this.builderBaseTrophies = data.builderBaseTrophies ?? null;
25
25
  this.clanRank = data.clanRank;
@@ -1,4 +1,4 @@
1
- import { APILeague } from '../types';
1
+ import { APILeagueTier } from '../types';
2
2
  import { Icon } from './Icon';
3
3
  /** Represents a Player's League. */
4
4
  export declare class League {
@@ -8,7 +8,7 @@ export declare class League {
8
8
  name: string;
9
9
  /** The League Icon. */
10
10
  icon: Icon;
11
- constructor(data: APILeague);
11
+ constructor(data: APILeagueTier);
12
12
  /** Position of this League. Starting from 0 (Un-ranked) */
13
13
  get position(): number;
14
14
  }
@@ -39,7 +39,7 @@ class Player {
39
39
  this.role = data.role?.replace('admin', 'elder') ?? null;
40
40
  this.warOptedIn = data.warPreference ? data.warPreference === 'in' : null;
41
41
  this.clan = data.clan ? new PlayerClan_1.PlayerClan(client, data.clan) : null;
42
- this.league = new League_1.League(data.league ?? Constants_1.UnrankedLeagueData);
42
+ this.league = new League_1.League(data.leagueTier ?? Constants_1.UnrankedLeagueData);
43
43
  this.legendStatistics = data.legendStatistics ? new LegendStatistics_1.LegendStatistics(data.legendStatistics) : null;
44
44
  this.achievements = data.achievements.map((data) => new Achievement_1.Achievement(data));
45
45
  this.labels = data.labels.map((data) => new Label_1.Label(data));
@@ -72,9 +72,8 @@ export interface APIClanMember {
72
72
  role: 'member' | 'admin' | 'coLeader' | 'leader';
73
73
  expLevel: number;
74
74
  townHallLevel: number;
75
- league: APILeague;
76
75
  leagueTier?: APILeagueTier;
77
- builderBaseLeague?: Omit<APILeague, 'iconUrls'>;
76
+ builderBaseLeague?: Omit<APILeagueTier, 'iconUrls'>;
78
77
  trophies: number;
79
78
  builderBaseTrophies?: number;
80
79
  clanRank: number;
@@ -267,7 +266,6 @@ export interface APIPlayer {
267
266
  role?: string;
268
267
  warPreference?: 'in' | 'out';
269
268
  clan?: APIPlayerClan;
270
- league?: APILeague;
271
269
  leagueTier?: APILeagueTier;
272
270
  builderBaseLeague?: {
273
271
  id: number;
@@ -363,7 +361,6 @@ export interface APIPlayerRanking {
363
361
  rank: number;
364
362
  previousRank: number;
365
363
  clan?: Omit<APIPlayerClan, 'clanLevel'>;
366
- league: APILeague;
367
364
  leagueTier?: APILeagueTier;
368
365
  }
369
366
  /** /locations/{locationId}/rankings/clans-builder-base */
@@ -416,11 +413,6 @@ export interface APIClanCapitalRankingList {
416
413
  items: APIClanCapitalRanking[];
417
414
  paging: APIPaging;
418
415
  }
419
- /** /leagues */
420
- export interface APILeagueList {
421
- items: APILeague[];
422
- paging: APIPaging;
423
- }
424
416
  /** /leaguetiers */
425
417
  export interface APILeagueTierList {
426
418
  items: APILeagueTier[];
@@ -434,12 +426,6 @@ export interface APIBuilderBaseLeague {
434
426
  id: number;
435
427
  name: string;
436
428
  }
437
- /** /leagues/{leagueId} */
438
- export interface APILeague {
439
- id: number;
440
- name: string;
441
- iconUrls: APIIcon;
442
- }
443
429
  export interface APILeagueTier {
444
430
  id: number;
445
431
  name: string;
@@ -447,7 +433,7 @@ export interface APILeagueTier {
447
433
  }
448
434
  /** /leagues/{leagueId}/seasons/{seasonId} */
449
435
  export interface APIPlayerSeasonRankingList {
450
- items: Omit<APIPlayerRanking, 'league'>[];
436
+ items: Omit<APIPlayerRanking, 'leagueTier'>[];
451
437
  paging: APIPaging;
452
438
  }
453
439
  /** /leagues/{leagueId}/seasons */
@@ -17,7 +17,7 @@ export declare const UnrankedLeagueData: {
17
17
  name: string;
18
18
  iconUrls: {
19
19
  small: string;
20
- tiny: string;
20
+ large: string;
21
21
  };
22
22
  };
23
23
  export declare const UnrankedLeagueId = 29000000;
@@ -20,11 +20,11 @@ exports.BuilderTroops = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCa
20
20
  exports.Heroes = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'hero').map((unit) => unit.name);
21
21
  exports.HeroPets = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'pet').map((unit) => unit.name);
22
22
  exports.UnrankedLeagueData = {
23
- id: 29000000,
23
+ id: 105000000,
24
24
  name: 'Unranked',
25
25
  iconUrls: {
26
- small: 'https://api-assets.clashofclans.com/leagues/72/e--YMyIexEQQhE4imLoJcwhYn6Uy8KqlgyY3_kFV6t4.png',
27
- tiny: 'https://api-assets.clashofclans.com/leagues/36/e--YMyIexEQQhE4imLoJcwhYn6Uy8KqlgyY3_kFV6t4.png'
26
+ small: 'https://api-assets.clashofclans.com/leaguetiers/125/yyYo5DUFeFBZvmMEQh0ZxvG-1sUOZ_S3kDMB7RllXX0.png',
27
+ large: 'https://api-assets.clashofclans.com/leaguetiers/326/yyYo5DUFeFBZvmMEQh0ZxvG-1sUOZ_S3kDMB7RllXX0.png'
28
28
  }
29
29
  };
30
30
  exports.UnrankedLeagueId = 29000000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clashofclans.js",
3
- "version": "3.4.1-dev.2517a97",
3
+ "version": "3.4.2-dev.559ce53",
4
4
  "description": "JavaScript library for interacting with the Clash of Clans API",
5
5
  "author": "https://clashofclans.js.org",
6
6
  "license": "MIT",