1 <?php
2 namespace Slack;
3
4 5 6
7 class DirectMessageChannel extends ClientObject implements ChannelInterface
8 {
9 10 11
12 public function getId()
13 {
14 return $this->data['id'];
15 }
16
17 18 19 20 21
22 public function getTimeCreated()
23 {
24 $time = new \DateTime();
25 $time->setTimestamp($this->data['created']);
26 return $time;
27 }
28
29 30 31 32 33
34 public function getUser()
35 {
36 return $this->client->getUserById($this->data['user']);
37 }
38
39 40 41
42 public function close()
43 {
44 return $this->client->apiCall('im.close', [
45 'channel' => $this->getId(),
46 ])->then(function ($response) {
47 return !isset($response['no_op']);
48 });
49 }
50 }
51