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 | /** |
||
61 | * Fetch latest chat history for this room. |
||
62 | * More info: https://www.hipchat.com/docs/apiv2/method/view_recent_room_history |
||
63 | * |
||
64 | * @param string $id The id or name of the room |
||
65 | * @param array $params Query string parameter(s), for example: array('max-results' => 30) |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | public function getRecentHistory($id, $params = array()) |
||
79 | |||
80 | /** |
||
81 | * Creates a room |
||
82 | * More info: https://www.hipchat.com/docs/apiv2/method/create_room |
||
83 | * |
||
84 | * @param Room $room New room to be persisted |
||
85 | * |
||
86 | * @return integer Just created room id |
||
87 | */ |
||
88 | public function createRoom(Room $room) |
||
94 | |||
95 | /** |
||
96 | * Updates a room |
||
97 | * More info: https://www.hipchat.com/docs/apiv2/method/update_room |
||
98 | * |
||
99 | * @param Room $room Existing room to be updated |
||
100 | * |
||
101 | * @return void |
||
102 | */ |
||
103 | public function updateRoom(Room $room) |
||
107 | |||
108 | /** |
||
109 | * Deletes a room and kicks the current participants. |
||
110 | * More info: https://www.hipchat.com/docs/apiv2/method/delete_room |
||
111 | * |
||
112 | * @param string $id The id or name of the room. |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | public function deleteRoom($id) |
||
120 | |||
121 | /** |
||
122 | * Send a room a notification |
||
123 | * More info: https://www.hipchat.com/docs/apiv2/method/send_room_notification |
||
124 | * |
||
125 | * @param string $id The id or name of the room |
||
126 | * @param Message $message The message to be sent |
||
127 | * |
||
128 | * @return void |
||
129 | */ |
||
130 | public function sendRoomNotification($id, Message $message) |
||
135 | |||
136 | /** |
||
137 | * Adds a member to a private room |
||
138 | * More info: https://www.hipchat.com/docs/apiv2/method/add_member |
||
139 | * |
||
140 | * @param string $roomId The id or name of the room |
||
141 | * @param string $memberId The id, email address, or mention name (beginning with an '@') of the user |
||
142 | * |
||
143 | * @return void |
||
144 | */ |
||
145 | public function addMember($roomId, $memberId) |
||
149 | |||
150 | /** |
||
151 | * Removes a member from a private room. |
||
152 | * More info: https://www.hipchat.com/docs/apiv2/method/remove_member |
||
153 | * |
||
154 | * @param string $roomId The id, email address, or mention name (beginning with an '@') of the user |
||
155 | * @param string $memberId The id or name of the room |
||
156 | * |
||
157 | * @return void |
||
158 | */ |
||
159 | public function removeMember($roomId, $memberId) |
||
163 | |||
164 | /** |
||
165 | * Invites a member to a public room |
||
166 | * More info: https://www.hipchat.com/docs/apiv2/method/invite_user |
||
167 | * |
||
168 | * @param string $roomId The id or name of the room |
||
169 | * @param string $memberId The id, email address, or mention name (beginning with an '@') of the user |
||
170 | * @param string $reason The message displayed to a user when they are invited |
||
171 | * |
||
172 | * @return void |
||
173 | */ |
||
174 | public function inviteUser($roomId, $memberId, $reason) |
||
178 | |||
179 | /** |
||
180 | * Set a topic on a room |
||
181 | * More info: https://www.hipchat.com/docs/apiv2/method/set_topic |
||
182 | * |
||
183 | * @param string $roomId The id or name of the room |
||
184 | * @param string $topic The topic to be set |
||
185 | * |
||
186 | * @return void |
||
187 | */ |
||
188 | public function setTopic($roomId, $topic) |
||
192 | |||
193 | /** |
||
194 | * Creates a new webhook |
||
195 | * More info: https://www.hipchat.com/docs/apiv2/method/create_webhook |
||
196 | * |
||
197 | * @param string $roomId The id or name of the room |
||
198 | * @param Webhook $webhook The webhook to create |
||
199 | * |
||
200 | * @return int Just created webhook id |
||
201 | */ |
||
202 | public function createWebhook($roomId, Webhook $webhook) |
||
208 | |||
209 | /** |
||
210 | * Deletes a new webhook |
||
211 | * More info: https://www.hipchat.com/docs/apiv2/method/delete_webhook |
||
212 | * |
||
213 | * @param string $roomId The id or name of the room |
||
214 | * @param string $webhookId The id of the webhook to delete |
||
215 | * |
||
216 | * @return void |
||
217 | */ |
||
218 | public function deleteWebhook($roomId, $webhookId) |
||
222 | |||
223 | /** |
||
224 | * Gets all webhooks for this room |
||
225 | * More info: https://www.hipchat.com/docs/apiv2/method/get_all_webhooks |
||
226 | * |
||
227 | * @param string $roomId The id or name of the room |
||
228 | * |
||
229 | * @TODO should return a Collection |
||
230 | * @return array Array of Webhook |
||
231 | */ |
||
232 | public function getAllWebhooks($roomId) |
||
242 | } |
||
243 |