An interface to Gitter REST API via Perl 5.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/WebService
t
.gitignore
.travis.yml
LICENSE
Makefile.PL
README.pod
cpanfile
dist.ini

README.pod

NAME

WebService::Gitter - An interface to Gitter REST API via Perl 5.

VERSION

version 2.2.0

SYNOPSIS

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);

Travis status

NOTE

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.

Methods

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.

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.

update_room($room_id, topic => $topic, noindex => $noindex, tags => $tags)

Description: Update room.

Parameter: REQUIRED $room_id - Room ID.

Parameter: OPTIONAL $topic - Room topic.

Parameter: OPTIONAL $noindex - (false, true) Whether the room is indexed by search engines.

Parameter: OPTIONAL $tags - 'tag1, tag2, etc' Tags that define the room.

Returns: Update 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.

Parameter: REQUIRED $message_id - Message ID.

Parameter: REQUIRED $new_text - Text to replace old message.

Returns: Retrieve update message response.

unread_items($user_id, $room_id)

Description: Retrieve unread items and mentions from a room.

Parameter: REQUIRED $user_id - User ID.

Parameter: REQUIRED $room_id - Room ID.

Returns: Unread items response.

mark_unread_items($user_id, $room_id, @chat_ids)

Description: Mark chat messages as read.

Parameter: REQUIRED $user_id - User ID.

Parameter: REQUIRED $room_id - Room ID.

Parameter: REQUIRED @chat_ids - List of chat ids to mark as read.

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.

Parameter: REQUIRED $user_id - User ID.

Returns: User's organizations response.

repos($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.

Parameter: REQUIRED $user_id - User ID.

Returns: User's repositories list data response.

channels($user_id)

Description: List of Gitter channels nested under the current user.

Parameter: REQUIRED $user_id - User ID.

Returns: User's channel list response.

SEE ALSO

Gitter API documentation

Function::Parameters

WebService::Client

AUTHOR

faraco <skelic3@gmail.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017-2018 by faraco.

This is free software, licensed under:

The MIT (X11) License