Skip to content

Commit

Permalink
fix(Clan): missing clanCapital property (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
csuvajit committed Jan 15, 2023
1 parent e71b7fa commit c612762
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

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.

## 3.0.1 (11-01-2023)
## 3.0.2 (15-01-2023)

### Bug Fixes

- Conflict with the same name of builder base and home base troops. (#123)
- Fix the issue with the `Client#getLeagueWar()` method.
- Typings and documentation for clan capital.
- Fix the issue with the `Clan#clanCapital` property.

### Features

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clashofclans.js",
"version": "3.0.1",
"version": "3.0.2",
"description": "JavaScript library for interacting with the Clash of Clans API",
"author": "SUVAJIT <suvajit.me@gmail.com>",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion src/struct/Clan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export class Clan {
this.warLeague = data.warLeague ? new WarLeague(data.warLeague) : null;
this.memberCount = data.members;
this.labels = data.labels.map((label) => new Label(label));
this.clanCapital = Object.keys(data.clanCapital).length > 0 ? new ClanCapital(data.clanCapital) : null;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
this.clanCapital = Object.keys(data.clanCapital ?? {}).length > 0 ? new ClanCapital(data.clanCapital) : null;
this.isFamilyFriendly = data.isFamilyFriendly;
this.capitalPoints = data.clanCapitalPoints;
this.capitalLeague = data.capitalLeague;
Expand Down
2 changes: 1 addition & 1 deletion src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface APISeason {

/** /clans?name={name}&limit={limit} */
export interface APIClanList {
items: Omit<APIClan, 'memberList'>[];
items: Omit<APIClan, 'memberList' | 'clanCapital'>[];
paging: APIPaging;
}

Expand Down

1 comment on commit c612762

@csuvajit
Copy link
Contributor Author

@csuvajit csuvajit commented on c612762 Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for clashofclans-js ready!

✅ Preview
https://clashofclans-ew1j5wc7q-csuvajit.vercel.app

Built with commit c612762.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.