lastfm-nodejs-client 1.2.4 → 1.3.0

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.
Files changed (53) hide show
  1. package/@types/index.d.ts +16 -16
  2. package/CHANGELOG.md +30 -24
  3. package/README.md +4 -0
  4. package/bun.lockb +0 -0
  5. package/dist/auth.d.ts +12 -0
  6. package/dist/auth.js +23 -0
  7. package/dist/config.js +1 -0
  8. package/dist/createOptions.d.ts +6 -0
  9. package/dist/createOptions.js +12 -0
  10. package/dist/getInfo.d.ts +8 -0
  11. package/dist/getInfo.js +19 -0
  12. package/dist/getLovedTracks.d.ts +8 -0
  13. package/dist/getLovedTracks.js +19 -0
  14. package/dist/getRecentTracks.d.ts +8 -0
  15. package/dist/getRecentTracks.js +19 -0
  16. package/dist/getTopAlbums.d.ts +8 -0
  17. package/dist/getTopAlbums.js +19 -0
  18. package/dist/getTopArtists.d.ts +8 -0
  19. package/dist/getTopArtists.js +19 -0
  20. package/dist/getTopTracks.d.ts +8 -0
  21. package/dist/getTopTracks.js +19 -0
  22. package/dist/getWeeklyAlbumChart.d.ts +8 -0
  23. package/dist/getWeeklyAlbumChart.js +19 -0
  24. package/dist/getWeeklyArtistChart.d.ts +8 -0
  25. package/dist/getWeeklyArtistChart.js +19 -0
  26. package/dist/getWeeklyChartList.d.ts +8 -0
  27. package/dist/getWeeklyChartList.js +19 -0
  28. package/dist/getWeeklyTrackChart.d.ts +8 -0
  29. package/dist/getWeeklyTrackChart.js +19 -0
  30. package/dist/index.d.ts +23 -14
  31. package/dist/index.js +22 -181
  32. package/dist/method.d.ts +16 -0
  33. package/dist/method.js +2 -0
  34. package/dist/request.js +84 -3
  35. package/package.json +5 -4
  36. package/src/auth.ts +23 -0
  37. package/src/config.ts +13 -1
  38. package/src/createOptions.ts +12 -0
  39. package/src/getInfo.ts +17 -0
  40. package/src/getLovedTracks.ts +19 -0
  41. package/src/getRecentTracks.ts +19 -0
  42. package/src/getTopAlbums.ts +19 -0
  43. package/src/getTopArtists.ts +19 -0
  44. package/src/getTopTracks.ts +19 -0
  45. package/src/getWeeklyAlbumChart.ts +19 -0
  46. package/src/getWeeklyArtistChart.ts +19 -0
  47. package/src/getWeeklyChartList.ts +19 -0
  48. package/src/getWeeklyTrackChart.ts +20 -0
  49. package/src/index.ts +12 -252
  50. package/src/method.ts +19 -1
  51. package/src/request.ts +90 -3
  52. package/tsconfig.json +1 -1
  53. package/src/types.d.ts +0 -392
package/dist/index.js CHANGED
@@ -3,192 +3,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const auth_1 = require("./auth");
6
7
  const config_1 = __importDefault(require("./config"));
8
+ const getInfo_1 = require("./getInfo");
9
+ const getLovedTracks_1 = require("./getLovedTracks");
10
+ const getRecentTracks_1 = require("./getRecentTracks");
11
+ const getTopAlbums_1 = require("./getTopAlbums");
12
+ const getTopArtists_1 = require("./getTopArtists");
13
+ const getTopTracks_1 = require("./getTopTracks");
14
+ const getWeeklyAlbumChart_1 = require("./getWeeklyAlbumChart");
15
+ const getWeeklyArtistChart_1 = require("./getWeeklyArtistChart");
16
+ const getWeeklyChartList_1 = require("./getWeeklyChartList");
17
+ const getWeeklyTrackChart_1 = require("./getWeeklyTrackChart");
7
18
  const method_1 = __importDefault(require("./method"));
8
- const request_1 = __importDefault(require("./request"));
9
19
  function LastFmApi() {
10
- /**
11
- * POST: Auth - LastFM
12
- *
13
- * https://www.last.fm/api/show/auth.getToken
14
- *
15
- * Authentication tokens are API account specific.
16
- * They are valid for 60 minutes from the moment they are granted.
17
- * Can only used once (they are consumed when a session is created).
18
- * @returns Auth token
19
- */
20
- function auth(method, user, period, limit) {
21
- const options = {
22
- method,
23
- user,
24
- period,
25
- limit,
26
- };
27
- return (0, request_1.default)(options);
28
- }
29
- /**
30
- * GET: User profile information - LastFM
31
- *
32
- * https://www.last.fm/api/show/user.getInfo
33
- * @returns User profile data
34
- */
35
- function getInfo(method, user, period, limit) {
36
- const options = {
37
- method,
38
- user,
39
- period,
40
- limit,
41
- };
42
- return (0, request_1.default)(options);
43
- }
44
- /**
45
- * GET: Love Tracks - LastFM
46
- *
47
- * https://www.last.fm/api/show/user.getLovedTracks
48
- * @returns Loved Tracks;
49
- */
50
- function getLovedTracks(method, user, period, limit) {
51
- const options = {
52
- method,
53
- user,
54
- period,
55
- limit,
56
- };
57
- return (0, request_1.default)(options);
58
- }
59
- /**
60
- * GET: Recent Tracks - LastFM
61
- *
62
- * https://www.last.fm/api/show/user.getRecentTracks
63
- * @returns Recent Tracks
64
- */
65
- function getRecentTracks(method, user, period, limit) {
66
- const options = {
67
- method,
68
- user,
69
- period,
70
- limit,
71
- };
72
- return (0, request_1.default)(options);
73
- }
74
- /**
75
- * GET: Top Albums - LastFM
76
- *
77
- * https://www.last.fm/api/show/user.getTopAlbums
78
- * @returns Top Albums
79
- */
80
- function getTopAlbums(method, user, period, limit) {
81
- const options = {
82
- method,
83
- user,
84
- period,
85
- limit,
86
- };
87
- return (0, request_1.default)(options);
88
- }
89
- /**
90
- * GET: Top Artist - LastFM
91
- *
92
- * https://www.last.fm/api/show/user.getTopArtists
93
- * @returns Top Artists
94
- */
95
- function getTopArtists(method, user, period, limit) {
96
- const options = {
97
- method,
98
- user,
99
- period,
100
- limit,
101
- };
102
- return (0, request_1.default)(options);
103
- }
104
- /**
105
- * GET: Top Tracks - LastFM
106
- *
107
- * https://www.last.fm/api/show/user.getTopTracks
108
- * @returns Top Tracks
109
- */
110
- function getTopTracks(method, user, period, limit) {
111
- const options = {
112
- method,
113
- user,
114
- period,
115
- limit,
116
- };
117
- return (0, request_1.default)(options);
118
- }
119
- /**
120
- * GET: Weekly album chart - LastFM
121
- *
122
- * https://www.last.fm/api/show/user.getWeeklyAlbumChart
123
- * @returns Weekly album chart
124
- */
125
- function getWeeklyAlbumChart(method, user, period, limit) {
126
- const options = {
127
- method,
128
- user,
129
- period,
130
- limit,
131
- };
132
- return (0, request_1.default)(options);
133
- }
134
- /**
135
- * GET: Weekly artist chart - LastFM
136
- *
137
- * https://www.last.fm/api/show/user.getWeeklyArtistChart
138
- * @returns Weekly artist chart
139
- */
140
- function getWeeklyArtistChart(method, user, period, limit) {
141
- const options = {
142
- method,
143
- user,
144
- period,
145
- limit,
146
- };
147
- return (0, request_1.default)(options);
148
- }
149
- /**
150
- * GET: Weekly chart list - LastFM
151
- *
152
- * https://www.last.fm/api/show/user.getWeeklyChartList
153
- * @returns Weekly chart list
154
- */
155
- function getWeeklyChartList(method, user, period, limit) {
156
- const options = {
157
- method,
158
- user,
159
- period,
160
- limit,
161
- };
162
- return (0, request_1.default)(options);
163
- }
164
- /**
165
- * GET: Weekly track chart - LastFM
166
- *
167
- * https://www.last.fm/api/show/user.getWeeklyTrackChart
168
- * @returns Weekly track chart
169
- */
170
- function getWeeklyTrackChart(method, user, period, limit) {
171
- const options = {
172
- method,
173
- user,
174
- period,
175
- limit,
176
- };
177
- return (0, request_1.default)(options);
178
- }
179
20
  return {
180
- auth,
21
+ auth: auth_1.auth,
181
22
  config: config_1.default,
182
- getInfo,
183
- getLovedTracks,
184
- getRecentTracks,
185
- getTopAlbums,
186
- getTopArtists,
187
- getTopTracks,
188
- getWeeklyAlbumChart,
189
- getWeeklyArtistChart,
190
- getWeeklyChartList,
191
- getWeeklyTrackChart,
23
+ getInfo: getInfo_1.getInfo,
24
+ getLovedTracks: getLovedTracks_1.getLovedTracks,
25
+ getRecentTracks: getRecentTracks_1.getRecentTracks,
26
+ getTopAlbums: getTopAlbums_1.getTopAlbums,
27
+ getTopArtists: getTopArtists_1.getTopArtists,
28
+ getTopTracks: getTopTracks_1.getTopTracks,
29
+ getWeeklyAlbumChart: getWeeklyAlbumChart_1.getWeeklyAlbumChart,
30
+ getWeeklyArtistChart: getWeeklyArtistChart_1.getWeeklyArtistChart,
31
+ getWeeklyChartList: getWeeklyChartList_1.getWeeklyChartList,
32
+ getWeeklyTrackChart: getWeeklyTrackChart_1.getWeeklyTrackChart,
192
33
  method: method_1.default,
193
34
  };
194
35
  }
package/dist/method.d.ts CHANGED
@@ -1,3 +1,19 @@
1
+ interface UserMethod {
2
+ getInfo: string;
3
+ loved_tracks: string;
4
+ recent_tracks: string;
5
+ top_albums: string;
6
+ top_artists: string;
7
+ top_tracks: string;
8
+ weekly_album_chart: string;
9
+ weekly_artist_chart: string;
10
+ weekly_chart_list: string;
11
+ weekly_track_chart: string;
12
+ }
13
+ export interface Method {
14
+ auth: string;
15
+ user: UserMethod;
16
+ }
1
17
  declare const _default: {
2
18
  auth: string;
3
19
  user: {
package/dist/method.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
4
+ ;
3
5
  exports.default = {
4
6
  auth: 'auth.getToken',
5
7
  user: {
package/dist/request.js CHANGED
@@ -14,6 +14,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const cross_fetch_1 = __importDefault(require("cross-fetch"));
16
16
  const config_1 = __importDefault(require("./config"));
17
+ var ErrorResponse;
18
+ (function (ErrorResponse) {
19
+ ErrorResponse[ErrorResponse["InvalidService"] = 2] = "InvalidService";
20
+ ErrorResponse[ErrorResponse["InvalidMethod"] = 3] = "InvalidMethod";
21
+ ErrorResponse[ErrorResponse["AuthenticationFailed"] = 4] = "AuthenticationFailed";
22
+ ErrorResponse[ErrorResponse["InvalidFormat"] = 5] = "InvalidFormat";
23
+ ErrorResponse[ErrorResponse["InvalidParameters"] = 6] = "InvalidParameters";
24
+ ErrorResponse[ErrorResponse["InvalidResource"] = 7] = "InvalidResource";
25
+ ErrorResponse[ErrorResponse["OperationFailed"] = 8] = "OperationFailed";
26
+ ErrorResponse[ErrorResponse["InvalidSessionKey"] = 9] = "InvalidSessionKey";
27
+ ErrorResponse[ErrorResponse["InvalidAPIKey"] = 10] = "InvalidAPIKey";
28
+ ErrorResponse[ErrorResponse["ServiceOffline"] = 11] = "ServiceOffline";
29
+ ErrorResponse[ErrorResponse["InvalidMethodSignature"] = 13] = "InvalidMethodSignature";
30
+ ErrorResponse[ErrorResponse["TemporaryError"] = 16] = "TemporaryError";
31
+ ErrorResponse[ErrorResponse["SuspendedAPIKey"] = 26] = "SuspendedAPIKey";
32
+ ErrorResponse[ErrorResponse["RateLimitExceeded"] = 29] = "RateLimitExceeded";
33
+ })(ErrorResponse || (ErrorResponse = {}));
17
34
  const buildUrl = (options) => {
18
35
  const params = new URLSearchParams();
19
36
  params.append('method', options.method);
@@ -35,10 +52,74 @@ const request = (options) => __awaiter(void 0, void 0, void 0, function* () {
35
52
  },
36
53
  })
37
54
  .then((res) => {
38
- if (res.status >= 400) {
39
- throw new Error('Bad response from server');
55
+ switch (res.status) {
56
+ case 200: {
57
+ return res.json();
58
+ }
59
+ case 400: {
60
+ throw new Error('Bad request');
61
+ }
62
+ case 401: {
63
+ throw new Error('Unauthorized');
64
+ }
65
+ case 403: {
66
+ throw new Error('Forbidden');
67
+ }
68
+ case 404: {
69
+ throw new Error('Not found');
70
+ }
71
+ case 500: {
72
+ throw new Error('Internal server error');
73
+ }
74
+ case 503: {
75
+ throw new Error('Service unavailable');
76
+ }
77
+ case ErrorResponse.InvalidAPIKey: {
78
+ throw new Error('Invalid API key');
79
+ }
80
+ case ErrorResponse.InvalidMethod: {
81
+ throw new Error('Invalid method');
82
+ }
83
+ case ErrorResponse.InvalidParameters: {
84
+ throw new Error('Invalid parameters');
85
+ }
86
+ case ErrorResponse.InvalidResource: {
87
+ throw new Error('Invalid resource');
88
+ }
89
+ case ErrorResponse.InvalidSessionKey: {
90
+ throw new Error('Invalid session key');
91
+ }
92
+ case ErrorResponse.InvalidService: {
93
+ throw new Error('Invalid service');
94
+ }
95
+ case ErrorResponse.OperationFailed: {
96
+ throw new Error('Operation failed');
97
+ }
98
+ case ErrorResponse.RateLimitExceeded: {
99
+ throw new Error('Rate limit exceeded');
100
+ }
101
+ case ErrorResponse.ServiceOffline: {
102
+ throw new Error('Service offline');
103
+ }
104
+ case ErrorResponse.SuspendedAPIKey: {
105
+ throw new Error('Suspended API key');
106
+ }
107
+ case ErrorResponse.TemporaryError: {
108
+ throw new Error('Temporary error');
109
+ }
110
+ case ErrorResponse.AuthenticationFailed: {
111
+ throw new Error('Authentication failed');
112
+ }
113
+ case ErrorResponse.InvalidFormat: {
114
+ throw new Error('Invalid format');
115
+ }
116
+ case ErrorResponse.InvalidMethodSignature: {
117
+ throw new Error('Invalid method signature');
118
+ }
119
+ default: {
120
+ throw new Error('Unknown error');
121
+ }
40
122
  }
41
- return res.json();
42
123
  })
43
124
  .then((json) => json)
44
125
  .catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lastfm-nodejs-client",
3
- "version": "1.2.4",
3
+ "version": "1.3.0",
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
  "scripts": {
@@ -28,8 +28,9 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@playwright/test": "^1.37.1",
31
- "@types/node": "^20.5.1",
32
- "typescript": "^5.1.6"
31
+ "@types/node": "^20.6.0",
32
+ "typescript": "^5.2.2",
33
+ "bun-types": "latest"
33
34
  },
34
35
  "repository": {
35
36
  "type": "git",
@@ -39,4 +40,4 @@
39
40
  "url": "https://github.com/mannuelf/lastfm-nodejs-client/issues"
40
41
  },
41
42
  "homepage": "https://github.com/mannuelf/lastfm-nodejs-client#readme"
42
- }
43
+ }
package/src/auth.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { AuthResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * POST: Auth - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/auth.getToken
9
+ *
10
+ * Authentication tokens are API account specific.
11
+ * They are valid for 60 minutes from the moment they are granted.
12
+ * Can only used once (they are consumed when a session is created).
13
+ * @returns Auth token
14
+ */
15
+ export function auth(
16
+ method: string,
17
+ user: string,
18
+ period: string,
19
+ limit: string,
20
+ ): Promise<AuthResponse> {
21
+ const options = createOptions(method, user, period, limit);
22
+ return request<AuthResponse>(options);
23
+ }
package/src/config.ts CHANGED
@@ -1,6 +1,18 @@
1
1
  import * as dotenv from 'dotenv';
2
2
  dotenv.config();
3
3
 
4
+ interface 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
+
4
16
  export default {
5
17
  api_key: `${process.env.LASTFM_API_KEY}`,
6
18
  app_name: `${process.env.LASTFM_APPNAME}`,
@@ -11,4 +23,4 @@ export default {
11
23
  },
12
24
  share_secret: `${process.env.LASTFM_SHARED_SECRET}`,
13
25
  username: `${process.env.LASTFM_USER}`,
14
- };
26
+ } satisfies Config;
@@ -0,0 +1,12 @@
1
+ export function createOptions(
2
+ method: string,
3
+ user: string,
4
+ period?: string,
5
+ limit?: string) {
6
+ return {
7
+ method,
8
+ user,
9
+ period,
10
+ limit,
11
+ }
12
+ }
package/src/getInfo.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { UserResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: User profile information - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getInfo
9
+ * @returns User profile information
10
+ */
11
+ export function getInfo(
12
+ method: string,
13
+ user: string,
14
+ ): Promise<UserResponse> {
15
+ const options = createOptions(method, user);
16
+ return request<UserResponse>(options);
17
+ }
@@ -0,0 +1,19 @@
1
+ import { LovedTracksResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Love Tracks - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getLovedTracks
9
+ * @returns Loved Tracks;
10
+ */
11
+ export function getLovedTracks(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<LovedTracksResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<LovedTracksResponse>(options);
19
+ }
@@ -0,0 +1,19 @@
1
+ import { RecentTracksResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Recent Tracks - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getRecentTracks
9
+ * @returns Recent Tracks
10
+ */
11
+ export function getRecentTracks(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<RecentTracksResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<RecentTracksResponse>(options);
19
+ }
@@ -0,0 +1,19 @@
1
+ import { TopAlbumsResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Top Albums - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getTopAlbums
9
+ * @returns Top Albums
10
+ */
11
+ export function getTopAlbums(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<TopAlbumsResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<TopAlbumsResponse>(options);
19
+ }
@@ -0,0 +1,19 @@
1
+ import { TopArtistsResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Top Artist - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getTopArtists
9
+ * @returns Top Artists
10
+ */
11
+ export function getTopArtists(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<TopArtistsResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<TopArtistsResponse>(options);
19
+ }
@@ -0,0 +1,19 @@
1
+ import { TopTrackResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Top Tracks - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getTopTracks
9
+ * @returns Top Tracks
10
+ */
11
+ export function getTopTracks(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<TopTrackResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<TopTrackResponse>(options);
19
+ }
@@ -0,0 +1,19 @@
1
+ import { WeeklyAlbumChartResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Weekly album chart - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getWeeklyAlbumChart
9
+ * @returns Weekly album chart
10
+ */
11
+ export function getWeeklyAlbumChart(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<WeeklyAlbumChartResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<WeeklyAlbumChartResponse>(options);
19
+ }
@@ -0,0 +1,19 @@
1
+ import { WeeklyArtistChartResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Weekly artist chart - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getWeeklyArtistChart
9
+ * @returns Weekly artist chart
10
+ */
11
+ export function getWeeklyArtistChart(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<WeeklyArtistChartResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<WeeklyArtistChartResponse>(options);
19
+ }
@@ -0,0 +1,19 @@
1
+ import { WeeklyChartListResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+ /**
6
+ * GET: Weekly chart list - LastFM
7
+ *
8
+ * https://www.last.fm/api/show/user.getWeeklyChartList
9
+ * @returns Weekly chart list
10
+ */
11
+ export function getWeeklyChartList(
12
+ method: string,
13
+ user: string,
14
+ period: string,
15
+ limit: string,
16
+ ): Promise<WeeklyChartListResponse> {
17
+ const options = createOptions(method, user, period, limit);
18
+ return request<WeeklyChartListResponse>(options);
19
+ }
@@ -0,0 +1,20 @@
1
+ import { WeeklyTrackChartResponse } from '../@types';
2
+ import { createOptions } from './createOptions';
3
+ import request from './request';
4
+
5
+
6
+ /**
7
+ * GET: Weekly track chart - LastFM
8
+ *
9
+ * https://www.last.fm/api/show/user.getWeeklyTrackChart
10
+ * @returns Weekly track chart
11
+ */
12
+ export function getWeeklyTrackChart(
13
+ method: string,
14
+ user: string,
15
+ period: string,
16
+ limit: string,
17
+ ): Promise<WeeklyTrackChartResponse> {
18
+ const options = createOptions(method, user, period, limit);
19
+ return request<WeeklyTrackChartResponse>(options);
20
+ }