lastfm-nodejs-client 1.4.2 → 1.4.3

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/@types/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export interface LovedTracksResponse {
8
8
 
9
9
  export interface LovedTracks {
10
10
  track: Track[];
11
- '@attr': Attr;
11
+ '@attr': AttrNowPlaying;
12
12
  }
13
13
  export interface TopAlbumsResponse {
14
14
  topalbums: TopAlbums;
@@ -20,7 +20,7 @@ export interface TopTrackResponse {
20
20
 
21
21
  export interface TopTracks {
22
22
  track: Track[];
23
- '@attr': Attr2;
23
+ '@attr': AttrLimit;
24
24
  }
25
25
 
26
26
  export interface UserResponse {
@@ -33,7 +33,7 @@ export interface RecentTracksResponse {
33
33
 
34
34
  export interface RecentTracks {
35
35
  track: Track[];
36
- '@attr': Attr2;
36
+ '@attr': AttrLimit;
37
37
  }
38
38
 
39
39
  export interface LoveTracksResponse {
@@ -42,14 +42,14 @@ export interface LoveTracksResponse {
42
42
 
43
43
  export interface LovedTracks {
44
44
  track: Track[];
45
- '@attr': Attr;
45
+ '@attr': AttrNowPlaying;
46
46
  }
47
47
  export interface FriendsResponse {
48
48
  friends: Friends;
49
49
  }
50
50
 
51
51
  export interface Friends {
52
- '@attr': Attr;
52
+ '@attr': AttrNowPlaying;
53
53
  user: User[];
54
54
  }
55
55
 
@@ -59,7 +59,7 @@ export interface TopArtistsResponse {
59
59
 
60
60
  export interface TopArtists {
61
61
  artist: Artist[];
62
- '@attr': Attr2;
62
+ '@attr': AttrLimit;
63
63
  }
64
64
 
65
65
  export interface WeeklyArtistChartResponse {
@@ -68,7 +68,7 @@ export interface WeeklyArtistChartResponse {
68
68
 
69
69
  export interface WeeklyArtistChart {
70
70
  artist: Artist[];
71
- '@attr': Attr2;
71
+ '@attr': AttrLimit;
72
72
  }
73
73
 
74
74
  export interface WeeklyAlbumChartResponse {
@@ -80,7 +80,7 @@ export interface WeeklyAlbumChart {
80
80
  '@attr': WeeklyalbumChartAttr;
81
81
  }
82
82
 
83
- export type WeeklyAlbum = {
83
+ export interface WeeklyAlbum {
84
84
  artist: {
85
85
  mbid: string;
86
86
  '#text': string;
@@ -132,12 +132,14 @@ export interface ArtistImage {
132
132
  playcount: number;
133
133
  }
134
134
 
135
- export interface Album {
136
- mbid: string;
137
- '#text': string;
138
- }
135
+ export interface Album extends Track {
136
+ album: Album;
137
+ artist: Artist;
138
+ name: string;
139
+ url: string
140
+ };
139
141
 
140
- export interface Attr {
142
+ export interface AttrNowPlaying {
141
143
  nowplaying: string;
142
144
  }
143
145
 
@@ -147,18 +149,20 @@ export interface Date {
147
149
  }
148
150
 
149
151
  export interface Track {
150
- artist: Artist;
151
- streamable: string;
152
- image: Image[];
153
- mbid: string;
152
+ '@attr'?: AttrRank;
154
153
  album: Album;
154
+ artist: Artist;
155
+ date?: Date;
156
+ duration?: string;
157
+ image?: Image[];
158
+ mbid: string;
155
159
  name: string;
156
- '@attr': Attr;
160
+ playcount?: string;
161
+ streamable?: string;
157
162
  url: string;
158
- date: Date;
159
163
  }
160
164
 
161
- export interface Attr2 {
165
+ export interface AttrLimit {
162
166
  user: string;
163
167
  totalPages: string;
164
168
  page: string;
@@ -168,7 +172,7 @@ export interface Attr2 {
168
172
 
169
173
  export interface RecentTracks {
170
174
  track: Track[];
171
- '@attr': Attr2;
175
+ '@attr': AttrLimit;
172
176
  }
173
177
 
174
178
  export interface Image {
@@ -202,7 +206,7 @@ export interface User {
202
206
 
203
207
  export interface TopAlbums {
204
208
  album: Album[];
205
- '@attr': Attr2;
209
+ '@attr': AttrLimit;
206
210
  }
207
211
 
208
212
  export interface WeeklyArtistChartResponse {
@@ -211,14 +215,14 @@ export interface WeeklyArtistChartResponse {
211
215
 
212
216
  export interface WeeklyArtistChart {
213
217
  artist: Artist[];
214
- '@attr': Attr2;
218
+ '@attr': AttrLimit;
215
219
  }
216
220
 
217
- export interface Attr1 {
218
- rank: string;
221
+ export interface AttrRank {
222
+ rank?: string;
219
223
  }
220
224
 
221
- export interface Attr2 {
225
+ export interface AttrLimit {
222
226
  from: string;
223
227
  user: string;
224
228
  to: string;
@@ -249,7 +253,7 @@ export interface WeeklyTrackChartResponse {
249
253
 
250
254
  export interface WeeklyTrackChart {
251
255
  track: Track[];
252
- '@attr': WeeklyTrackChartAttr2;
256
+ '@attr': AttrLimit;
253
257
  }
254
258
 
255
259
  export interface WeeklyTrackChartTrack {
@@ -258,7 +262,7 @@ export interface WeeklyTrackChartTrack {
258
262
  mbid: string;
259
263
  url: string;
260
264
  name: string;
261
- '@attr': Attr;
265
+ '@attr': AttrNowPlaying;
262
266
  playcount: string;
263
267
  }
264
268
 
@@ -267,113 +271,6 @@ export interface WeeklyTrackChartArtist {
267
271
  '#text': string;
268
272
  }
269
273
 
270
- export interface WeeklyTrackChartAttr {
271
- rank: string;
272
- }
273
-
274
- export interface WeeklyTrackChartAttr2 {
275
- from: string;
276
- user: string;
277
- to: string;
278
- }
279
-
280
- export const LastFmApi: () => {
281
- auth: (method: string, user: string) => Promise<AuthResponse>;
282
- config: {
283
- api_key: string;
284
- app_name: string;
285
- base_url: string;
286
- format: {
287
- json: string;
288
- xml: string;
289
- };
290
- share_secret: string;
291
- username: string;
292
- };
293
- getInfo: (method: string, user: string) => Promise<UserResponse>;
294
- getLovedTracks: (
295
- method: string,
296
- user: string,
297
- period: string,
298
- limit: number,
299
- ) => Promise<LovedTracksResponse>;
300
- getRecentTracks: (
301
- method: string,
302
- user: string,
303
- period: string,
304
- limit: number,
305
- ) => Promise<RecentTracksResponse>;
306
- getTopAlbums: (
307
- method: string,
308
- user: string,
309
- period: string,
310
- limit: number,
311
- ) => Promise<TopAlbumsResponse>;
312
- getTopArtists: (
313
- method: string,
314
- user: string,
315
- period: string,
316
- limit: number,
317
- ) => Promise<TopArtistsResponse>;
318
- getTopTracks: (
319
- method: string,
320
- user: string,
321
- period: string,
322
- limit: number,
323
- ) => Promise<TopTrackResponse>;
324
- getWeeklyAlbumChart: (
325
- method: string,
326
- user: string,
327
- period: string,
328
- limit: number,
329
- ) => Promise<WeeklyAlbumChartResponse>;
330
- getWeeklyArtistChart: (
331
- method: string,
332
- user: string,
333
- period: string,
334
- limit: number,
335
- ) => Promise<WeeklyArtistChartResponse>;
336
- getWeeklyChartList: (
337
- method: string,
338
- user: string,
339
- period: string,
340
- limit: number,
341
- ) => Promise<WeeklyChartListResponse>;
342
- getWeeklyTrackChart: (
343
- method: string,
344
- user: string,
345
- period: string,
346
- limit: number,
347
- ) => Promise<WeeklyTrackChartResponse>;
348
- };
349
- export interface config {
350
- api_key: string;
351
- app_name: string;
352
- base_url: string;
353
- format: {
354
- json: string;
355
- xml: string;
356
- };
357
- share_secret: string;
358
- username: string;
359
- }
360
-
361
- export interface method {
362
- auth: string;
363
- user: {
364
- getInfo: string;
365
- loved_tracks: string;
366
- recent_tracks: string;
367
- top_albums: string;
368
- top_artists: string;
369
- top_tracks: string;
370
- weekly_album_chart: string;
371
- weekly_artist_chart: string;
372
- weekly_chart_list: string;
373
- weekly_track_chart: string;
374
- };
375
- }
376
-
377
274
  export enum ErrorResponse {
378
275
  InvalidService = 2,
379
276
  InvalidMethod = 3,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.3
4
+
5
+ - fix missmatched types for Album and Track, added some optionals pity, but it works, that just how they give us the data.
6
+
3
7
  ## 1.4.2
4
8
 
5
9
  - bug, release dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lastfm-nodejs-client",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "A NodeJS wrapper client for LastFm API. Fetching public data by username using the LastFm public API",
5
5
  "main": "./dist",
6
6
  "keywords": [
package/tsconfig.json CHANGED
@@ -12,8 +12,8 @@
12
12
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
13
13
 
14
14
  /* Language and Environment */
15
- "target": "ES6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
16
- "lib": ["DOM", "ESNext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
15
+ "target": "ES6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
16
+ "lib": ["DOM", "ESNext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
17
17
  // "jsx": "preserve", /* Specify what JSX code is generated. */
18
18
  // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
19
19
  // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
@@ -26,9 +26,9 @@
26
26
  // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
27
 
28
28
  /* Modules */
29
- "module": "NodeNext" /* Specify what module code is generated. */,
30
- "rootDir": "./src" /* Specify the root folder within your source files. */,
31
- "moduleResolution": "NodeNext" /* Specify how TypeScript looks up a file from a given module specifier. */,
29
+ "module": "NodeNext" /* Specify what module code is generated. */,
30
+ "rootDir": "./src" /* Specify the root folder within your source files. */,
31
+ "moduleResolution": "NodeNext" /* Specify how TypeScript looks up a file from a given module specifier. */,
32
32
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
33
  // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
34
  // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
@@ -46,7 +46,7 @@
46
46
 
47
47
  /* Emit */
48
48
  "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
49
- "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
50
50
  // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
51
51
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
52
52
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
@@ -77,16 +77,16 @@
77
77
  "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
78
78
 
79
79
  /* Type Checking */
80
- "strict": true /* Enable all strict type-checking options. */,
81
- "noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
82
- "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */,
80
+ "strict": true /* Enable all strict type-checking options. */,
81
+ "noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
82
+ "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */,
83
83
  // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
84
84
  // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
85
85
  // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
86
86
  // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
87
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
88
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
89
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
87
+ "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
88
+ "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
89
+ "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
90
90
  // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
91
91
  // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
92
92
  // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
@@ -98,7 +98,7 @@
98
98
  // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
99
99
 
100
100
  /* Completeness */
101
- "skipDefaultLibCheck": true /* Skip type checking .d.ts files that are included with TypeScript. */,
102
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
101
+ "skipDefaultLibCheck": true /* Skip type checking .d.ts files that are included with TypeScript. */,
102
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
103
103
  }
104
104
  }
@@ -1,392 +0,0 @@
1
- export interface AuthResponse {
2
- token: string;
3
- }
4
-
5
- export interface LovedTracksResponse {
6
- lovedtracks: LovedTracks;
7
- }
8
-
9
- export interface LovedTracks {
10
- track: Track[];
11
- '@attr': Attr;
12
- }
13
- export interface TopAlbumsResponse {
14
- topalbums: TopAlbums;
15
- }
16
-
17
- export interface TopTrackResponse {
18
- toptracks: TopTracks;
19
- }
20
-
21
- export interface TopTracks {
22
- track: Track[];
23
- '@attr': Attr2;
24
- }
25
-
26
- export interface UserResponse {
27
- user: User;
28
- }
29
-
30
- export interface RecentTracksResponse {
31
- recenttracks: RecentTracks;
32
- }
33
-
34
- export interface RecentTracks {
35
- track: Track[];
36
- '@attr': Attr2;
37
- }
38
-
39
- export interface LoveTracksResponse {
40
- lovedtracks: LovedTracks;
41
- }
42
-
43
- export interface LovedTracks {
44
- track: Track[];
45
- '@attr': Attr;
46
- }
47
- export interface FriendsResponse {
48
- friends: Friends;
49
- }
50
-
51
- export interface Friends {
52
- '@attr': Attr;
53
- user: User[];
54
- }
55
-
56
- export interface TopArtistsResponse {
57
- topartists: TopArtists;
58
- }
59
-
60
- export interface TopArtists {
61
- artist: Artist[];
62
- '@attr': Attr2;
63
- }
64
-
65
- export interface WeeklyArtistChartResponse {
66
- weeklyartistchart: WeeklyArtistChart;
67
- }
68
-
69
- export interface WeeklyArtistChart {
70
- artist: Artist[];
71
- '@attr': Attr2;
72
- }
73
-
74
- export interface WeeklyAlbumChartResponse {
75
- weeklyalbumchart: WeeklyAlbumChart;
76
- }
77
-
78
- export interface WeeklyAlbumChart {
79
- album: WeeklyAlbum[];
80
- '@attr': WeeklyalbumChartAttr;
81
- }
82
-
83
- export type WeeklyAlbum = {
84
- artist: {
85
- mbid: string;
86
- '#text': string;
87
- };
88
- mbid: string;
89
- url: string;
90
- name: string;
91
- '@attr': { rank: string };
92
- playcount: string;
93
- image?: string;
94
- };
95
-
96
- export interface WeeklyalbumChartAttr {
97
- from: string;
98
- to: string;
99
- user: string;
100
- }
101
-
102
- export interface AlbumAttr {
103
- rank: string;
104
- }
105
-
106
- export type Artist = {
107
- '@attr': {
108
- rank: number;
109
- };
110
- cover: ArtistImage;
111
- image?: Image[];
112
- mbid: string;
113
- name: string;
114
- playcount: number;
115
- streamable: number;
116
- url: string;
117
- '#text': string;
118
- };
119
-
120
- export interface Attribs {
121
- page: number;
122
- perPage: number;
123
- user: string;
124
- total: number;
125
- totalPages: number;
126
- }
127
-
128
- export interface ArtistImage {
129
- name: string;
130
- photo: string;
131
- attribution: string;
132
- playcount: number;
133
- }
134
-
135
- export interface Album {
136
- mbid: string;
137
- '#text': string;
138
- }
139
-
140
- export interface Attr {
141
- nowplaying: string;
142
- }
143
-
144
- export interface Date {
145
- uts: string;
146
- '#text': string;
147
- }
148
-
149
- export interface Track {
150
- artist: Artist;
151
- streamable: string;
152
- image: Image[];
153
- mbid: string;
154
- album: Album;
155
- name: string;
156
- '@attr': Attr;
157
- url: string;
158
- date: Date;
159
- }
160
-
161
- export interface Attr2 {
162
- user: string;
163
- totalPages: string;
164
- page: string;
165
- perPage: string;
166
- total: string;
167
- }
168
-
169
- export interface RecentTracks {
170
- track: Track[];
171
- '@attr': Attr2;
172
- }
173
-
174
- export interface Image {
175
- size: string;
176
- '#text': string;
177
- }
178
-
179
- export interface Registered {
180
- unixtime: string;
181
- '#text': number;
182
- }
183
-
184
- export interface User {
185
- name: string;
186
- age: string;
187
- subscriber: string;
188
- realname: string;
189
- bootstrap: string;
190
- playcount: string;
191
- artist_count: string;
192
- playlists: string;
193
- track_count: string;
194
- album_count: string;
195
- image: Image[];
196
- registered: Registered;
197
- country: string;
198
- gender: string;
199
- url: string;
200
- type: string;
201
- }
202
-
203
- export interface TopAlbums {
204
- album: Album[];
205
- '@attr': Attr2;
206
- }
207
-
208
- export interface WeeklyArtistChartResponse {
209
- weeklyartistchart: WeeklyArtistChart;
210
- }
211
-
212
- export interface WeeklyArtistChart {
213
- artist: Artist[];
214
- '@attr': Attr2;
215
- }
216
-
217
- export interface Attr1 {
218
- rank: string;
219
- }
220
-
221
- export interface Attr2 {
222
- from: string;
223
- user: string;
224
- to: string;
225
- }
226
-
227
- export interface WeeklyChartListResponse {
228
- weeklychartlist: WeeklyChartList;
229
- }
230
-
231
- export interface WeeklyChartList {
232
- chart: WeeklyChartListChart[];
233
- '@attr': WeeklyChartListAttr;
234
- }
235
-
236
- export interface WeeklyChartListChart {
237
- '#text': string;
238
- from: string;
239
- to: string;
240
- }
241
-
242
- export interface WeeklyChartListAttr {
243
- user: string;
244
- }
245
-
246
- export interface WeeklyTrackChartResponse {
247
- weeklytrackchart: WeeklyTrackChart;
248
- }
249
-
250
- export interface WeeklyTrackChart {
251
- track: Track[];
252
- '@attr': WeeklyTrackChartAttr2;
253
- }
254
-
255
- export interface WeeklyTrackChartTrack {
256
- artist: WeeklyTrackChartArtist;
257
- image: Image[];
258
- mbid: string;
259
- url: string;
260
- name: string;
261
- '@attr': Attr;
262
- playcount: string;
263
- }
264
-
265
- export interface WeeklyTrackChartArtist {
266
- mbid: string;
267
- '#text': string;
268
- }
269
-
270
- export interface WeeklyTrackChartAttr {
271
- rank: string;
272
- }
273
-
274
- export interface WeeklyTrackChartAttr2 {
275
- from: string;
276
- user: string;
277
- to: string;
278
- }
279
-
280
- export const LastFmApi: () => {
281
- auth: (method: string, user: string) => Promise<AuthResponse>;
282
- config: {
283
- api_key: string;
284
- app_name: string;
285
- base_url: string;
286
- format: {
287
- json: string;
288
- xml: string;
289
- };
290
- share_secret: string;
291
- username: string;
292
- };
293
- getInfo: (method: string, user: string) => Promise<UserResponse>;
294
- getLovedTracks: (
295
- method: string,
296
- user: string,
297
- period: string,
298
- limit: number,
299
- ) => Promise<LovedTracksResponse>;
300
- getRecentTracks: (
301
- method: string,
302
- user: string,
303
- period: string,
304
- limit: number,
305
- ) => Promise<RecentTracksResponse>;
306
- getTopAlbums: (
307
- method: string,
308
- user: string,
309
- period: string,
310
- limit: number,
311
- ) => Promise<TopAlbumsResponse>;
312
- getTopArtists: (
313
- method: string,
314
- user: string,
315
- period: string,
316
- limit: number,
317
- ) => Promise<TopArtistsResponse>;
318
- getTopTracks: (
319
- method: string,
320
- user: string,
321
- period: string,
322
- limit: number,
323
- ) => Promise<TopTrackResponse>;
324
- getWeeklyAlbumChart: (
325
- method: string,
326
- user: string,
327
- period: string,
328
- limit: number,
329
- ) => Promise<WeeklyAlbumChartResponse>;
330
- getWeeklyArtistChart: (
331
- method: string,
332
- user: string,
333
- period: string,
334
- limit: number,
335
- ) => Promise<WeeklyArtistChartResponse>;
336
- getWeeklyChartList: (
337
- method: string,
338
- user: string,
339
- period: string,
340
- limit: number,
341
- ) => Promise<WeeklyChartListResponse>;
342
- getWeeklyTrackChart: (
343
- method: string,
344
- user: string,
345
- period: string,
346
- limit: number,
347
- ) => Promise<WeeklyTrackChartResponse>;
348
- };
349
- export interface config {
350
- api_key: string;
351
- app_name: string;
352
- base_url: string;
353
- format: {
354
- json: string;
355
- xml: string;
356
- };
357
- share_secret: string;
358
- username: string;
359
- }
360
-
361
- export interface method {
362
- auth: string;
363
- user: {
364
- getInfo: string;
365
- loved_tracks: string;
366
- recent_tracks: string;
367
- top_albums: string;
368
- top_artists: string;
369
- top_tracks: string;
370
- weekly_album_chart: string;
371
- weekly_artist_chart: string;
372
- weekly_chart_list: string;
373
- weekly_track_chart: string;
374
- };
375
- }
376
-
377
- export enum ErrorResponse {
378
- InvalidService = 2,
379
- InvalidMethod = 3,
380
- AuthenticationFailed = 4,
381
- InvalidFormat = 5,
382
- InvalidParameters = 6,
383
- InvalidResource = 7,
384
- OperationFailed = 8,
385
- InvalidSessionKey = 9,
386
- InvalidAPIKey = 10,
387
- ServiceOffline = 11,
388
- InvalidMethodSignature = 13,
389
- TemporaryError = 16,
390
- SuspendedAPIKey = 26,
391
- RateLimitExceeded = 29
392
- }