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