WebService::Gitter - An interface to Gitter REST API via Perl 5.
version 2.2.0
use strict; use warnings; use WebService::Gitter; my $git = WebService::Gitter->new(api_key => 'secret'); # Get current authenticated user. $git->get_me; # List groups belonging to the authenticated user. $git->list_groups; # List all rooms belonging to the group/community. $git->rooms_under_group($group_id); # List all rooms belonging to the searched user. $git->rooms(q => $query); # List room data via URI. $git->room_from_uri(uri => $room_uri); # Join a room. $git->join_room($room_id, $user_id); # Leave/remove user from a room. $git->remove_user_from_room($room_id, $user_id); # Update room. $git->update_room($room_id, topic => $topic, noindex => $noindex, tags => $tags); # Delete room. $git->delete_room($room_id); # List all users in a room. $git->room_users($room_id, q => $query, skip => $skip_n, limit => $limit_n); # List all messages in a room. $git->list_messages($room_id, skip => $skip_n, beforeId => $beforeId, afterId => $afterId, aroundId => $aroundId, limit => $limit_n, q => $query); # Get single message in a room using its message ID. $git->single_message($room_id, $message_id); # Send message/text to a room. $git->send_message($room_id, text => $text); # Update message/text in a room. $git->update_message($room_id, $message_id, text => $new_text); # Retrieve unread items and mentions from a room. $git->unread_items($user_id, $room_id); # Use to mark chat messages as read. $git->mark_unread_items($user_id, $room_id, @chat_ids); # List of the user's GitHub Repositories and their respective Room if available. $git->orgs($user_id); # List of the user's GitHub Repositories and their respective Room if available. $git->repos($user_id); # List of Gitter channels nested under the current user. $git->channels($user_id);
This module does not support Faye endpoint and streaming API..yet. Currently as of writing this, the Gitter's API is still in beta and likely to break backward compatibility in the future.
new(api_key => 'your_api_key')
Description: Set Pixabay API key.
get_me
Description: Get current authenticated user.
Returns: Authenticated user data.
list_groups
Description: List joined groups by the authenticated user.
Returns: Authenticated user joined groups data.
rooms_under_group($group_id)
Description: List all rooms belonging to the group/community.
Parameter: REQUIRED $group_id - Group/community ID.
$group_id
Returns: All rooms data belonging to the particular community.
rooms(q => $query)
Description: List all rooms belonging to the searched user.
Parameter: OPTIONAL $query - Search/query string.
$query
Returns: All rooms data belonging to the user.
room_from_uri(uri => $room_uri)
Description: List room data via URI.
Parameter: REQUIRED $room_uri - Room URI.
$room_uri
Returns: Room from URI response message.
join_room($room_id, $user_id)
Description: Join a room.
Parameter: REQUIRED $room_id - Room ID.
$room_id
Parameter: REQUIRED $user_id - User ID.
$user_id
Returns: Join room message response.
remove_user_from_room($room_id, $user_id)
Description: Remove a user from a room. This can be self-inflicted to leave the the room and remove room from your left menu.
Returns: Remove user from a room response message.
update_room($room_id, topic => $topic, noindex => $noindex, tags => $tags)
Description: Update room.
Parameter: OPTIONAL $topic - Room topic.
$topic
Parameter: OPTIONAL $noindex - (false, true) Whether the room is indexed by search engines.
$noindex
Parameter: OPTIONAL $tags - 'tag1, tag2, etc' Tags that define the room.
$tags
Returns: Update room response message.
delete_room($room_id)
Description: Delete room.
Returns: Delete room response message.
room_users($room_id, q => $query, skip => $skip_n, limit => $limit_n)
Description: List all users in a room.
Note: By default, it will skip 0 and return only 30 users data.
Parameter: OPTIONAL $query - User's search/query string.
Parameter: OPTIONAL $skip_n - Skip n users.
$skip_n
Parameter: OPTIONAL $limit_n - Set return limit.
$limit_n
Returns: All users data belonging to the room.
list_messages($room_id, skip => $skip_n, beforeId => $beforeId, afterId => $afterId, aroundId => $aroundId, limit => $limit_n, q => $query)
Description: List all messages in a room.
Parameter: OPTIONAL $skip_n - Skip n messages (constrained to 5000 or less).
Parameter: OPTIONAL $beforeId - Get messages before beforeId.
$beforeId
Parameter: OPTIONAL $afterId - Get messages after afterId.
$afterId
Parameter: OPTIONAL $aroundId - Get messages after aroundId.
$aroundId
Parameter: OPTIONAL $limit_n - Maximum number of messages to return (constrained to 100 or less).
Parameter: OPTIONAL $query - Search query.
Returns: List of messages in a room.
single_message($room_id, $message_id)
Description: Get single message in a room using its message ID.
Parameter: REQUIRED $message_id - Message ID.
$message_id
Returns: Retrieve a single message using its ID.
send_message($room_id, text => $text)
Description: Send message/text to a room.
Parameter: REQUIRED $text - Text to send.
$text
Returns: Retrieve send message response.
update_message($room_id, $message_id, text => $new_text)
Description: Update message/text in a room.
Parameter: REQUIRED $new_text - Text to replace old message.
$new_text
Returns: Retrieve update message response.
unread_items($user_id, $room_id)
Description: Retrieve unread items and mentions from a room.
Returns: Unread items response.
mark_unread_items($user_id, $room_id, @chat_ids)
Description: Mark chat messages as read.
Parameter: REQUIRED @chat_ids - List of chat ids to mark as read.
@chat_ids
Returns: Marked chat_ids/items response.
orgs($user_id)
Description: List of the user's GitHub Repositories and their respective Room if available.
Note: It'll return private repositories if the current user has granted Gitter privileges to access them.
Returns: User's organizations response.
repos($user_id)
Returns: User's repositories list data response.
channels($user_id)
Description: List of Gitter channels nested under the current user.
Returns: User's channel list response.
Gitter API documentation
Function::Parameters
WebService::Client
faraco <skelic3@gmail.com>
This software is Copyright (c) 2017-2018 by faraco.
This is free software, licensed under:
The MIT (X11) License
To install WebService::Gitter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Gitter
CPAN shell
perl -MCPAN -e shell install WebService::Gitter
For more information on module installation, please visit the detailed CPAN module installation guide.