1 | <?php |
||
27 | class Netatmo extends AbstractService |
||
28 | { |
||
29 | |||
30 | // SCOPES |
||
31 | // @link https://dev.netatmo.com/doc/authentication/scopes |
||
32 | |||
33 | // Used to read weather station's data (devicelist, getmeasure) |
||
34 | const SCOPE_STATION_READ = 'read_station'; |
||
35 | // Used to read thermostat's data (devicelist, getmeasure, getthermstate) |
||
36 | const SCOPE_THERMOSTAT_READ = 'read_thermostat'; |
||
37 | // Used to configure the thermostat (syncschedule, setthermpoint) |
||
38 | const SCOPE_THERMOSTAT_WRITE = 'write_thermostat'; |
||
39 | |||
40 | public function __construct( |
||
41 | CredentialsInterface $credentials, |
||
42 | ClientInterface $httpClient, |
||
43 | TokenStorageInterface $storage, |
||
44 | $scopes = array(), |
||
45 | UriInterface $baseApiUri = null |
||
46 | ) { |
||
47 | parent::__construct( |
||
48 | $credentials, |
||
49 | $httpClient, |
||
50 | $storage, |
||
51 | $scopes, |
||
52 | $baseApiUri, |
||
53 | true // use parameter state |
||
54 | ); |
||
55 | |||
56 | if (null === $baseApiUri) { |
||
57 | $this->baseApiUri = new Uri('https://api.netatmo.net/'); |
||
58 | } |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function getAuthorizationEndpoint() |
||
65 | { |
||
66 | return new Uri($this->baseApiUri.'oauth2/authorize'); |
||
67 | |||
68 | } |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | public function getAccessTokenEndpoint() |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | protected function getAuthorizationMethod() |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | protected function parseAccessTokenResponse($responseBody) |
||
117 | } |
||
118 |