lastfm-nodejs-client 1.5.6 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/README.md +140 -74
  2. package/dist/@types/album/addTags.d.ts +11 -0
  3. package/dist/@types/album/getInfo.d.ts +11 -0
  4. package/dist/@types/album/getTags.d.ts +11 -0
  5. package/dist/@types/album/getTopTags.d.ts +10 -0
  6. package/dist/@types/album/removeTag.d.ts +11 -0
  7. package/dist/@types/album/search.d.ts +10 -0
  8. package/dist/@types/artist/addTags.d.ts +10 -0
  9. package/dist/@types/artist/getCorrection.d.ts +9 -0
  10. package/dist/@types/artist/getInfo.d.ts +10 -0
  11. package/dist/@types/artist/getSimilar.d.ts +10 -0
  12. package/dist/@types/artist/getTags.d.ts +10 -0
  13. package/dist/@types/artist/getTopAlbums.d.ts +11 -0
  14. package/dist/@types/artist/getTopTags.d.ts +9 -0
  15. package/dist/@types/artist/getTopTracks.d.ts +11 -0
  16. package/dist/@types/artist/removeTag.d.ts +10 -0
  17. package/dist/@types/artist/search.d.ts +10 -0
  18. package/dist/@types/auth/getMobileSession.d.ts +11 -0
  19. package/dist/@types/auth/getSession.d.ts +10 -0
  20. package/dist/@types/auth.d.ts +9 -6
  21. package/dist/@types/chart/topArtists.d.ts +11 -0
  22. package/dist/@types/chart/topTags.d.ts +8 -0
  23. package/dist/@types/chart/topTracks.d.ts +8 -0
  24. package/dist/@types/config.d.ts +13 -11
  25. package/dist/@types/createOptions.d.ts +23 -0
  26. package/dist/@types/geo/getTopArtists.d.ts +10 -0
  27. package/dist/@types/geo/getTopTracks.d.ts +10 -0
  28. package/dist/@types/getFriends.d.ts +6 -3
  29. package/dist/@types/getInfo.d.ts +5 -3
  30. package/dist/@types/getLovedTracks.d.ts +7 -3
  31. package/dist/@types/getRecentTracks.d.ts +7 -3
  32. package/dist/@types/getTopAlbums.d.ts +7 -3
  33. package/dist/@types/getTopArtists.d.ts +7 -3
  34. package/dist/@types/getTopTracks.d.ts +7 -3
  35. package/dist/@types/getUserTopTags.d.ts +6 -3
  36. package/dist/@types/getWeeklyAlbumChart.d.ts +7 -3
  37. package/dist/@types/getWeeklyArtistChart.d.ts +7 -3
  38. package/dist/@types/getWeeklyChartList.d.ts +8 -3
  39. package/dist/@types/getWeeklyTrackChart.d.ts +7 -3
  40. package/dist/@types/index.d.ts +31 -89
  41. package/dist/@types/lastfm.types.d.ts +1 -2
  42. package/dist/@types/library/getArtists.d.ts +10 -0
  43. package/dist/@types/md5.d.ts +7 -0
  44. package/dist/@types/method.d.ts +25 -77
  45. package/dist/@types/request.d.ts +23 -0
  46. package/dist/@types/tag/getInfo.d.ts +9 -0
  47. package/dist/@types/tag/getSimilar.d.ts +8 -0
  48. package/dist/@types/tag/getTopAlbums.d.ts +10 -0
  49. package/dist/@types/tag/getTopArtists.d.ts +10 -0
  50. package/dist/@types/tag/getTopTags.d.ts +7 -0
  51. package/dist/@types/tag/getWeeklyChartList.d.ts +9 -0
  52. package/dist/@types/tag/topTracks.d.ts +6 -3
  53. package/dist/@types/track/addTags.d.ts +11 -0
  54. package/dist/@types/track/getCorrection.d.ts +10 -0
  55. package/dist/@types/track/getInfo.d.ts +11 -0
  56. package/dist/@types/track/getSimilar.d.ts +11 -0
  57. package/dist/@types/track/getTags.d.ts +11 -0
  58. package/dist/@types/track/getTopTags.d.ts +10 -0
  59. package/dist/@types/track/love.d.ts +10 -0
  60. package/dist/@types/track/removeTag.d.ts +11 -0
  61. package/dist/@types/track/scrobble.d.ts +12 -0
  62. package/dist/@types/track/search.d.ts +11 -0
  63. package/dist/@types/track/unlove.d.ts +10 -0
  64. package/dist/@types/track/updateNowPlaying.d.ts +11 -0
  65. package/dist/@types/user/getPersonalTags.d.ts +12 -0
  66. package/dist/album/addTags.js +11 -0
  67. package/dist/album/addTags.js.map +1 -1
  68. package/dist/album/getInfo.js +11 -0
  69. package/dist/album/getInfo.js.map +1 -1
  70. package/dist/album/getTags.js +11 -0
  71. package/dist/album/getTags.js.map +1 -1
  72. package/dist/album/getTopTags.js +10 -0
  73. package/dist/album/getTopTags.js.map +1 -1
  74. package/dist/album/removeTag.js +11 -0
  75. package/dist/album/removeTag.js.map +1 -1
  76. package/dist/album/search.js +10 -0
  77. package/dist/album/search.js.map +1 -1
  78. package/dist/artist/addTags.js +10 -0
  79. package/dist/artist/addTags.js.map +1 -1
  80. package/dist/artist/getCorrection.js +9 -0
  81. package/dist/artist/getCorrection.js.map +1 -1
  82. package/dist/artist/getInfo.js +10 -0
  83. package/dist/artist/getInfo.js.map +1 -1
  84. package/dist/artist/getSimilar.js +10 -0
  85. package/dist/artist/getSimilar.js.map +1 -1
  86. package/dist/artist/getTags.js +10 -0
  87. package/dist/artist/getTags.js.map +1 -1
  88. package/dist/artist/getTopAlbums.js +11 -0
  89. package/dist/artist/getTopAlbums.js.map +1 -1
  90. package/dist/artist/getTopTags.js +9 -0
  91. package/dist/artist/getTopTags.js.map +1 -1
  92. package/dist/artist/getTopTracks.js +11 -0
  93. package/dist/artist/getTopTracks.js.map +1 -1
  94. package/dist/artist/removeTag.js +10 -0
  95. package/dist/artist/removeTag.js.map +1 -1
  96. package/dist/artist/search.js +10 -0
  97. package/dist/artist/search.js.map +1 -1
  98. package/dist/auth/getMobileSession.js +11 -0
  99. package/dist/auth/getMobileSession.js.map +1 -1
  100. package/dist/auth/getSession.js +10 -0
  101. package/dist/auth/getSession.js.map +1 -1
  102. package/dist/auth.js +9 -6
  103. package/dist/auth.js.map +1 -1
  104. package/dist/chart/topArtists.js +11 -0
  105. package/dist/chart/topArtists.js.map +1 -1
  106. package/dist/chart/topTags.js +8 -0
  107. package/dist/chart/topTags.js.map +1 -1
  108. package/dist/chart/topTracks.js +8 -0
  109. package/dist/chart/topTracks.js.map +1 -1
  110. package/dist/cjs/album/addTags.js +11 -0
  111. package/dist/cjs/album/addTags.js.map +1 -1
  112. package/dist/cjs/album/getInfo.js +11 -0
  113. package/dist/cjs/album/getInfo.js.map +1 -1
  114. package/dist/cjs/album/getTags.js +11 -0
  115. package/dist/cjs/album/getTags.js.map +1 -1
  116. package/dist/cjs/album/getTopTags.js +10 -0
  117. package/dist/cjs/album/getTopTags.js.map +1 -1
  118. package/dist/cjs/album/removeTag.js +11 -0
  119. package/dist/cjs/album/removeTag.js.map +1 -1
  120. package/dist/cjs/album/search.js +10 -0
  121. package/dist/cjs/album/search.js.map +1 -1
  122. package/dist/cjs/artist/addTags.js +10 -0
  123. package/dist/cjs/artist/addTags.js.map +1 -1
  124. package/dist/cjs/artist/getCorrection.js +9 -0
  125. package/dist/cjs/artist/getCorrection.js.map +1 -1
  126. package/dist/cjs/artist/getInfo.js +10 -0
  127. package/dist/cjs/artist/getInfo.js.map +1 -1
  128. package/dist/cjs/artist/getSimilar.js +10 -0
  129. package/dist/cjs/artist/getSimilar.js.map +1 -1
  130. package/dist/cjs/artist/getTags.js +10 -0
  131. package/dist/cjs/artist/getTags.js.map +1 -1
  132. package/dist/cjs/artist/getTopAlbums.js +11 -0
  133. package/dist/cjs/artist/getTopAlbums.js.map +1 -1
  134. package/dist/cjs/artist/getTopTags.js +9 -0
  135. package/dist/cjs/artist/getTopTags.js.map +1 -1
  136. package/dist/cjs/artist/getTopTracks.js +11 -0
  137. package/dist/cjs/artist/getTopTracks.js.map +1 -1
  138. package/dist/cjs/artist/removeTag.js +10 -0
  139. package/dist/cjs/artist/removeTag.js.map +1 -1
  140. package/dist/cjs/artist/search.js +10 -0
  141. package/dist/cjs/artist/search.js.map +1 -1
  142. package/dist/cjs/auth/getMobileSession.js +11 -0
  143. package/dist/cjs/auth/getMobileSession.js.map +1 -1
  144. package/dist/cjs/auth/getSession.js +10 -0
  145. package/dist/cjs/auth/getSession.js.map +1 -1
  146. package/dist/cjs/auth.js +9 -6
  147. package/dist/cjs/auth.js.map +1 -1
  148. package/dist/cjs/chart/topArtists.js +11 -0
  149. package/dist/cjs/chart/topArtists.js.map +1 -1
  150. package/dist/cjs/chart/topTags.js +8 -0
  151. package/dist/cjs/chart/topTags.js.map +1 -1
  152. package/dist/cjs/chart/topTracks.js +8 -0
  153. package/dist/cjs/chart/topTracks.js.map +1 -1
  154. package/dist/cjs/config.js.map +1 -1
  155. package/dist/cjs/createOptions.js +23 -0
  156. package/dist/cjs/createOptions.js.map +1 -1
  157. package/dist/cjs/geo/getTopArtists.js +10 -0
  158. package/dist/cjs/geo/getTopArtists.js.map +1 -1
  159. package/dist/cjs/geo/getTopTracks.js +10 -0
  160. package/dist/cjs/geo/getTopTracks.js.map +1 -1
  161. package/dist/cjs/getFriends.js +6 -3
  162. package/dist/cjs/getFriends.js.map +1 -1
  163. package/dist/cjs/getInfo.js +5 -3
  164. package/dist/cjs/getInfo.js.map +1 -1
  165. package/dist/cjs/getLovedTracks.js +7 -3
  166. package/dist/cjs/getLovedTracks.js.map +1 -1
  167. package/dist/cjs/getRecentTracks.js +7 -3
  168. package/dist/cjs/getRecentTracks.js.map +1 -1
  169. package/dist/cjs/getTopAlbums.js +7 -3
  170. package/dist/cjs/getTopAlbums.js.map +1 -1
  171. package/dist/cjs/getTopArtists.js +7 -3
  172. package/dist/cjs/getTopArtists.js.map +1 -1
  173. package/dist/cjs/getTopTracks.js +7 -3
  174. package/dist/cjs/getTopTracks.js.map +1 -1
  175. package/dist/cjs/getUserTopTags.js +6 -3
  176. package/dist/cjs/getUserTopTags.js.map +1 -1
  177. package/dist/cjs/getWeeklyAlbumChart.js +7 -3
  178. package/dist/cjs/getWeeklyAlbumChart.js.map +1 -1
  179. package/dist/cjs/getWeeklyArtistChart.js +7 -3
  180. package/dist/cjs/getWeeklyArtistChart.js.map +1 -1
  181. package/dist/cjs/getWeeklyChartList.js +8 -3
  182. package/dist/cjs/getWeeklyChartList.js.map +1 -1
  183. package/dist/cjs/getWeeklyTrackChart.js +7 -3
  184. package/dist/cjs/getWeeklyTrackChart.js.map +1 -1
  185. package/dist/cjs/index.js +21 -0
  186. package/dist/cjs/index.js.map +1 -1
  187. package/dist/cjs/library/getArtists.js +10 -0
  188. package/dist/cjs/library/getArtists.js.map +1 -1
  189. package/dist/cjs/md5.js +80 -0
  190. package/dist/cjs/md5.js.map +1 -0
  191. package/dist/cjs/method.js +11 -0
  192. package/dist/cjs/method.js.map +1 -1
  193. package/dist/cjs/request.js +32 -2
  194. package/dist/cjs/request.js.map +1 -1
  195. package/dist/cjs/tag/getInfo.js +9 -0
  196. package/dist/cjs/tag/getInfo.js.map +1 -1
  197. package/dist/cjs/tag/getSimilar.js +8 -0
  198. package/dist/cjs/tag/getSimilar.js.map +1 -1
  199. package/dist/cjs/tag/getTopAlbums.js +10 -0
  200. package/dist/cjs/tag/getTopAlbums.js.map +1 -1
  201. package/dist/cjs/tag/getTopArtists.js +10 -0
  202. package/dist/cjs/tag/getTopArtists.js.map +1 -1
  203. package/dist/cjs/tag/getTopTags.js +7 -0
  204. package/dist/cjs/tag/getTopTags.js.map +1 -1
  205. package/dist/cjs/tag/getWeeklyChartList.js +9 -0
  206. package/dist/cjs/tag/getWeeklyChartList.js.map +1 -1
  207. package/dist/cjs/tag/topTracks.js +6 -3
  208. package/dist/cjs/tag/topTracks.js.map +1 -1
  209. package/dist/cjs/track/addTags.js +11 -0
  210. package/dist/cjs/track/addTags.js.map +1 -1
  211. package/dist/cjs/track/getCorrection.js +10 -0
  212. package/dist/cjs/track/getCorrection.js.map +1 -1
  213. package/dist/cjs/track/getInfo.js +11 -0
  214. package/dist/cjs/track/getInfo.js.map +1 -1
  215. package/dist/cjs/track/getSimilar.js +11 -0
  216. package/dist/cjs/track/getSimilar.js.map +1 -1
  217. package/dist/cjs/track/getTags.js +11 -0
  218. package/dist/cjs/track/getTags.js.map +1 -1
  219. package/dist/cjs/track/getTopTags.js +10 -0
  220. package/dist/cjs/track/getTopTags.js.map +1 -1
  221. package/dist/cjs/track/love.js +10 -0
  222. package/dist/cjs/track/love.js.map +1 -1
  223. package/dist/cjs/track/removeTag.js +11 -0
  224. package/dist/cjs/track/removeTag.js.map +1 -1
  225. package/dist/cjs/track/scrobble.js +12 -0
  226. package/dist/cjs/track/scrobble.js.map +1 -1
  227. package/dist/cjs/track/search.js +11 -0
  228. package/dist/cjs/track/search.js.map +1 -1
  229. package/dist/cjs/track/unlove.js +10 -0
  230. package/dist/cjs/track/unlove.js.map +1 -1
  231. package/dist/cjs/track/updateNowPlaying.js +11 -0
  232. package/dist/cjs/track/updateNowPlaying.js.map +1 -1
  233. package/dist/cjs/user/getPersonalTags.js +12 -0
  234. package/dist/cjs/user/getPersonalTags.js.map +1 -1
  235. package/dist/config.js.map +1 -1
  236. package/dist/createOptions.js +23 -0
  237. package/dist/createOptions.js.map +1 -1
  238. package/dist/geo/getTopArtists.js +10 -0
  239. package/dist/geo/getTopArtists.js.map +1 -1
  240. package/dist/geo/getTopTracks.js +10 -0
  241. package/dist/geo/getTopTracks.js.map +1 -1
  242. package/dist/getFriends.js +6 -3
  243. package/dist/getFriends.js.map +1 -1
  244. package/dist/getInfo.js +5 -3
  245. package/dist/getInfo.js.map +1 -1
  246. package/dist/getLovedTracks.js +7 -3
  247. package/dist/getLovedTracks.js.map +1 -1
  248. package/dist/getRecentTracks.js +7 -3
  249. package/dist/getRecentTracks.js.map +1 -1
  250. package/dist/getTopAlbums.js +7 -3
  251. package/dist/getTopAlbums.js.map +1 -1
  252. package/dist/getTopArtists.js +7 -3
  253. package/dist/getTopArtists.js.map +1 -1
  254. package/dist/getTopTracks.js +7 -3
  255. package/dist/getTopTracks.js.map +1 -1
  256. package/dist/getUserTopTags.js +6 -3
  257. package/dist/getUserTopTags.js.map +1 -1
  258. package/dist/getWeeklyAlbumChart.js +7 -3
  259. package/dist/getWeeklyAlbumChart.js.map +1 -1
  260. package/dist/getWeeklyArtistChart.js +7 -3
  261. package/dist/getWeeklyArtistChart.js.map +1 -1
  262. package/dist/getWeeklyChartList.js +8 -3
  263. package/dist/getWeeklyChartList.js.map +1 -1
  264. package/dist/getWeeklyTrackChart.js +7 -3
  265. package/dist/getWeeklyTrackChart.js.map +1 -1
  266. package/dist/index.js +21 -0
  267. package/dist/index.js.map +1 -1
  268. package/dist/library/getArtists.js +10 -0
  269. package/dist/library/getArtists.js.map +1 -1
  270. package/dist/md5.js +77 -0
  271. package/dist/md5.js.map +1 -0
  272. package/dist/method.js +11 -0
  273. package/dist/method.js.map +1 -1
  274. package/dist/request.js +32 -2
  275. package/dist/request.js.map +1 -1
  276. package/dist/tag/getInfo.js +9 -0
  277. package/dist/tag/getInfo.js.map +1 -1
  278. package/dist/tag/getSimilar.js +8 -0
  279. package/dist/tag/getSimilar.js.map +1 -1
  280. package/dist/tag/getTopAlbums.js +10 -0
  281. package/dist/tag/getTopAlbums.js.map +1 -1
  282. package/dist/tag/getTopArtists.js +10 -0
  283. package/dist/tag/getTopArtists.js.map +1 -1
  284. package/dist/tag/getTopTags.js +7 -0
  285. package/dist/tag/getTopTags.js.map +1 -1
  286. package/dist/tag/getWeeklyChartList.js +9 -0
  287. package/dist/tag/getWeeklyChartList.js.map +1 -1
  288. package/dist/tag/topTracks.js +6 -3
  289. package/dist/tag/topTracks.js.map +1 -1
  290. package/dist/track/addTags.js +11 -0
  291. package/dist/track/addTags.js.map +1 -1
  292. package/dist/track/getCorrection.js +10 -0
  293. package/dist/track/getCorrection.js.map +1 -1
  294. package/dist/track/getInfo.js +11 -0
  295. package/dist/track/getInfo.js.map +1 -1
  296. package/dist/track/getSimilar.js +11 -0
  297. package/dist/track/getSimilar.js.map +1 -1
  298. package/dist/track/getTags.js +11 -0
  299. package/dist/track/getTags.js.map +1 -1
  300. package/dist/track/getTopTags.js +10 -0
  301. package/dist/track/getTopTags.js.map +1 -1
  302. package/dist/track/love.js +10 -0
  303. package/dist/track/love.js.map +1 -1
  304. package/dist/track/removeTag.js +11 -0
  305. package/dist/track/removeTag.js.map +1 -1
  306. package/dist/track/scrobble.js +12 -0
  307. package/dist/track/scrobble.js.map +1 -1
  308. package/dist/track/search.js +11 -0
  309. package/dist/track/search.js.map +1 -1
  310. package/dist/track/unlove.js +10 -0
  311. package/dist/track/unlove.js.map +1 -1
  312. package/dist/track/updateNowPlaying.js +11 -0
  313. package/dist/track/updateNowPlaying.js.map +1 -1
  314. package/dist/user/getPersonalTags.js +12 -0
  315. package/dist/user/getPersonalTags.js.map +1 -1
  316. package/package.json +13 -10
package/README.md CHANGED
@@ -5,129 +5,195 @@
5
5
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/ba3b73c24e06433fabe0efed8b43d026)](https://www.codacy.com/gh/mannuelf/lastfm-nodejs-client/dashboard?utm_source=github.com&utm_medium=referral&utm_content=mannuelf/lastfm-nodejs-client&utm_campaign=Badge_Grade)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- A Node JS wrapper client for fetching public data from [LastFm API](https://www.last.fm/api).
8
+ A TypeScript client for the [Last.fm API](https://www.last.fm/api). Works in Node.js ≥18 and all modern browsers — no polyfills required.
9
9
 
10
- Fetch server side or client side, thanks to [cross-fetch](https://github.com/lquixada/cross-fetch)
10
+ ## Why use this
11
11
 
12
- ## How to use the client
12
+ **Zero dependencies.** The library ships no third-party runtime dependencies. HTTP requests use the native `fetch` API built into Node.js ≥18, and API signatures are generated with the built-in `node:crypto` module. Installing it won't bloat your `node_modules` or introduce supply-chain risk.
13
13
 
14
- Install the npm package in your project.
14
+ **Fully typed.** Every API response has a hand-written TypeScript interface, so you get autocomplete and type safety straight out of the box no extra `@types` packages needed.
15
+
16
+ **Dual ESM + CJS.** The package ships both ES module and CommonJS builds, so it works in any Node.js project regardless of whether you use `import` or `require`.
17
+
18
+ ## Install
15
19
 
16
20
  ```bash
17
- pnpm install
21
+ pnpm add lastfm-nodejs-client
18
22
  ```
19
23
 
20
- Consider [PNPM](https://pnpm.io/) ▶️
24
+ ```bash
25
+ npm install lastfm-nodejs-client
26
+ ```
21
27
 
22
- ### Import it
28
+ ```bash
29
+ yarn add lastfm-nodejs-client
30
+ ```
23
31
 
24
- Import the client module:
32
+ ```bash
33
+ bun add lastfm-nodejs-client
34
+ ```
25
35
 
26
- ```js
27
- import { lastFm } from 'lastfm-nodejs-client';
36
+ ```ts
37
+ // Deno
38
+ import LastFmApi from 'jsr:@mannuelf/lastfm-nodejs-client';
28
39
  ```
29
40
 
30
- Import the Types as type:
41
+ ## Setup
42
+
43
+ Create a `.env` file in your project root:
31
44
 
32
- ```js
33
- import type {
34
- Artist,
35
- Track,
36
- User,
37
- WeeklyAlbum,
38
- } from 'lastfm-nodejs-client/dist/@types/lastfm.types';
45
+ ```bash
46
+ LASTFM_API_BASE_URL="https://ws.audioscrobbler.com/2.0/"
47
+ LASTFM_USER="your_username"
48
+ LASTFM_API_KEY="your_api_key"
49
+ LASTFM_APPNAME="your_app_name"
50
+ LASTFM_SHARED_SECRET="your_shared_secret"
39
51
  ```
40
52
 
41
- _Working on getting these into [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped)_
53
+ Get your API key at [last.fm/api/account/create](https://www.last.fm/api/account/create).
54
+
55
+ ## Usage
42
56
 
43
- ### Use it
57
+ ```ts
58
+ import LastFmApi from 'lastfm-nodejs-client';
44
59
 
45
- ```js
46
60
  const lastFm = LastFmApi();
47
- const { config, method } = lastFm;
48
-
49
- const getTopArtists = async () => {
50
- const data = await lastFm.getTopArtists(
51
- method.user.top_artists,
52
- config.username,
53
- 'overall',
54
- '200',
55
- );
56
- const { topartists } = data;
57
- return topartists;
58
- };
61
+ const { method } = lastFm;
59
62
  ```
60
63
 
61
- 🚀 Gives you:
62
-
63
- ![user](https://res.cloudinary.com/mannuel/image/upload/v1668059500/topartist.png)
64
+ ### Get a user's top artists
64
65
 
65
- ## Developing client
66
+ ```ts
67
+ import LastFmApi from 'lastfm-nodejs-client';
68
+ import type { TopArtistsResponse } from 'lastfm-nodejs-client';
66
69
 
67
- Written in TypeScript, compiles down to ES2015, provides the types for the lastFm entities.
70
+ const lastFm = LastFmApi();
71
+ const { method } = lastFm;
68
72
 
69
- ## Fork repo
73
+ const data: TopArtistsResponse = await lastFm.getTopArtists(
74
+ method.user.getTopArtists,
75
+ 'your_username',
76
+ 'overall', // period: overall | 7day | 1month | 3month | 6month | 12month
77
+ '10', // limit
78
+ );
70
79
 
71
- ```bash
72
- gh repo fork mannuelf/lastfm-nodejs-client
80
+ console.log(data.topartists.artist);
73
81
  ```
74
82
 
75
- What's gh? [Get it here](https://cli.github.com/manual/gh_repo_fork)
83
+ ### Get a user's recent tracks
76
84
 
77
- ### Postman collections
85
+ ```ts
86
+ import LastFmApi from 'lastfm-nodejs-client';
87
+ import type { RecentTracksResponse } from 'lastfm-nodejs-client';
78
88
 
79
- A list of endpoints currently mapped to this client. Still under development, not feature complete.
89
+ const lastFm = LastFmApi();
90
+ const { method } = lastFm;
80
91
 
81
- [View collections](https://documenter.getpostman.com/view/4217/2s8YKJELqJ) ▶️
92
+ const data: RecentTracksResponse = await lastFm.getRecentTracks(
93
+ method.user.getRecentTracks,
94
+ 'your_username',
95
+ '10', // limit
96
+ );
82
97
 
83
- ### ENV
98
+ console.log(data.recenttracks.track);
99
+ ```
84
100
 
85
- Create `.env` file in project root:
101
+ ### Get artist info
86
102
 
87
- You do not need an API key to query the public USER entity, add only base url and a username to env file.
103
+ ```ts
104
+ import LastFmApi from 'lastfm-nodejs-client';
105
+ import type { ArtistInfoResponse } from 'lastfm-nodejs-client';
88
106
 
89
- ```bash
90
- LASTFM_API_BASE_URL=""
91
- LASTFM_USER=""
92
- ```
107
+ const lastFm = LastFmApi();
108
+ const { method } = lastFm;
93
109
 
94
- For everything else you will need to include:
110
+ const data: ArtistInfoResponse = await lastFm.artist.artistGetInfo(
111
+ method.artist.getInfo,
112
+ 'Radiohead',
113
+ );
95
114
 
96
- ```bash
97
- LASTFM_API_KEY=""
98
- LASTFM_APPNAME=""
115
+ console.log(data.artist);
99
116
  ```
100
117
 
101
- Create them [here](https://www.last.fm/api/account/create).
118
+ ### Get album info
102
119
 
103
- ### Develop
120
+ ```ts
121
+ import LastFmApi from 'lastfm-nodejs-client';
122
+ import type { AlbumInfoResponse } from 'lastfm-nodejs-client';
104
123
 
105
- ```bash
106
- pnpm test
124
+ const lastFm = LastFmApi();
125
+ const { method } = lastFm;
126
+
127
+ const data: AlbumInfoResponse = await lastFm.album.albumGetInfo(
128
+ method.album.getInfo,
129
+ 'Radiohead',
130
+ 'OK Computer',
131
+ );
132
+
133
+ console.log(data.album);
107
134
  ```
108
135
 
109
- ```bash
110
- pnpm lint
111
- pnpm lint-fix
136
+ ### Search for a track
137
+
138
+ ```ts
139
+ import LastFmApi from 'lastfm-nodejs-client';
140
+ import type { TrackSearchResponse } from 'lastfm-nodejs-client';
141
+
142
+ const lastFm = LastFmApi();
143
+ const { method } = lastFm;
144
+
145
+ const data: TrackSearchResponse = await lastFm.track.trackSearch(
146
+ method.track.search,
147
+ 'Creep',
148
+ 'Radiohead', // optional artist filter
149
+ '5', // limit
150
+ );
151
+
152
+ console.log(data.results.trackmatches.track);
112
153
  ```
113
154
 
114
- ### Build
155
+ ### Love a track (authenticated)
115
156
 
116
- ```bash
117
- pnpm build
157
+ Requires a session key (`sk`) obtained via `auth.getMobileSession` or `auth.getSession`.
158
+
159
+ ```ts
160
+ import LastFmApi from 'lastfm-nodejs-client';
161
+
162
+ const lastFm = LastFmApi();
163
+ const { method } = lastFm;
164
+
165
+ await lastFm.track.trackLove(method.track.love, 'Radiohead', 'Creep', 'your_session_key');
118
166
  ```
119
167
 
120
- ### Publish
168
+ ## All available namespaces
169
+
170
+ | Namespace | Methods |
171
+ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
172
+ | `album` | `albumGetInfo`, `albumGetTags`, `albumGetTopTags`, `albumSearch`, `albumAddTags`, `albumRemoveTag` |
173
+ | `artist` | `artistGetInfo`, `artistGetSimilar`, `artistGetTags`, `artistGetTopAlbums`, `artistGetTopTags`, `artistGetTopTracks`, `artistSearch`, `artistAddTags`, `artistRemoveTag`, `artistGetCorrection` |
174
+ | `auth` | `getToken`, `getSession`, `getMobileSession` |
175
+ | `chart` | `chartTopArtists`, `chartTopTracks`, `chartTopTags` |
176
+ | `geo` | `geoGetTopArtists`, `geoGetTopTracks` |
177
+ | `library` | `libraryGetArtists` |
178
+ | `tag` | `tagGetInfo`, `tagGetSimilar`, `tagGetTopAlbums`, `tagGetTopArtists`, `tagGetTopTags`, `tagGetWeeklyChartList`, `tagTopTracks` |
179
+ | `track` | `trackGetInfo`, `trackGetSimilar`, `trackGetTags`, `trackGetTopTags`, `trackSearch`, `trackLove`, `trackUnlove`, `trackAddTags`, `trackRemoveTag`, `trackScrobble`, `trackUpdateNowPlaying`, `trackGetCorrection` |
180
+ | `user` | `userGetPersonalTags` |
181
+
182
+ Legacy flat methods also available: `getTopArtists`, `getTopTracks`, `getRecentTracks`, `getLovedTracks`, `getInfo`, `getFriends`, `getUserTopTags`, `getWeeklyAlbumChart`, `getWeeklyArtistChart`, `getWeeklyChartList`, `getWeeklyTrackChart`, `getTopAlbums`.
183
+
184
+ ## Developing
121
185
 
122
186
  ```bash
123
- pnpm prepare
124
- pnpm publish
187
+ gh repo fork mannuelf/lastfm-nodejs-client
125
188
  ```
126
189
 
127
- ### Why I built this?
128
-
129
- I was building a scrobbles page [https://mannuelferreira.com/scrobbles](https://mannuelferreira.com/scrobbles) and I thought others might want it to.
190
+ ```bash
191
+ pnpm install
192
+ pnpm test
193
+ pnpm lint
194
+ pnpm build
195
+ ```
130
196
 
131
- ### TODO
197
+ ### Why I built this
132
198
 
133
- - move types into [DefinitelyTyped](https://github.com/mannuelf/DefinitelyTyped)
199
+ I was building a scrobbles page at [mannuelferreira.com/scrobbles](https://mannuelferreira.com/scrobbles) and thought others might find it useful.
@@ -1,2 +1,13 @@
1
1
  import type { AuthResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Tag an album using a list of user-supplied tags. Requires authentication.
4
+ *
5
+ * @see https://www.last.fm/api/show/album.addTags
6
+ * @param method - The Last.fm API method string (`method.album.addTags`)
7
+ * @param artist - The artist name
8
+ * @param album - The album name
9
+ * @param tags - A comma-separated list of tags to apply (max 10)
10
+ * @param sk - A session key obtained via the auth flow
11
+ * @returns Authentication response confirming the operation
12
+ */
2
13
  export declare function albumAddTags(method: string, artist: string, album: string, tags: string, sk: string): Promise<AuthResponse>;
@@ -1,2 +1,13 @@
1
1
  import type { AlbumInfoResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the metadata and tracklist for an album on Last.fm.
4
+ *
5
+ * @see https://www.last.fm/api/show/album.getInfo
6
+ * @param method - The Last.fm API method string (`method.album.getInfo`)
7
+ * @param artist - The artist name
8
+ * @param album - The album name
9
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
10
+ * @param lang - ISO 639 alpha-2 language code for the biography text (default `'en'`)
11
+ * @returns Album metadata including tracklist, wiki, and tags
12
+ */
2
13
  export declare function albumGetInfo(method: string, artist: string, album: string, autocorrect?: string, lang?: string): Promise<AlbumInfoResponse>;
@@ -1,2 +1,13 @@
1
1
  import type { AlbumTagsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the tags applied by an individual user to an album on Last.fm.
4
+ *
5
+ * @see https://www.last.fm/api/show/album.getTags
6
+ * @param method - The Last.fm API method string (`method.album.getTags`)
7
+ * @param artist - The artist name
8
+ * @param album - The album name
9
+ * @param user - The Last.fm username whose tags to retrieve
10
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
11
+ * @returns Tags applied by the user to this album
12
+ */
2
13
  export declare function albumGetTags(method: string, artist: string, album: string, user: string, autocorrect?: string): Promise<AlbumTagsResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { AlbumTopTagsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top tags applied to an album on Last.fm, ordered by tag count.
4
+ *
5
+ * @see https://www.last.fm/api/show/album.getTopTags
6
+ * @param method - The Last.fm API method string (`method.album.getTopTags`)
7
+ * @param artist - The artist name
8
+ * @param album - The album name
9
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
10
+ * @returns Top tags for the album ordered by tag count
11
+ */
2
12
  export declare function albumGetTopTags(method: string, artist: string, album: string, autocorrect?: string): Promise<AlbumTopTagsResponse>;
@@ -1,2 +1,13 @@
1
1
  import type { AuthResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Remove a user-applied tag from an album. Requires authentication.
4
+ *
5
+ * @see https://www.last.fm/api/show/album.removeTag
6
+ * @param method - The Last.fm API method string (`method.album.removeTag`)
7
+ * @param artist - The artist name
8
+ * @param album - The album name
9
+ * @param tag - A single tag to remove from the album
10
+ * @param sk - A session key obtained via the auth flow
11
+ * @returns Authentication response confirming the operation
12
+ */
2
13
  export declare function albumRemoveTag(method: string, artist: string, album: string, tag: string, sk: string): Promise<AuthResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { AlbumSearchResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Search for an album by name on Last.fm. Returns paginated results.
4
+ *
5
+ * @see https://www.last.fm/api/show/album.search
6
+ * @param method - The Last.fm API method string (`method.album.search`)
7
+ * @param album - The album name to search for
8
+ * @param limit - Number of results per page (default `'30'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @returns Paginated album search results
11
+ */
2
12
  export declare function albumSearch(method: string, album: string, limit?: string, page?: string): Promise<AlbumSearchResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { AuthResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Tag an artist using a list of user-supplied tags. Requires authentication.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.addTags
6
+ * @param method - The Last.fm API method string (`method.artist.addTags`)
7
+ * @param artist - The artist name
8
+ * @param tags - A comma-separated list of tags to apply (max 10)
9
+ * @param sk - A session key obtained via the auth flow
10
+ * @returns Authentication response confirming the operation
11
+ */
2
12
  export declare function artistAddTags(method: string, artist: string, tags: string, sk: string): Promise<AuthResponse>;
@@ -1,2 +1,11 @@
1
1
  import type { ArtistCorrectionResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Use the Last.fm corrections data to check whether the supplied artist has a correction
4
+ * to a canonical artist name.
5
+ *
6
+ * @see https://www.last.fm/api/show/artist.getCorrection
7
+ * @param method - The Last.fm API method string (`method.artist.getCorrection`)
8
+ * @param artist - The artist name to check for a correction
9
+ * @returns The corrected canonical artist name if one exists
10
+ */
2
11
  export declare function artistGetCorrection(method: string, artist: string): Promise<ArtistCorrectionResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { ArtistInfoResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the metadata for an artist on Last.fm. Includes biography, tags, and similar artists.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.getInfo
6
+ * @param method - The Last.fm API method string (`method.artist.getInfo`)
7
+ * @param artist - The artist name
8
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
9
+ * @param lang - ISO 639 alpha-2 language code for the biography text (default `'en'`)
10
+ * @returns Artist metadata including biography, similar artists, and top tags
11
+ */
2
12
  export declare function artistGetInfo(method: string, artist: string, autocorrect?: string, lang?: string): Promise<ArtistInfoResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { ArtistSimilarResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get all the artists similar to this artist.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.getSimilar
6
+ * @param method - The Last.fm API method string (`method.artist.getSimilar`)
7
+ * @param artist - The artist name
8
+ * @param limit - Maximum number of similar artists to return (default `'30'`)
9
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
10
+ * @returns A list of similar artists with match scores
11
+ */
2
12
  export declare function artistGetSimilar(method: string, artist: string, limit?: string, autocorrect?: string): Promise<ArtistSimilarResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { ArtistTagsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the tags applied by an individual user to an artist on Last.fm.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.getTags
6
+ * @param method - The Last.fm API method string (`method.artist.getTags`)
7
+ * @param artist - The artist name
8
+ * @param user - The Last.fm username whose tags to retrieve
9
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
10
+ * @returns Tags applied by the user to this artist
11
+ */
2
12
  export declare function artistGetTags(method: string, artist: string, user: string, autocorrect?: string): Promise<ArtistTagsResponse>;
@@ -1,2 +1,13 @@
1
1
  import type { ArtistTopAlbumsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top albums for an artist on Last.fm, ordered by popularity.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.getTopAlbums
6
+ * @param method - The Last.fm API method string (`method.artist.getTopAlbums`)
7
+ * @param artist - The artist name
8
+ * @param limit - Number of results per page (default `'50'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
11
+ * @returns Paginated list of the artist's top albums
12
+ */
2
13
  export declare function artistGetTopAlbums(method: string, artist: string, limit?: string, page?: string, autocorrect?: string): Promise<ArtistTopAlbumsResponse>;
@@ -1,2 +1,11 @@
1
1
  import type { ArtistTopTagsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top tags for an artist on Last.fm, ordered by popularity.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.getTopTags
6
+ * @param method - The Last.fm API method string (`method.artist.getTopTags`)
7
+ * @param artist - The artist name
8
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
9
+ * @returns Top tags for the artist ordered by tag count
10
+ */
2
11
  export declare function artistGetTopTags(method: string, artist: string, autocorrect?: string): Promise<ArtistTopTagsResponse>;
@@ -1,2 +1,13 @@
1
1
  import type { ArtistTopTracksResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top tracks for an artist on Last.fm, ordered by popularity.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.getTopTracks
6
+ * @param method - The Last.fm API method string (`method.artist.getTopTracks`)
7
+ * @param artist - The artist name
8
+ * @param limit - Number of results per page (default `'50'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
11
+ * @returns Paginated list of the artist's top tracks
12
+ */
2
13
  export declare function artistGetTopTracks(method: string, artist: string, limit?: string, page?: string, autocorrect?: string): Promise<ArtistTopTracksResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { AuthResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Remove a user-applied tag from an artist. Requires authentication.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.removeTag
6
+ * @param method - The Last.fm API method string (`method.artist.removeTag`)
7
+ * @param artist - The artist name
8
+ * @param tag - A single tag to remove from the artist
9
+ * @param sk - A session key obtained via the auth flow
10
+ * @returns Authentication response confirming the operation
11
+ */
2
12
  export declare function artistRemoveTag(method: string, artist: string, tag: string, sk: string): Promise<AuthResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { ArtistSearchResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Search for an artist by name on Last.fm. Returns paginated results.
4
+ *
5
+ * @see https://www.last.fm/api/show/artist.search
6
+ * @param method - The Last.fm API method string (`method.artist.search`)
7
+ * @param artist - The artist name to search for
8
+ * @param limit - Number of results per page (default `'30'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @returns Paginated artist search results
11
+ */
2
12
  export declare function artistSearch(method: string, artist: string, limit?: string, page?: string): Promise<ArtistSearchResponse>;
@@ -1,2 +1,13 @@
1
1
  import type { AuthMobileSessionResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Create a session for a user using their username and password (mobile auth flow).
4
+ *
5
+ * The returned session key can be used for authenticated write operations.
6
+ *
7
+ * @see https://www.last.fm/api/show/auth.getMobileSession
8
+ * @param method - The Last.fm API method string (`method.auth.getMobileSession`)
9
+ * @param username - The Last.fm username
10
+ * @param password - The user's plaintext password
11
+ * @returns A session key valid for write operations
12
+ */
2
13
  export declare function authGetMobileSession(method: string, username: string, password: string): Promise<AuthMobileSessionResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { AuthSessionResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Fetch a session key for a user after they have authorised a token via the Last.fm web auth flow.
4
+ *
5
+ * Tokens are valid for 60 minutes and can only be used once.
6
+ *
7
+ * @see https://www.last.fm/api/show/auth.getSession
8
+ * @param method - The Last.fm API method string (`method.auth.getSession`)
9
+ * @param token - The token previously granted by `auth.getToken` and authorised by the user
10
+ * @returns A session key valid for write operations
11
+ */
2
12
  export declare function authGetSession(method: string, token: string): Promise<AuthSessionResponse>;
@@ -1,12 +1,15 @@
1
1
  import { type AuthResponse } from './lastfm.types.js';
2
2
  /**
3
- * POST: Auth - LastFM
3
+ * Fetch an unauthenticated token for the web auth flow.
4
4
  *
5
- * https://www.last.fm/api/show/auth.getToken
5
+ * Tokens are API-account-specific, valid for 60 minutes, and consumed
6
+ * once a session is created via `auth.getSession`.
6
7
  *
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
8
+ * @see https://www.last.fm/api/show/auth.getToken
9
+ * @param method - The Last.fm API method string (`method.auth.getToken`)
10
+ * @param user - The Last.fm username
11
+ * @param period - The time period parameter
12
+ * @param limit - The limit parameter
13
+ * @returns An unauthenticated token to redirect the user to the Last.fm auth page
11
14
  */
12
15
  export declare function auth(method: string, user: string, period: string, limit: string): Promise<AuthResponse>;
@@ -1,2 +1,13 @@
1
1
  import type { ChartTopArtistResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top artists chart on Last.fm.
4
+ *
5
+ * @see https://www.last.fm/api/show/chart.getTopArtists
6
+ * @param method - The Last.fm API method string (`method.chart.getTopArtists`)
7
+ * @param user - The Last.fm username
8
+ * @param period - The time period over which to retrieve the chart
9
+ * @param page - Page number to fetch
10
+ * @param limit - Number of results per page
11
+ * @returns Paginated list of the most popular artists globally
12
+ */
2
13
  export declare function chartTopArtists(method: string, user: string, period: string, page: string, limit: string): Promise<ChartTopArtistResponse>;
@@ -1,2 +1,10 @@
1
1
  import type { ChartTopTagsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top tags chart on Last.fm, ordered by tag popularity.
4
+ *
5
+ * @see https://www.last.fm/api/show/chart.getTopTags
6
+ * @param method - The Last.fm API method string (`method.chart.getTopTags`)
7
+ * @param page - Page number to fetch
8
+ * @returns Paginated list of the most popular tags globally
9
+ */
2
10
  export declare function chartTopTags(method: string, page: string): Promise<ChartTopTagsResponse>;
@@ -1,2 +1,10 @@
1
1
  import type { ChartTopTracksResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top tracks chart on Last.fm.
4
+ *
5
+ * @see https://www.last.fm/api/show/chart.getTopTracks
6
+ * @param method - The Last.fm API method string (`method.chart.getTopTracks`)
7
+ * @param page - Page number to fetch
8
+ * @returns Paginated list of the most popular tracks globally
9
+ */
2
10
  export declare function chartTopTracks(method: string, page: string): Promise<ChartTopTracksResponse>;
@@ -1,13 +1,4 @@
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: {
1
+ interface Config {
11
2
  api_key: string;
12
3
  app_name: string;
13
4
  base_url: string;
@@ -17,4 +8,15 @@ export declare const config: {
17
8
  };
18
9
  share_secret: string;
19
10
  username: string;
20
- };
11
+ }
12
+ /**
13
+ * @description Stores the Last.fm API key, app name, base url, format, shared secret, and username.
14
+ * Simply add a .env file to the root of the project and add the following:
15
+ * LASTFM_API_KEY=your_api_key
16
+ * LASTFM_APPNAME=your_app_name
17
+ * LASTFM_API_BASE_URL=your_base_url
18
+ * LASTFM_SHARED_SECRET=your_shared_secret
19
+ * LASTFM_USER=your_username
20
+ */
21
+ export declare const config: Config;
22
+ export {};
@@ -1,3 +1,26 @@
1
+ /**
2
+ * Builds a request options object for use with `request` or `signedRequest`.
3
+ *
4
+ * @param method - The Last.fm API method string (e.g. `'user.getInfo'`)
5
+ * @param user - Last.fm username
6
+ * @param period - Time period (`overall`, `7day`, `1month`, `3month`, `6month`, `12month`)
7
+ * @param limit - Number of results to return per page
8
+ * @param page - Page number for paginated results (1-indexed)
9
+ * @param from - Unix timestamp; only return scrobbles after this time
10
+ * @param tag - Tag name
11
+ * @param artist - Artist name
12
+ * @param album - Album title
13
+ * @param track - Track title
14
+ * @param country - Country name as defined by the ISO 3166-1 standard
15
+ * @param autocorrect - Set to `'1'` to auto-correct misspelled artist/track names
16
+ * @param mbid - MusicBrainz ID for the resource
17
+ * @param lang - ISO 639 alpha-2 language code for localised text (default `'en'`)
18
+ * @param sk - Session key obtained via the auth flow
19
+ * @param token - Authentication token from `auth.getToken`
20
+ * @param tags - Comma-separated list of user-supplied tags (max 10)
21
+ * @param timestamp - Unix timestamp of the scrobble
22
+ * @returns A request options object ready to pass to `request` or `signedRequest`
23
+ */
1
24
  export declare function createOptions(method: string, user: string, period?: string, limit?: string, page?: string, from?: string, tag?: string, artist?: string, album?: string, track?: string, country?: string, autocorrect?: string, mbid?: string, lang?: string, sk?: string, token?: string, tags?: string, timestamp?: string): {
2
25
  method: string;
3
26
  page: string | undefined;