A client to retrieve some basic infos about Deezer resources.

Create a client instance with the given options. Options should be passed in to the constructor as kwargs.

import { Client } from "deezer-ts";
client = new Client();

This client provides several methods to retrieve the content most kinds of Deezer objects, based on their json structure.

Headers can be forced by using the headers kwarg. For example, use Accept-Language header to force the output language.

import { Client } from "deezer-ts";
client = new Client({ headers: { "Accept-Language": "en" } });

Additional headers to pass.

Constructors

  • Create a new client instance.

    Parameters

    • Optionalheaders: Record<string, string>

      Additional headers to pass.

    Returns Client

Methods

  • Make a request to the API and parse the response.

    Type Parameters

    • T

      The type of the response.

    Parameters

    • method: string

      The HTTP method to use.

    • path: string

      The path to request.

    • paginateList: false

      Whether to paginate the response.

    • Optionalparent: Resource

      The parent resource.

    • OptionalresourceType: ResourceConstructor

      The resource type.

    • OptionalresourceId: number

      The resource id.

    • Optionalparams: Record<string, string>

      Additional parameters to pass.

    Returns Promise<T>

    • The response.
  • Make a request to the API and parse the response.

    Type Parameters

    • T

      The type of the response.

    Parameters

    • method: string

      The HTTP method to use.

    • path: string

      The path to request.

    • paginateList: true

      Whether to paginate the response.

    • Optionalparent: Resource

      The parent resource.

    • OptionalresourceType: ResourceConstructor

      The resource type.

    • OptionalresourceId: number

      The resource id.

    • Optionalparams: Record<string, string>

      Additional parameters to pass.

    Returns Promise<GenericPaginatedList<T>>

    • The response.
  • Get the album with the given id.

    Parameters

    • albumId: number

      The id of the album to get.

    Returns Promise<Album>

    Album - An album object.

  • Get the artist with the given id.

    Parameters

    • artistId: number

      The id of the artist to get.

    Returns Promise<Artist>

    Artist - An artist object.

  • Get overall charts for tracks, albums, artists and playlists for the given genre ID.

    Combine charts of several resources in one endpoint.

    Parameters

    • genreId: number = 0

      The genre id, default to All genre (genreId = 0).

    Returns Promise<Chart>

    Chart - A chart instance.

  • Get top tracks for the given genre id.

    Parameters

    • genreId: number = 0

      The genre id, default to All genre (genreId = 0).

    Returns Promise<Track[]>

    A list of Track instances.

  • Get top albums for the given genre id.

    Parameters

    • genreId: number = 0

      The genre id, default to All genre (genreId = 0).

    Returns Promise<Album[]>

    A list of Album instances.

  • Get top artists for the given genre id.

    Parameters

    • genreId: number = 0

      The genre id, default to All genre (genreId = 0).

    Returns Promise<Artist[]>

    A list of Artist instances.

  • Get top playlists for the given genre id.

    Parameters

    • genreId: number = 0

      The genre id, default to All genre (genreId = 0).

    Returns Promise<Playlist[]>

    A list of Playlist instances.

  • Get top podcasts for the given genre id.

    Parameters

    • genreId: number = 0

      The genre id, default to All genre (genreId = 0).

    Returns Promise<Podcast[]>

    A list of Podcast instances.

  • Get the editorial with the given id.

    Parameters

    • editorialId: number

      The id of the editorial to get.

    Returns Promise<Editorial>

    a Editorial object.

  • Get the episode with the given id.

    Parameters

    • episodeId: number

      The id of the episode to get.

    Returns Promise<Episode>

    Episode - An episode object.

  • Get the genre with the given id.

    Parameters

    • genreId: number

      The id of the genre to get.

    Returns Promise<Genre>

    Genre - A genre object.

  • Get the playlist with the given id.

    Parameters

    • playlistId: number

      The id of the playlist to get.

    Returns Promise<Playlist>

    Playlist - A playlist object.

  • Get the podcast with the given id.

    Parameters

    • podcastId: number

      The id of the podcast to get.

    Returns Promise<Podcast>

    Podcast - A podcast object.

  • Get the radio with the given id.

    Parameters

    • radioId: number

      The id of the radio to get.

    Returns Promise<Radio>

    Radio - A radio object.

  • Get the track with the given id.

    Parameters

    • trackId: number

      The id of the track to get.

    Returns Promise<Track>

    Track - A track object.

  • Get the user with the given id.

    Parameters

    • userId: number

      The id of the user to get.

    Returns Promise<User>

    User - A user object.

  • Get the flow of the user with the given id.

    Parameters

    • userId: number

      The id of the user to get.

    • Optionalparams: Record<string, string>

      Additional parameters to pass.

    Returns Promise<PaginatedList<Track>>

    PaginatedList of Track - A list of tracks.

  • Search tracks.

    Advanced search is available by either formatting the query yourself or by using the dedicated keywords arguments.

    Parameters

    • query: string = ""

      the query to search for, this is directly passed as q query.

    • Optionalstrict: boolean

      whether to disable fuzzy search and enable strict mode.

    • Optionalordering: string

      see Deezer API docs for possible values..

    • advancedParams: {
          artist?: string;
          album?: string;
          track?: string;
          label?: string;
          dur_min?: number;
          dur_max?: number;
          bpm_min?: number;
          bpm_max?: number;
      } = {}

      Additional parameters to pass.

      • Optionalartist?: string

        The artist to search for

      • Optionalalbum?: string

        The album to search for

      • Optionaltrack?: string

        The track to search for

      • Optionallabel?: string

        The label to search for

      • Optionaldur_min?: number

        The minimum duration of the track

      • Optionaldur_max?: number

        The maximum duration of the track

      • Optionalbpm_min?: number

        The minimum BPM of the track

      • Optionalbpm_max?: number

        The maximum BPM of the track

    Returns Promise<PaginatedList<Track>>

    PaginatedList of Track - A list of tracks.

  • Search albums matching the given query.

    Parameters

    • query: string = ""

      the query to search for, this is directly passed as q query.

    • Optionalstrict: boolean

      whether to disable fuzzy search and enable strict mode.

    • Optionalordering: string

      see Deezer API docs for possible values.

    Returns Promise<PaginatedList<Album>>

  • Search artists matching the given query.

    Parameters

    • query: string = ""

      the query to search for, this is directly passed as q query.

    • Optionalstrict: boolean

      whether to disable fuzzy search and enable strict mode.

    • Optionalordering: string

      see Deezer API docs for possible values.

    Returns Promise<PaginatedList<Artist>>

  • Search playlists matching the given query.

    Parameters

    • query: string = ""

      the query to search for, this is directly passed as q query.

    • Optionalstrict: boolean

      whether to disable fuzzy search and enable strict mode.

    • Optionalordering: string

      see Deezer API docs for possible values.

    Returns Promise<PaginatedList<Playlist>>