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
@@ -20,13 +20,15 @@ jobs:
20
20
  run: pnpm install
21
21
  - name: Install Playwright Browsers
22
22
  run: npx playwright install --with-deps
23
+ - name: Install @playwright/test package
24
+ run: pnpm add -D @playwright/test
23
25
  - name: Creates environment variables
24
26
  run: |
25
27
  echo "LASTFM_API_BASE_URL: https://ws.audioscrobbler.com/2.0/"
26
28
  echo "LASTFM_API_KEY: abcdefghijklmnopqrstuvxyz"
27
29
  - name: Run Playwright tests
28
30
  run: pnpm dlx playwright test
29
- - uses: actions/upload-artifact@v3
31
+ - uses: actions/upload-artifact@v2
30
32
  if: always()
31
33
  with:
32
34
  name: playwright-report
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20
package/@types/index.d.ts CHANGED
@@ -374,19 +374,19 @@ export interface method {
374
374
  };
375
375
  }
376
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
- }
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
+ }
package/CHANGELOG.md CHANGED
@@ -1,9 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0
4
+
5
+ - Updates npm dependencies.
6
+ - refactors request with new error handling and responses.
7
+ - updates getInfo, removes hte un-required params.
8
+
9
+ ## 1.2.4
10
+
11
+ - Updates npm dependencies.
12
+ - Refactors request methods options and updates all callsites.
13
+ - Add nvmrc file for easy switching node version.
14
+
3
15
  ## 1.2.3
4
16
 
5
- - Adds tests, using Playwright
6
- - Adds dotenv npm module as a new dependency
17
+ - Adds tests, using Playwright.
18
+ - Adds dotenv npm module as a new dependency.
7
19
 
8
20
  ## 1.2.2
9
21
 
@@ -11,7 +23,7 @@
11
23
 
12
24
  ## 1.2.1
13
25
 
14
- - Tidy up, removes console logs
26
+ - Tidy up, removes console logs.
15
27
 
16
28
  ## 1.2.0
17
29
 
@@ -19,15 +31,15 @@
19
31
 
20
32
  ## 1.1.5
21
33
 
22
- - Fix incorrect type on request method
34
+ - Fix incorrect type on request method.
23
35
 
24
36
  ## 1.1.4
25
37
 
26
- - Fix incorrect type on request method
38
+ - Fix incorrect type on request method.
27
39
 
28
40
  ## 1.1.3
29
41
 
30
- - Fix incorrect type import
42
+ - Fix incorrect type import.
31
43
 
32
44
  ## 1.1.2
33
45
 
@@ -35,44 +47,44 @@
35
47
 
36
48
  ## 1.1.1
37
49
 
38
- - update function declaration
39
- - re-add type declartion files for source code
50
+ - update function declaration.
51
+ - re-add type declartion files for source code.
40
52
 
41
53
  ## 1.1.0
42
54
 
43
- - Downgrade node-fetch to v2.6.7
44
- - Do not ship separate declaration files
45
- - TS now exports to CommonJs modules for better support older consumers
55
+ - Downgrade node-fetch to v2.6.7.
56
+ - Do not ship separate declaration files.
57
+ - TS now exports to CommonJs modules for better support older consumers.
46
58
 
47
59
  ## 1.0.6
48
60
 
49
- - Forking repo README update
61
+ - Forking repo README update.
50
62
 
51
63
  ## 1.0.5
52
64
 
53
- - Fix local types
54
- - Update readme with current way of using the types
55
- - adds screenshot of it in use
65
+ - Fix local types.
66
+ - Update readme with current way of using the types.
67
+ - adds screenshot of it in use.
56
68
 
57
69
  ## 1.0.4
58
70
 
59
- - Export types
71
+ - Export types.
60
72
 
61
73
  ## 1.0.3
62
74
 
63
- - Adds types file to distribution
64
- - Updates readme with types imports
75
+ - Adds types file to distribution.
76
+ - Updates readme with types imports.
65
77
 
66
78
  ## 1.0.2
67
79
 
68
- - Refactors types.d.ts to types.ts so can ship them with package and consumers can import them in their projects
80
+ - Refactors types.d.ts to types.ts so can ship them with package and consumers can import them in their projects.
69
81
 
70
82
  ## 1.0.1
71
83
 
72
- - Refactors config and methods to own modules
73
- - tsconfig, generate types to allow shipping types in one package, no need to DefinitleyTyped right now
74
- - update docs with new way of interacting with API
84
+ - Refactors config and methods to own modules.
85
+ - tsconfig, generate types to allow shipping types in one package, no need to DefinitleyTyped right now.
86
+ - update docs with new way of interacting with API.
75
87
 
76
88
  ## 1.0.0
77
89
 
78
- - Initial project setup
90
+ - Initial project setup.
package/README.md CHANGED
@@ -110,3 +110,7 @@ pnpm build
110
110
  ### Why I built this?
111
111
 
112
112
  I was building a scrobbles page [https://mannuelferreira.com/scrobbles](https://mannuelferreira.com/scrobbles) and I thought others might want it to.
113
+
114
+ ### TODO
115
+
116
+ - move types into [DefinitelyTyped](https://github.com/mannuelf/DefinitelyTyped)
package/SECURITY.md CHANGED
@@ -2,13 +2,12 @@
2
2
 
3
3
  ## Supported Versions
4
4
 
5
- Dependebot alerts have been enabled and security patches to any dependecies will be brought to light and merged manually by maintainer.
5
+ Dependabot alerts have been enabled and security patches to any dependencies will be brought to light and merged manually by maintainer.
6
6
 
7
7
  | Version | Supported |
8
8
  | ------- | ------------------ |
9
9
  | 1.0.x | :white_check_mark: |
10
10
 
11
-
12
11
  ## Reporting a Vulnerability
13
12
 
14
13
  If you find anything at all kindly report it as bug report here on github ✌️
package/bun.lockb ADDED
Binary file
package/dist/auth.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { AuthResponse } from '../@types';
2
+ /**
3
+ * POST: Auth - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/auth.getToken
6
+ *
7
+ * Authentication tokens are API account specific.
8
+ * They are valid for 60 minutes from the moment they are granted.
9
+ * Can only used once (they are consumed when a session is created).
10
+ * @returns Auth token
11
+ */
12
+ export declare function auth(method: string, user: string, period: string, limit: string): Promise<AuthResponse>;
package/dist/auth.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.auth = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * POST: Auth - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/auth.getToken
13
+ *
14
+ * Authentication tokens are API account specific.
15
+ * They are valid for 60 minutes from the moment they are granted.
16
+ * Can only used once (they are consumed when a session is created).
17
+ * @returns Auth token
18
+ */
19
+ function auth(method, user, period, limit) {
20
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
21
+ return (0, request_1.default)(options);
22
+ }
23
+ exports.auth = auth;
package/dist/config.js CHANGED
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const dotenv = __importStar(require("dotenv"));
27
27
  dotenv.config();
28
+ ;
28
29
  exports.default = {
29
30
  api_key: `${process.env.LASTFM_API_KEY}`,
30
31
  app_name: `${process.env.LASTFM_APPNAME}`,
@@ -0,0 +1,6 @@
1
+ export declare function createOptions(method: string, user: string, period?: string, limit?: string): {
2
+ method: string;
3
+ user: string;
4
+ period: string | undefined;
5
+ limit: string | undefined;
6
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOptions = void 0;
4
+ function createOptions(method, user, period, limit) {
5
+ return {
6
+ method,
7
+ user,
8
+ period,
9
+ limit,
10
+ };
11
+ }
12
+ exports.createOptions = createOptions;
@@ -0,0 +1,8 @@
1
+ import { UserResponse } from '../@types';
2
+ /**
3
+ * GET: User profile information - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getInfo
6
+ * @returns User profile information
7
+ */
8
+ export declare function getInfo(method: string, user: string): Promise<UserResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getInfo = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: User profile information - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getInfo
13
+ * @returns User profile information
14
+ */
15
+ function getInfo(method, user) {
16
+ const options = (0, createOptions_1.createOptions)(method, user);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getInfo = getInfo;
@@ -0,0 +1,8 @@
1
+ import { LovedTracksResponse } from '../@types';
2
+ /**
3
+ * GET: Love Tracks - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getLovedTracks
6
+ * @returns Loved Tracks;
7
+ */
8
+ export declare function getLovedTracks(method: string, user: string, period: string, limit: string): Promise<LovedTracksResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getLovedTracks = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Love Tracks - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getLovedTracks
13
+ * @returns Loved Tracks;
14
+ */
15
+ function getLovedTracks(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getLovedTracks = getLovedTracks;
@@ -0,0 +1,8 @@
1
+ import { RecentTracksResponse } from '../@types';
2
+ /**
3
+ * GET: Recent Tracks - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getRecentTracks
6
+ * @returns Recent Tracks
7
+ */
8
+ export declare function getRecentTracks(method: string, user: string, period: string, limit: string): Promise<RecentTracksResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getRecentTracks = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Recent Tracks - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getRecentTracks
13
+ * @returns Recent Tracks
14
+ */
15
+ function getRecentTracks(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getRecentTracks = getRecentTracks;
@@ -0,0 +1,8 @@
1
+ import { TopAlbumsResponse } from '../@types';
2
+ /**
3
+ * GET: Top Albums - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getTopAlbums
6
+ * @returns Top Albums
7
+ */
8
+ export declare function getTopAlbums(method: string, user: string, period: string, limit: string): Promise<TopAlbumsResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getTopAlbums = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Top Albums - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getTopAlbums
13
+ * @returns Top Albums
14
+ */
15
+ function getTopAlbums(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getTopAlbums = getTopAlbums;
@@ -0,0 +1,8 @@
1
+ import { TopArtistsResponse } from '../@types';
2
+ /**
3
+ * GET: Top Artist - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getTopArtists
6
+ * @returns Top Artists
7
+ */
8
+ export declare function getTopArtists(method: string, user: string, period: string, limit: string): Promise<TopArtistsResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getTopArtists = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Top Artist - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getTopArtists
13
+ * @returns Top Artists
14
+ */
15
+ function getTopArtists(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getTopArtists = getTopArtists;
@@ -0,0 +1,8 @@
1
+ import { TopTrackResponse } from '../@types';
2
+ /**
3
+ * GET: Top Tracks - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getTopTracks
6
+ * @returns Top Tracks
7
+ */
8
+ export declare function getTopTracks(method: string, user: string, period: string, limit: string): Promise<TopTrackResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getTopTracks = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Top Tracks - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getTopTracks
13
+ * @returns Top Tracks
14
+ */
15
+ function getTopTracks(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getTopTracks = getTopTracks;
@@ -0,0 +1,8 @@
1
+ import { WeeklyAlbumChartResponse } from '../@types';
2
+ /**
3
+ * GET: Weekly album chart - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getWeeklyAlbumChart
6
+ * @returns Weekly album chart
7
+ */
8
+ export declare function getWeeklyAlbumChart(method: string, user: string, period: string, limit: string): Promise<WeeklyAlbumChartResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWeeklyAlbumChart = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Weekly album chart - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getWeeklyAlbumChart
13
+ * @returns Weekly album chart
14
+ */
15
+ function getWeeklyAlbumChart(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getWeeklyAlbumChart = getWeeklyAlbumChart;
@@ -0,0 +1,8 @@
1
+ import { WeeklyArtistChartResponse } from '../@types';
2
+ /**
3
+ * GET: Weekly artist chart - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getWeeklyArtistChart
6
+ * @returns Weekly artist chart
7
+ */
8
+ export declare function getWeeklyArtistChart(method: string, user: string, period: string, limit: string): Promise<WeeklyArtistChartResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWeeklyArtistChart = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Weekly artist chart - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getWeeklyArtistChart
13
+ * @returns Weekly artist chart
14
+ */
15
+ function getWeeklyArtistChart(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getWeeklyArtistChart = getWeeklyArtistChart;
@@ -0,0 +1,8 @@
1
+ import { WeeklyChartListResponse } from '../@types';
2
+ /**
3
+ * GET: Weekly chart list - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getWeeklyChartList
6
+ * @returns Weekly chart list
7
+ */
8
+ export declare function getWeeklyChartList(method: string, user: string, period: string, limit: string): Promise<WeeklyChartListResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWeeklyChartList = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Weekly chart list - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getWeeklyChartList
13
+ * @returns Weekly chart list
14
+ */
15
+ function getWeeklyChartList(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getWeeklyChartList = getWeeklyChartList;
@@ -0,0 +1,8 @@
1
+ import { WeeklyTrackChartResponse } from '../@types';
2
+ /**
3
+ * GET: Weekly track chart - LastFM
4
+ *
5
+ * https://www.last.fm/api/show/user.getWeeklyTrackChart
6
+ * @returns Weekly track chart
7
+ */
8
+ export declare function getWeeklyTrackChart(method: string, user: string, period: string, limit: string): Promise<WeeklyTrackChartResponse>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWeeklyTrackChart = void 0;
7
+ const createOptions_1 = require("./createOptions");
8
+ const request_1 = __importDefault(require("./request"));
9
+ /**
10
+ * GET: Weekly track chart - LastFM
11
+ *
12
+ * https://www.last.fm/api/show/user.getWeeklyTrackChart
13
+ * @returns Weekly track chart
14
+ */
15
+ function getWeeklyTrackChart(method, user, period, limit) {
16
+ const options = (0, createOptions_1.createOptions)(method, user, period, limit);
17
+ return (0, request_1.default)(options);
18
+ }
19
+ exports.getWeeklyTrackChart = getWeeklyTrackChart;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,16 @@
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: string) => Promise<AuthResponse>;
1
+ import { auth } from './auth';
2
+ import { getInfo } from './getInfo';
3
+ import { getLovedTracks } from './getLovedTracks';
4
+ import { getRecentTracks } from './getRecentTracks';
5
+ import { getTopAlbums } from './getTopAlbums';
6
+ import { getTopArtists } from './getTopArtists';
7
+ import { getTopTracks } from './getTopTracks';
8
+ import { getWeeklyAlbumChart } from './getWeeklyAlbumChart';
9
+ import { getWeeklyArtistChart } from './getWeeklyArtistChart';
10
+ import { getWeeklyChartList } from './getWeeklyChartList';
11
+ import { getWeeklyTrackChart } from './getWeeklyTrackChart';
12
+ export default function LastFmApi(): {
13
+ auth: typeof auth;
4
14
  config: {
5
15
  api_key: string;
6
16
  app_name: string;
@@ -12,16 +22,16 @@ declare function LastFmApi(): {
12
22
  share_secret: string;
13
23
  username: string;
14
24
  };
15
- getInfo: (method: string, user: string, period: string, limit: string) => Promise<UserResponse>;
16
- getLovedTracks: (method: string, user: string, period: string, limit: string) => Promise<LovedTracksResponse>;
17
- getRecentTracks: (method: string, user: string, period: string, limit: string) => Promise<RecentTracksResponse>;
18
- getTopAlbums: (method: string, user: string, period: string, limit: string) => Promise<TopAlbumsResponse>;
19
- getTopArtists: (method: string, user: string, period: string, limit: string) => Promise<TopArtistsResponse>;
20
- getTopTracks: (method: string, user: string, period: string, limit: string) => Promise<TopTrackResponse>;
21
- getWeeklyAlbumChart: (method: string, user: string, period: string, limit: string) => Promise<WeeklyAlbumChartResponse>;
22
- getWeeklyArtistChart: (method: string, user: string, period: string, limit: string) => Promise<WeeklyArtistChartResponse>;
23
- getWeeklyChartList: (method: string, user: string, period: string, limit: string) => Promise<WeeklyChartListResponse>;
24
- getWeeklyTrackChart: (method: string, user: string, period: string, limit: string) => Promise<WeeklyTrackChartResponse>;
25
+ getInfo: typeof getInfo;
26
+ getLovedTracks: typeof getLovedTracks;
27
+ getRecentTracks: typeof getRecentTracks;
28
+ getTopAlbums: typeof getTopAlbums;
29
+ getTopArtists: typeof getTopArtists;
30
+ getTopTracks: typeof getTopTracks;
31
+ getWeeklyAlbumChart: typeof getWeeklyAlbumChart;
32
+ getWeeklyArtistChart: typeof getWeeklyArtistChart;
33
+ getWeeklyChartList: typeof getWeeklyChartList;
34
+ getWeeklyTrackChart: typeof getWeeklyTrackChart;
25
35
  method: {
26
36
  auth: string;
27
37
  user: {
@@ -38,4 +48,3 @@ declare function LastFmApi(): {
38
48
  };
39
49
  };
40
50
  };
41
- export default LastFmApi;