Properties

$uuid

$uuid : array

UUID holds the Playlist UUID

Type

array

$timeout

$timeout : integer

Timeout represents the HTTP timeout when HTTP requests to the SinusBot API are performed

Type

integer

$token

$token : string

Token is the SinusBot auth token which will be there temporary stored.

Type

string

$url

$url : string

URL is the SinusBot URL with the port and the HTTP protocol

Type

string

$headers

$headers : array

headers are http headers which will be added on every request

Type

array

$playlist

$playlist : array

Playlist stores the initial received playlist data

Type

array

Methods

__construct()

__construct(\SinusBot\API  $api, array  $playlist) : void

__construct

Parameters

\SinusBot\API $api

SinusBot API

array $playlist

SinusBot Playlist array.

addHeader()

addHeader(string  $key, string  $value) 

addHeader adds a header to every http request

Parameters

string $key

http header key

string $value

http header value

setAuthToken()

setAuthToken(string  $token) 

setAuthToken overrides the auth token

Parameters

string $token

Auth-Token, when you want to override

rename()

rename(string  $playlistName) : array

rename renames a playlist

Parameters

string $playlistName

new name for the playlist

Returns

array —

status

getTracks()

getTracks() : array

getPlaylistTracks returns the tracks of the playlist

Returns

array —

files

getName()

getName() : string

getName returns the name of the playlist

Returns

string —

name

getEntries()

getEntries() : array

getEntries returns the track entries

Returns

array —

track entries

getSource()

getSource() : string

getSource returns the source of the playlist

Returns

string —

source

addTrack()

addTrack(string  $trackUUID) : array

addPlaylistTrack adds a track to the playlist

Parameters

string $trackUUID

uuid of the track

Returns

array —

status

deleteTrack()

deleteTrack(integer  $trackPosition) : array

deleteTrack deletes a track from the playlist

Parameters

integer $trackPosition

first entry = 0

Returns

array —

status

deleteTracks()

deleteTracks() : array

deleteTracks deletes all the tracks in the playlist

Returns

array —

status

delete()

delete() : array

delete deletes a playlist

Returns

array —

status

request()

request(string  $path, string  $method = "GET", string  $payload = null, boolean  $encoded = false) : array

request executes a request to the SinusBot API

Parameters

string $path

/api/v1/

string $method

http method

string $payload

http POST payload

boolean $encoded

when not encoded it will be JSON marshalled

Returns

array —

decoded JSON response

getError()

getError(integer  $code) : string

getError returns the string representive to the given http status code

Parameters

integer $code

http status code

Returns

string —

http status code string representive