PHP Class SpotifyWebAPI\Session

Afficher le fichier Open project: jwilsson/spotify-web-api-php Class Usage Examples

Protected Properties

Свойство Type Description
$accessToken
$clientId
$clientSecret
$expirationTime
$redirectUri
$refreshToken
$request

Méthodes publiques

Méthode Description
__construct ( string $clientId, string $clientSecret, string $redirectUri = '', Request $request = null ) Constructor Set up client credentials.
getAccessToken ( ) : string Get the access token.
getAuthorizeUrl ( array | object $options = [] ) : string Get the authorization URL.
getClientId ( ) : string Get the client ID.
getClientSecret ( ) : string Get the client secret.
getRedirectUri ( ) : string Get the client's redirect URI.
getRefreshToken ( ) : string Get the refresh token.
getTokenExpiration ( ) : integer Get the access token expiration time.
refreshAccessToken ( string $refreshToken ) : boolean Refresh an access token.
requestAccessToken ( string $authorizationCode ) : boolean Request an access token given an authorization code.
requestCredentialsToken ( array $scope = [] ) : boolean Request an access token using the Client Credentials Flow.
setClientId ( string $clientId ) : void Set the client ID.
setClientSecret ( string $clientSecret ) : void Set the client secret.
setRedirectUri ( string $redirectUri ) : void Set the client's redirect URI.

Method Details

__construct() public méthode

Constructor Set up client credentials.
public __construct ( string $clientId, string $clientSecret, string $redirectUri = '', Request $request = null )
$clientId string The client ID.
$clientSecret string The client secret.
$redirectUri string Optional. The redirect URI.
$request Request Optional. The Request object to use.

getAccessToken() public méthode

Get the access token.
public getAccessToken ( ) : string
Résultat string The access token.

getAuthorizeUrl() public méthode

Get the authorization URL.
public getAuthorizeUrl ( array | object $options = [] ) : string
$options array | object Optional. Options for the authorization URL. - array scope Optional. Scope(s) to request from the user. - boolean show_dialog Optional. Whether or not to force the user to always approve the app. Default is false. - string state Optional. A CSRF token.
Résultat string The authorization URL.

getClientId() public méthode

Get the client ID.
public getClientId ( ) : string
Résultat string The client ID.

getClientSecret() public méthode

Get the client secret.
public getClientSecret ( ) : string
Résultat string The client secret.

getRedirectUri() public méthode

Get the client's redirect URI.
public getRedirectUri ( ) : string
Résultat string The redirect URI.

getRefreshToken() public méthode

Get the refresh token.
public getRefreshToken ( ) : string
Résultat string The refresh token.

getTokenExpiration() public méthode

Get the access token expiration time.
public getTokenExpiration ( ) : integer
Résultat integer A Unix timestamp indicating the token expiration time.

refreshAccessToken() public méthode

Refresh an access token.
public refreshAccessToken ( string $refreshToken ) : boolean
$refreshToken string The refresh token to use.
Résultat boolean Whether the access token was successfully refreshed.

requestAccessToken() public méthode

Request an access token given an authorization code.
public requestAccessToken ( string $authorizationCode ) : boolean
$authorizationCode string The authorization code from Spotify.
Résultat boolean True when the access token was successfully granted, false otherwise.

requestCredentialsToken() public méthode

Request an access token using the Client Credentials Flow.
public requestCredentialsToken ( array $scope = [] ) : boolean
$scope array Optional. Scope(s) to request from the user.
Résultat boolean True when an access token was successfully granted, false otherwise.

setClientId() public méthode

Set the client ID.
public setClientId ( string $clientId ) : void
$clientId string The client ID.
Résultat void

setClientSecret() public méthode

Set the client secret.
public setClientSecret ( string $clientSecret ) : void
$clientSecret string The client secret.
Résultat void

setRedirectUri() public méthode

Set the client's redirect URI.
public setRedirectUri ( string $redirectUri ) : void
$redirectUri string The redirect URI.
Résultat void

Property Details

$accessToken protected_oe property

protected $accessToken

$clientId protected_oe property

protected $clientId

$clientSecret protected_oe property

protected $clientSecret

$expirationTime protected_oe property

protected $expirationTime

$redirectUri protected_oe property

protected $redirectUri

$refreshToken protected_oe property

protected $refreshToken

$request protected_oe property

protected $request