1- import { LastFM } from './base' ;
2- import { LastFMParam , LastFMApiRequest , LastFMRequestParams , LastFMUnknownFunction } from './api-request' ;
3-
4- export interface LastFMAlbumParams {
5- readonly album : string ;
6- readonly artist : string ;
7- }
8-
9- export interface LastFMAlbumOptionalParams {
10- readonly mbid ?: string ;
11- readonly autocorrect ?: 0 | 1 ;
12- }
13-
14- export interface LastFMAlbumAddTagsParams extends LastFMRequestParams < LastFMParam > , LastFMAlbumParams {
15- readonly tags : string | string [ ] ;
16- }
17-
18- export interface LastFMAlbumGetInfoParams
19- extends LastFMRequestParams < 0 | 1 | void > ,
20- LastFMAlbumParams ,
21- LastFMAlbumOptionalParams {
22- readonly lang ?: string ;
23- readonly username ?: string ;
24- }
25-
26- export interface LastFMAlbumGetTagsParams
27- extends LastFMRequestParams < 0 | 1 | void > ,
28- LastFMAlbumParams ,
29- LastFMAlbumOptionalParams {
30- readonly user ?: string ;
31- }
32-
33- export interface LastFMAlbumGetTopTagsParams
34- extends LastFMRequestParams < 0 | 1 | void > ,
35- LastFMAlbumParams ,
36- LastFMAlbumOptionalParams { }
37-
38- export interface LastFMAlbumRemoveLastFMTagParams extends LastFMRequestParams < LastFMParam > , LastFMAlbumParams {
39- readonly tag : string ;
40- }
41-
42- export interface LastFMAlbumSearchParams extends LastFMRequestParams < number | void > {
43- readonly page ?: number ;
44- readonly album : string ;
45- readonly limit ?: number ;
46- }
1+ import { LastFM } from './base.js' ;
2+ import { LastFMApiRequest } from './api-request.js' ;
3+ import {
4+ LastFMUnknownFunction ,
5+ LastFMAlbumSearchParams ,
6+ LastFMAlbumAddTagsParams ,
7+ LastFMAlbumGetInfoParams ,
8+ LastFMAlbumGetTagsParams ,
9+ LastFMAlbumSearchResponse ,
10+ LastFMAlbumGetInfoResponse ,
11+ LastFMAlbumGetTagsResponse ,
12+ LastFMAlbumGetTopTagsParams ,
13+ LastFMAlbumRemoveLastFMTagParams
14+ } from './types.js' ;
4715
4816export class LastFMAlbum extends LastFM {
49- constructor ( apiKey : string , secret ?: string , sessionKey ?: string ) {
50- super ( apiKey , secret , sessionKey ) ;
51- }
52-
53- public addTags (
54- params : LastFMAlbumAddTagsParams ,
55- callback : LastFMUnknownFunction
56- ) : Promise < LastFMApiRequest > | void {
57- return new LastFMApiRequest ( )
17+ public addTags ( params : LastFMAlbumAddTagsParams , callback ?: LastFMUnknownFunction ) : Promise < void > {
18+ return new LastFMApiRequest < void > ( )
5819 . set ( params )
5920 . set ( {
6021 api_key : this . apiKey ,
@@ -67,9 +28,9 @@ export class LastFMAlbum extends LastFM {
6728
6829 public getInfo (
6930 params : LastFMAlbumGetInfoParams ,
70- callback : LastFMUnknownFunction
71- ) : Promise < LastFMApiRequest > | void {
72- return new LastFMApiRequest ( )
31+ callback ? : LastFMUnknownFunction
32+ ) : Promise < LastFMAlbumGetInfoResponse > {
33+ return new LastFMApiRequest < LastFMAlbumGetInfoResponse > ( )
7334 . set ( params )
7435 . set ( {
7536 api_key : this . apiKey ,
@@ -80,9 +41,9 @@ export class LastFMAlbum extends LastFM {
8041
8142 public getTags (
8243 params : LastFMAlbumGetTagsParams ,
83- callback : LastFMUnknownFunction
84- ) : Promise < LastFMApiRequest > | void {
85- return new LastFMApiRequest ( )
44+ callback ? : LastFMUnknownFunction
45+ ) : Promise < LastFMAlbumGetTagsResponse > {
46+ return new LastFMApiRequest < LastFMAlbumGetTagsResponse > ( )
8647 . set ( params )
8748 . set ( {
8849 api_key : this . apiKey ,
@@ -93,9 +54,9 @@ export class LastFMAlbum extends LastFM {
9354
9455 public getTopTags (
9556 params : LastFMAlbumGetTopTagsParams ,
96- callback : LastFMUnknownFunction
97- ) : Promise < LastFMApiRequest > | void {
98- return new LastFMApiRequest ( )
57+ callback ? : LastFMUnknownFunction
58+ ) : Promise < LastFMAlbumGetTagsResponse > {
59+ return new LastFMApiRequest < LastFMAlbumGetTagsResponse > ( )
9960 . set ( params )
10061 . set ( {
10162 api_key : this . apiKey ,
@@ -104,11 +65,8 @@ export class LastFMAlbum extends LastFM {
10465 . send ( callback ) ;
10566 }
10667
107- public removeTag (
108- params : LastFMAlbumRemoveLastFMTagParams ,
109- callback : LastFMUnknownFunction
110- ) : Promise < LastFMApiRequest > | void {
111- return new LastFMApiRequest ( )
68+ public removeTag ( params : LastFMAlbumRemoveLastFMTagParams , callback ?: LastFMUnknownFunction ) : Promise < void > {
69+ return new LastFMApiRequest < void > ( )
11270 . set ( params )
11371 . set ( {
11472 api_key : this . apiKey ,
@@ -119,8 +77,11 @@ export class LastFMAlbum extends LastFM {
11977 . send ( 'POST' , callback ) ;
12078 }
12179
122- public search ( params : LastFMAlbumSearchParams , callback : LastFMUnknownFunction ) : Promise < LastFMApiRequest > | void {
123- return new LastFMApiRequest ( )
80+ public search (
81+ params : LastFMAlbumSearchParams ,
82+ callback ?: LastFMUnknownFunction
83+ ) : Promise < LastFMAlbumSearchResponse > {
84+ return new LastFMApiRequest < LastFMAlbumSearchResponse > ( )
12485 . set ( params )
12586 . set ( {
12687 api_key : this . apiKey ,
0 commit comments