\duncan3dc\Sonos\CloudApi

Summary

Methods
Properties
Constants
__construct()
getUrl()
getAccessToken()
request()
getUser()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$client
$provider
N/A

Properties

$client

$client : \GuzzleHttp\ClientInterface

Type

\GuzzleHttp\ClientInterface

Methods

__construct()

__construct(string  $key, string  $secret, string  $redirect, \GuzzleHttp\ClientInterface|null  $client = null) 

Create a new instance.

Parameters

string $key
string $secret
string $redirect
\GuzzleHttp\ClientInterface|null $client

getUrl()

getUrl() : string

Get the authorisation URL for the API.

Returns

string

getAccessToken()

getAccessToken(string  $code) : \League\OAuth2\Client\Token\AccessToken

Generate an access token for the API.

Parameters

string $code

Returns

\League\OAuth2\Client\Token\AccessToken

request()

request(\duncan3dc\Sonos\Cloud\string  $method, \duncan3dc\Sonos\Cloud\string  $url, array  $data, \League\OAuth2\Client\Token\AccessToken  $token) : \stdClass

Send a request and return the response.

Parameters

\duncan3dc\Sonos\Cloud\string $method

The HTTP verb to use for the request

\duncan3dc\Sonos\Cloud\string $url

The url to issue the request to (https://api.ws.sonos.com/control/api/v1/ is optional)

array $data

The parameters to send with the request

\League\OAuth2\Client\Token\AccessToken $token

The access token for authorisation

Returns

\stdClass

getUser()

getUser(\duncan3dc\Sonos\Cloud\string  $username, \Psr\SimpleCache\CacheInterface  $cache = null) : \duncan3dc\Sonos\Cloud\Interfaces\UserInterface

Get a user instance.

Parameters

\duncan3dc\Sonos\Cloud\string $username
\Psr\SimpleCache\CacheInterface $cache

Returns

\duncan3dc\Sonos\Cloud\Interfaces\UserInterface