lastfm-nodejs-client 1.4.3 → 1.4.5
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/README.md +14 -2
- package/{@types → dist/@types}/index.d.ts +41 -21
- package/dist/cjs/auth.d.ts +12 -0
- package/dist/{auth.js → cjs/auth.js} +11 -11
- package/dist/cjs/chart/topArtists.d.ts +2 -0
- package/dist/cjs/chart/topArtists.js +13 -0
- package/dist/cjs/chart/topTags.d.ts +2 -0
- package/dist/cjs/chart/topTags.js +13 -0
- package/dist/cjs/chart/topTracks.d.ts +2 -0
- package/dist/cjs/chart/topTracks.js +13 -0
- package/dist/{config.d.ts → cjs/config.d.ts} +0 -1
- package/dist/{config.js → cjs/config.js} +0 -1
- package/dist/cjs/createOptions.d.ts +7 -0
- package/dist/{createOptions.js → cjs/createOptions.js} +2 -1
- package/dist/{getInfo.d.ts → cjs/getInfo.d.ts} +1 -2
- package/dist/{getInfo.js → cjs/getInfo.js} +2 -2
- package/dist/{getLovedTracks.d.ts → cjs/getLovedTracks.d.ts} +1 -2
- package/dist/{getLovedTracks.js → cjs/getLovedTracks.js} +2 -2
- package/dist/{getRecentTracks.d.ts → cjs/getRecentTracks.d.ts} +1 -2
- package/dist/{getRecentTracks.js → cjs/getRecentTracks.js} +2 -2
- package/dist/{getTopAlbums.d.ts → cjs/getTopAlbums.d.ts} +1 -2
- package/dist/{getTopAlbums.js → cjs/getTopAlbums.js} +2 -2
- package/dist/{getTopArtists.d.ts → cjs/getTopArtists.d.ts} +1 -2
- package/dist/{getTopArtists.js → cjs/getTopArtists.js} +2 -2
- package/dist/{getTopTracks.d.ts → cjs/getTopTracks.d.ts} +1 -2
- package/dist/{getTopTracks.js → cjs/getTopTracks.js} +2 -2
- package/dist/{getWeeklyAlbumChart.d.ts → cjs/getWeeklyAlbumChart.d.ts} +1 -2
- package/dist/{getWeeklyAlbumChart.js → cjs/getWeeklyAlbumChart.js} +2 -2
- package/dist/{getWeeklyArtistChart.d.ts → cjs/getWeeklyArtistChart.d.ts} +1 -2
- package/dist/{getWeeklyArtistChart.js → cjs/getWeeklyArtistChart.js} +2 -2
- package/dist/{getWeeklyChartList.d.ts → cjs/getWeeklyChartList.d.ts} +1 -2
- package/dist/{getWeeklyChartList.js → cjs/getWeeklyChartList.js} +2 -2
- package/dist/{getWeeklyTrackChart.d.ts → cjs/getWeeklyTrackChart.d.ts} +1 -2
- package/dist/{getWeeklyTrackChart.js → cjs/getWeeklyTrackChart.js} +2 -2
- package/dist/{index.d.ts → cjs/index.d.ts} +14 -3
- package/dist/cjs/index.js +41 -0
- package/dist/{method.d.ts → cjs/method.d.ts} +11 -1
- package/dist/{method.js → cjs/method.js} +5 -2
- package/dist/cjs/package.json +3 -0
- package/dist/{request.d.ts → cjs/request.d.ts} +0 -1
- package/dist/{request.js → cjs/request.js} +7 -15
- package/dist/mjs/auth.d.ts +12 -0
- package/dist/mjs/auth.js +16 -0
- package/dist/mjs/chart/topArtists.d.ts +2 -0
- package/dist/mjs/chart/topArtists.js +6 -0
- package/dist/mjs/chart/topTags.d.ts +2 -0
- package/dist/mjs/chart/topTags.js +6 -0
- package/dist/mjs/chart/topTracks.d.ts +2 -0
- package/dist/mjs/chart/topTracks.js +6 -0
- package/dist/mjs/config.d.ts +20 -0
- package/dist/mjs/config.js +22 -0
- package/dist/mjs/createOptions.d.ts +7 -0
- package/dist/mjs/createOptions.js +9 -0
- package/dist/mjs/getInfo.d.ts +8 -0
- package/dist/mjs/getInfo.js +12 -0
- package/dist/mjs/getLovedTracks.d.ts +8 -0
- package/dist/mjs/getLovedTracks.js +12 -0
- package/dist/mjs/getRecentTracks.d.ts +8 -0
- package/dist/mjs/getRecentTracks.js +12 -0
- package/dist/mjs/getTopAlbums.d.ts +8 -0
- package/dist/mjs/getTopAlbums.js +12 -0
- package/dist/mjs/getTopArtists.d.ts +8 -0
- package/dist/mjs/getTopArtists.js +12 -0
- package/dist/mjs/getTopTracks.d.ts +8 -0
- package/dist/mjs/getTopTracks.js +12 -0
- package/dist/mjs/getWeeklyAlbumChart.d.ts +8 -0
- package/dist/mjs/getWeeklyAlbumChart.js +12 -0
- package/dist/mjs/getWeeklyArtistChart.d.ts +8 -0
- package/dist/mjs/getWeeklyArtistChart.js +12 -0
- package/dist/mjs/getWeeklyChartList.d.ts +8 -0
- package/dist/mjs/getWeeklyChartList.js +12 -0
- package/dist/mjs/getWeeklyTrackChart.d.ts +8 -0
- package/dist/mjs/getWeeklyTrackChart.js +12 -0
- package/dist/mjs/index.d.ts +63 -0
- package/{src/index.ts → dist/mjs/index.js} +25 -18
- package/dist/mjs/method.d.ts +43 -0
- package/dist/mjs/method.js +20 -0
- package/dist/mjs/package.json +3 -0
- package/dist/mjs/request.d.ts +8 -0
- package/dist/mjs/request.js +119 -0
- package/lastfm-nodejs-client/package.json +7 -0
- package/package.json +41 -13
- package/.env.example +0 -6
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/codeql.yml +0 -74
- package/.github/workflows/playwright.yml +0 -36
- package/.nvmrc +0 -1
- package/.prettierrc.yaml +0 -6
- package/CHANGELOG.md +0 -108
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -9
- package/SECURITY.md +0 -13
- package/dist/auth.d.ts +0 -13
- package/dist/auth.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/createOptions.d.ts +0 -7
- package/dist/createOptions.d.ts.map +0 -1
- package/dist/getInfo.d.ts.map +0 -1
- package/dist/getLovedTracks.d.ts.map +0 -1
- package/dist/getRecentTracks.d.ts.map +0 -1
- package/dist/getTopAlbums.d.ts.map +0 -1
- package/dist/getTopArtists.d.ts.map +0 -1
- package/dist/getTopTracks.d.ts.map +0 -1
- package/dist/getWeeklyAlbumChart.d.ts.map +0 -1
- package/dist/getWeeklyArtistChart.d.ts.map +0 -1
- package/dist/getWeeklyChartList.d.ts.map +0 -1
- package/dist/getWeeklyTrackChart.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -31
- package/dist/method.d.ts.map +0 -1
- package/dist/request.d.ts.map +0 -1
- package/playwright.config.ts +0 -37
- package/src/auth.ts +0 -23
- package/src/config.ts +0 -34
- package/src/createOptions.ts +0 -12
- package/src/getInfo.ts +0 -17
- package/src/getLovedTracks.ts +0 -19
- package/src/getRecentTracks.ts +0 -19
- package/src/getTopAlbums.ts +0 -19
- package/src/getTopArtists.ts +0 -19
- package/src/getTopTracks.ts +0 -19
- package/src/getWeeklyAlbumChart.ts +0 -19
- package/src/getWeeklyArtistChart.ts +0 -19
- package/src/getWeeklyChartList.ts +0 -19
- package/src/getWeeklyTrackChart.ts +0 -20
- package/src/method.ts +0 -33
- package/src/request.ts +0 -133
- package/tests/env.spec.ts +0 -21
- package/tsconfig.dev.json +0 -7
- package/tsconfig.json +0 -104
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -44,20 +35,20 @@ const buildUrl = (options) => {
|
|
|
44
35
|
params.append('format', config_1.config.format.json);
|
|
45
36
|
return `${config_1.config.base_url}?${params.toString()}`;
|
|
46
37
|
};
|
|
47
|
-
const request = (options) =>
|
|
38
|
+
const request = async (options) => {
|
|
48
39
|
const url = buildUrl(options);
|
|
49
|
-
return (
|
|
40
|
+
return (await (0, cross_fetch_1.default)(url, {
|
|
50
41
|
headers: {
|
|
51
42
|
'Content-Type': 'application/json',
|
|
52
43
|
},
|
|
53
44
|
})
|
|
54
|
-
.then((res) => {
|
|
45
|
+
.then(async (res) => {
|
|
55
46
|
if (!res.ok) {
|
|
56
47
|
throw new Error(res.statusText);
|
|
57
48
|
}
|
|
58
49
|
switch (res.status) {
|
|
59
50
|
case 200: {
|
|
60
|
-
return res.json();
|
|
51
|
+
return await res.json();
|
|
61
52
|
}
|
|
62
53
|
case 400: {
|
|
63
54
|
throw new Error('Bad request');
|
|
@@ -126,7 +117,8 @@ const request = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
126
117
|
})
|
|
127
118
|
.then((json) => json)
|
|
128
119
|
.catch((error) => {
|
|
129
|
-
|
|
120
|
+
// eslint-disable-next-line no-console
|
|
121
|
+
console.error('🚨 error:', error);
|
|
130
122
|
}));
|
|
131
|
-
}
|
|
123
|
+
};
|
|
132
124
|
exports.default = request;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type 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/mjs/auth.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createOptions } from "./createOptions";
|
|
2
|
+
import request from "./request";
|
|
3
|
+
/**
|
|
4
|
+
* POST: Auth - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/auth.getToken
|
|
7
|
+
*
|
|
8
|
+
* Authentication tokens are API account specific.
|
|
9
|
+
* They are valid for 60 minutes from the moment they are granted.
|
|
10
|
+
* Can only used once (they are consumed when a session is created).
|
|
11
|
+
* @returns Auth token
|
|
12
|
+
*/
|
|
13
|
+
export async function auth(method, user, period, limit) {
|
|
14
|
+
const options = createOptions(method, user, period, limit);
|
|
15
|
+
return await request(options);
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Stores the Last.fm API key, app name, base url, format, shared secret, and username.
|
|
3
|
+
* Simply add a .env file to the root of the project and add the following:
|
|
4
|
+
* LASTFM_API_KEY=your_api_key
|
|
5
|
+
* LASTFM_APPNAME=your_app_name
|
|
6
|
+
* LASTFM_API_BASE_URL=your_base_url
|
|
7
|
+
* LASTFM_SHARED_SECRET=your_shared_secret
|
|
8
|
+
* LASTFM_USER=your_username
|
|
9
|
+
*/
|
|
10
|
+
export declare const config: {
|
|
11
|
+
api_key: string;
|
|
12
|
+
app_name: string;
|
|
13
|
+
base_url: string;
|
|
14
|
+
format: {
|
|
15
|
+
json: string;
|
|
16
|
+
xml: string;
|
|
17
|
+
};
|
|
18
|
+
share_secret: string;
|
|
19
|
+
username: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as dotenv from 'dotenv';
|
|
2
|
+
dotenv.config();
|
|
3
|
+
/**
|
|
4
|
+
* @description Stores the Last.fm API key, app name, base url, format, shared secret, and username.
|
|
5
|
+
* Simply add a .env file to the root of the project and add the following:
|
|
6
|
+
* LASTFM_API_KEY=your_api_key
|
|
7
|
+
* LASTFM_APPNAME=your_app_name
|
|
8
|
+
* LASTFM_API_BASE_URL=your_base_url
|
|
9
|
+
* LASTFM_SHARED_SECRET=your_shared_secret
|
|
10
|
+
* LASTFM_USER=your_username
|
|
11
|
+
*/
|
|
12
|
+
export const config = {
|
|
13
|
+
api_key: `${process.env.LASTFM_API_KEY}`,
|
|
14
|
+
app_name: `${process.env.LASTFM_APPNAME}`,
|
|
15
|
+
base_url: `${process.env.LASTFM_API_BASE_URL}`,
|
|
16
|
+
format: {
|
|
17
|
+
json: 'json',
|
|
18
|
+
xml: 'xml',
|
|
19
|
+
},
|
|
20
|
+
share_secret: `${process.env.LASTFM_SHARED_SECRET}`,
|
|
21
|
+
username: `${process.env.LASTFM_USER}`,
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from "./createOptions";
|
|
2
|
+
import request from "./request";
|
|
3
|
+
/**
|
|
4
|
+
* GET: User profile information - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getInfo
|
|
7
|
+
* @returns User profile information
|
|
8
|
+
*/
|
|
9
|
+
export async function getInfo(method, user) {
|
|
10
|
+
const options = createOptions(method, user);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Love Tracks - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getLovedTracks
|
|
7
|
+
* @returns Loved Tracks;
|
|
8
|
+
*/
|
|
9
|
+
export async function getLovedTracks(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Recent Tracks - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getRecentTracks
|
|
7
|
+
* @returns Recent Tracks
|
|
8
|
+
*/
|
|
9
|
+
export async function getRecentTracks(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Top Albums - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getTopAlbums
|
|
7
|
+
* @returns Top Albums
|
|
8
|
+
*/
|
|
9
|
+
export async function getTopAlbums(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Top Artist - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getTopArtists
|
|
7
|
+
* @returns Top Artists
|
|
8
|
+
*/
|
|
9
|
+
export async function getTopArtists(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Top Tracks - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getTopTracks
|
|
7
|
+
* @returns Top Tracks
|
|
8
|
+
*/
|
|
9
|
+
export async function getTopTracks(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Weekly album chart - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getWeeklyAlbumChart
|
|
7
|
+
* @returns Weekly album chart
|
|
8
|
+
*/
|
|
9
|
+
export async function getWeeklyAlbumChart(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Weekly artist chart - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getWeeklyArtistChart
|
|
7
|
+
* @returns Weekly artist chart
|
|
8
|
+
*/
|
|
9
|
+
export async function getWeeklyArtistChart(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Weekly chart list - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getWeeklyChartList
|
|
7
|
+
* @returns Weekly chart list
|
|
8
|
+
*/
|
|
9
|
+
export async function getWeeklyChartList(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type 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,12 @@
|
|
|
1
|
+
import { createOptions } from './createOptions';
|
|
2
|
+
import request from './request';
|
|
3
|
+
/**
|
|
4
|
+
* GET: Weekly track chart - LastFM
|
|
5
|
+
*
|
|
6
|
+
* https://www.last.fm/api/show/user.getWeeklyTrackChart
|
|
7
|
+
* @returns Weekly track chart
|
|
8
|
+
*/
|
|
9
|
+
export async function getWeeklyTrackChart(method, user, period, limit) {
|
|
10
|
+
const options = createOptions(method, user, period, limit);
|
|
11
|
+
return await request(options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
import { chartTopTags } from './chart/topTags';
|
|
13
|
+
import { chartTopTracks } from './chart/topTracks';
|
|
14
|
+
import { chartTopArtists } from './chart/topArtists';
|
|
15
|
+
export default function LastFmApi(): {
|
|
16
|
+
auth: typeof auth;
|
|
17
|
+
chart: {
|
|
18
|
+
chartTopArtists: typeof chartTopArtists;
|
|
19
|
+
chartTopTracks: typeof chartTopTracks;
|
|
20
|
+
chartTopTags: typeof chartTopTags;
|
|
21
|
+
};
|
|
22
|
+
config: {
|
|
23
|
+
api_key: string;
|
|
24
|
+
app_name: string;
|
|
25
|
+
base_url: string;
|
|
26
|
+
format: {
|
|
27
|
+
json: string;
|
|
28
|
+
xml: string;
|
|
29
|
+
};
|
|
30
|
+
share_secret: string;
|
|
31
|
+
username: string;
|
|
32
|
+
};
|
|
33
|
+
getInfo: typeof getInfo;
|
|
34
|
+
getLovedTracks: typeof getLovedTracks;
|
|
35
|
+
getRecentTracks: typeof getRecentTracks;
|
|
36
|
+
getTopAlbums: typeof getTopAlbums;
|
|
37
|
+
getTopArtists: typeof getTopArtists;
|
|
38
|
+
getTopTracks: typeof getTopTracks;
|
|
39
|
+
getWeeklyAlbumChart: typeof getWeeklyAlbumChart;
|
|
40
|
+
getWeeklyArtistChart: typeof getWeeklyArtistChart;
|
|
41
|
+
getWeeklyChartList: typeof getWeeklyChartList;
|
|
42
|
+
getWeeklyTrackChart: typeof getWeeklyTrackChart;
|
|
43
|
+
method: {
|
|
44
|
+
auth: string;
|
|
45
|
+
chart: {
|
|
46
|
+
getTopTracks: string;
|
|
47
|
+
getTopTags: string;
|
|
48
|
+
getTopArtists: string;
|
|
49
|
+
};
|
|
50
|
+
user: {
|
|
51
|
+
getInfo: string;
|
|
52
|
+
getLovedTracks: string;
|
|
53
|
+
getRecentTracks: string;
|
|
54
|
+
getTopAlbums: string;
|
|
55
|
+
getTopArtists: string;
|
|
56
|
+
getTopTracks: string;
|
|
57
|
+
getWeeklyAlbumChart: string;
|
|
58
|
+
getWeeklyArtistChart: string;
|
|
59
|
+
getWeeklyChartList: string;
|
|
60
|
+
getWeeklyTrackChart: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -11,21 +11,28 @@ import { getWeeklyArtistChart } from './getWeeklyArtistChart';
|
|
|
11
11
|
import { getWeeklyChartList } from './getWeeklyChartList';
|
|
12
12
|
import { getWeeklyTrackChart } from './getWeeklyTrackChart';
|
|
13
13
|
import { method } from './method';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
import { chartTopTags } from './chart/topTags';
|
|
15
|
+
import { chartTopTracks } from './chart/topTracks';
|
|
16
|
+
import { chartTopArtists } from './chart/topArtists';
|
|
17
|
+
export default function LastFmApi() {
|
|
18
|
+
return {
|
|
19
|
+
auth,
|
|
20
|
+
chart: {
|
|
21
|
+
chartTopArtists,
|
|
22
|
+
chartTopTracks,
|
|
23
|
+
chartTopTags,
|
|
24
|
+
},
|
|
25
|
+
config,
|
|
26
|
+
getInfo,
|
|
27
|
+
getLovedTracks,
|
|
28
|
+
getRecentTracks,
|
|
29
|
+
getTopAlbums,
|
|
30
|
+
getTopArtists,
|
|
31
|
+
getTopTracks,
|
|
32
|
+
getWeeklyAlbumChart,
|
|
33
|
+
getWeeklyArtistChart,
|
|
34
|
+
getWeeklyChartList,
|
|
35
|
+
getWeeklyTrackChart,
|
|
36
|
+
method,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface ChartMethod {
|
|
2
|
+
getTopArtists: string;
|
|
3
|
+
getTopTags: string;
|
|
4
|
+
getTopTracks: string;
|
|
5
|
+
}
|
|
6
|
+
interface UserMethod {
|
|
7
|
+
getInfo: string;
|
|
8
|
+
getLovedTracks: string;
|
|
9
|
+
getRecentTracks: string;
|
|
10
|
+
getTopAlbums: string;
|
|
11
|
+
getTopArtists: string;
|
|
12
|
+
getTopTracks: string;
|
|
13
|
+
getWeeklyAlbumChart: string;
|
|
14
|
+
getWeeklyArtistChart: string;
|
|
15
|
+
getWeeklyChartList: string;
|
|
16
|
+
getWeeklyTrackChart: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Method {
|
|
19
|
+
auth: string;
|
|
20
|
+
chart: ChartMethod;
|
|
21
|
+
user: UserMethod;
|
|
22
|
+
}
|
|
23
|
+
export declare const method: {
|
|
24
|
+
auth: string;
|
|
25
|
+
chart: {
|
|
26
|
+
getTopTracks: string;
|
|
27
|
+
getTopTags: string;
|
|
28
|
+
getTopArtists: string;
|
|
29
|
+
};
|
|
30
|
+
user: {
|
|
31
|
+
getInfo: string;
|
|
32
|
+
getLovedTracks: string;
|
|
33
|
+
getRecentTracks: string;
|
|
34
|
+
getTopAlbums: string;
|
|
35
|
+
getTopArtists: string;
|
|
36
|
+
getTopTracks: string;
|
|
37
|
+
getWeeklyAlbumChart: string;
|
|
38
|
+
getWeeklyArtistChart: string;
|
|
39
|
+
getWeeklyChartList: string;
|
|
40
|
+
getWeeklyTrackChart: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const method = {
|
|
2
|
+
auth: 'auth.getToken',
|
|
3
|
+
chart: {
|
|
4
|
+
getTopTracks: 'chart.getTopTracks',
|
|
5
|
+
getTopTags: 'chart.getTopTags',
|
|
6
|
+
getTopArtists: 'chart.getTopArtists',
|
|
7
|
+
},
|
|
8
|
+
user: {
|
|
9
|
+
getInfo: 'user.getInfo',
|
|
10
|
+
getLovedTracks: 'user.getLovedTracks',
|
|
11
|
+
getRecentTracks: 'user.getRecentTracks',
|
|
12
|
+
getTopAlbums: 'user.getTopAlbums',
|
|
13
|
+
getTopArtists: 'user.getTopArtists',
|
|
14
|
+
getTopTracks: 'user.getTopTracks',
|
|
15
|
+
getWeeklyAlbumChart: 'user.getWeeklyAlbumChart',
|
|
16
|
+
getWeeklyArtistChart: 'user.getWeeklyArtistChart',
|
|
17
|
+
getWeeklyChartList: 'user.getWeeklyChartList',
|
|
18
|
+
getWeeklyTrackChart: 'user.getWeeklyTrackChart',
|
|
19
|
+
},
|
|
20
|
+
};
|