lastfm-nodejs-client 1.6.0 → 1.7.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 (310) 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/library/getArtists.d.ts +10 -0
  42. package/dist/@types/method.d.ts +25 -77
  43. package/dist/@types/request.d.ts +23 -0
  44. package/dist/@types/tag/getInfo.d.ts +9 -0
  45. package/dist/@types/tag/getSimilar.d.ts +8 -0
  46. package/dist/@types/tag/getTopAlbums.d.ts +10 -0
  47. package/dist/@types/tag/getTopArtists.d.ts +10 -0
  48. package/dist/@types/tag/getTopTags.d.ts +7 -0
  49. package/dist/@types/tag/getWeeklyChartList.d.ts +9 -0
  50. package/dist/@types/tag/topTracks.d.ts +6 -3
  51. package/dist/@types/track/addTags.d.ts +11 -0
  52. package/dist/@types/track/getCorrection.d.ts +10 -0
  53. package/dist/@types/track/getInfo.d.ts +11 -0
  54. package/dist/@types/track/getSimilar.d.ts +11 -0
  55. package/dist/@types/track/getTags.d.ts +11 -0
  56. package/dist/@types/track/getTopTags.d.ts +10 -0
  57. package/dist/@types/track/love.d.ts +10 -0
  58. package/dist/@types/track/removeTag.d.ts +11 -0
  59. package/dist/@types/track/scrobble.d.ts +12 -0
  60. package/dist/@types/track/search.d.ts +11 -0
  61. package/dist/@types/track/unlove.d.ts +10 -0
  62. package/dist/@types/track/updateNowPlaying.d.ts +11 -0
  63. package/dist/@types/user/getPersonalTags.d.ts +12 -0
  64. package/dist/album/addTags.js +11 -0
  65. package/dist/album/addTags.js.map +1 -1
  66. package/dist/album/getInfo.js +11 -0
  67. package/dist/album/getInfo.js.map +1 -1
  68. package/dist/album/getTags.js +11 -0
  69. package/dist/album/getTags.js.map +1 -1
  70. package/dist/album/getTopTags.js +10 -0
  71. package/dist/album/getTopTags.js.map +1 -1
  72. package/dist/album/removeTag.js +11 -0
  73. package/dist/album/removeTag.js.map +1 -1
  74. package/dist/album/search.js +10 -0
  75. package/dist/album/search.js.map +1 -1
  76. package/dist/artist/addTags.js +10 -0
  77. package/dist/artist/addTags.js.map +1 -1
  78. package/dist/artist/getCorrection.js +9 -0
  79. package/dist/artist/getCorrection.js.map +1 -1
  80. package/dist/artist/getInfo.js +10 -0
  81. package/dist/artist/getInfo.js.map +1 -1
  82. package/dist/artist/getSimilar.js +10 -0
  83. package/dist/artist/getSimilar.js.map +1 -1
  84. package/dist/artist/getTags.js +10 -0
  85. package/dist/artist/getTags.js.map +1 -1
  86. package/dist/artist/getTopAlbums.js +11 -0
  87. package/dist/artist/getTopAlbums.js.map +1 -1
  88. package/dist/artist/getTopTags.js +9 -0
  89. package/dist/artist/getTopTags.js.map +1 -1
  90. package/dist/artist/getTopTracks.js +11 -0
  91. package/dist/artist/getTopTracks.js.map +1 -1
  92. package/dist/artist/removeTag.js +10 -0
  93. package/dist/artist/removeTag.js.map +1 -1
  94. package/dist/artist/search.js +10 -0
  95. package/dist/artist/search.js.map +1 -1
  96. package/dist/auth/getMobileSession.js +11 -0
  97. package/dist/auth/getMobileSession.js.map +1 -1
  98. package/dist/auth/getSession.js +10 -0
  99. package/dist/auth/getSession.js.map +1 -1
  100. package/dist/auth.js +9 -6
  101. package/dist/auth.js.map +1 -1
  102. package/dist/chart/topArtists.js +11 -0
  103. package/dist/chart/topArtists.js.map +1 -1
  104. package/dist/chart/topTags.js +8 -0
  105. package/dist/chart/topTags.js.map +1 -1
  106. package/dist/chart/topTracks.js +8 -0
  107. package/dist/chart/topTracks.js.map +1 -1
  108. package/dist/cjs/album/addTags.js +11 -0
  109. package/dist/cjs/album/addTags.js.map +1 -1
  110. package/dist/cjs/album/getInfo.js +11 -0
  111. package/dist/cjs/album/getInfo.js.map +1 -1
  112. package/dist/cjs/album/getTags.js +11 -0
  113. package/dist/cjs/album/getTags.js.map +1 -1
  114. package/dist/cjs/album/getTopTags.js +10 -0
  115. package/dist/cjs/album/getTopTags.js.map +1 -1
  116. package/dist/cjs/album/removeTag.js +11 -0
  117. package/dist/cjs/album/removeTag.js.map +1 -1
  118. package/dist/cjs/album/search.js +10 -0
  119. package/dist/cjs/album/search.js.map +1 -1
  120. package/dist/cjs/artist/addTags.js +10 -0
  121. package/dist/cjs/artist/addTags.js.map +1 -1
  122. package/dist/cjs/artist/getCorrection.js +9 -0
  123. package/dist/cjs/artist/getCorrection.js.map +1 -1
  124. package/dist/cjs/artist/getInfo.js +10 -0
  125. package/dist/cjs/artist/getInfo.js.map +1 -1
  126. package/dist/cjs/artist/getSimilar.js +10 -0
  127. package/dist/cjs/artist/getSimilar.js.map +1 -1
  128. package/dist/cjs/artist/getTags.js +10 -0
  129. package/dist/cjs/artist/getTags.js.map +1 -1
  130. package/dist/cjs/artist/getTopAlbums.js +11 -0
  131. package/dist/cjs/artist/getTopAlbums.js.map +1 -1
  132. package/dist/cjs/artist/getTopTags.js +9 -0
  133. package/dist/cjs/artist/getTopTags.js.map +1 -1
  134. package/dist/cjs/artist/getTopTracks.js +11 -0
  135. package/dist/cjs/artist/getTopTracks.js.map +1 -1
  136. package/dist/cjs/artist/removeTag.js +10 -0
  137. package/dist/cjs/artist/removeTag.js.map +1 -1
  138. package/dist/cjs/artist/search.js +10 -0
  139. package/dist/cjs/artist/search.js.map +1 -1
  140. package/dist/cjs/auth/getMobileSession.js +11 -0
  141. package/dist/cjs/auth/getMobileSession.js.map +1 -1
  142. package/dist/cjs/auth/getSession.js +10 -0
  143. package/dist/cjs/auth/getSession.js.map +1 -1
  144. package/dist/cjs/auth.js +9 -6
  145. package/dist/cjs/auth.js.map +1 -1
  146. package/dist/cjs/chart/topArtists.js +11 -0
  147. package/dist/cjs/chart/topArtists.js.map +1 -1
  148. package/dist/cjs/chart/topTags.js +8 -0
  149. package/dist/cjs/chart/topTags.js.map +1 -1
  150. package/dist/cjs/chart/topTracks.js +8 -0
  151. package/dist/cjs/chart/topTracks.js.map +1 -1
  152. package/dist/cjs/config.js.map +1 -1
  153. package/dist/cjs/createOptions.js +23 -0
  154. package/dist/cjs/createOptions.js.map +1 -1
  155. package/dist/cjs/geo/getTopArtists.js +10 -0
  156. package/dist/cjs/geo/getTopArtists.js.map +1 -1
  157. package/dist/cjs/geo/getTopTracks.js +10 -0
  158. package/dist/cjs/geo/getTopTracks.js.map +1 -1
  159. package/dist/cjs/getFriends.js +6 -3
  160. package/dist/cjs/getFriends.js.map +1 -1
  161. package/dist/cjs/getInfo.js +5 -3
  162. package/dist/cjs/getInfo.js.map +1 -1
  163. package/dist/cjs/getLovedTracks.js +7 -3
  164. package/dist/cjs/getLovedTracks.js.map +1 -1
  165. package/dist/cjs/getRecentTracks.js +7 -3
  166. package/dist/cjs/getRecentTracks.js.map +1 -1
  167. package/dist/cjs/getTopAlbums.js +7 -3
  168. package/dist/cjs/getTopAlbums.js.map +1 -1
  169. package/dist/cjs/getTopArtists.js +7 -3
  170. package/dist/cjs/getTopArtists.js.map +1 -1
  171. package/dist/cjs/getTopTracks.js +7 -3
  172. package/dist/cjs/getTopTracks.js.map +1 -1
  173. package/dist/cjs/getUserTopTags.js +6 -3
  174. package/dist/cjs/getUserTopTags.js.map +1 -1
  175. package/dist/cjs/getWeeklyAlbumChart.js +7 -3
  176. package/dist/cjs/getWeeklyAlbumChart.js.map +1 -1
  177. package/dist/cjs/getWeeklyArtistChart.js +7 -3
  178. package/dist/cjs/getWeeklyArtistChart.js.map +1 -1
  179. package/dist/cjs/getWeeklyChartList.js +8 -3
  180. package/dist/cjs/getWeeklyChartList.js.map +1 -1
  181. package/dist/cjs/getWeeklyTrackChart.js +7 -3
  182. package/dist/cjs/getWeeklyTrackChart.js.map +1 -1
  183. package/dist/cjs/index.js +21 -0
  184. package/dist/cjs/index.js.map +1 -1
  185. package/dist/cjs/library/getArtists.js +10 -0
  186. package/dist/cjs/library/getArtists.js.map +1 -1
  187. package/dist/cjs/method.js +11 -0
  188. package/dist/cjs/method.js.map +1 -1
  189. package/dist/cjs/request.js +30 -0
  190. package/dist/cjs/request.js.map +1 -1
  191. package/dist/cjs/tag/getInfo.js +9 -0
  192. package/dist/cjs/tag/getInfo.js.map +1 -1
  193. package/dist/cjs/tag/getSimilar.js +8 -0
  194. package/dist/cjs/tag/getSimilar.js.map +1 -1
  195. package/dist/cjs/tag/getTopAlbums.js +10 -0
  196. package/dist/cjs/tag/getTopAlbums.js.map +1 -1
  197. package/dist/cjs/tag/getTopArtists.js +10 -0
  198. package/dist/cjs/tag/getTopArtists.js.map +1 -1
  199. package/dist/cjs/tag/getTopTags.js +7 -0
  200. package/dist/cjs/tag/getTopTags.js.map +1 -1
  201. package/dist/cjs/tag/getWeeklyChartList.js +9 -0
  202. package/dist/cjs/tag/getWeeklyChartList.js.map +1 -1
  203. package/dist/cjs/tag/topTracks.js +6 -3
  204. package/dist/cjs/tag/topTracks.js.map +1 -1
  205. package/dist/cjs/track/addTags.js +11 -0
  206. package/dist/cjs/track/addTags.js.map +1 -1
  207. package/dist/cjs/track/getCorrection.js +10 -0
  208. package/dist/cjs/track/getCorrection.js.map +1 -1
  209. package/dist/cjs/track/getInfo.js +11 -0
  210. package/dist/cjs/track/getInfo.js.map +1 -1
  211. package/dist/cjs/track/getSimilar.js +11 -0
  212. package/dist/cjs/track/getSimilar.js.map +1 -1
  213. package/dist/cjs/track/getTags.js +11 -0
  214. package/dist/cjs/track/getTags.js.map +1 -1
  215. package/dist/cjs/track/getTopTags.js +10 -0
  216. package/dist/cjs/track/getTopTags.js.map +1 -1
  217. package/dist/cjs/track/love.js +10 -0
  218. package/dist/cjs/track/love.js.map +1 -1
  219. package/dist/cjs/track/removeTag.js +11 -0
  220. package/dist/cjs/track/removeTag.js.map +1 -1
  221. package/dist/cjs/track/scrobble.js +12 -0
  222. package/dist/cjs/track/scrobble.js.map +1 -1
  223. package/dist/cjs/track/search.js +11 -0
  224. package/dist/cjs/track/search.js.map +1 -1
  225. package/dist/cjs/track/unlove.js +10 -0
  226. package/dist/cjs/track/unlove.js.map +1 -1
  227. package/dist/cjs/track/updateNowPlaying.js +11 -0
  228. package/dist/cjs/track/updateNowPlaying.js.map +1 -1
  229. package/dist/cjs/user/getPersonalTags.js +12 -0
  230. package/dist/cjs/user/getPersonalTags.js.map +1 -1
  231. package/dist/config.js.map +1 -1
  232. package/dist/createOptions.js +23 -0
  233. package/dist/createOptions.js.map +1 -1
  234. package/dist/geo/getTopArtists.js +10 -0
  235. package/dist/geo/getTopArtists.js.map +1 -1
  236. package/dist/geo/getTopTracks.js +10 -0
  237. package/dist/geo/getTopTracks.js.map +1 -1
  238. package/dist/getFriends.js +6 -3
  239. package/dist/getFriends.js.map +1 -1
  240. package/dist/getInfo.js +5 -3
  241. package/dist/getInfo.js.map +1 -1
  242. package/dist/getLovedTracks.js +7 -3
  243. package/dist/getLovedTracks.js.map +1 -1
  244. package/dist/getRecentTracks.js +7 -3
  245. package/dist/getRecentTracks.js.map +1 -1
  246. package/dist/getTopAlbums.js +7 -3
  247. package/dist/getTopAlbums.js.map +1 -1
  248. package/dist/getTopArtists.js +7 -3
  249. package/dist/getTopArtists.js.map +1 -1
  250. package/dist/getTopTracks.js +7 -3
  251. package/dist/getTopTracks.js.map +1 -1
  252. package/dist/getUserTopTags.js +6 -3
  253. package/dist/getUserTopTags.js.map +1 -1
  254. package/dist/getWeeklyAlbumChart.js +7 -3
  255. package/dist/getWeeklyAlbumChart.js.map +1 -1
  256. package/dist/getWeeklyArtistChart.js +7 -3
  257. package/dist/getWeeklyArtistChart.js.map +1 -1
  258. package/dist/getWeeklyChartList.js +8 -3
  259. package/dist/getWeeklyChartList.js.map +1 -1
  260. package/dist/getWeeklyTrackChart.js +7 -3
  261. package/dist/getWeeklyTrackChart.js.map +1 -1
  262. package/dist/index.js +21 -0
  263. package/dist/index.js.map +1 -1
  264. package/dist/library/getArtists.js +10 -0
  265. package/dist/library/getArtists.js.map +1 -1
  266. package/dist/method.js +11 -0
  267. package/dist/method.js.map +1 -1
  268. package/dist/request.js +30 -0
  269. package/dist/request.js.map +1 -1
  270. package/dist/tag/getInfo.js +9 -0
  271. package/dist/tag/getInfo.js.map +1 -1
  272. package/dist/tag/getSimilar.js +8 -0
  273. package/dist/tag/getSimilar.js.map +1 -1
  274. package/dist/tag/getTopAlbums.js +10 -0
  275. package/dist/tag/getTopAlbums.js.map +1 -1
  276. package/dist/tag/getTopArtists.js +10 -0
  277. package/dist/tag/getTopArtists.js.map +1 -1
  278. package/dist/tag/getTopTags.js +7 -0
  279. package/dist/tag/getTopTags.js.map +1 -1
  280. package/dist/tag/getWeeklyChartList.js +9 -0
  281. package/dist/tag/getWeeklyChartList.js.map +1 -1
  282. package/dist/tag/topTracks.js +6 -3
  283. package/dist/tag/topTracks.js.map +1 -1
  284. package/dist/track/addTags.js +11 -0
  285. package/dist/track/addTags.js.map +1 -1
  286. package/dist/track/getCorrection.js +10 -0
  287. package/dist/track/getCorrection.js.map +1 -1
  288. package/dist/track/getInfo.js +11 -0
  289. package/dist/track/getInfo.js.map +1 -1
  290. package/dist/track/getSimilar.js +11 -0
  291. package/dist/track/getSimilar.js.map +1 -1
  292. package/dist/track/getTags.js +11 -0
  293. package/dist/track/getTags.js.map +1 -1
  294. package/dist/track/getTopTags.js +10 -0
  295. package/dist/track/getTopTags.js.map +1 -1
  296. package/dist/track/love.js +10 -0
  297. package/dist/track/love.js.map +1 -1
  298. package/dist/track/removeTag.js +11 -0
  299. package/dist/track/removeTag.js.map +1 -1
  300. package/dist/track/scrobble.js +12 -0
  301. package/dist/track/scrobble.js.map +1 -1
  302. package/dist/track/search.js +11 -0
  303. package/dist/track/search.js.map +1 -1
  304. package/dist/track/unlove.js +10 -0
  305. package/dist/track/unlove.js.map +1 -1
  306. package/dist/track/updateNowPlaying.js +11 -0
  307. package/dist/track/updateNowPlaying.js.map +1 -1
  308. package/dist/user/getPersonalTags.js +12 -0
  309. package/dist/user/getPersonalTags.js.map +1 -1
  310. package/package.json +7 -10
@@ -1,2 +1,12 @@
1
1
  import type { GeoTopArtistsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the most popular artists on Last.fm by country.
4
+ *
5
+ * @see https://www.last.fm/api/show/geo.getTopArtists
6
+ * @param method - The Last.fm API method string (`method.geo.getTopArtists`)
7
+ * @param country - Country name as defined by the ISO 3166-1 standard
8
+ * @param limit - Number of results per page (default `'50'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @returns Paginated list of top artists for the given country
11
+ */
2
12
  export declare function geoGetTopArtists(method: string, country: string, limit?: string, page?: string): Promise<GeoTopArtistsResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { GeoTopTracksResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the most popular tracks on Last.fm by country.
4
+ *
5
+ * @see https://www.last.fm/api/show/geo.getTopTracks
6
+ * @param method - The Last.fm API method string (`method.geo.getTopTracks`)
7
+ * @param country - Country name as defined by the ISO 3166-1 standard
8
+ * @param limit - Number of results per page (default `'50'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @returns Paginated list of top tracks for the given country
11
+ */
2
12
  export declare function geoGetTopTracks(method: string, country: string, limit?: string, page?: string): Promise<GeoTopTracksResponse>;
@@ -1,8 +1,11 @@
1
1
  import type { FriendsResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Friends - LastFM
3
+ * Get a list of the user's friends on Last.fm.
4
4
  *
5
- * https://www.last.fm/api/show/user.getFriends
6
- * @returns Friends of a user
5
+ * @see https://www.last.fm/api/show/user.getFriends
6
+ * @param method - The Last.fm API method string (`method.user.getFriends`)
7
+ * @param user - The Last.fm username
8
+ * @param limit - Number of results per page
9
+ * @returns A list of the user's friends with their profile information
7
10
  */
8
11
  export declare function getFriends(method: string, user: string, limit: string): Promise<FriendsResponse>;
@@ -1,8 +1,10 @@
1
1
  import { type UserResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: User profile information - LastFM
3
+ * Get information about a user profile on Last.fm.
4
4
  *
5
- * https://www.last.fm/api/show/user.getInfo
6
- * @returns User profile information
5
+ * @see https://www.last.fm/api/show/user.getInfo
6
+ * @param method - The Last.fm API method string (`method.user.getInfo`)
7
+ * @param user - The Last.fm username
8
+ * @returns User profile information including name, playcount, and registration date
7
9
  */
8
10
  export declare function getInfo(method: string, user: string): Promise<UserResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type LovedTracksResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Love Tracks - LastFM
3
+ * Get the last 50 tracks loved by a user on Last.fm.
4
4
  *
5
- * https://www.last.fm/api/show/user.getLovedTracks
6
- * @returns Loved Tracks;
5
+ * @see https://www.last.fm/api/show/user.getLovedTracks
6
+ * @param method - The Last.fm API method string (`method.user.getLovedTracks`)
7
+ * @param user - The Last.fm username
8
+ * @param period - The time period to retrieve loved tracks for
9
+ * @param limit - Number of results per page
10
+ * @returns The user's loved tracks
7
11
  */
8
12
  export declare function getLovedTracks(method: string, user: string, period: string, limit: string): Promise<LovedTracksResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type RecentTracksResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Recent Tracks - LastFM
3
+ * Get a list of the recent tracks listened to by a user on Last.fm.
4
4
  *
5
- * https://www.last.fm/api/show/user.getRecentTracks
6
- * @returns Recent Tracks
5
+ * @see https://www.last.fm/api/show/user.getRecentTracks
6
+ * @param method - The Last.fm API method string (`method.user.getRecentTracks`)
7
+ * @param user - The Last.fm username
8
+ * @param limit - Number of results per page
9
+ * @param from - Unix timestamp; only return tracks scrobbled after this time
10
+ * @returns The user's recent tracks including any currently playing track
7
11
  */
8
12
  export declare function getRecentTracks(method: string, user: string, limit: string, from?: string): Promise<RecentTracksResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type TopAlbumsResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Top Albums - LastFM
3
+ * Get the top albums listened to by a user on Last.fm, over a given time period.
4
4
  *
5
- * https://www.last.fm/api/show/user.getTopAlbums
6
- * @returns Top Albums
5
+ * @see https://www.last.fm/api/show/user.getTopAlbums
6
+ * @param method - The Last.fm API method string (`method.user.getTopAlbums`)
7
+ * @param user - The Last.fm username
8
+ * @param period - Time period (`overall`, `7day`, `1month`, `3month`, `6month`, `12month`)
9
+ * @param limit - Number of results per page
10
+ * @returns The user's top albums for the given period
7
11
  */
8
12
  export declare function getTopAlbums(method: string, user: string, period: string, limit: string): Promise<TopAlbumsResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type TopArtistsResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Top Artist - LastFM
3
+ * Get the top artists listened to by a user on Last.fm, over a given time period.
4
4
  *
5
- * https://www.last.fm/api/show/user.getTopArtists
6
- * @returns Top Artists
5
+ * @see https://www.last.fm/api/show/user.getTopArtists
6
+ * @param method - The Last.fm API method string (`method.user.getTopArtists`)
7
+ * @param user - The Last.fm username
8
+ * @param period - Time period (`overall`, `7day`, `1month`, `3month`, `6month`, `12month`)
9
+ * @param limit - Number of results per page
10
+ * @returns The user's top artists for the given period
7
11
  */
8
12
  export declare function getTopArtists(method: string, user: string, period: string, limit: string): Promise<TopArtistsResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type TopTrackResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Top Tracks - LastFM
3
+ * Get the top tracks listened to by a user on Last.fm, over a given time period.
4
4
  *
5
- * https://www.last.fm/api/show/user.getTopTracks
6
- * @returns Top Tracks
5
+ * @see https://www.last.fm/api/show/user.getTopTracks
6
+ * @param method - The Last.fm API method string (`method.user.getTopTracks`)
7
+ * @param user - The Last.fm username
8
+ * @param period - Time period (`overall`, `7day`, `1month`, `3month`, `6month`, `12month`)
9
+ * @param limit - Number of results per page
10
+ * @returns The user's top tracks for the given period
7
11
  */
8
12
  export declare function getTopTracks(method: string, user: string, period: string, limit: string): Promise<TopTrackResponse>;
@@ -1,8 +1,11 @@
1
1
  import type { UserTopTagsResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: User Top Tags - LastFM
3
+ * Get the top tags used by a user on Last.fm, ordered by tag count.
4
4
  *
5
- * https://www.last.fm/api/show/user.getTopTags
6
- * @returns Top Tags for a user
5
+ * @see https://www.last.fm/api/show/user.getTopTags
6
+ * @param method - The Last.fm API method string (`method.user.getTopTags`)
7
+ * @param user - The Last.fm username
8
+ * @param limit - Maximum number of tags to return
9
+ * @returns The user's most-used tags ordered by count
7
10
  */
8
11
  export declare function getUserTopTags(method: string, user: string, limit: string): Promise<UserTopTagsResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type WeeklyAlbumChartResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Weekly album chart - LastFM
3
+ * Get a list of the albums in a user's weekly album chart on Last.fm.
4
4
  *
5
- * https://www.last.fm/api/show/user.getWeeklyAlbumChart
6
- * @returns Weekly album chart
5
+ * @see https://www.last.fm/api/show/user.getWeeklyAlbumChart
6
+ * @param method - The Last.fm API method string (`method.user.getWeeklyAlbumChart`)
7
+ * @param user - The Last.fm username
8
+ * @param period - The time period for the chart
9
+ * @param limit - Number of results per page
10
+ * @returns The user's weekly album chart
7
11
  */
8
12
  export declare function getWeeklyAlbumChart(method: string, user: string, period: string, limit: string): Promise<WeeklyAlbumChartResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type WeeklyArtistChartResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Weekly artist chart - LastFM
3
+ * Get a list of the artists in a user's weekly artist chart on Last.fm.
4
4
  *
5
- * https://www.last.fm/api/show/user.getWeeklyArtistChart
6
- * @returns Weekly artist chart
5
+ * @see https://www.last.fm/api/show/user.getWeeklyArtistChart
6
+ * @param method - The Last.fm API method string (`method.user.getWeeklyArtistChart`)
7
+ * @param user - The Last.fm username
8
+ * @param period - The time period for the chart
9
+ * @param limit - Number of results per page
10
+ * @returns The user's weekly artist chart
7
11
  */
8
12
  export declare function getWeeklyArtistChart(method: string, user: string, period: string, limit: string): Promise<WeeklyArtistChartResponse>;
@@ -1,8 +1,13 @@
1
1
  import { type WeeklyChartListResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Weekly chart list - LastFM
3
+ * Get a list of available charts for a user on Last.fm, expressed as date ranges
4
+ * which can be sent to the chart services.
4
5
  *
5
- * https://www.last.fm/api/show/user.getWeeklyChartList
6
- * @returns Weekly chart list
6
+ * @see https://www.last.fm/api/show/user.getWeeklyChartList
7
+ * @param method - The Last.fm API method string (`method.user.getWeeklyChartList`)
8
+ * @param user - The Last.fm username
9
+ * @param period - The time period for the chart list
10
+ * @param limit - Number of results per page
11
+ * @returns A list of date ranges representing available weekly charts for this user
7
12
  */
8
13
  export declare function getWeeklyChartList(method: string, user: string, period: string, limit: string): Promise<WeeklyChartListResponse>;
@@ -1,8 +1,12 @@
1
1
  import { type WeeklyTrackChartResponse } from './lastfm.types.js';
2
2
  /**
3
- * GET: Weekly track chart - LastFM
3
+ * Get a list of the tracks in a user's weekly track chart on Last.fm.
4
4
  *
5
- * https://www.last.fm/api/show/user.getWeeklyTrackChart
6
- * @returns Weekly track chart
5
+ * @see https://www.last.fm/api/show/user.getWeeklyTrackChart
6
+ * @param method - The Last.fm API method string (`method.user.getWeeklyTrackChart`)
7
+ * @param user - The Last.fm username
8
+ * @param period - The time period for the chart
9
+ * @param limit - Number of results per page
10
+ * @returns The user's weekly track chart
7
11
  */
8
12
  export declare function getWeeklyTrackChart(method: string, user: string, period: string, limit: string): Promise<WeeklyTrackChartResponse>;
@@ -1,4 +1,5 @@
1
1
  import { auth } from './auth.js';
2
+ import { config } from './config.js';
2
3
  import { getFriends } from './getFriends.js';
3
4
  import { getInfo } from './getInfo.js';
4
5
  import { getLovedTracks } from './getLovedTracks.js';
@@ -11,6 +12,7 @@ import { getWeeklyAlbumChart } from './getWeeklyAlbumChart.js';
11
12
  import { getWeeklyArtistChart } from './getWeeklyArtistChart.js';
12
13
  import { getWeeklyChartList } from './getWeeklyChartList.js';
13
14
  import { getWeeklyTrackChart } from './getWeeklyTrackChart.js';
15
+ import { method } from './method.js';
14
16
  import { chartTopTags } from './chart/topTags.js';
15
17
  import { chartTopTracks } from './chart/topTracks.js';
16
18
  import { chartTopArtists } from './chart/topArtists.js';
@@ -55,7 +57,11 @@ import { trackRemoveTag } from './track/removeTag.js';
55
57
  import { trackScrobble } from './track/scrobble.js';
56
58
  import { trackUpdateNowPlaying } from './track/updateNowPlaying.js';
57
59
  import { userGetPersonalTags } from './user/getPersonalTags.js';
58
- declare const LastFmApi: () => {
60
+ /**
61
+ * The return type of {@link LastFmApi}, containing all namespaced API methods
62
+ * and the {@link method} constant for method name strings.
63
+ */
64
+ export type LastFmApiReturn = {
59
65
  auth: typeof auth;
60
66
  album: {
61
67
  albumGetInfo: typeof albumGetInfo;
@@ -117,17 +123,7 @@ declare const LastFmApi: () => {
117
123
  user: {
118
124
  userGetPersonalTags: typeof userGetPersonalTags;
119
125
  };
120
- config: {
121
- api_key: string;
122
- app_name: string;
123
- base_url: string;
124
- format: {
125
- json: string;
126
- xml: string;
127
- };
128
- share_secret: string;
129
- username: string;
130
- };
126
+ config: typeof config;
131
127
  getFriends: typeof getFriends;
132
128
  getInfo: typeof getInfo;
133
129
  getLovedTracks: typeof getLovedTracks;
@@ -140,82 +136,28 @@ declare const LastFmApi: () => {
140
136
  getWeeklyArtistChart: typeof getWeeklyArtistChart;
141
137
  getWeeklyChartList: typeof getWeeklyChartList;
142
138
  getWeeklyTrackChart: typeof getWeeklyTrackChart;
143
- method: {
144
- album: {
145
- addTags: string;
146
- getInfo: string;
147
- getTags: string;
148
- getTopTags: string;
149
- removeTag: string;
150
- search: string;
151
- };
152
- artist: {
153
- addTags: string;
154
- getCorrection: string;
155
- getInfo: string;
156
- getSimilar: string;
157
- getTags: string;
158
- getTopAlbums: string;
159
- getTopTags: string;
160
- getTopTracks: string;
161
- removeTag: string;
162
- search: string;
163
- };
164
- auth: {
165
- getMobileSession: string;
166
- getSession: string;
167
- getToken: string;
168
- };
169
- chart: {
170
- getTopTracks: string;
171
- getTopTags: string;
172
- getTopArtists: string;
173
- };
174
- geo: {
175
- getTopArtists: string;
176
- getTopTracks: string;
177
- };
178
- library: {
179
- getArtists: string;
180
- };
181
- tag: {
182
- getInfo: string;
183
- getSimilar: string;
184
- getTopAlbums: string;
185
- getTopArtists: string;
186
- getTopTags: string;
187
- getTopTracks: string;
188
- getWeeklyChartList: string;
189
- };
190
- track: {
191
- addTags: string;
192
- getCorrection: string;
193
- getInfo: string;
194
- getSimilar: string;
195
- getTags: string;
196
- getTopTags: string;
197
- love: string;
198
- removeTag: string;
199
- scrobble: string;
200
- search: string;
201
- unlove: string;
202
- updateNowPlaying: string;
203
- };
204
- user: {
205
- getFriends: string;
206
- getInfo: string;
207
- getLovedTracks: string;
208
- getPersonalTags: string;
209
- getRecentTracks: string;
210
- getTopAlbums: string;
211
- getTopArtists: string;
212
- getTopTags: string;
213
- getTopTracks: string;
214
- getWeeklyAlbumChart: string;
215
- getWeeklyArtistChart: string;
216
- getWeeklyChartList: string;
217
- getWeeklyTrackChart: string;
218
- };
219
- };
139
+ method: typeof method;
220
140
  };
141
+ /**
142
+ * Creates a Last.fm API client with all supported methods organised by namespace.
143
+ *
144
+ * Use the {@link method} constant (exposed as `api.method`) to pass the correct
145
+ * method string to each API function.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * import LastFmApi from 'lastfm-nodejs-client';
150
+ *
151
+ * const api = LastFmApi();
152
+ *
153
+ * // Read-only: get a user's top artists
154
+ * const topArtists = await api.getTopArtists(api.method.user.getTopArtists, 'username', '7day', '10');
155
+ *
156
+ * // Write: scrobble a track (requires session key)
157
+ * await api.track.trackScrobble(api.method.track.scrobble, 'Artist', 'Track', String(Date.now() / 1000 | 0), 'Album', sk);
158
+ * ```
159
+ *
160
+ * @returns An object containing all Last.fm API methods organised by namespace.
161
+ */
162
+ declare const LastFmApi: () => LastFmApiReturn;
221
163
  export default LastFmApi;
@@ -1,2 +1,12 @@
1
1
  import type { LibraryArtistsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * A paginated list of all the artists in a user's library, with playcounts and tag counts.
4
+ *
5
+ * @see https://www.last.fm/api/show/library.getArtists
6
+ * @param method - The Last.fm API method string (`method.library.getArtists`)
7
+ * @param user - The Last.fm username whose library to fetch
8
+ * @param limit - Number of results per page (default `'50'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @returns Paginated list of artists from the user's library
11
+ */
2
12
  export declare function libraryGetArtists(method: string, user: string, limit?: string, page?: string): Promise<LibraryArtistsResponse>;
@@ -1,3 +1,4 @@
1
+ /** Last.fm `album.*` method name strings. */
1
2
  interface AlbumMethod {
2
3
  addTags: string;
3
4
  getInfo: string;
@@ -6,6 +7,7 @@ interface AlbumMethod {
6
7
  removeTag: string;
7
8
  search: string;
8
9
  }
10
+ /** Last.fm `artist.*` method name strings. */
9
11
  interface ArtistMethod {
10
12
  addTags: string;
11
13
  getCorrection: string;
@@ -18,23 +20,28 @@ interface ArtistMethod {
18
20
  removeTag: string;
19
21
  search: string;
20
22
  }
23
+ /** Last.fm `auth.*` method name strings. */
21
24
  interface AuthMethod {
22
25
  getMobileSession: string;
23
26
  getSession: string;
24
27
  getToken: string;
25
28
  }
29
+ /** Last.fm `chart.*` method name strings. */
26
30
  interface ChartMethod {
27
31
  getTopArtists: string;
28
32
  getTopTags: string;
29
33
  getTopTracks: string;
30
34
  }
35
+ /** Last.fm `geo.*` method name strings. */
31
36
  interface GeoMethod {
32
37
  getTopArtists: string;
33
38
  getTopTracks: string;
34
39
  }
40
+ /** Last.fm `library.*` method name strings. */
35
41
  interface LibraryMethod {
36
42
  getArtists: string;
37
43
  }
44
+ /** Last.fm `tag.*` method name strings. */
38
45
  interface TagMethod {
39
46
  getInfo: string;
40
47
  getSimilar: string;
@@ -44,6 +51,7 @@ interface TagMethod {
44
51
  getTopTracks: string;
45
52
  getWeeklyChartList: string;
46
53
  }
54
+ /** Last.fm `track.*` method name strings. */
47
55
  interface TrackMethod {
48
56
  addTags: string;
49
57
  getCorrection: string;
@@ -58,6 +66,7 @@ interface TrackMethod {
58
66
  unlove: string;
59
67
  updateNowPlaying: string;
60
68
  }
69
+ /** Last.fm `user.*` method name strings. */
61
70
  interface UserMethod {
62
71
  getFriends: string;
63
72
  getInfo: string;
@@ -73,6 +82,10 @@ interface UserMethod {
73
82
  getWeeklyChartList: string;
74
83
  getWeeklyTrackChart: string;
75
84
  }
85
+ /**
86
+ * Namespace map of all supported Last.fm API method name strings.
87
+ * @see {@link method} for the singleton constant of this type.
88
+ */
76
89
  export interface Method {
77
90
  album: AlbumMethod;
78
91
  artist: ArtistMethod;
@@ -84,81 +97,16 @@ export interface Method {
84
97
  track: TrackMethod;
85
98
  user: UserMethod;
86
99
  }
87
- export declare const method: {
88
- album: {
89
- addTags: string;
90
- getInfo: string;
91
- getTags: string;
92
- getTopTags: string;
93
- removeTag: string;
94
- search: string;
95
- };
96
- artist: {
97
- addTags: string;
98
- getCorrection: string;
99
- getInfo: string;
100
- getSimilar: string;
101
- getTags: string;
102
- getTopAlbums: string;
103
- getTopTags: string;
104
- getTopTracks: string;
105
- removeTag: string;
106
- search: string;
107
- };
108
- auth: {
109
- getMobileSession: string;
110
- getSession: string;
111
- getToken: string;
112
- };
113
- chart: {
114
- getTopTracks: string;
115
- getTopTags: string;
116
- getTopArtists: string;
117
- };
118
- geo: {
119
- getTopArtists: string;
120
- getTopTracks: string;
121
- };
122
- library: {
123
- getArtists: string;
124
- };
125
- tag: {
126
- getInfo: string;
127
- getSimilar: string;
128
- getTopAlbums: string;
129
- getTopArtists: string;
130
- getTopTags: string;
131
- getTopTracks: string;
132
- getWeeklyChartList: string;
133
- };
134
- track: {
135
- addTags: string;
136
- getCorrection: string;
137
- getInfo: string;
138
- getSimilar: string;
139
- getTags: string;
140
- getTopTags: string;
141
- love: string;
142
- removeTag: string;
143
- scrobble: string;
144
- search: string;
145
- unlove: string;
146
- updateNowPlaying: string;
147
- };
148
- user: {
149
- getFriends: string;
150
- getInfo: string;
151
- getLovedTracks: string;
152
- getPersonalTags: string;
153
- getRecentTracks: string;
154
- getTopAlbums: string;
155
- getTopArtists: string;
156
- getTopTags: string;
157
- getTopTracks: string;
158
- getWeeklyAlbumChart: string;
159
- getWeeklyArtistChart: string;
160
- getWeeklyChartList: string;
161
- getWeeklyTrackChart: string;
162
- };
163
- };
100
+ /**
101
+ * Constant map of all Last.fm API method name strings, organised by namespace.
102
+ *
103
+ * Pass the appropriate value to API functions as the `method` parameter.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * const api = LastFmApi();
108
+ * const info = await api.getInfo(api.method.user.getInfo, 'username');
109
+ * ```
110
+ */
111
+ export declare const method: Method;
164
112
  export {};
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Options passed to `request` and `signedRequest`.
3
+ * All fields correspond to Last.fm API query/body parameters.
4
+ */
1
5
  interface RequestOptions {
2
6
  method: string;
3
7
  user?: string;
@@ -20,6 +24,25 @@ interface RequestOptions {
20
24
  username?: string;
21
25
  password?: string;
22
26
  }
27
+ /**
28
+ * Performs a GET request to the Last.fm API.
29
+ *
30
+ * Throws an `Error` on HTTP failure or if the Last.fm response body contains an error code.
31
+ *
32
+ * @param options - Request options specifying the method and query parameters
33
+ * @returns The parsed JSON response typed as `Response`
34
+ */
23
35
  declare const request: <Response>(options: RequestOptions) => Promise<Response>;
36
+ /**
37
+ * Performs an MD5-signed POST request to the Last.fm API.
38
+ *
39
+ * Used for write operations (scrobble, love, addTags, auth sessions).
40
+ * Generates an `api_sig` by sorting all parameters alphabetically, concatenating
41
+ * `key+value` pairs, appending the shared secret, and MD5-hashing the result.
42
+ *
43
+ * @param options - Request options specifying the method and POST body parameters
44
+ * @param secret - The Last.fm shared secret used to generate the API signature
45
+ * @returns The parsed JSON response typed as `Response`
46
+ */
24
47
  export declare const signedRequest: <Response>(options: RequestOptions, secret: string) => Promise<Response>;
25
48
  export default request;
@@ -1,2 +1,11 @@
1
1
  import type { TagInfoResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the metadata for a tag on Last.fm. Includes a short wiki summary.
4
+ *
5
+ * @see https://www.last.fm/api/show/tag.getInfo
6
+ * @param method - The Last.fm API method string (`method.tag.getInfo`)
7
+ * @param tag - The tag name
8
+ * @param lang - ISO 639 alpha-2 language code for the wiki text (default `'en'`)
9
+ * @returns Tag metadata including wiki text and reach
10
+ */
2
11
  export declare function tagGetInfo(method: string, tag: string, lang?: string): Promise<TagInfoResponse>;
@@ -1,2 +1,10 @@
1
1
  import type { TagSimilarResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Search for tags similar to this one on Last.fm. Returns tags ranked by similarity.
4
+ *
5
+ * @see https://www.last.fm/api/show/tag.getSimilar
6
+ * @param method - The Last.fm API method string (`method.tag.getSimilar`)
7
+ * @param tag - The tag name to find similar tags for
8
+ * @returns A list of similar tags
9
+ */
2
10
  export declare function tagGetSimilar(method: string, tag: string): Promise<TagSimilarResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { TagTopAlbumsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top albums tagged with a given tag on Last.fm, ordered by tag count.
4
+ *
5
+ * @see https://www.last.fm/api/show/tag.getTopAlbums
6
+ * @param method - The Last.fm API method string (`method.tag.getTopAlbums`)
7
+ * @param tag - The tag name
8
+ * @param limit - Number of results per page (default `'50'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @returns Paginated list of top albums for the given tag
11
+ */
2
12
  export declare function tagGetTopAlbums(method: string, tag: string, limit?: string, page?: string): Promise<TagTopAlbumsResponse>;
@@ -1,2 +1,12 @@
1
1
  import type { TagTopArtistsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Get the top artists tagged with a given tag on Last.fm, ordered by tag count.
4
+ *
5
+ * @see https://www.last.fm/api/show/tag.getTopArtists
6
+ * @param method - The Last.fm API method string (`method.tag.getTopArtists`)
7
+ * @param tag - The tag name
8
+ * @param limit - Number of results per page (default `'50'`)
9
+ * @param page - Page number to fetch (default `'1'`)
10
+ * @returns Paginated list of top artists for the given tag
11
+ */
2
12
  export declare function tagGetTopArtists(method: string, tag: string, limit?: string, page?: string): Promise<TagTopArtistsResponse>;
@@ -1,2 +1,9 @@
1
1
  import type { TagTopTagsResponse } from '../lastfm.types.js';
2
+ /**
3
+ * Fetches the top global tags on Last.fm, sorted by popularity (number of times used).
4
+ *
5
+ * @see https://www.last.fm/api/show/tag.getTopTags
6
+ * @param method - The Last.fm API method string (`method.tag.getTopTags`)
7
+ * @returns The top tags on Last.fm ordered by usage count
8
+ */
2
9
  export declare function tagGetTopTags(method: string): Promise<TagTopTagsResponse>;