lastfm-nodejs-client 1.2.3 → 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 (57) hide show
  1. package/.github/workflows/playwright.yml +3 -1
  2. package/.nvmrc +1 -0
  3. package/@types/index.d.ts +16 -16
  4. package/CHANGELOG.md +35 -23
  5. package/README.md +4 -0
  6. package/SECURITY.md +1 -2
  7. package/bun.lockb +0 -0
  8. package/dist/auth.d.ts +12 -0
  9. package/dist/auth.js +23 -0
  10. package/dist/config.js +1 -0
  11. package/dist/createOptions.d.ts +6 -0
  12. package/dist/createOptions.js +12 -0
  13. package/dist/getInfo.d.ts +8 -0
  14. package/dist/getInfo.js +19 -0
  15. package/dist/getLovedTracks.d.ts +8 -0
  16. package/dist/getLovedTracks.js +19 -0
  17. package/dist/getRecentTracks.d.ts +8 -0
  18. package/dist/getRecentTracks.js +19 -0
  19. package/dist/getTopAlbums.d.ts +8 -0
  20. package/dist/getTopAlbums.js +19 -0
  21. package/dist/getTopArtists.d.ts +8 -0
  22. package/dist/getTopArtists.js +19 -0
  23. package/dist/getTopTracks.d.ts +8 -0
  24. package/dist/getTopTracks.js +19 -0
  25. package/dist/getWeeklyAlbumChart.d.ts +8 -0
  26. package/dist/getWeeklyAlbumChart.js +19 -0
  27. package/dist/getWeeklyArtistChart.d.ts +8 -0
  28. package/dist/getWeeklyArtistChart.js +19 -0
  29. package/dist/getWeeklyChartList.d.ts +8 -0
  30. package/dist/getWeeklyChartList.js +19 -0
  31. package/dist/getWeeklyTrackChart.d.ts +8 -0
  32. package/dist/getWeeklyTrackChart.js +19 -0
  33. package/dist/index.d.ts +23 -14
  34. package/dist/index.js +22 -115
  35. package/dist/method.d.ts +16 -0
  36. package/dist/method.js +2 -0
  37. package/dist/request.d.ts +7 -1
  38. package/dist/request.js +99 -6
  39. package/package.json +15 -14
  40. package/src/auth.ts +23 -0
  41. package/src/config.ts +13 -1
  42. package/src/createOptions.ts +12 -0
  43. package/src/getInfo.ts +17 -0
  44. package/src/getLovedTracks.ts +19 -0
  45. package/src/getRecentTracks.ts +19 -0
  46. package/src/getTopAlbums.ts +19 -0
  47. package/src/getTopArtists.ts +19 -0
  48. package/src/getTopTracks.ts +19 -0
  49. package/src/getWeeklyAlbumChart.ts +19 -0
  50. package/src/getWeeklyArtistChart.ts +19 -0
  51. package/src/getWeeklyChartList.ts +19 -0
  52. package/src/getWeeklyTrackChart.ts +20 -0
  53. package/src/index.ts +12 -186
  54. package/src/method.ts +19 -1
  55. package/src/request.ts +110 -15
  56. package/tsconfig.json +1 -1
  57. package/src/types.d.ts +0 -392
package/dist/index.js CHANGED
@@ -3,126 +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
- return (0, request_1.default)(method, user, period, limit);
22
- }
23
- /**
24
- * GET: User profile information - LastFM
25
- *
26
- * https://www.last.fm/api/show/user.getInfo
27
- * @returns User profile data
28
- */
29
- function getInfo(method, user, period, limit) {
30
- return (0, request_1.default)(method, user, period, limit);
31
- }
32
- /**
33
- * GET: Love Tracks - LastFM
34
- *
35
- * https://www.last.fm/api/show/user.getLovedTracks
36
- * @returns Loved Tracks;
37
- */
38
- function getLovedTracks(method, user, period, limit) {
39
- return (0, request_1.default)(method, user, period, limit);
40
- }
41
- /**
42
- * GET: Recent Tracks - LastFM
43
- *
44
- * https://www.last.fm/api/show/user.getRecentTracks
45
- * @returns Recent Tracks
46
- */
47
- function getRecentTracks(method, user, period, limit) {
48
- return (0, request_1.default)(method, user, period, limit);
49
- }
50
- /**
51
- * GET: Top Albums - LastFM
52
- *
53
- * https://www.last.fm/api/show/user.getTopAlbums
54
- * @returns Top Albums
55
- */
56
- function getTopAlbums(method, user, period, limit) {
57
- return (0, request_1.default)(method, user, period, limit);
58
- }
59
- /**
60
- * GET: Top Artist - LastFM
61
- *
62
- * https://www.last.fm/api/show/user.getTopArtists
63
- * @returns Top Artists
64
- */
65
- function getTopArtists(method, user, period, limit) {
66
- return (0, request_1.default)(method, user, period, limit);
67
- }
68
- /**
69
- * GET: Top Tracks - LastFM
70
- *
71
- * https://www.last.fm/api/show/user.getTopTracks
72
- * @returns Top Tracks
73
- */
74
- function getTopTracks(method, user, period, limit) {
75
- return (0, request_1.default)(method, user, period, limit);
76
- }
77
- /**
78
- * GET: Weekly album chart - LastFM
79
- *
80
- * https://www.last.fm/api/show/user.getWeeklyAlbumChart
81
- * @returns Weekly album chart
82
- */
83
- function getWeeklyAlbumChart(method, user, period, limit) {
84
- return (0, request_1.default)(method, user, period, limit);
85
- }
86
- /**
87
- * GET: Weekly artist chart - LastFM
88
- *
89
- * https://www.last.fm/api/show/user.getWeeklyArtistChart
90
- * @returns Weekly artist chart
91
- */
92
- function getWeeklyArtistChart(method, user, period, limit) {
93
- return (0, request_1.default)(method, user, period, limit);
94
- }
95
- /**
96
- * GET: Weekly chart list - LastFM
97
- *
98
- * https://www.last.fm/api/show/user.getWeeklyChartList
99
- * @returns Weekly chart list
100
- */
101
- function getWeeklyChartList(method, user, period, limit) {
102
- return (0, request_1.default)(method, user, period, limit);
103
- }
104
- /**
105
- * GET: Weekly track chart - LastFM
106
- *
107
- * https://www.last.fm/api/show/user.getWeeklyTrackChart
108
- * @returns Weekly track chart
109
- */
110
- function getWeeklyTrackChart(method, user, period, limit) {
111
- return (0, request_1.default)(method, user, period, limit);
112
- }
113
20
  return {
114
- auth,
21
+ auth: auth_1.auth,
115
22
  config: config_1.default,
116
- getInfo,
117
- getLovedTracks,
118
- getRecentTracks,
119
- getTopAlbums,
120
- getTopArtists,
121
- getTopTracks,
122
- getWeeklyAlbumChart,
123
- getWeeklyArtistChart,
124
- getWeeklyChartList,
125
- 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,
126
33
  method: method_1.default,
127
34
  };
128
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.d.ts CHANGED
@@ -1,2 +1,8 @@
1
- declare const request: <Response_1>(method: string, user: string, period?: string, limit?: string) => Promise<Response_1>;
1
+ interface RequestOptions {
2
+ method: string;
3
+ user?: string;
4
+ period?: string;
5
+ limit?: string;
6
+ }
7
+ declare const request: <Response_1>(options: RequestOptions) => Promise<Response_1>;
2
8
  export default request;
package/dist/request.js CHANGED
@@ -14,19 +14,112 @@ 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
- const request = (method, user, period, limit) => __awaiter(void 0, void 0, void 0, function* () {
18
- const url = `
19
- ${config_1.default.base_url}?method=${method}${user ? '&user=' : ''}${user}${user ? '&user=' : ''}${user}${period ? '&period=' : ''}${period}&${limit ? '&limit=' : ''}${limit}&api_key=${config_1.default.api_key}&format=${config_1.default.format.json}`;
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 = {}));
34
+ const buildUrl = (options) => {
35
+ const params = new URLSearchParams();
36
+ params.append('method', options.method);
37
+ if (options.user)
38
+ params.append('user', options.user);
39
+ if (options.period)
40
+ params.append('period', options.period);
41
+ if (options.limit)
42
+ params.append('limit', options.limit);
43
+ params.append('api_key', config_1.default.api_key);
44
+ params.append('format', config_1.default.format.json);
45
+ return `${config_1.default.base_url}?${params.toString()}`;
46
+ };
47
+ const request = (options) => __awaiter(void 0, void 0, void 0, function* () {
48
+ const url = buildUrl(options);
20
49
  return (yield (0, cross_fetch_1.default)(url, {
21
50
  headers: {
22
51
  'Content-Type': 'application/json',
23
52
  },
24
53
  })
25
54
  .then((res) => {
26
- if (res.status >= 400) {
27
- 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
+ }
28
122
  }
29
- return res.json();
30
123
  })
31
124
  .then((json) => json)
32
125
  .catch((error) => {
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "lastfm-nodejs-client",
3
- "version": "1.2.3",
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
+ "scripts": {
7
+ "build": "rimraf dist && tsc",
8
+ "clean": "rimraf dist",
9
+ "dev": "npm run clean && tsc --watch --project tsconfig.dev.json",
10
+ "test": "npx playwright test --reporter=list"
11
+ },
6
12
  "keywords": [
7
13
  "client",
8
14
  "lastFm",
@@ -16,14 +22,15 @@
16
22
  ],
17
23
  "license": "MIT",
18
24
  "dependencies": {
19
- "cross-fetch": "^3.1.5",
20
- "dotenv": "^16.0.3",
21
- "rimraf": "^3.0.2"
25
+ "cross-fetch": "^4.0.0",
26
+ "dotenv": "^16.3.1",
27
+ "rimraf": "^5.0.1"
22
28
  },
23
29
  "devDependencies": {
24
- "@playwright/test": "^1.28.1",
25
- "@types/node": "^18.11.7",
26
- "typescript": "^4.8.4"
30
+ "@playwright/test": "^1.37.1",
31
+ "@types/node": "^20.6.0",
32
+ "typescript": "^5.2.2",
33
+ "bun-types": "latest"
27
34
  },
28
35
  "repository": {
29
36
  "type": "git",
@@ -32,11 +39,5 @@
32
39
  "bugs": {
33
40
  "url": "https://github.com/mannuelf/lastfm-nodejs-client/issues"
34
41
  },
35
- "homepage": "https://github.com/mannuelf/lastfm-nodejs-client#readme",
36
- "scripts": {
37
- "build": "rimraf dist && tsc",
38
- "clean": "rimraf dist",
39
- "dev": "npm run clean && tsc --watch --project tsconfig.dev.json",
40
- "test": "npx playwright test --reporter=list"
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
+ }