Giter VIP home page Giter VIP logo

rocket-chat-rest-client's Introduction

rocket-chat-rest-client

Lightweight Java client for Rocket.Chat's REST API using Unirest and Jackson.

Notes

  • Rocket.Chat v0.48 rewrote the REST API, see the pull request #5140 for details
  • This api is still a work in progress, feel free to submit pull requests to add functionality
  • Server url doesn't require api/ anymore, but it can still be provided
  • None of the results are cached, every time a method is called it goes out and gets it
  • The method calls are sync and blocking
  • Maven is configured to startup Rocket.Chat v.0.48-develop via docker therefore docker must be installed.

Java

RocketChatClient rc = new RocketChatClient("https://demo.rocket.chat/api/", "<user>", "<password>");

// get meta info
System.out.println("Rocket.Chat Server Version is: " + info.getServerInformation().getVersion());
		
// use typed API to retrieve rooms		
Room[] channels = rc.getChannels();
for (Room c : channels) {
	System.out.println(String.format("name: %s, id: %s", c.getName(), c.getId()));
}

//NOTE: Sending a message isn't supported yet, due to inconsistencies that `v1/chat.postMessage` has versus other `v1/` APIs. 
// send a message to a room. Room ID is resolved automatically
rc.send("test", "Hello from REST client" + new Date());

// Call this if you are done or want to refresh the auth token
rc.logout();

Maven

<repositories>
	<repository>
		<id>jitpack.io</id>
		 <url>https://jitpack.io</url>
	</repository>
</repositories>
	
<dependencies>
	<dependency>
		<groupId>com.github.baloise</groupId>
		<artifactId>rocket-chat-rest-client</artifactId>
		<version>0.1.0-SNAPSHOT</version>
	</dependency>
</dependencies>

Compiling

The maven build needs Docker for integration testing. Please install it for your platform before running

mvn clean install

To keep the docker containers running:

mvn -Ddocker.keepRunning clean install

rocket-chat-rest-client's People

Contributors

rynefagin avatar culmat avatar rh-imcmahon avatar graywolf336 avatar eloy83 avatar

Stargazers

 avatar LaSombra avatar

Watchers

LaSombra avatar James Cloos avatar  avatar  avatar

Forkers

lasombra

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.