| @@ 18-31 (lines=14) @@ | ||
| 15 | * @param string $identifier |
|
| 16 | * @return DeviceModel |
|
| 17 | */ |
|
| 18 | public function getDevice(string $identifier): DeviceModel |
|
| 19 | { |
|
| 20 | try { |
|
| 21 | $response = $this->client->get('/v2/devices/' . $identifier); |
|
| 22 | ||
| 23 | return $this->serializer->deserialize( |
|
| 24 | (string)$response->getBody(), |
|
| 25 | DeviceModel::class, |
|
| 26 | 'json' |
|
| 27 | ); |
|
| 28 | } catch (ClientException $e) { |
|
| 29 | throw $this->createApiException($e); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return DeviceModel[] |
|
| @@ 36-49 (lines=14) @@ | ||
| 33 | /** |
|
| 34 | * @return DeviceModel[] |
|
| 35 | */ |
|
| 36 | public function getDevices(): array |
|
| 37 | { |
|
| 38 | try { |
|
| 39 | $response = $this->client->get('/v2/devices'); |
|
| 40 | ||
| 41 | return $this->serializer->deserialize( |
|
| 42 | (string)$response->getBody(), |
|
| 43 | 'array<Speicher210\Estimote\Model\Device>', |
|
| 44 | 'json' |
|
| 45 | ); |
|
| 46 | } catch (ClientException $e) { |
|
| 47 | throw $this->createApiException($e); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @param string $identifier The device identifier. |
|