Bånder

UserHandler extends BaseHandler
in package

Table of Contents

Properties

$baseUrl  : string
$client  : Client
$credentialService  : LastFmCredentialService|null
$sessionKey  : string|null

Methods

__construct()  : mixed
getLovedTracks()  : array<string|int, mixed>
getRecentTracks()  : array<string|int, mixed>
getTopArtists()  : array<string|int, mixed>
setCredentialService()  : void
Set the credential service for automatic session management
setSessionKey()  : void
Manually set session key (overrides automatic detection)
buildQueryParams()  : array<string|int, mixed>
Build query parameters with automatic session key injection
getSessionKey()  : string|null
Get session key for authenticated requests
hasValidCredentials()  : bool
Check if current user has valid credentials
makeRequest()  : array<string|int, mixed>
Make synchronous API request with error handling
makeRequestAsync()  : PromiseInterface
Make asynchronous API request returning a promise
requireAuthentication()  : bool
Require authenticated session for the request

Properties

$sessionKey

protected string|null $sessionKey = null

Methods

__construct()

public __construct(Client $client, string $baseUrl) : mixed
Parameters
$client : Client
$baseUrl : string

getLovedTracks()

public getLovedTracks([string|null $username = null ][, int $limit = 50 ][, int $page = 1 ]) : array<string|int, mixed>
Parameters
$username : string|null = null
$limit : int = 50
$page : int = 1
Return values
array<string|int, mixed>

getRecentTracks()

public getRecentTracks([string|null $username = null ][, int $limit = 50 ][, int $page = 1 ]) : array<string|int, mixed>
Parameters
$username : string|null = null
$limit : int = 50
$page : int = 1
Return values
array<string|int, mixed>

getTopArtists()

public getTopArtists([string|null $username = null ][, string $period = 'overall' ][, int $limit = 50 ]) : array<string|int, mixed>
Parameters
$username : string|null = null
$period : string = 'overall'
$limit : int = 50
Return values
array<string|int, mixed>

setSessionKey()

Manually set session key (overrides automatic detection)

public setSessionKey(string|null $sessionKey) : void
Parameters
$sessionKey : string|null

buildQueryParams()

Build query parameters with automatic session key injection

protected buildQueryParams(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

getSessionKey()

Get session key for authenticated requests

protected getSessionKey() : string|null
Return values
string|null

hasValidCredentials()

Check if current user has valid credentials

protected hasValidCredentials() : bool
Return values
bool

makeRequest()

Make synchronous API request with error handling

protected makeRequest(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

makeRequestAsync()

Make asynchronous API request returning a promise

protected makeRequestAsync(array<string|int, mixed> $params) : PromiseInterface
Parameters
$params : array<string|int, mixed>
Return values
PromiseInterface

requireAuthentication()

Require authenticated session for the request

protected requireAuthentication() : bool
Return values
bool

        
On this page

Search results