1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Slack API library. |
5
|
|
|
* |
6
|
|
|
* (c) Cas Leentfaar <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace CL\Slack\Model; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @author Cas Leentfaar <[email protected]> |
16
|
|
|
* |
17
|
|
|
* @link Official documentation at https://api.slack.com/types/channel |
18
|
|
|
*/ |
19
|
|
|
class Channel extends SimpleChannel |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var SimpleMessage |
23
|
|
|
*/ |
24
|
|
|
private $latest; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
private $lastRead; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var bool |
33
|
|
|
*/ |
34
|
|
|
private $isMember; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var array<string> |
38
|
|
|
*/ |
39
|
|
|
private $members = []; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var Customizable |
43
|
|
|
*/ |
44
|
|
|
private $topic; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var Customizable |
48
|
|
|
*/ |
49
|
|
|
private $purpose; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return string The ID of this channel. |
53
|
|
|
*/ |
54
|
|
|
public function getId() |
55
|
|
|
{ |
56
|
|
|
return $this->id; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return string The name of the channel, without a leading hash sign. |
61
|
|
|
*/ |
62
|
|
|
public function getName() |
63
|
|
|
{ |
64
|
|
|
return $this->name; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return SimpleMessage The latest message in the channel. |
69
|
|
|
*/ |
70
|
|
|
public function getLatest() |
71
|
|
|
{ |
72
|
|
|
return $this->latest; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string The Slack timestamp for the last message the calling user has read in this channel. |
77
|
|
|
*/ |
78
|
|
|
public function getLastRead() |
79
|
|
|
{ |
80
|
|
|
return $this->lastRead; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return \DateTime The date/time on which this channel was created. |
85
|
|
|
*/ |
86
|
|
|
public function getCreated() |
87
|
|
|
{ |
88
|
|
|
return $this->created; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return string The user ID of the member that created this channel. |
93
|
|
|
*/ |
94
|
|
|
public function getCreator() |
95
|
|
|
{ |
96
|
|
|
return $this->creator; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return bool True if this channel has been archived, false otherwise. |
101
|
|
|
*/ |
102
|
|
|
public function isArchived() |
103
|
|
|
{ |
104
|
|
|
return $this->isArchived; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return bool Returns true if this channel is the "general" channel that includes all regular team members, |
109
|
|
|
* false otherwise. In most teams this is called #general but some teams have renamed it. |
110
|
|
|
*/ |
111
|
|
|
public function isGeneral() |
112
|
|
|
{ |
113
|
|
|
return $this->isGeneral; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @return bool Will be true if the calling member is part of the channel. |
118
|
|
|
*/ |
119
|
|
|
public function isMember() |
120
|
|
|
{ |
121
|
|
|
return $this->isMember; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return array A list of user ids for all users in this channel. |
126
|
|
|
* This includes any disabled accounts that were in this channel when they were disabled. |
127
|
|
|
*/ |
128
|
|
|
public function getMembers() |
129
|
|
|
{ |
130
|
|
|
return $this->members; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return Customizable Information about the channel's topic. |
135
|
|
|
*/ |
136
|
|
|
public function getTopic() |
137
|
|
|
{ |
138
|
|
|
return $this->topic; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @return Customizable Information about the channel's purpose. |
143
|
|
|
*/ |
144
|
|
|
public function getPurpose() |
145
|
|
|
{ |
146
|
|
|
return $this->purpose; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|