\duncan3dc\Sonos\CloudUser

Summary

Methods
Properties
Constants
__construct()
isAuthorised()
getUrl()
setCode()
request()
getHouseholds()
getHousehold()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getToken()
$username
$api
$cache
$cacheKey
N/A

Properties

$username

$username : string

Type

string

$cache

$cache : \Psr\SimpleCache\CacheInterface

Type

\Psr\SimpleCache\CacheInterface

$cacheKey

$cacheKey : string

Type

string

Methods

__construct()

__construct(string  $username, \duncan3dc\Sonos\Cloud\Interfaces\ApiInterface  $api, \Psr\SimpleCache\CacheInterface  $cache) 

Create a new instance.

Parameters

string $username
\duncan3dc\Sonos\Cloud\Interfaces\ApiInterface $api
\Psr\SimpleCache\CacheInterface $cache

isAuthorised()

isAuthorised() : boolean

Check if we have access to this users account.

Returns

boolean

getUrl()

getUrl() : string

Get the URL to send the user to for authorisation.

Returns

string

setCode()

setCode(\duncan3dc\Sonos\Cloud\string  $code) : void

Set the user's authorisation code after redirect.

Parameters

\duncan3dc\Sonos\Cloud\string $code

The code returned by the successful authorisation

request()

request(\duncan3dc\Sonos\Cloud\string  $method, \duncan3dc\Sonos\Cloud\string  $url, array  $data = array()) 

Parameters

\duncan3dc\Sonos\Cloud\string $method
\duncan3dc\Sonos\Cloud\string $url
array $data

getHouseholds()

getHouseholds() : \duncan3dc\Sonos\Cloud\Interfaces\iterable|array<mixed,\duncan3dc\Sonos\Cloud\Interfaces\HouseholdInterface>

Get all the households this user has access to.

Returns

\duncan3dc\Sonos\Cloud\Interfaces\iterable|array<mixed,\duncan3dc\Sonos\Cloud\Interfaces\HouseholdInterface>

getHousehold()

getHousehold(\duncan3dc\Sonos\Cloud\string  $id) : \duncan3dc\Sonos\Cloud\Interfaces\HouseholdInterface

Get a household this user has access to.

Parameters

\duncan3dc\Sonos\Cloud\string $id

Returns

\duncan3dc\Sonos\Cloud\Interfaces\HouseholdInterface

getToken()

getToken() : \League\OAuth2\Client\Token\AccessToken

Get the access token for this user.

Returns

\League\OAuth2\Client\Token\AccessToken