GithubHelp home page GithubHelp logo

hipchat-java's Introduction

Build Status

hipchat-java

Java client for the HipChat V2 API. The implementation is base on this doc.

Requirements:

Java 8

Quick Start:

To add this client into your project:

  • maven
<dependency>
    <groupId>io.evanwong.oss</groupId>
    <artifactId>hipchat-java</artifactId>
    <version>0.4.3</version>
</dependency>
  • gradle
compile 'io.evanwong.oss:hipchat-java:0.4.3'

If you are using Java 7, there is a temporary workaround using retrolambda.

  • maven
<dependency>
    <groupId>io.evanwong.oss</groupId>
    <artifactId>hipchat-java7</artifactId>
    <version>0.4.0</version>
</dependency>
  • gradle
compile 'io.evanwong.oss:hipchat-java7:0.4.0'

To send a notification

String defaultAccessToken = "abcd1234";
HipChatClient client = new HipChatClient(defaultAccessToken);
SendRoomNotificationRequestBuilder builder = client.prepareSendRoomNotificationRequestBuilder("myRoom", "hello world!");
Future<NoContent> future = builder.setColor(MessageColor.YELLOW).setNotify(true).build().execute();
//optional... if you want/need to inspect the result:
NoContent noContent = future.get();

Methods

CAPABILITIES
  • Get capabilities
EMOTICONS
  • Get emoticon
  • Get all emoticons
OAUTH SESSIONS
  • Generate token
  • Get session
  • Delete session
ROOMS
  • Get all rooms
  • Create room
  • Get room
  • Update room
  • Delete room
  • View room history
  • Get room message
  • Send room message
  • View recent room history
  • Invite user
  • Add member
  • Remove member
  • Get all members
  • Send room notification redirect
  • Send room notification
  • Get all participants
  • Reply to message
  • Share file with room
  • Share link with room
  • Get room statistics
  • Set topic
  • Get all webhooks
  • Create webhook
  • Get webhook
  • Delete webhook
USERS
  • Get all users
  • Create user
  • View user
  • Update user
  • Delete user
  • Get privatechat message
  • View recent privatechat history
  • Private message user
  • Update photo
  • Delete photo
  • Get auto join rooms
  • Share file with user
  • Share link with user

License

The MIT License (MIT)

Copyright (c) 2014 Evan Wong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

hipchat-java's People

Contributors

bmatthias avatar evanwong avatar hikoma avatar jfricke avatar kdwodc avatar michaelruhwedel avatar rodmidde avatar tyutyutyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hipchat-java's Issues

Compilation errors in the provided sample code

Tried your sample code in the readme file.

String defaultAccessToken = "22222-mytoken";
HipChatClient client = new HipChatClient(defaultAccessToken);
SendRoomNotificationRequestBuilder builder = client.prepareSendRoomNotificationRequestBuilder("room-test-1","this is my first message");
java.util.concurrent.Future future;
future = builder.setColor(MessageColor.YELLOW).setNotify(true).build().execute();

and got the following compilation errors in the last line of code;
- The type io.evanwong.oss.hipchat.v2.commons.Request cannot be resolved. It is indirectly referenced from
required .class files
- The method execute() is undefined for the type SendRoomNotificationRequest
hip-chat-error

quick reply is much appreciated.
thanks in advance.

Unrecognized fields should be ignored.

In Request.java, this line should be added in order to prevent the client from failing if Atlassian adds new fields:

this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Currently I am getting this exception:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "version" (class io.evanwong.oss.hipchat.v2.rooms.RoomItem), not marked as ignorable (3 known properties: "links", "id", "name"])

Java7 release of 0.4.2?

Hi,
first of all thank you for maintaining a backwards compatible version of the API.
We could use the User API which the 0.4.0 of the Java 7 release does not provide yet.
Could you please release the new version to Maven central?

Thanks and cheers,
Michael

Java 7 support?!

Many of us still uses Java 7, especially in old projects. Would be possible to make a Java 7 compatible jar?

Memory leaks (threads)

I recently integrated this library (v0.3.0) in an existing project, where I was using v1 hipchat API. Here is more or less how I use it : I have a static HipChat object in method in MyClass

private static final HipChatClient hcc = new HipChatClient("mytoken") ;
private static void sendMessageImpl(String message, MessageColor color,boolean critical) {
    //some stuff then prepare the query
    SendRoomNotificationRequestBuilder builder = hcc.prepareSendRoomNotificationRequestBuilder("myroomId", "message to send");
    Future<NoContent> future = builder.setColor(colorToUse).setNotify(notify).build().execute();
            NoContent noContent = future.get();

I have a timer that calls MyCalls.sendMessageImpl(...) every two minutes, multiple times.

I recently started to receive reports of memory leaks happening. A further investigation with JProfiler revealed that I had a steadily growing number of new threads (blocked) .

After some hours the number of threads was in the order of thousands, and in 48 hours, boom.

Interestingly enough, when turning hipchat off, the number of threads is steady , as it should be : 6.

Am I doing something wrong? is this a known problem? am I using an old version? It consumed one day of work finding this.

The example given in the README does not work

hi!

I am using the example in the readme, but it does not work:

        try {
            String defaultAccessToken = "xxxxx";
            HipChatClient client = new HipChatClient(defaultAccessToken);

            SendRoomNotificationRequestBuilder builder = client.prepareSendRoomNotificationRequestBuilder("test", "hello world!");


            Future<NoContent> future = builder.setColor(MessageColor.YELLOW).setNotify(true).build().execute();
//optional... if you want/need to inspect the result:
            NoContent noContent = future.get();
        } catch(Exception e) {
            LOG.error("exception", e);
        }

this is returning:

2015-03-13 14:11:29,821 ERROR [-1:?] [io.evanwong.oss.hipchat.v2.commons.PostRequest] Invalid response status: 401, content: {
  "error": {
    "code": 401,
    "message": "Invalid OAuth session",
    "type": "Unauthorized"
  }
}

And I do not see any OAUTH related methods on the HipChat client.

how do I get this to work? What am I doing wrong?

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.