SearchHandler
extends BaseHandler
in package
Table of Contents
Properties
- $accessToken : string|null
- $baseUrl : string
- $client : Client
- $credentialService : SpotifyCredentialService|null
Methods
- __construct() : mixed
- search() : array<string|int, mixed>
- Search for tracks, albums, artists, or playlists
- searchAlbums() : array<string|int, mixed>
- Search for albums
- searchArtists() : array<string|int, mixed>
- Search for artists
- searchPlaylists() : array<string|int, mixed>
- Search for playlists
- searchTracks() : array<string|int, mixed>
- Search for tracks
- setAccessToken() : void
- Set the access token
- setCredentialService() : void
- Set the credential service
- getAccessToken() : string|null
- Get the current access token
- getAuthHeaders() : array<string|int, mixed>
- Get authorization headers
- makeRequest() : array<string|int, mixed>
- Make an authenticated request
Properties
$accessToken
protected
string|null
$accessToken
= null
$baseUrl read-only
protected
string
$baseUrl
$client read-only
protected
Client
$client
$credentialService
protected
SpotifyCredentialService|null
$credentialService
= null
Methods
__construct()
public
__construct(Client $client, string $baseUrl) : mixed
Parameters
- $client : Client
- $baseUrl : string
search()
Search for tracks, albums, artists, or playlists
public
search(string $query[, array<string|int, mixed> $types = ['track'] ][, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ]) : array<string|int, mixed>
Parameters
- $query : string
- $types : array<string|int, mixed> = ['track']
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
Return values
array<string|int, mixed>searchAlbums()
Search for albums
public
searchAlbums(string $query[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ]) : array<string|int, mixed>
Parameters
- $query : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
Return values
array<string|int, mixed>searchArtists()
Search for artists
public
searchArtists(string $query[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ]) : array<string|int, mixed>
Parameters
- $query : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
Return values
array<string|int, mixed>searchPlaylists()
Search for playlists
public
searchPlaylists(string $query[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ]) : array<string|int, mixed>
Parameters
- $query : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
Return values
array<string|int, mixed>searchTracks()
Search for tracks
public
searchTracks(string $query[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ]) : array<string|int, mixed>
Parameters
- $query : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
Return values
array<string|int, mixed>setAccessToken()
Set the access token
public
setAccessToken(string|null $accessToken) : void
Parameters
- $accessToken : string|null
setCredentialService()
Set the credential service
public
setCredentialService(SpotifyCredentialService $credentialService) : void
Parameters
- $credentialService : SpotifyCredentialService
getAccessToken()
Get the current access token
protected
getAccessToken() : string|null
Return values
string|nullgetAuthHeaders()
Get authorization headers
protected
getAuthHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>makeRequest()
Make an authenticated request
protected
makeRequest(string $method, string $endpoint[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $method : string
- $endpoint : string
- $options : array<string|int, mixed> = []