Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DeezerAlbum

Class for Deezer Albums

Hierarchy

  • DeezerAlbum

Index

Constructors

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

Properties

artist: DeezerArtist

The artist of the album

available?: boolean

Whether the album is available

undefined for partial albums

see

DeezerAlbum.partial

contributors?: DeezerArtist[]

The contributors to the album

undefined for partial albums

see

DeezerAlbum.partial

The album cover available in four sizes

durationInSec?: number

The duration of the album in seconds

undefined for partial albums

see

DeezerAlbum.partial

explicit: boolean

true if the album contains any explicit lyrics

genres?: DeezerGenre[]

The list of genres present in this album

undefined for partial albums

see

DeezerAlbum.partial

id: number

The id of the album

numberOfFans?: number

The number of fans the album has

undefined for partial albums

see

DeezerAlbum.partial

partial: boolean

Signifies that some properties are not populated

Partial albums can be populated by calling DeezerAlbum.fetch.

true for albums in search results and false if the album was fetched directly or expanded.

recordType: string

The record type of the album (e.g. EP, ALBUM, etc ...)

releaseDate?: Date

The release date of the album

undefined for partial albums

see

DeezerAlbum.partial

title: string

The title of the album

tracks: DeezerTrack[]

The list of tracks in the album

empty (length === 0) for partial albums

Use DeezerAlbum.fetch to populate the tracks and other properties

see

DeezerAlbum.partial

tracksCount: number

The number of tracks in the album

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

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

upc?: string

The universal product code of the album

undefined for partial albums

see

DeezerAlbum.partial

url: string

The URL to the album on Deezer

Methods

  • Fetches all the tracks in the album and returns them

    const album = await play.deezer('album url')

    const tracks = await album.all_tracks()

    Returns Promise<DeezerTrack[]>

    An array of DeezerTrack

  • Fetches and populates the missing fields including all tracks.

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

    Returns Promise<DeezerAlbum>

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

  • toJSON(): { artist: DeezerArtist; available: undefined | boolean; contributors: undefined | DeezerArtist[]; cover: DeezerImage; durationInSec: undefined | number; explicit: boolean; genres: undefined | DeezerGenre[]; id: number; numberOfFans: undefined | number; recordType: string; releaseDate: undefined | Date; title: string; tracks: { 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 }[]; tracksCount: number; type: "playlist" | "track" | "album"; upc: undefined | string; url: string }
  • Converts instances of this class to JSON data

    Returns { artist: DeezerArtist; available: undefined | boolean; contributors: undefined | DeezerArtist[]; cover: DeezerImage; durationInSec: undefined | number; explicit: boolean; genres: undefined | DeezerGenre[]; id: number; numberOfFans: undefined | number; recordType: string; releaseDate: undefined | Date; title: string; tracks: { 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 }[]; tracksCount: number; type: "playlist" | "track" | "album"; upc: undefined | string; url: string }

    JSON data.

    • artist: DeezerArtist
    • available: undefined | boolean
    • contributors: undefined | DeezerArtist[]
    • cover: DeezerImage
    • durationInSec: undefined | number
    • explicit: boolean
    • genres: undefined | DeezerGenre[]
    • id: number
    • numberOfFans: undefined | number
    • recordType: string
    • releaseDate: undefined | Date
    • title: string
    • tracks: { 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 }[]
    • tracksCount: number
    • type: "playlist" | "track" | "album"
    • upc: undefined | string
    • url: string

Generated using TypeDoc