NAME
WebService::Gitter - An interface to Gitter REST API via Perl 5.
VERSION
version 2.0.0
SYNOPSIS
use strict;
use warnings;
use WebService::Gitter;
use v5.10;
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);
# 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);
Methods
- 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.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.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.Returns: Room from URI response message.
- join_room($room_id, $user_id)
-
Description: Join a room.
Parameter: REQUIRED
$room_id
- Room ID.Parameter: REQUIRED
$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.
Parameter: REQUIRED
$room_id
- Room ID.Parameter: REQUIRED
$user_id
- User ID.Returns: Remove user from a room response message.
- delete_room($room_id)
-
Description: Delete room.
Parameter: REQUIRED
$room_id
- Room ID.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: REQUIRED
$room_id
- Room ID.Parameter: OPTIONAL
$query
- User's search/query string.Parameter: OPTIONAL
$skip_n
- Skip n users.Parameter: OPTIONAL
$limit_n
- Set return limit.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.
Note: By default, it will skip 0 and return only 30 users data.
Parameter: REQUIRED
$room_id
- Room ID.Parameter: OPTIONAL
$skip_n
- Skip n messages (constrained to 5000 or less).Parameter: OPTIONAL
$beforeId
- Get messages before beforeId.Parameter: OPTIONAL
$afterId
- Get messages after afterId.Parameter: OPTIONAL
$aroundId
- Get messages after 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
$room_id
- Room ID.Parameter: REQUIRED
$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
$room_id
- Room ID.Parameter: REQUIRED
$text
- Text to send.Returns: Retrieve send message response.
- update_message($room_id, $message_id, text => $new_text)
-
Description: Update message/text in a room.
Parameter: REQUIRED
$room_id
- Room ID.Paramater: REQUIRED
$message_id
- Message ID.Parameter: REQUIRED
$new_text
- Text to replace old message.Returns: Retrieve update message response.
SEE ALSO
AUTHOR
faraco <skelic3@gmail.com>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2017-2018 by faraco.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007