SpotifyClient
in package
Table of Contents
Constants
- BASE_URL = 'https://api.spotify.com/v1/'
Properties
- $auth : AuthHandler
- $genres : GenreHandler
- $search : SearchHandler
- $user : UserHandler
- $client : Client
- $credentialService : SpotifyCredentialService
Methods
- __clone() : mixed
- Clone the handlers when cloning the client
- __construct() : mixed
- clearSession() : void
- Reset access token for all handlers (logout)
- forUser() : static
- Get authenticated client for a specific user
- getAccessToken() : string|null
- Get the current access token from credential service
- getBaseUrl() : string
- Get the base URL
- getClient() : Client
- Get the HTTP client
- getCredentialService() : SpotifyCredentialService
- Get the credential service
- hasValidCredentials() : bool
- Check if current user has valid credentials
- isAuthenticated() : bool
- Check if the client is configured for authenticated requests
- setAccessToken() : void
- Override access token for all handlers
- withAccessToken() : static
- Create a clone of this client with a specific access token
- injectCredentialService() : void
- Inject credential service into all handlers that extend BaseHandler
Constants
BASE_URL
public
mixed
BASE_URL
= 'https://api.spotify.com/v1/'
Properties
$auth
public
AuthHandler
$auth
$genres
public
GenreHandler
$genres
$search
public
SearchHandler
$search
$user
public
UserHandler
$user
$client read-only
private
Client
$client
$credentialService read-only
private
SpotifyCredentialService
$credentialService
Methods
__clone()
Clone the handlers when cloning the client
public
__clone() : mixed
__construct()
public
__construct(Client $client, SpotifyCredentialService $credentialService) : mixed
Parameters
- $client : Client
- $credentialService : SpotifyCredentialService
clearSession()
Reset access token for all handlers (logout)
public
clearSession() : void
forUser()
Get authenticated client for a specific user
public
forUser(User $user) : static
Parameters
- $user : User
Return values
staticgetAccessToken()
Get the current access token from credential service
public
getAccessToken() : string|null
Return values
string|nullgetBaseUrl()
Get the base URL
public
getBaseUrl() : string
Return values
stringgetClient()
Get the HTTP client
public
getClient() : Client
Return values
ClientgetCredentialService()
Get the credential service
public
getCredentialService() : SpotifyCredentialService
Return values
SpotifyCredentialServicehasValidCredentials()
Check if current user has valid credentials
public
hasValidCredentials() : bool
Return values
boolisAuthenticated()
Check if the client is configured for authenticated requests
public
isAuthenticated() : bool
Return values
boolsetAccessToken()
Override access token for all handlers
public
setAccessToken(string|null $accessToken) : void
Parameters
- $accessToken : string|null
withAccessToken()
Create a clone of this client with a specific access token
public
withAccessToken(string|null $accessToken) : static
Parameters
- $accessToken : string|null
Return values
staticinjectCredentialService()
Inject credential service into all handlers that extend BaseHandler
private
injectCredentialService() : void