1 | <?php |
||
11 | class RoomAPI |
||
12 | { |
||
13 | /** @var Client */ |
||
14 | protected $client; |
||
15 | |||
16 | /** |
||
17 | * Room api constructor |
||
18 | * |
||
19 | * @param Client $client that will be used to connect the server |
||
20 | */ |
||
21 | public function __construct(Client $client) |
||
25 | |||
26 | /** |
||
27 | * List non-archived rooms for this group |
||
28 | * More info: https://www.hipchat.com/docs/apiv2/method/get_all_rooms |
||
29 | * |
||
30 | * @param array $params Query string parameter(s), for example: array('max-results' => 30) |
||
31 | * |
||
32 | * @return array |
||
33 | */ |
||
34 | public function getRooms($params = array()) |
||
44 | |||
45 | /** |
||
46 | * Gets room by id or name |
||
47 | * More info: https://www.hipchat.com/docs/apiv2/method/get_room |
||
48 | * |
||
49 | * @param string $id The id or name of the room |
||
50 | * |
||
51 | * @return Room |
||
52 | */ |
||
53 | public function getRoom($id) |
||
59 | |||
60 | public function getRoomMembers($id) |
||
66 | |||
67 | /** |
||
68 | * Fetch latest chat history for this room. |
||
69 | * More info: https://www.hipchat.com/docs/apiv2/method/view_recent_room_history |
||
70 | * |
||
71 | * @param string $id The id or name of the room |
||
72 | * @param array $params Query string parameter(s), for example: array('max-results' => 30) |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | public function getRecentHistory($id, $params = array()) |
||
86 | |||
87 | /** |
||
88 | * Creates a room |
||
89 | * More info: https://www.hipchat.com/docs/apiv2/method/create_room |
||
90 | * |
||
91 | * @param Room $room New room to be persisted |
||
92 | * |
||
93 | * @return integer Just created room id |
||
94 | */ |
||
95 | public function createRoom(Room $room) |
||
101 | |||
102 | /** |
||
103 | * Updates a room |
||
104 | * More info: https://www.hipchat.com/docs/apiv2/method/update_room |
||
105 | * |
||
106 | * @param Room $room Existing room to be updated |
||
107 | * |
||
108 | * @return void |
||
109 | */ |
||
110 | public function updateRoom(Room $room) |
||
114 | |||
115 | /** |
||
116 | * Deletes a room and kicks the current participants. |
||
117 | * More info: https://www.hipchat.com/docs/apiv2/method/delete_room |
||
118 | * |
||
119 | * @param string $id The id or name of the room. |
||
120 | * |
||
121 | * @return void |
||
122 | */ |
||
123 | public function deleteRoom($id) |
||
127 | |||
128 | /** |
||
129 | * Send a room a notification |
||
130 | * More info: https://www.hipchat.com/docs/apiv2/method/send_room_notification |
||
131 | * |
||
132 | * @param string $id The id or name of the room |
||
133 | * @param Message $message The message to be sent |
||
134 | * |
||
135 | * @return void |
||
136 | */ |
||
137 | public function sendRoomNotification($id, Message $message) |
||
141 | |||
142 | /** |
||
143 | * Adds a member to a private room |
||
144 | * More info: https://www.hipchat.com/docs/apiv2/method/add_member |
||
145 | * |
||
146 | * @param string $roomId The id or name of the room |
||
147 | * @param string $memberId The id, email address, or mention name (beginning with an '@') of the user |
||
148 | * |
||
149 | * @return void |
||
150 | */ |
||
151 | public function addMember($roomId, $memberId) |
||
155 | |||
156 | /** |
||
157 | * Removes a member from a private room. |
||
158 | * More info: https://www.hipchat.com/docs/apiv2/method/remove_member |
||
159 | * |
||
160 | * @param string $roomId The id, email address, or mention name (beginning with an '@') of the user |
||
161 | * @param string $memberId The id or name of the room |
||
162 | * |
||
163 | * @return void |
||
164 | */ |
||
165 | public function removeMember($roomId, $memberId) |
||
169 | |||
170 | /** |
||
171 | * Invites a member to a public room |
||
172 | * More info: https://www.hipchat.com/docs/apiv2/method/invite_user |
||
173 | * |
||
174 | * @param string $roomId The id or name of the room |
||
175 | * @param string $memberId The id, email address, or mention name (beginning with an '@') of the user |
||
176 | * @param string $reason The message displayed to a user when they are invited |
||
177 | * |
||
178 | * @return void |
||
179 | */ |
||
180 | public function inviteUser($roomId, $memberId, $reason) |
||
184 | |||
185 | /** |
||
186 | * Set a topic on a room |
||
187 | * More info: https://www.hipchat.com/docs/apiv2/method/set_topic |
||
188 | * |
||
189 | * @param string $roomId The id or name of the room |
||
190 | * @param string $topic The topic to be set |
||
191 | * |
||
192 | * @return void |
||
193 | */ |
||
194 | public function setTopic($roomId, $topic) |
||
198 | |||
199 | /** |
||
200 | * Creates a new webhook |
||
201 | * More info: https://www.hipchat.com/docs/apiv2/method/create_webhook |
||
202 | * |
||
203 | * @param string $roomId The id or name of the room |
||
204 | * @param Webhook $webhook The webhook to create |
||
205 | * |
||
206 | * @return int Just created webhook id |
||
207 | */ |
||
208 | public function createWebhook($roomId, Webhook $webhook) |
||
214 | |||
215 | /** |
||
216 | * Deletes a new webhook |
||
217 | * More info: https://www.hipchat.com/docs/apiv2/method/delete_webhook |
||
218 | * |
||
219 | * @param string $roomId The id or name of the room |
||
220 | * @param string $webhookId The id of the webhook to delete |
||
221 | * |
||
222 | * @return void |
||
223 | */ |
||
224 | public function deleteWebhook($roomId, $webhookId) |
||
228 | |||
229 | /** |
||
230 | * Gets all webhooks for this room |
||
231 | * More info: https://www.hipchat.com/docs/apiv2/method/get_all_webhooks |
||
232 | * |
||
233 | * @param string $roomId The id or name of the room |
||
234 | * |
||
235 | * @TODO should return a Collection |
||
236 | * @return array Array of Webhook |
||
237 | */ |
||
238 | public function getAllWebhooks($roomId) |
||
248 | } |
||
249 |