| @@ 40-51 (lines=12) @@ | ||
| 37 | * |
|
| 38 | * @return Bridge[] |
|
| 39 | */ |
|
| 40 | public function getBridges() |
|
| 41 | { |
|
| 42 | $uri = 'bridges'; |
|
| 43 | $response = $this->client->getEndpoint()->get($uri); |
|
| 44 | ||
| 45 | $bridges = []; |
|
| 46 | foreach (\GuzzleHttp\json_decode($response->getBody()) as $bridge) { |
|
| 47 | $bridges[] = new Bridge($this->client, $bridge); |
|
| 48 | } |
|
| 49 | ||
| 50 | return $bridges; |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Create a new bridge. This bridge persists until it has been shut down, or Asterisk has been shut down. |
|
| @@ 54-65 (lines=12) @@ | ||
| 51 | * |
|
| 52 | * @return Channel[] |
|
| 53 | */ |
|
| 54 | public function getChannels() |
|
| 55 | { |
|
| 56 | $uri = '/channels'; |
|
| 57 | $response = $this->client->getEndpoint()->get($uri); |
|
| 58 | ||
| 59 | $channels = []; |
|
| 60 | foreach (\GuzzleHttp\json_decode($response->getBody()) as $channel) { |
|
| 61 | $channels[] = new Channel($this->client, $channel); |
|
| 62 | } |
|
| 63 | ||
| 64 | return $channels; |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Create a new channel (originate). The new channel is created immediately and a snapshot of it |
|
| @@ 49-60 (lines=12) @@ | ||
| 46 | * |
|
| 47 | * @return DeviceState[] |
|
| 48 | */ |
|
| 49 | public function getDeviceStates() |
|
| 50 | { |
|
| 51 | $uri = 'deviceStates'; |
|
| 52 | $response = $this->client->getEndpoint()->get($uri); |
|
| 53 | ||
| 54 | $deviceStates = []; |
|
| 55 | foreach (\GuzzleHttp\json_decode($response->getBody()) as $deviceState) { |
|
| 56 | $deviceStates[] = new DeviceState($this->client, $deviceState); |
|
| 57 | } |
|
| 58 | ||
| 59 | return $deviceStates; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Retrieve the current state of a device. |
|
| @@ 43-54 (lines=12) @@ | ||
| 40 | * |
|
| 41 | * @return Endpoint |
|
| 42 | */ |
|
| 43 | public function getEndpoints() |
|
| 44 | { |
|
| 45 | $uri = 'endpoints'; |
|
| 46 | $response = $this->client->getEndpoint()->get($uri); |
|
| 47 | ||
| 48 | $endpoints = []; |
|
| 49 | foreach (\GuzzleHttp\json_decode($response->getBody()) as $endpoint) { |
|
| 50 | $endpoints[] = new Endpoint($this->client, $endpoint); |
|
| 51 | } |
|
| 52 | ||
| 53 | return $endpoints; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Send a message to some technology URI or endpoint. |
|
| @@ 89-104 (lines=16) @@ | ||
| 86 | * @return \phparia\Resources\Endpoint[] |
|
| 87 | * @throws NotFoundException |
|
| 88 | */ |
|
| 89 | public function getEndpointsByTech($tech) |
|
| 90 | { |
|
| 91 | $uri = "endpoints/$tech"; |
|
| 92 | try { |
|
| 93 | $response = $this->client->getEndpoint()->get($uri); |
|
| 94 | } catch (RequestException $e) { |
|
| 95 | $this->processRequestException($e); |
|
| 96 | } |
|
| 97 | ||
| 98 | $endpoints = []; |
|
| 99 | foreach (\GuzzleHttp\json_decode($response->getBody()) as $endpoint) { |
|
| 100 | $endpoints[] = new Endpoint($this->client, $endpoint); |
|
| 101 | } |
|
| 102 | ||
| 103 | return $endpoints; |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Details for an endpoint. |
|