-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,993 additions
and
548 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"TYPESCRIPT": { | ||
"ABC": [ | ||
30, | ||
60, | ||
120, | ||
180 | ||
], | ||
"LOC": [ | ||
75, | ||
120, | ||
180, | ||
240 | ||
], | ||
"TOTAL_LOC": [ | ||
600, | ||
750, | ||
960, | ||
1350 | ||
], | ||
"BLOCK_NESTING": [ | ||
9, | ||
12, | ||
15, | ||
18 | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LAST_FM_API_KEY="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ ehthumbs.db | |
Thumbs.db | ||
|
||
# Project specific | ||
.env | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// @ts-nocheck | ||
|
||
import { config } from 'dotenv'; | ||
|
||
import { | ||
LastFMGeo, | ||
LastFMTag, | ||
LastFMUser, | ||
LastFMAlbum, | ||
LastFMChart, | ||
LastFMTrack, | ||
LastFMArtist, | ||
LastFMLibrary | ||
} from '../dist/index.js'; | ||
|
||
config(); | ||
|
||
const API_KEY = process.env.LAST_FM_API_KEY; | ||
|
||
const geo = new LastFMGeo(API_KEY); | ||
const tag = new LastFMTag(API_KEY); | ||
const user = new LastFMUser(API_KEY); | ||
const album = new LastFMAlbum(API_KEY); | ||
const chart = new LastFMChart(API_KEY); | ||
const track = new LastFMTrack(API_KEY); | ||
const artist = new LastFMArtist(API_KEY); | ||
const library = new LastFMLibrary(API_KEY); | ||
|
||
const print = r => console.log(JSON.stringify(r, null, 2)); | ||
|
||
geo.getTopArtists({ country: 'Bulgaria', limit: 2 }).then(print); | ||
geo.getTopTracks({ country: 'Bulgaria', limit: 2 }).then(print); | ||
|
||
tag.getInfo({ tag: 'techno', limit: 2 }).then(print); | ||
tag.getSimilar({ tag: 'techno', limit: 2 }).then(print); | ||
tag.getTopAlbums({ tag: 'techno', limit: 2 }).then(print); | ||
tag.getTopArtists({ tag: 'techno', limit: 2 }).then(print); | ||
tag.getTopTags().then(print); | ||
tag.getTopTracks({ tag: 'techno', limit: 2 }).then(print); | ||
tag.getWeeklyChartList({ tag: 'techno' }).then(print); | ||
|
||
user.getFriends({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getInfo({ user: 'scriptex' }).then(print); | ||
user.getLovedTracks({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getPersonalTags({ user: 'scriptex', taggingtype: 'album', tag: 'techno', limit: 2 }).then(print); | ||
user.getPersonalTags({ user: 'scriptex', taggingtype: 'artist', tag: 'techno', limit: 2 }).then(print); | ||
user.getPersonalTags({ user: 'scriptex', taggingtype: 'track', tag: 'techno', limit: 2 }).then(print); | ||
user.getRecentTracks({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getTopAlbums({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getTopArtists({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getTopTags({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getTopTracks({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getWeeklyAlbumChart({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getWeeklyArtistChart({ user: 'scriptex', limit: 2 }).then(print); | ||
user.getWeeklyChartList({ user: 'scriptex' }).then(print); | ||
user.getWeeklyTrackChart({ user: 'scriptex' }).then(print); | ||
|
||
album.getInfo({ album: 'The Fat of The Land', artist: 'The Prodigy' }).then(print); | ||
//NOSONAR | ||
// album.getTags({ album: 'The Fat of The Land', artist: 'The Prodigy' }).then(print); | ||
album.getTopTags({ album: 'The Fat of The Land', artist: 'The Prodigy' }).then(print); | ||
album.search({ album: 'The Fat of The Land', artist: 'The Prodigy' }).then(print); | ||
|
||
chart.getTopArtists({ limit: 2 }).then(print); | ||
chart.getTopTags({ limit: 2 }).then(print); | ||
chart.getTopTracks({ limit: 2 }).then(print); | ||
|
||
track.getCorrection({ track: 'Firestarter', artist: 'The Prodigy' }).then(print); | ||
track.getInfo({ track: 'Firestarter', artist: 'The Prodigy' }).then(print); | ||
track.getSimilar({ track: 'Firestarter', artist: 'The Prodigy', limit: 2 }).then(print); | ||
//NOSONAR | ||
// track.getTags({ track: 'Firestarter', artist: 'The Prodigy', limit: 2 }).then(print); | ||
track.getTopTags({ track: 'Firestarter', artist: 'The Prodigy', limit: 2 }).then(print); | ||
track.search({ track: 'Firestarter', artist: 'The Prodigy', limit: 2 }).then(print); | ||
|
||
artist.getCorrection({ artist: 'The Prodigy' }).then(print); | ||
artist.getInfo({ artist: 'The Prodigy' }).then(print); | ||
artist.getSimilar({ artist: 'The Prodigy', limit: 2 }).then(print); | ||
//NOSONAR | ||
// artist.getTags({ artist: 'The Prodigy' }).then(print); | ||
artist.getTopAlbums({ artist: 'The Prodigy', limit: 2 }).then(print); | ||
artist.getTopTags({ artist: 'The Prodigy' }).then(print); | ||
artist.getTopTracks({ artist: 'The Prodigy', limit: 2 }).then(print); | ||
artist.search({ artist: 'The Prodigy', limit: 2 }).then(print); | ||
|
||
library.getArtists({ user: 'scriptex', limit: 2 }).then(print); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "lastfm-ts-api", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "An API client for the Last.FM API written in TypeScript", | ||
"keywords": [ | ||
"Last.FM", | ||
|
@@ -17,18 +17,21 @@ | |
"author": "Atanas Atanasov <[email protected]> (https://atanas.info)", | ||
"funding": "https://github.com/sponsors/scriptex", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "github:scriptex/lastfm-ts-api" | ||
}, | ||
"scripts": { | ||
"watch": "tsc -w", | ||
"build": "tsc" | ||
"build": "tsc", | ||
"demo": "node demo/index.js" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@types/node": "20.8.9", | ||
"dotenv": "16.3.1", | ||
"tslib": "2.6.2", | ||
"typescript": "5.2.2" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.