lastfm-nodejs-client 1.1.0 → 1.1.1

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1
4
+
5
+ - update function declaration
6
+ - re-add type declartion files for source code
7
+
3
8
  ## 1.1.0
4
9
 
5
10
  - Downgrade node-fetch to v2.6.7
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ api_key: string;
3
+ app_name: string;
4
+ base_url: string;
5
+ format: {
6
+ json: string;
7
+ xml: string;
8
+ };
9
+ share_secret: string;
10
+ username: string;
11
+ };
12
+ export default _default;
package/dist/index.d.ts CHANGED
@@ -1,392 +1,41 @@
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?: string;
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: '';
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, period: string, limit: number) => Promise<AuthResponse>;
282
- config: {
283
- api_key: string;
284
- app_name: string;
285
- base_url: string;
286
- format: {
287
- json: string;
288
- xml: string;
1
+ import { AuthResponse, LovedTracksResponse, RecentTracksResponse, TopAlbumsResponse, TopArtistsResponse, TopTrackResponse, UserResponse, WeeklyAlbumChartResponse, WeeklyArtistChartResponse, WeeklyChartListResponse, WeeklyTrackChartResponse } from './types';
2
+ declare function LastFmApi(): {
3
+ auth: (method: string, user: string, period: string, limit: number) => Promise<AuthResponse>;
4
+ config: {
5
+ api_key: string;
6
+ app_name: string;
7
+ base_url: string;
8
+ format: {
9
+ json: string;
10
+ xml: string;
11
+ };
12
+ share_secret: string;
13
+ username: string;
14
+ };
15
+ getInfo: (method: string, user: string, period: string, limit: number) => Promise<UserResponse>;
16
+ getLovedTracks: (method: string, user: string, period: string, limit: number) => Promise<LovedTracksResponse>;
17
+ getRecentTracks: (method: string, user: string, period: string, limit: number) => Promise<RecentTracksResponse>;
18
+ getTopAlbums: (method: string, user: string, period: string, limit: number) => Promise<TopAlbumsResponse>;
19
+ getTopArtists: (method: string, user: string, period: string, limit: number) => Promise<TopArtistsResponse>;
20
+ getTopTracks: (method: string, user: string, period: string, limit: number) => Promise<TopTrackResponse>;
21
+ getWeeklyAlbumChart: (method: string, user: string, period: string, limit: number) => Promise<WeeklyAlbumChartResponse>;
22
+ getWeeklyArtistChart: (method: string, user: string, period: string, limit: number) => Promise<WeeklyArtistChartResponse>;
23
+ getWeeklyChartList: (method: string, user: string, period: string, limit: number) => Promise<WeeklyChartListResponse>;
24
+ getWeeklyTrackChart: (method: string, user: string, period: string, limit: number) => Promise<WeeklyTrackChartResponse>;
25
+ method: {
26
+ auth: string;
27
+ user: {
28
+ getInfo: string;
29
+ loved_tracks: string;
30
+ recent_tracks: string;
31
+ top_albums: string;
32
+ top_artists: string;
33
+ top_tracks: string;
34
+ weekly_album_chart: string;
35
+ weekly_artist_chart: string;
36
+ weekly_chart_list: string;
37
+ weekly_track_chart: string;
38
+ };
289
39
  };
290
- share_secret: string;
291
- username: string;
292
- };
293
- getInfo: (method: string, user: string, period: string, limit: number) => 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
40
  };
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 Errors {
378
- 'InvalidService' = 2,
379
- 'InvalidMethod' = 3,
380
- 'AuthenticationFailed' = 4,
381
- 'Invalid format' = 5,
382
- 'Invalid parameters' = 6,
383
- 'InvalidResourceSpecified' = 7,
384
- 'OperationFailed' = 8,
385
- 'Invalid session key' = 9,
386
- 'InvalidApiKey' = 10,
387
- 'ServiceOffline' = 11,
388
- 'InvalidMethodSignatureSupplied' = 13,
389
- 'TemporaryErrorRequest' = 16,
390
- 'SuspendedApiKey' = 26,
391
- 'RateLimitExceeded' = 29,
392
- }
41
+ export default LastFmApi;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const config_1 = __importDefault(require("./config"));
7
7
  const method_1 = __importDefault(require("./method"));
8
8
  const request_1 = __importDefault(require("./request"));
9
- const LastFmApi = function LastFmApi() {
9
+ function LastFmApi() {
10
10
  /**
11
11
  * POST: Auth - LastFM
12
12
  *
@@ -125,5 +125,5 @@ const LastFmApi = function LastFmApi() {
125
125
  getWeeklyTrackChart,
126
126
  method: method_1.default,
127
127
  };
128
- };
128
+ }
129
129
  exports.default = LastFmApi;
@@ -0,0 +1,16 @@
1
+ declare const _default: {
2
+ auth: string;
3
+ user: {
4
+ getInfo: string;
5
+ loved_tracks: string;
6
+ recent_tracks: string;
7
+ top_albums: string;
8
+ top_artists: string;
9
+ top_tracks: string;
10
+ weekly_album_chart: string;
11
+ weekly_artist_chart: string;
12
+ weekly_chart_list: string;
13
+ weekly_track_chart: string;
14
+ };
15
+ };
16
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const request: <Parameters_1, Response_1>(method: string, user: string, period?: string, limit?: number) => Promise<Response_1>;
2
+ export default request;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lastfm-nodejs-client",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A client for fetching public data with username using the LastFm public API",
5
5
  "main": "./dist",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  WeeklyTrackChartResponse,
16
16
  } from './types';
17
17
 
18
- const LastFmApi = function LastFmApi() {
18
+ function LastFmApi() {
19
19
  /**
20
20
  * POST: Auth - LastFM
21
21
  *
@@ -200,6 +200,6 @@ const LastFmApi = function LastFmApi() {
200
200
  getWeeklyTrackChart,
201
201
  method,
202
202
  };
203
- };
203
+ }
204
204
 
205
205
  export default LastFmApi;
package/tsconfig.json CHANGED
@@ -44,7 +44,7 @@
44
44
  // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
45
45
 
46
46
  /* Emit */
47
- "declaration": false /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
47
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
48
48
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
49
  // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
50
50
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */