1 | <?php |
||
49 | class Rooms extends AbstractResource implements \IteratorAggregate |
||
50 | { |
||
51 | const GITHUB_ORG = 'ORG'; |
||
52 | const ORG_CHANNEL = 'ORG_CHANNEL'; |
||
53 | |||
54 | const GITHUB_REPO = 'REPO'; |
||
55 | const REPO_CHANNEL = 'REPO_CHANNEL'; |
||
56 | |||
57 | const ONE_TO_ONE = 'ONETOONE'; |
||
58 | const USER_CHANNEL = 'USER_CHANNEL'; |
||
59 | |||
60 | /** |
||
61 | * List rooms the current user is in |
||
62 | * |
||
63 | * @param string $query Search query |
||
64 | * @return array |
||
65 | * @throws \InvalidArgumentException |
||
66 | * @throws \Throwable |
||
67 | * @throws \Exception |
||
68 | */ |
||
69 | public function all(string $query = null): array |
||
77 | |||
78 | /** |
||
79 | * To join a room you'll need to provide a URI for it. |
||
80 | * Said URI can represent a GitHub Org, a GitHub Repo or a Gitter Channel. |
||
81 | * - If the room exists and the user has enough permission to access it, it'll be added to the room. |
||
82 | * - If the room doesn't exist but the supplied URI represents a GitHub Org or GitHub Repo the user |
||
83 | * is an admin of, the room will be created automatically and the user added. |
||
84 | * |
||
85 | * @param string $roomId Required ID of the room you would like to join |
||
86 | * @param string $userId Required ID of the user |
||
87 | * @return array |
||
88 | * @throws \InvalidArgumentException |
||
89 | * @throws \Throwable |
||
90 | * @throws \Exception |
||
91 | */ |
||
92 | public function joinUser(string $roomId, string $userId): array |
||
99 | |||
100 | /** |
||
101 | * Join to target room |
||
102 | * |
||
103 | * @param string $roomId Required ID of the room you would like to join |
||
104 | * @return array |
||
105 | * @throws \RuntimeException |
||
106 | * @throws \InvalidArgumentException |
||
107 | * @throws \Throwable |
||
108 | * @throws \Exception |
||
109 | * @throws \GuzzleHttp\Exception\ClientException |
||
110 | */ |
||
111 | public function join(string $roomId): array |
||
115 | |||
116 | /** |
||
117 | * To join a room you'll need to provide a URI for it. |
||
118 | * |
||
119 | * Said URI can represent a GitHub Org, a GitHub Repo or a Gitter Channel. |
||
120 | * - If the room exists and the user has enough permission to access it, it'll be added to the room. |
||
121 | * - If the room doesn't exist but the supplied URI represents a GitHub Org or GitHub Repo the user |
||
122 | * |
||
123 | * is an admin of, the room will be created automatically and the user added. |
||
124 | * |
||
125 | * @param string $name Required URI of the room you would like to join |
||
126 | * @return array |
||
127 | * @throws \InvalidArgumentException |
||
128 | * @throws \Throwable |
||
129 | * @throws \Exception |
||
130 | */ |
||
131 | public function joinByName(string $name): array |
||
135 | |||
136 | /** |
||
137 | * @param string $name |
||
138 | * @return array |
||
139 | * @throws \InvalidArgumentException |
||
140 | * @throws \Throwable |
||
141 | * @throws \Exception |
||
142 | */ |
||
143 | public function findByName(string $name): array |
||
147 | |||
148 | /** |
||
149 | * Kick target user from target room |
||
150 | * |
||
151 | * @param string $roomId Required ID of the room |
||
152 | * @param string $userId Required ID of the user |
||
153 | * @return array |
||
154 | * @throws \InvalidArgumentException |
||
155 | * @throws \Throwable |
||
156 | * @throws \Exception |
||
157 | */ |
||
158 | public function kick(string $roomId, string $userId): array |
||
166 | |||
167 | /** |
||
168 | * This can be self-inflicted to leave the the room and remove room from your left menu. |
||
169 | * |
||
170 | * @param string $roomId Required ID of the room |
||
171 | * @return array |
||
172 | * @throws \RuntimeException |
||
173 | * @throws \InvalidArgumentException |
||
174 | * @throws \Throwable |
||
175 | * @throws \Exception |
||
176 | * @throws \GuzzleHttp\Exception\ClientException |
||
177 | */ |
||
178 | public function leave(string $roomId): array |
||
182 | |||
183 | /** |
||
184 | * Sets up a new topic of target room |
||
185 | * |
||
186 | * @param string $roomId Room id |
||
187 | * @param string $topic Room topic |
||
188 | * @return mixed |
||
189 | * @throws \InvalidArgumentException |
||
190 | * @throws \Throwable |
||
191 | * @throws \Exception |
||
192 | */ |
||
193 | public function topic(string $roomId, string $topic): array |
||
201 | |||
202 | /** |
||
203 | * Sets the room is indexed by search engines |
||
204 | * |
||
205 | * @param string $roomId Room id |
||
206 | * @param bool $enabled Enable or disable room indexing |
||
207 | * @return array |
||
208 | * @throws \InvalidArgumentException |
||
209 | * @throws \Throwable |
||
210 | * @throws \Exception |
||
211 | */ |
||
212 | public function searchIndex(string $roomId, bool $enabled = true): array |
||
220 | |||
221 | /** |
||
222 | * Sets the tags that define the room |
||
223 | * |
||
224 | * @param string $roomId Room id |
||
225 | * @param array $tags Target tags |
||
226 | * @return array |
||
227 | * @throws \InvalidArgumentException |
||
228 | * @throws \Throwable |
||
229 | * @throws \Exception |
||
230 | */ |
||
231 | public function tags(string $roomId, array $tags = []): array |
||
239 | |||
240 | /** |
||
241 | * If you hate one of the rooms - you can destroy it! |
||
242 | * Fatality. |
||
243 | * |
||
244 | * @internal BE CAREFUL: THIS IS VERY DANGEROUS OPERATION. |
||
245 | * |
||
246 | * @param string $roomId Target room id |
||
247 | * @return array |
||
248 | * @throws \InvalidArgumentException |
||
249 | * @throws \Throwable |
||
250 | * @throws \Exception |
||
251 | */ |
||
252 | public function delete(string $roomId): array |
||
259 | |||
260 | /** |
||
261 | * List of Users currently in the room. |
||
262 | * |
||
263 | * @param string $roomId Target room id |
||
264 | * @param string $query Optional query for users search |
||
265 | * @return \Generator |
||
266 | * @throws \InvalidArgumentException |
||
267 | * @throws \Throwable |
||
268 | * @throws \Exception |
||
269 | */ |
||
270 | public function users(string $roomId, string $query = null): \Generator |
||
291 | |||
292 | /** |
||
293 | * Use the streaming API to listen events. |
||
294 | * The streaming API allows real-time access to messages fetching. |
||
295 | * |
||
296 | * @param string $roomId |
||
297 | * @return Observer |
||
298 | * @throws \InvalidArgumentException |
||
299 | * @throws \Throwable |
||
300 | */ |
||
301 | public function events(string $roomId): Observer |
||
309 | |||
310 | /** |
||
311 | * Use the streaming API to listen messages. |
||
312 | * The streaming API allows real-time access to messages fetching. |
||
313 | * |
||
314 | * @param string $roomId |
||
315 | * @return Observer |
||
316 | * @throws \InvalidArgumentException |
||
317 | * @throws \Throwable |
||
318 | */ |
||
319 | public function messages(string $roomId): Observer |
||
327 | |||
328 | /** |
||
329 | * @return \Generator |
||
330 | * @throws \InvalidArgumentException |
||
331 | * @throws \Throwable |
||
332 | * @throws \Exception |
||
333 | */ |
||
334 | public function getIterator(): \Generator |
||
342 | } |
||
343 |