Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DeezerTrack

Class representing a Deezer track

Hierarchy

  • DeezerTrack

Index

Constructors

  • new DeezerTrack(data: any, partial: boolean): DeezerTrack

Properties

The album that this track is in

artist: DeezerArtist

The artist of the track

bpm?: number

The number of beats per minute

undefined for partial tracks

see

DeezerTrack.partial

contributors?: DeezerArtist[]

The artists that have contributed to the track

undefined for partial tracks

see

DeezerTrack.partial

diskNumber?: number

The number of the disk the track is on

undefined for partial tracks

see

DeezerTrack.partial

durationInSec: number

The duration of the track in seconds

explicit: boolean

true if the track contains any explicit lyrics

gain?: number

The gain of the track

undefined for partial tracks

see

DeezerTrack.partial

id: number

The id of the track

partial: boolean

Signifies that some properties are not populated

Partial tracks can be populated by calling DeezerTrack.fetch.

true for tracks in search results and false if the track was fetched directly or expanded.

previewURL: string

URL to a file containing the first 30 seconds of the track

rank: number

The rank of the track

releaseDate?: Date

The release date

undefined for partial tracks

see

DeezerTrack.partial

shortTitle: string

A shorter version of the title

title: string

The title of the track

trackPosition?: number

The position of the track in the album

undefined for partial tracks

see

DeezerTrack.partial

type: "playlist" | "track" | "album"

The type, always 'track', useful to determine what the deezer function returned

url: string

The URL of the track on Deezer

Methods

  • Fetches and populates the missing fields

    The property partial will be false if this method finishes successfully.

    Returns Promise<DeezerTrack>

    A promise with the same track this method was called on.

  • toJSON(): { album: DeezerTrackAlbum; artist: DeezerArtist; bpm: undefined | number; contributors: undefined | DeezerArtist[]; diskNumber: undefined | number; durationInSec: number; explicit: boolean; gain: undefined | number; id: number; previewURL: string; rank: number; releaseDate: undefined | Date; shortTitle: string; title: string; trackPosition: undefined | number; type: "playlist" | "track" | "album"; url: string }
  • Converts instances of this class to JSON data

    Returns { album: DeezerTrackAlbum; artist: DeezerArtist; bpm: undefined | number; contributors: undefined | DeezerArtist[]; diskNumber: undefined | number; durationInSec: number; explicit: boolean; gain: undefined | number; id: number; previewURL: string; rank: number; releaseDate: undefined | Date; shortTitle: string; title: string; trackPosition: undefined | number; type: "playlist" | "track" | "album"; url: string }

    JSON data.

    • album: DeezerTrackAlbum
    • artist: DeezerArtist
    • bpm: undefined | number
    • contributors: undefined | DeezerArtist[]
    • diskNumber: undefined | number
    • durationInSec: number
    • explicit: boolean
    • gain: undefined | number
    • id: number
    • previewURL: string
    • rank: number
    • releaseDate: undefined | Date
    • shortTitle: string
    • title: string
    • trackPosition: undefined | number
    • type: "playlist" | "track" | "album"
    • url: string

Generated using TypeDoc