lastfm-nodejs-client 1.0.1 → 1.0.2
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.
- package/CHANGELOG.md +4 -0
- package/README.md +4 -12
- package/dist/types.d.ts +250 -0
- package/dist/types.js +20 -0
- package/package.json +4 -1
- /package/src/{types.d.ts → types.ts} +0 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
A Node JS wrapper client for fetching public data from [LastFm API](https://www.last.fm/api).
|
|
4
4
|
|
|
5
|
+
## But Why?
|
|
6
|
+
|
|
7
|
+
I was building scrobbles page [https://mannuelferreira.com/scrobbles](https://mannuelferreira.com/scrobbles) and I thought other might want it to.
|
|
8
|
+
|
|
5
9
|
## How to use the client
|
|
6
10
|
|
|
7
11
|
Install the npm package in your project.
|
|
@@ -80,15 +84,3 @@ Build
|
|
|
80
84
|
```bash
|
|
81
85
|
pnpm build
|
|
82
86
|
```
|
|
83
|
-
|
|
84
|
-
## Testing code
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
pnpm test
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## TODO
|
|
91
|
-
|
|
92
|
-
- [ ] Add types to DefinitelyTyped project
|
|
93
|
-
- [ ] Write tests
|
|
94
|
-
- [ ] Write more endpoints
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
export interface AuthResponse {
|
|
2
|
+
token: string;
|
|
3
|
+
}
|
|
4
|
+
export interface LovedTracksResponse {
|
|
5
|
+
lovedtracks: LovedTracks;
|
|
6
|
+
}
|
|
7
|
+
export interface LovedTracks {
|
|
8
|
+
track: Track[];
|
|
9
|
+
'@attr': Attr;
|
|
10
|
+
}
|
|
11
|
+
export interface TopAlbumsResponse {
|
|
12
|
+
topalbums: TopAlbums;
|
|
13
|
+
}
|
|
14
|
+
export interface TopTrackResponse {
|
|
15
|
+
toptracks: TopTracks;
|
|
16
|
+
}
|
|
17
|
+
export interface TopTracks {
|
|
18
|
+
track: Track[];
|
|
19
|
+
'@attr': Attr2;
|
|
20
|
+
}
|
|
21
|
+
export interface UserResponse {
|
|
22
|
+
user: User;
|
|
23
|
+
}
|
|
24
|
+
export interface RecentTracksResponse {
|
|
25
|
+
recenttracks: RecentTracks;
|
|
26
|
+
}
|
|
27
|
+
export interface RecentTracks {
|
|
28
|
+
track: Track[];
|
|
29
|
+
'@attr': Attr2;
|
|
30
|
+
}
|
|
31
|
+
export interface LoveTracksResponse {
|
|
32
|
+
lovedtracks: LovedTracks;
|
|
33
|
+
}
|
|
34
|
+
export interface LovedTracks {
|
|
35
|
+
track: Track[];
|
|
36
|
+
'@attr': Attr;
|
|
37
|
+
}
|
|
38
|
+
export interface FriendsResponse {
|
|
39
|
+
friends: Friends;
|
|
40
|
+
}
|
|
41
|
+
export interface Friends {
|
|
42
|
+
'@attr': Attr;
|
|
43
|
+
user: User[];
|
|
44
|
+
}
|
|
45
|
+
export interface TopArtistsResponse {
|
|
46
|
+
topartists: TopArtists;
|
|
47
|
+
}
|
|
48
|
+
export interface TopArtists {
|
|
49
|
+
artist: Artist[];
|
|
50
|
+
'@attr': Attr2;
|
|
51
|
+
}
|
|
52
|
+
export interface WeeklyArtistChartResponse {
|
|
53
|
+
weeklyartistchart: WeeklyArtistChart;
|
|
54
|
+
}
|
|
55
|
+
export interface WeeklyArtistChart {
|
|
56
|
+
artist: Artist[];
|
|
57
|
+
'@attr': Attr2;
|
|
58
|
+
}
|
|
59
|
+
export interface WeeklyAlbumChartResponse {
|
|
60
|
+
weeklyalbumchart: WeeklyAlbumChart;
|
|
61
|
+
}
|
|
62
|
+
export interface WeeklyAlbumChart {
|
|
63
|
+
album: WeeklyAlbum[];
|
|
64
|
+
'@attr': WeeklyalbumChartAttr;
|
|
65
|
+
}
|
|
66
|
+
export declare type WeeklyAlbum = {
|
|
67
|
+
artist: {
|
|
68
|
+
mbid: string;
|
|
69
|
+
'#text': string;
|
|
70
|
+
};
|
|
71
|
+
mbid: string;
|
|
72
|
+
url: string;
|
|
73
|
+
name: string;
|
|
74
|
+
'@attr': {
|
|
75
|
+
rank: string;
|
|
76
|
+
};
|
|
77
|
+
playcount: string;
|
|
78
|
+
image?: string;
|
|
79
|
+
};
|
|
80
|
+
export interface WeeklyalbumChartAttr {
|
|
81
|
+
from: string;
|
|
82
|
+
to: string;
|
|
83
|
+
user: string;
|
|
84
|
+
}
|
|
85
|
+
export interface AlbumAttr {
|
|
86
|
+
rank: string;
|
|
87
|
+
}
|
|
88
|
+
export declare type Artist = {
|
|
89
|
+
'@attr': {
|
|
90
|
+
rank: number;
|
|
91
|
+
};
|
|
92
|
+
cover: ArtistImage;
|
|
93
|
+
image?: string;
|
|
94
|
+
mbid: string;
|
|
95
|
+
name: string;
|
|
96
|
+
playcount: number;
|
|
97
|
+
streamable: number;
|
|
98
|
+
url: string;
|
|
99
|
+
'#text': string;
|
|
100
|
+
};
|
|
101
|
+
export interface Attribs {
|
|
102
|
+
page: number;
|
|
103
|
+
perPage: number;
|
|
104
|
+
user: string;
|
|
105
|
+
total: number;
|
|
106
|
+
totalPages: number;
|
|
107
|
+
}
|
|
108
|
+
export interface ArtistImage {
|
|
109
|
+
name: string;
|
|
110
|
+
photo: string;
|
|
111
|
+
attribution: string;
|
|
112
|
+
playcount: number;
|
|
113
|
+
}
|
|
114
|
+
export interface Album {
|
|
115
|
+
mbid: string;
|
|
116
|
+
'#text': string;
|
|
117
|
+
}
|
|
118
|
+
export interface Attr {
|
|
119
|
+
nowplaying: string;
|
|
120
|
+
}
|
|
121
|
+
export interface Date {
|
|
122
|
+
uts: string;
|
|
123
|
+
'#text': string;
|
|
124
|
+
}
|
|
125
|
+
export interface Track {
|
|
126
|
+
artist: Artist;
|
|
127
|
+
streamable: string;
|
|
128
|
+
image: '';
|
|
129
|
+
mbid: string;
|
|
130
|
+
album: Album;
|
|
131
|
+
name: string;
|
|
132
|
+
'@attr': Attr;
|
|
133
|
+
url: string;
|
|
134
|
+
date: Date;
|
|
135
|
+
}
|
|
136
|
+
export interface Attr2 {
|
|
137
|
+
user: string;
|
|
138
|
+
totalPages: string;
|
|
139
|
+
page: string;
|
|
140
|
+
perPage: string;
|
|
141
|
+
total: string;
|
|
142
|
+
}
|
|
143
|
+
export interface RecentTracks {
|
|
144
|
+
track: Track[];
|
|
145
|
+
'@attr': Attr2;
|
|
146
|
+
}
|
|
147
|
+
export interface Image {
|
|
148
|
+
size: string;
|
|
149
|
+
'#text': string;
|
|
150
|
+
}
|
|
151
|
+
export interface Registered {
|
|
152
|
+
unixtime: string;
|
|
153
|
+
'#text': number;
|
|
154
|
+
}
|
|
155
|
+
export interface User {
|
|
156
|
+
name: string;
|
|
157
|
+
age: string;
|
|
158
|
+
subscriber: string;
|
|
159
|
+
realname: string;
|
|
160
|
+
bootstrap: string;
|
|
161
|
+
playcount: string;
|
|
162
|
+
artist_count: string;
|
|
163
|
+
playlists: string;
|
|
164
|
+
track_count: string;
|
|
165
|
+
album_count: string;
|
|
166
|
+
image: Image[];
|
|
167
|
+
registered: Registered;
|
|
168
|
+
country: string;
|
|
169
|
+
gender: string;
|
|
170
|
+
url: string;
|
|
171
|
+
type: string;
|
|
172
|
+
}
|
|
173
|
+
export interface TopAlbums {
|
|
174
|
+
album: Album[];
|
|
175
|
+
'@attr': Attr2;
|
|
176
|
+
}
|
|
177
|
+
export interface WeeklyArtistChartResponse {
|
|
178
|
+
weeklyartistchart: WeeklyArtistChart;
|
|
179
|
+
}
|
|
180
|
+
export interface WeeklyArtistChart {
|
|
181
|
+
artist: Artist[];
|
|
182
|
+
'@attr': Attr2;
|
|
183
|
+
}
|
|
184
|
+
export interface Attr1 {
|
|
185
|
+
rank: string;
|
|
186
|
+
}
|
|
187
|
+
export interface Attr2 {
|
|
188
|
+
from: string;
|
|
189
|
+
user: string;
|
|
190
|
+
to: string;
|
|
191
|
+
}
|
|
192
|
+
export interface WeeklyChartListResponse {
|
|
193
|
+
weeklychartlist: WeeklyChartList;
|
|
194
|
+
}
|
|
195
|
+
export interface WeeklyChartList {
|
|
196
|
+
chart: WeeklyChartListChart[];
|
|
197
|
+
'@attr': WeeklyChartListAttr;
|
|
198
|
+
}
|
|
199
|
+
export interface WeeklyChartListChart {
|
|
200
|
+
'#text': string;
|
|
201
|
+
from: string;
|
|
202
|
+
to: string;
|
|
203
|
+
}
|
|
204
|
+
export interface WeeklyChartListAttr {
|
|
205
|
+
user: string;
|
|
206
|
+
}
|
|
207
|
+
export interface WeeklyTrackChartResponse {
|
|
208
|
+
weeklytrackchart: WeeklyTrackChart;
|
|
209
|
+
}
|
|
210
|
+
export interface WeeklyTrackChart {
|
|
211
|
+
track: Track[];
|
|
212
|
+
'@attr': WeeklyTrackChartAttr2;
|
|
213
|
+
}
|
|
214
|
+
export interface WeeklyTrackChartTrack {
|
|
215
|
+
artist: WeeklyTrackChartArtist;
|
|
216
|
+
image: Image[];
|
|
217
|
+
mbid: string;
|
|
218
|
+
url: string;
|
|
219
|
+
name: string;
|
|
220
|
+
'@attr': Attr;
|
|
221
|
+
playcount: string;
|
|
222
|
+
}
|
|
223
|
+
export interface WeeklyTrackChartArtist {
|
|
224
|
+
mbid: string;
|
|
225
|
+
'#text': string;
|
|
226
|
+
}
|
|
227
|
+
export interface WeeklyTrackChartAttr {
|
|
228
|
+
rank: string;
|
|
229
|
+
}
|
|
230
|
+
export interface WeeklyTrackChartAttr2 {
|
|
231
|
+
from: string;
|
|
232
|
+
user: string;
|
|
233
|
+
to: string;
|
|
234
|
+
}
|
|
235
|
+
export declare enum Errors {
|
|
236
|
+
'InvalidService' = 2,
|
|
237
|
+
'InvalidMethod' = 3,
|
|
238
|
+
'AuthenticationFailed' = 4,
|
|
239
|
+
'Invalid format' = 5,
|
|
240
|
+
'Invalid parameters' = 6,
|
|
241
|
+
'InvalidResourceSpecified' = 7,
|
|
242
|
+
'OperationFailed' = 8,
|
|
243
|
+
'Invalid session key' = 9,
|
|
244
|
+
'InvalidApiKey' = 10,
|
|
245
|
+
'ServiceOffline' = 11,
|
|
246
|
+
'InvalidMethodSignatureSupplied' = 13,
|
|
247
|
+
'TemporaryErrorRequest' = 16,
|
|
248
|
+
'SuspendedApiKey' = 26,
|
|
249
|
+
'RateLimitExceeded' = 29
|
|
250
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Errors = void 0;
|
|
4
|
+
var Errors;
|
|
5
|
+
(function (Errors) {
|
|
6
|
+
Errors[Errors["InvalidService"] = 2] = "InvalidService";
|
|
7
|
+
Errors[Errors["InvalidMethod"] = 3] = "InvalidMethod";
|
|
8
|
+
Errors[Errors["AuthenticationFailed"] = 4] = "AuthenticationFailed";
|
|
9
|
+
Errors[Errors["Invalid format"] = 5] = "Invalid format";
|
|
10
|
+
Errors[Errors["Invalid parameters"] = 6] = "Invalid parameters";
|
|
11
|
+
Errors[Errors["InvalidResourceSpecified"] = 7] = "InvalidResourceSpecified";
|
|
12
|
+
Errors[Errors["OperationFailed"] = 8] = "OperationFailed";
|
|
13
|
+
Errors[Errors["Invalid session key"] = 9] = "Invalid session key";
|
|
14
|
+
Errors[Errors["InvalidApiKey"] = 10] = "InvalidApiKey";
|
|
15
|
+
Errors[Errors["ServiceOffline"] = 11] = "ServiceOffline";
|
|
16
|
+
Errors[Errors["InvalidMethodSignatureSupplied"] = 13] = "InvalidMethodSignatureSupplied";
|
|
17
|
+
Errors[Errors["TemporaryErrorRequest"] = 16] = "TemporaryErrorRequest";
|
|
18
|
+
Errors[Errors["SuspendedApiKey"] = 26] = "SuspendedApiKey";
|
|
19
|
+
Errors[Errors["RateLimitExceeded"] = 29] = "RateLimitExceeded";
|
|
20
|
+
})(Errors = exports.Errors || (exports.Errors = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lastfm-nodejs-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A client for fetching public data with username using the LastFm public API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"node"
|
|
17
17
|
],
|
|
18
18
|
"author": "Mannuel Ferreira",
|
|
19
|
+
"maintainers": [
|
|
20
|
+
"Mannuel Ferreira"
|
|
21
|
+
],
|
|
19
22
|
"license": "MIT",
|
|
20
23
|
"dependencies": {
|
|
21
24
|
"node-fetch": "^3.2.10",
|
|
File without changes
|