blib/lib/WebService/Gitter.pm

filter: Statementstmt 21.0% 36 / 171 Branchbran 0.0% 0 / 124 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 17.3% 4 / 23 Podpod 100% 19 / 19 totaltotal 15.8% 59 / 372 CC 70 SCAR 39.0
CC
70
Cov
11%
list_messages
132.0
room_users
110.0
update_room
72.0
CRAP 49.4
↑ Summary
1 package WebService::Gitter;
2 1 $WebService::Gitter::VERSION = '2.2.0';
3 #ABSTRACT: An interface to Gitter REST API via Perl 5.
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Function::Parameters;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 with 'WebService::Client';
11  
12 1 has api_key => (
13 is => 'ro',
14 required => 1
15 );
16  
17 1 has '+base_url' => ( default => 'https://api.gitter.im/v1' );
18  
19 0 ▶method get_me() {
Subroutine get_me: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method get_me (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and Function::Parameters::_croak('Too many arguments for method get_me (expected 1, got ' . @_ . ')') 0 0 0
20  
21 0 return $self->get( "/user/me?access_token=" . $self->api_key );
22 1 }
23  
24 0 ▶method list_groups() {
Subroutine list_groups: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method list_groups (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and Function::Parameters::_croak('Too many arguments for method list_groups (expected 1, got ' . @_ . ')') 0 0 0
25  
26 0 return $self->get( "/groups?access_token=" . $self->api_key );
27 1 }
28  
29 0 ▶method rooms_under_group($group_id) {
Subroutine rooms_under_group: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method rooms_under_group (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and Function::Parameters::_croak('Too many arguments for method rooms_under_group (expected 2, got ' . @_ . ')') 0 0 0
30  
31 0 return $self->get(
32 "/groups/$group_id/rooms?access_token=" . $self->api_key );
33 1 }
34  
35 0 ▶method rooms( : $q = '' ) {
Subroutine rooms: not called CC=6 SCAR=37.4
Pod documented
Branch: 4 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method rooms (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and (@_ - 1) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method rooms") 0 0 0
exists ${__rest}{'q'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method rooms: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 1 and (@_ - 1) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 1 and (@_ - 1) % 2
@_ > 1 (@_ - 1) % 2
Truth table0%0/3
A and B
A= @_ > 1B= (@_ - 1) % 2
ABresult
0X0
100
111
36 0 return $self->get( "/rooms?access_token=" . $self->api_key . "&q=$q" );
37 1 }
38  
39 0 ▶method room_from_uri( : $uri ) {
Subroutine room_from_uri: not called CC=6 SCAR=37.4
Pod documented
Branch: 4 branches
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for method room_from_uri (expected 3, got ' . @_ . ')') 0 0 0
@_ > 1 and (@_ - 1) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method room_from_uri") 0 0 0
exists ${__rest}{'uri'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method room_from_uri: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 1 and (@_ - 1) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 1 and (@_ - 1) % 2
@_ > 1 (@_ - 1) % 2
Truth table0%0/3
A and B
A= @_ > 1B= (@_ - 1) % 2
ABresult
0X0
100
111
40 0 return $self->post( "/rooms?access_token=" . $self->api_key,
41 { uri => $uri } );
42 1 }
43  
44 0 ▶method join_room( $room_id, $user_id ) {
Subroutine join_room: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for method join_room (expected 3, got ' . @_ . ')') 0 0 0
@_ > 3 and Function::Parameters::_croak('Too many arguments for method join_room (expected 3, got ' . @_ . ')') 0 0 0
45 0 return $self->post( "/user/$user_id/rooms?access_token=" . $self->api_key,
46 { id => $room_id } );
47 1 }
48  
49 0 ▶method remove_user_from_room( $room_id, $user_id ) {
Subroutine remove_user_from_room: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for method remove_user_from_room (expected 3, got ' . @_ . ')') 0 0 0
@_ > 3 and Function::Parameters::_croak('Too many arguments for method remove_user_from_room (expected 3, got ' . @_ . ')') 0 0 0
50 0 return $self->delete(
51 "/rooms/$room_id/users/$user_id?access_token=" . $self->api_key );
52 1 }
53  
54 0 ▶method update_room( $room_id,
Subroutine update_room: not called CC=8 SCAR=42.8
Pod documented
55 : $topic = '',
56 : $noindex = 'false',
57 : $tags = '' )
58 0 ▶{
Branch: 6 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method update_room (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and (@_ - 2) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method update_room") 0 0 0
exists ${__rest}{'topic'} ? : 0 0 0
exists ${__rest}{'noindex'} ? : 0 0 0
exists ${__rest}{'tags'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method update_room: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 2 and (@_ - 2) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 2 and (@_ - 2) % 2
@_ > 2 (@_ - 2) % 2
Truth table0%0/3
A and B
A= @_ > 2B= (@_ - 2) % 2
ABresult
0X0
100
111
59 0 return $self->put(
60 "/rooms/$room_id?access_token=" . $self->api_key,
61 { topic => $topic, noindex => $noindex, tags => $tags }
62 );
63 1 }
64  
65 0 ▶method delete_room($room_id) {
Subroutine delete_room: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method delete_room (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and Function::Parameters::_croak('Too many arguments for method delete_room (expected 2, got ' . @_ . ')') 0 0 0
66 0 return $self->delete( "/rooms/$room_id?access_token=" . $self->api_key );
67 1 }
68  
69 0 ▶method room_users( $room_id, : $q = '', : $skip = 0, : $limit = 30 ) {
Subroutine room_users: not called CC=10 SCAR=47.0
Pod documented
Branch: 6 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method room_users (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and (@_ - 2) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method room_users") 0 0 0
exists ${__rest}{'q'} ? : 0 0 0
exists ${__rest}{'skip'} ? : 0 0 0
exists ${__rest}{'limit'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method room_users: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 2 and (@_ - 2) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 2 and (@_ - 2) % 2
@_ > 2 (@_ - 2) % 2
Truth table0%0/3
A and B
A= @_ > 2B= (@_ - 2) % 2
ABresult
0X0
100
111
70 0 ▶ return $self->get( "/rooms/$room_id/users?access_token="
Branch: 1 branch
BranchTrueFalseTotal
unless $q 0 0 0
71 . $self->api_key
72 . "&skip=$skip"
73 . "&limit=$limit" )
74 if not $q;
75  
76 0 ▶ return $self->get( "/rooms/$room_id/users?access_token="
Branch: 1 branch
BranchTrueFalseTotal
if $q 0 0 0
77 . $self->api_key . "&q=$q"
78 . "&skip=$skip"
79 . "&limit=$limit" )
80 if $q;
81 1 }
82  
83 0 ▶method list_messages(
Subroutine list_messages: not called CC=11 SCAR=48.8
Pod documented
84 $room_id,
85 : $skip = 0,
86 : $beforeId = '',
87 : $afterId = '',
88 : $aroundId = '',
89 : $limit = 30,
90 : $q = ''
91 )
92 0 ▶{
Branch: 9 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method list_messages (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and (@_ - 2) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method list_messages") 0 0 0
exists ${__rest}{'skip'} ? : 0 0 0
exists ${__rest}{'beforeId'} ? : 0 0 0
exists ${__rest}{'afterId'} ? : 0 0 0
exists ${__rest}{'aroundId'} ? : 0 0 0
exists ${__rest}{'limit'} ? : 0 0 0
exists ${__rest}{'q'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method list_messages: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 2 and (@_ - 2) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 2 and (@_ - 2) % 2
@_ > 2 (@_ - 2) % 2
Truth table0%0/3
A and B
A= @_ > 2B= (@_ - 2) % 2
ABresult
0X0
100
111
93 0 return $self->get( "/rooms/$room_id/chatMessages?access_token="
94 . $self->api_key
95 . "&skip=$skip"
96 . "&beforeId=$beforeId"
97 . "&afterId=$afterId"
98 . "&aroundId=$aroundId"
99 . "&limit=$limit"
100 . "&q=$q" );
101 1 }
102  
103 0 ▶method single_message( $room_id, $message_id ) {
Subroutine single_message: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for method single_message (expected 3, got ' . @_ . ')') 0 0 0
@_ > 3 and Function::Parameters::_croak('Too many arguments for method single_message (expected 3, got ' . @_ . ')') 0 0 0
104 0 return $self->get( "/rooms/$room_id/chatMessages/$message_id"
105 . "?access_token="
106 . $self->api_key );
107 1 }
108  
109 0 ▶method send_message( $room_id, : $text ) {
Subroutine send_message: not called CC=6 SCAR=37.4
Pod documented
Branch: 4 branches
BranchTrueFalseTotal
@_ < 4 and Function::Parameters::_croak('Too few arguments for method send_message (expected 4, got ' . @_ . ')') 0 0 0
@_ > 2 and (@_ - 2) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method send_message") 0 0 0
exists ${__rest}{'text'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method send_message: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 2 and (@_ - 2) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 2 and (@_ - 2) % 2
@_ > 2 (@_ - 2) % 2
Truth table0%0/3
A and B
A= @_ > 2B= (@_ - 2) % 2
ABresult
0X0
100
111
110 0 return $self->post(
111 "/rooms/$room_id/chatMessages?access_token=" . $self->api_key,
112 { text => $text } );
113 1 }
114  
115 0 ▶method update_message( $room_id, $message_id, : $text ) {
Subroutine update_message: not called CC=6 SCAR=37.4
Pod documented
Branch: 4 branches
BranchTrueFalseTotal
@_ < 5 and Function::Parameters::_croak('Too few arguments for method update_message (expected 5, got ' . @_ . ')') 0 0 0
@_ > 3 and (@_ - 3) % 2 and Function::Parameters::_croak("Odd number of paired arguments for method update_message") 0 0 0
exists ${__rest}{'text'} ? : 0 0 0
keys %{__rest} and Function::Parameters::_croak('In method update_message: no such named parameter: ' . join(", ", sort(keys %{__rest}))) 0 0 0
Condition0%0/3
@_ > 3 and (@_ - 3) % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 3 and (@_ - 3) % 2
@_ > 3 (@_ - 3) % 2
Truth table0%0/3
A and B
A= @_ > 3B= (@_ - 3) % 2
ABresult
0X0
100
111
116 0 return $self->put(
117 "/rooms/$room_id/chatMessages/$message_id?access_token="
118 . $self->api_key,
119 { text => $text }
120 );
121 1 }
122  
123 0 ▶method unread_items( $user_id, $room_id ) {
Subroutine unread_items: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for method unread_items (expected 3, got ' . @_ . ')') 0 0 0
@_ > 3 and Function::Parameters::_croak('Too many arguments for method unread_items (expected 3, got ' . @_ . ')') 0 0 0
124 0 return $self->get(
125 "/user/$user_id/rooms/$room_id/unreadItems?access_token="
126 . $self->api_key );
127 1 }
128  
129 0 ▶method mark_unread_items( $user_id, $room_id, @chat_ids ) {
Subroutine mark_unread_items: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for method mark_unread_items (expected 3, got ' . @_ . ')') 0 0 0
130 0 return $self->post(
131 "/user/$user_id/rooms/$room_id/unreadItems?access_token="
132 . $self->api_key,
133 { chat => @chat_ids }
134 );
135 1 }
136  
137 0 ▶method orgs($user_id) {
Subroutine orgs: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method orgs (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and Function::Parameters::_croak('Too many arguments for method orgs (expected 2, got ' . @_ . ')') 0 0 0
138 0 return $self->get( "/user/$user_id/orgs?access_token=" . $self->api_key );
139 1 }
140  
141 0 ▶method repos($user_id) {
Subroutine repos: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method repos (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and Function::Parameters::_croak('Too many arguments for method repos (expected 2, got ' . @_ . ')') 0 0 0
142 0 return $self->get( "/user/$user_id/repos?access_token=" . $self->api_key );
143 1 }
144  
145 0 ▶method channels($user_id) {
Subroutine channels: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method channels (expected 2, got ' . @_ . ')') 0 0 0
@_ > 2 and Function::Parameters::_croak('Too many arguments for method channels (expected 2, got ' . @_ . ')') 0 0 0
146 0 return $self->get(
147 "/user/$user_id/channels?access_token=" . $self->api_key );
148 1 }
149  
150 1 1;
151  
152 =pod
153  
154 =encoding UTF-8
155  
156 =head1 NAME
157  
158 WebService::Gitter - An interface to Gitter REST API via Perl 5.
159  
160 =head1 VERSION
161  
162 version 2.2.0
163  
164 =head1 SYNOPSIS
165  
166 use strict;
167 use warnings;
168 use WebService::Gitter;
169  
170 my $git = WebService::Gitter->new(api_key => 'secret');
171  
172 # Get current authenticated user.
173 $git->get_me;
174  
175 # List groups belonging to the authenticated user.
176 $git->list_groups;
177  
178 # List all rooms belonging to the group/community.
179 $git->rooms_under_group($group_id);
180  
181 # List all rooms belonging to the searched user.
182 $git->rooms(q => $query);
183  
184 # List room data via URI.
185 $git->room_from_uri(uri => $room_uri);
186  
187 # Join a room.
188 $git->join_room($room_id, $user_id);
189  
190 # Leave/remove user from a room.
191 $git->remove_user_from_room($room_id, $user_id);
192  
193 # Update room.
194 $git->update_room($room_id, topic => $topic, noindex => $noindex, tags => $tags);
195  
196 # Delete room.
197 $git->delete_room($room_id);
198  
199 # List all users in a room.
200 $git->room_users($room_id, q => $query, skip => $skip_n, limit => $limit_n);
201  
202 # List all messages in a room.
203 $git->list_messages($room_id, skip => $skip_n, beforeId => $beforeId,
204 afterId => $afterId, aroundId => $aroundId, limit => $limit_n,
205 q => $query);
206  
207 # Get single message in a room using its message ID.
208 $git->single_message($room_id, $message_id);
209  
210 # Send message/text to a room.
211 $git->send_message($room_id, text => $text);
212  
213 # Update message/text in a room.
214 $git->update_message($room_id, $message_id, text => $new_text);
215  
216 # Retrieve unread items and mentions from a room.
217 $git->unread_items($user_id, $room_id);
218  
219 # Use to mark chat messages as read.
220 $git->mark_unread_items($user_id, $room_id, @chat_ids);
221  
222 # List of the user's GitHub Repositories and their respective Room if available.
223 $git->orgs($user_id);
224  
225 # List of the user's GitHub Repositories and their respective Room if available.
226 $git->repos($user_id);
227  
228 # List of Gitter channels nested under the current user.
229 $git->channels($user_id);
230  
231 =begin html
232  
233 <p>
234 <a href="https://travis-ci.org/faraco/WebService-Gitter">
235 <img src="https://api.travis-ci.org/faraco/WebService-Gitter.svg?branch=master" alt="Travis status" />
236 </a>
237  
238  
239 <a href="https://kritika.io/users/faraco/repos/1212629170881351/heads/master/">
240 <img src="https://kritika.io/users/faraco/repos/1212629170881351/heads/master/status.svg"/>
241 </a>
242 </p>
243  
244 =end html
245  
246 =head1 NOTE
247  
248 This module does not support Faye endpoint and streaming API..yet. Currently as of writing this, the Gitter's API is
249 still in beta and likely to break backward compatibility in the future.
250  
251 =head2 Methods
252  
253 =over 4
254  
255 =item C<new(api_key =E<gt> 'your_api_key')>
256  
257 Description: Set Pixabay API key.
258  
259 =item C<get_me>
260  
261 Description: Get current authenticated user.
262  
263 Returns: Authenticated user data.
264  
265 =item C<list_groups>
266  
267 Description: List joined groups by the authenticated user.
268  
269 Returns: Authenticated user joined groups data.
270  
271 =item C<rooms_under_group($group_id)>
272  
273 Description: List all rooms belonging to the group/community.
274  
275 Parameter: B<REQUIRED> C<$group_id> - Group/community ID.
276  
277 Returns: All rooms data belonging to the particular community.
278  
279 =item C<rooms(q =E<gt> $query)>
280  
281 Description: List all rooms belonging to the searched user.
282  
283 Parameter: B<OPTIONAL> C<$query> - Search/query string.
284  
285 Returns: All rooms data belonging to the user.
286  
287 =item C<room_from_uri(uri =E<gt> $room_uri)>
288  
289 Description: List room data via URI.
290  
291 Parameter: B<REQUIRED> C<$room_uri> - Room URI.
292  
293 Returns: Room from URI response message.
294  
295 =item C<join_room($room_id, $user_id)>
296  
297 Description: Join a room.
298  
299 Parameter: B<REQUIRED> C<$room_id> - Room ID.
300  
301 Parameter: B<REQUIRED> C<$user_id> - User ID.
302  
303 Returns: Join room message response.
304  
305 =item C<remove_user_from_room($room_id, $user_id)>
306  
307 Description: Remove a user from a room.
308 This can be self-inflicted to leave the the room and remove room from your left menu.
309  
310 Parameter: B<REQUIRED> C<$room_id> - Room ID.
311  
312 Parameter: B<REQUIRED> C<$user_id> - User ID.
313  
314 Returns: Remove user from a room response message.
315  
316 =item C<update_room($room_id, topic =E<gt> $topic, noindex =E<gt> $noindex, tags =E<gt> $tags)>
317  
318 Description: Update room.
319  
320 Parameter: B<REQUIRED> C<$room_id> - Room ID.
321  
322 Parameter: B<OPTIONAL> C<$topic> - Room topic.
323  
324 Parameter: B<OPTIONAL> C<$noindex> - (false, true) Whether the room is indexed by search engines.
325  
326 Parameter: B<OPTIONAL> C<$tags> - 'tag1, tag2, etc' Tags that define the room.
327  
328 Returns: Update room response message.
329  
330 =item C<delete_room($room_id)>
331  
332 Description: Delete room.
333  
334 Parameter: B<REQUIRED> C<$room_id> - Room ID.
335  
336 Returns: Delete room response message.
337  
338 =item C<room_users($room_id, q =E<gt> $query, skip =E<gt> $skip_n, limit =E<gt> $limit_n)>
339  
340 Description: List all users in a room.
341  
342 Note: By default, it will skip 0 and return only 30 users data.
343  
344 Parameter: B<REQUIRED> C<$room_id> - Room ID.
345  
346 Parameter: B<OPTIONAL> C<$query> - User's search/query string.
347  
348 Parameter: B<OPTIONAL> C<$skip_n> - Skip n users.
349  
350 Parameter: B<OPTIONAL> C<$limit_n> - Set return limit.
351  
352 Returns: All users data belonging to the room.
353  
354 =item C<list_messages($room_id, skip =E<gt> $skip_n, beforeId =E<gt> $beforeId,
355 afterId =E<gt> $afterId, aroundId =E<gt> $aroundId, limit =E<gt> $limit_n,
356 q =E<gt> $query)>
357  
358 Description: List all messages in a room.
359  
360 Note: By default, it will skip 0 and return only 30 users data.
361  
362 Parameter: B<REQUIRED> C<$room_id> - Room ID.
363  
364 Parameter: B<OPTIONAL> C<$skip_n> - Skip n messages (constrained to 5000 or less).
365  
366 Parameter: B<OPTIONAL> C<$beforeId> - Get messages before beforeId.
367  
368 Parameter: B<OPTIONAL> C<$afterId> - Get messages after afterId.
369  
370 Parameter: B<OPTIONAL> C<$aroundId> - Get messages after aroundId.
371  
372 Parameter: B<OPTIONAL> C<$limit_n> - Maximum number of messages to return (constrained to 100 or less).
373  
374 Parameter: B<OPTIONAL> C<$query> - Search query.
375  
376 Returns: List of messages in a room.
377  
378 =item C<single_message($room_id, $message_id)>
379  
380 Description: Get single message in a room using its message ID.
381  
382 Parameter: B<REQUIRED> C<$room_id> - Room ID.
383  
384 Parameter: B<REQUIRED> C<$message_id> - Message ID.
385  
386 Returns: Retrieve a single message using its ID.
387  
388 =item C<send_message($room_id, text =E<gt> $text)>
389  
390 Description: Send message/text to a room.
391  
392 Parameter: B<REQUIRED> C<$room_id> - Room ID.
393  
394 Parameter: B<REQUIRED> C<$text> - Text to send.
395  
396 Returns: Retrieve send message response.
397  
398 =item C<update_message($room_id, $message_id, text =E<gt> $new_text)>
399  
400 Description: Update message/text in a room.
401  
402 Parameter: B<REQUIRED> C<$room_id> - Room ID.
403  
404 Parameter: B<REQUIRED> C<$message_id> - Message ID.
405  
406 Parameter: B<REQUIRED> C<$new_text> - Text to replace old message.
407  
408 Returns: Retrieve update message response.
409  
410 =item C<unread_items($user_id, $room_id)>
411  
412 Description: Retrieve unread items and mentions from a room.
413  
414 Parameter: B<REQUIRED> C<$user_id> - User ID.
415  
416 Parameter: B<REQUIRED> C<$room_id> - Room ID.
417  
418 Returns: Unread items response.
419  
420 =item C<mark_unread_items($user_id, $room_id, @chat_ids)>
421  
422 Description: Mark chat messages as read.
423  
424 Parameter: B<REQUIRED> C<$user_id> - User ID.
425  
426 Parameter: B<REQUIRED> C<$room_id> - Room ID.
427  
428 Parameter: B<REQUIRED> C<@chat_ids> - List of chat ids to mark as read.
429  
430 Returns: Marked chat_ids/items response.
431  
432 =item C<orgs($user_id)>
433  
434 Description: List of the user's GitHub Repositories and their respective Room if available.
435  
436 B<Note>: It'll return private repositories if the current user has granted Gitter privileges to access them.
437  
438 Parameter: B<REQUIRED> C<$user_id> - User ID.
439  
440 Returns: User's organizations response.
441  
442 =item C<repos($user_id)>
443  
444 Description: List of the user's GitHub Repositories and their respective Room if available.
445  
446 B<Note>: It'll return private repositories if the current user has granted Gitter privileges to access them.
447  
448 Parameter: B<REQUIRED> C<$user_id> - User ID.
449  
450 Returns: User's repositories list data response.
451  
452 =item C<channels($user_id)>
453  
454 Description: List of Gitter channels nested under the current user.
455  
456 Parameter: B<REQUIRED> C<$user_id> - User ID.
457  
458 Returns: User's channel list response.
459  
460 =back
461  
462 =head1 SEE ALSO
463  
464 L<Gitter API documentation|https://developer.gitter.im/docs/welcome>
465  
466 L<Function::Parameters>
467  
468 L<WebService::Client>
469  
470 =head1 AUTHOR
471  
472 faraco <skelic3@gmail.com>
473  
474 =head1 COPYRIGHT AND LICENSE
475  
476 This software is Copyright (c) 2017-2018 by faraco.
477  
478 This is free software, licensed under:
479  
480 The MIT (X11) License
481  
482 =cut
483  
484 __END__
↑ Summary