public class RocketChatClientImpl extends Object implements RocketChatClient
Please note, this client does not cache any of the results.
Constructor and Description |
---|
RocketChatClientImpl(String serverUrl,
boolean trustSSL,
String webhookToken)
Initialize a new instance of the client providing the server's url along with webhook for
posting notifications.
|
RocketChatClientImpl(String serverUrl,
boolean trustSSL,
String user,
String password)
Initialize a new instance of the client providing the server's url along with username and
password to use.
|
Modifier and Type | Method and Description |
---|---|
Room[] |
getChannels() |
String |
getInfo()
Retrieves server information
|
User |
getUser(String userId)
Retrieves a
User from the Rocket.Chat server. |
User[] |
getUsers()
Gets all of the users from a Rocket.Chat server, if you have a ton this will
take some time.
|
void |
send(Room room,
String message)
sends a message to a channel
|
void |
send(String channelName,
String message)
sends a message to a channel
|
void |
send(String channelName,
String message,
String emoji,
String avatar)
sends a message to a channel.
|
void |
send(String channelName,
String message,
String emoji,
String avatar,
List<Map<String,Object>> attachments)
sends a message to a channel.
|
public RocketChatClientImpl(String serverUrl, boolean trustSSL, String user, String password) throws RocketClientException
serverUrl
- of the Rocket.Chat server, with or without it ending in "/api/"trustSSL
- if set set the SSL certificate of the rpcket server will not be checkeduser
- which to authenticate withpassword
- of the user to authenticate withRocketClientException
public RocketChatClientImpl(String serverUrl, boolean trustSSL, String webhookToken) throws RocketClientException
serverUrl
- of the Rocket.Chat server, with or without it ending in "/api/"trustSSL
- if set set the SSL certificate of the rocket server will not be checkedwebhookToken
- authentication token or URLRocketClientException
public User[] getUsers() throws RocketClientException
RocketChatClient
getUsers
in interface RocketChatClient
User
sRocketClientException
- is thrown if there was a problem connecting, including if the result
wasn't successfulpublic User getUser(String userId) throws RocketClientException
RocketChatClient
User
from the Rocket.Chat server.getUser
in interface RocketChatClient
userId
- of the user to retrieveUser
RocketClientException
- is thrown if there was a problem connecting, including if the result
wasn't successful or there is no userpublic Room[] getChannels() throws RocketClientException
getChannels
in interface RocketChatClient
RocketClientException
- in case of communication errors with the RocketChat server backendpublic String getInfo() throws RocketClientException
RocketChatClient
getInfo
in interface RocketChatClient
RocketClientException
- in case of communications errorspublic void send(Room room, String message) throws CertificateException, RocketClientException
RocketChatClient
send
in interface RocketChatClient
room
- to use (aka channel)message
- to sendCertificateException
- in case of SSL errorsRocketClientException
- in case of communication errors with the RocketChat server backendpublic void send(String channelName, String message) throws CertificateException, RocketClientException
RocketChatClient
send
in interface RocketChatClient
channelName
- to usemessage
- to sendCertificateException
- in case of SSL errorsRocketClientException
- in case of communication errors with the RocketChat server backendpublic void send(String channelName, String message, String emoji, String avatar) throws CertificateException, RocketClientException
RocketChatClient
send
in interface RocketChatClient
channelName
- to usemessage
- to sendemoji
- to displayavatar
- to displayCertificateException
- in case of SSL errorsRocketClientException
- in case of communication errors with the RocketChat server backendpublic void send(String channelName, String message, String emoji, String avatar, List<Map<String,Object>> attachments) throws CertificateException, RocketClientException
RocketChatClient
send
in interface RocketChatClient
channelName
- to usemessage
- to sendemoji
- to displayavatar
- to displayattachments
- to sendCertificateException
- in case of SSL errorsRocketClientException
- in case of communication errors with the RocketChat server backendCopyright © 2016–2021. All rights reserved.