Skip to content

Commit

Permalink
Fix user.getTopTracks (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
yayuyokitano authored Dec 18, 2020
1 parent 53d3060 commit 1198d3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lastfm-typed",
"version": "0.5.0",
"version": "0.5.1",
"description": "Typed API wrapper for Last.FM using promises",
"main": "dist/index.js",
"author": "yayuyokitano",
Expand Down
8 changes: 8 additions & 0 deletions src/classes/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ export default class UserClass extends Base {

}

public async getTopTracks(usernameOrSessionKey:string, params?:{limit?:number, page?:number, period?:"overall"|"7day"|"1month"|"3month"|"6month"|"12month"}) {

this.checkLimit(params?.limit, 1000);

return (await this.sendRequest(this.key, this.secret, { method: "user.getTopTracks", user: usernameOrSessionKey, ...params })).toptracks as UserInterface.getTopTracks;

}

public async getWeeklyAlbumChart(usernameOrSessionKey:string, params?:{limit?:number, from:string, to:string}|{limit?:number}) {

this.checkLimit(params?.limit, 1000);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/userInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ interface TopTrack extends TagTrack {
}

export interface getTopTracks {
artist:TopTrack[];
track:TopTrack[];
"@attr":Metadata;
}

Expand Down

0 comments on commit 1198d3d

Please sign in to comment.