| @@ 189-200 (lines=12) @@ | ||
| 186 | /** |
|
| 187 | * {@inheritDoc} |
|
| 188 | */ |
|
| 189 | public function getChannelById($id) |
|
| 190 | { |
|
| 191 | if (!$this->connected) { |
|
| 192 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 193 | } |
|
| 194 | ||
| 195 | if (!isset($this->channels[$id])) { |
|
| 196 | return Promise\reject(new ApiException("No channel exists for ID '$id'.")); |
|
| 197 | } |
|
| 198 | ||
| 199 | return Promise\resolve($this->channels[$id]); |
|
| 200 | } |
|
| 201 | ||
| 202 | /** |
|
| 203 | * {@inheritDoc} |
|
| @@ 217-228 (lines=12) @@ | ||
| 214 | /** |
|
| 215 | * {@inheritDoc} |
|
| 216 | */ |
|
| 217 | public function getGroupById($id) |
|
| 218 | { |
|
| 219 | if (!$this->connected) { |
|
| 220 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 221 | } |
|
| 222 | ||
| 223 | if (!isset($this->groups[$id])) { |
|
| 224 | return Promise\reject(new ApiException("No group exists for ID '$id'.")); |
|
| 225 | } |
|
| 226 | ||
| 227 | return Promise\resolve($this->groups[$id]); |
|
| 228 | } |
|
| 229 | ||
| 230 | /** |
|
| 231 | * {@inheritDoc} |
|
| @@ 245-256 (lines=12) @@ | ||
| 242 | /** |
|
| 243 | * {@inheritDoc} |
|
| 244 | */ |
|
| 245 | public function getDMById($id) |
|
| 246 | { |
|
| 247 | if (!$this->connected) { |
|
| 248 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 249 | } |
|
| 250 | ||
| 251 | if (!isset($this->dms[$id])) { |
|
| 252 | return Promise\reject(new ApiException("No DM exists for ID '$id'.")); |
|
| 253 | } |
|
| 254 | ||
| 255 | return Promise\resolve($this->dms[$id]); |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * {@inheritDoc} |
|
| @@ 273-284 (lines=12) @@ | ||
| 270 | /** |
|
| 271 | * {@inheritDoc} |
|
| 272 | */ |
|
| 273 | public function getUserById($id) |
|
| 274 | { |
|
| 275 | if (!$this->connected) { |
|
| 276 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 277 | } |
|
| 278 | ||
| 279 | if (!isset($this->users[$id])) { |
|
| 280 | return Promise\reject(new ApiException("No user exists for ID '$id'.")); |
|
| 281 | } |
|
| 282 | ||
| 283 | return Promise\resolve($this->users[$id]); |
|
| 284 | } |
|
| 285 | ||
| 286 | /** |
|
| 287 | * Gets all bots in the Slack team. |
|
| @@ 307-318 (lines=12) @@ | ||
| 304 | * |
|
| 305 | * @return \React\Promise\PromiseInterface A promise for a bot object. |
|
| 306 | */ |
|
| 307 | public function getBotById($id) |
|
| 308 | { |
|
| 309 | if (!$this->connected) { |
|
| 310 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 311 | } |
|
| 312 | ||
| 313 | if (!isset($this->bots[$id])) { |
|
| 314 | return Promise\reject(new ApiException("No bot exists for ID '$id'.")); |
|
| 315 | } |
|
| 316 | ||
| 317 | return Promise\resolve($this->bots[$id]); |
|
| 318 | } |
|
| 319 | ||
| 320 | /** |
|
| 321 | * {@inheritDoc} |
|