Home Reference Source Repository
import Client from 'spotify-sdk/src/Client.js'
public class | source

Client

You can directly use instance of this class. client

Client is the responsible of comunicate with the API.

Static Member Summary

Static Public Members
public static get

Get the current instance of Client

Constructor Summary

Public Constructor
public

constructor(enforcer: Symbol)

Constructor

Member Summary

Public Members
public set

settings(settings: Object): *

Set settings

public set

token(data: String): *

Set token

public get

Get the current token

Method Summary

Public Methods
public

fetch(endpoint: String, method: String, body: Object): Promise

public

login(callback: Function): Function | Promise

This method fires a new window that allow login

public

request(url: String, method: String, body: Object): Promise

public

Function that encode objects

Static Public Members

public static get instance: Object: * source

Get the current instance of Client

Return:

Object

instance

Public Constructors

public constructor(enforcer: Symbol) source

Constructor

Params:

NameTypeAttributeDescription
enforcer Symbol

Public Members

public set settings(settings: Object): * source

Set settings

public set token(data: String): * source

Set token

public get token: String: * source

Get the current token

Return:

String

Current token

Public Methods

public fetch(endpoint: String, method: String, body: Object): Promise source

Params:

NameTypeAttributeDescription
endpoint String

Endpoint

method String

Method GET, POST, PUT or DELETE

body Object

Objet to send in the body

Return:

Promise

public login(callback: Function): Function | Promise source

This method fires a new window that allow login

Params:

NameTypeAttributeDescription
callback Function

Return:

Function | Promise

public request(url: String, method: String, body: Object): Promise source

Params:

NameTypeAttributeDescription
url String

Endpoint

method String

Method GET, POST, PUT or DELETE

body Object

Objet to send in the body

Return:

Promise

public toQueryString(obj: Object): String source

Function that encode objects

Params:

NameTypeAttributeDescription
obj Object

Object to encode

Return:

String

A encode object