AlbumStructure
Defined in: src/structures/album.ts:8
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AlbumStructure(client: FMClient): AlbumStructure;Defined in: src/structures/album.ts:11
Parameters
Section titled “Parameters”client
Section titled “client”Returns
Section titled “Returns”AlbumStructure
Methods
Section titled “Methods”search()
Section titled “search()”search(options: AlbumSearchOptions): Promise<AlbumSearchResponse>;Defined in: src/structures/album.ts:34
Search for an album by name. Returns album matches sorted by relevance.
Parameters
Section titled “Parameters”options
Section titled “options”The search options. See AlbumSearchOptions.
Returns
Section titled “Returns”Promise<AlbumSearchResponse>
A promise that resolves to the API response object.
- Success:
{ success: true, albums: Array, totalResultsOnLastFm: number | null } - Failure:
{ success: false, errorCode: ErrorCodes.MISSING_REQUIREMENTS | ErrorCodes.NO_ALBUM_MATCHES | number | string, errorMsg: string }
Example
Section titled “Example”const res = await fm.album.search({ album: "Hurry Up Tomorrow", limit: 5,});
if (res.success) { console.log(`Found ${res.albums.length} matching albums`);}