Skip to content

ChartStructure

Defined in: src/structures/chart.ts:15

new ChartStructure(client: FMClient): ChartStructure;

Defined in: src/structures/chart.ts:18

FMClient

ChartStructure

getTopArtists(options?: ChartGetTopTracksOptions): Promise<ChartTopArtistsResponse>;

Defined in: src/structures/chart.ts:114

Get the top artists chart.

ChartGetTopTracksOptions = {}

The optional options. See ChartGetTopArtistsOptions.

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 }
const res = await fm.chart.getTopArtists({
limit: 5,
});
if (res.success) {
console.log(`Top chart artist: ${res.topArtists[0].name}`);
}

getTopTracks(options?: ChartGetTopTracksOptions): Promise<ChartTopTracksResponse>;

Defined in: src/structures/chart.ts:40

Get the top tracks chart.

ChartGetTopTracksOptions = {}

The optional options. ChartGetTopTracksOptions.

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 }
const res = await fm.chart.getTopTracks({
limit: 5,
});
if (res.success) {
console.log(`Top chart track: ${res.topTracks[0].name}`);
}