ChartStructure
Defined in: src/structures/chart.ts:15
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ChartStructure(client: FMClient): ChartStructure;Defined in: src/structures/chart.ts:18
Parameters
Section titled “Parameters”client
Section titled “client”Returns
Section titled “Returns”ChartStructure
Methods
Section titled “Methods”getTopArtists()
Section titled “getTopArtists()”getTopArtists(options?: ChartGetTopTracksOptions): Promise<ChartTopArtistsResponse>;Defined in: src/structures/chart.ts:114
Get the top artists chart.
Parameters
Section titled “Parameters”options?
Section titled “options?”The optional options. See ChartGetTopArtistsOptions.
Returns
Section titled “Returns”Promise<ChartTopArtistsResponse>
A promise that resolves to the API response object.
- Success:
{ success: true, artists: Array } - Failure:
{ success: false, errorCode: ErrorCodes.MISSING_REQUIREMENTS | ErrorCodes.NO_TOP_ARTISTS | number | string, errorMsg: string }
Example
Section titled “Example”const res = await fm.chart.getTopArtists({ limit: 5,});
if (res.success) { console.log(`Top chart artist: ${res.topArtists[0].name}`);}getTopTracks()
Section titled “getTopTracks()”getTopTracks(options?: ChartGetTopTracksOptions): Promise<ChartTopTracksResponse>;Defined in: src/structures/chart.ts:40
Get the top tracks chart.
Parameters
Section titled “Parameters”options?
Section titled “options?”The optional options. ChartGetTopTracksOptions.
Returns
Section titled “Returns”Promise<ChartTopTracksResponse>
A promise that resolves to the API response object.
- Success:
{ success: true, tracks: Array } - Failure:
{ success: false, errorCode: ErrorCodes.MISSING_REQUIREMENTS | ErrorCodes.NO_TOP_TRACKS | number | string, errorMsg: string }
Example
Section titled “Example”const res = await fm.chart.getTopTracks({ limit: 5,});
if (res.success) { console.log(`Top chart track: ${res.topTracks[0].name}`);}