Idobata4J

An Java implementation of Idobata client

License

License

Categories

Categories

ta4j Business Logic Libraries Financial
GroupId

GroupId

com.uphyca.idobata
ArtifactId

ArtifactId

idobata4j-core
Last Version

Last Version

0.9.5
Release Date

Release Date

Type

Type

jar
Description

Description

Idobata4J
An Java implementation of Idobata client
Project URL

Project URL

https://github.com/uPhyca/idobata4j
Source Code Management

Source Code Management

https://github.com/uPhyca/idobata4j

Download idobata4j-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.uphyca.idobata/idobata4j-core/ -->
<dependency>
    <groupId>com.uphyca.idobata</groupId>
    <artifactId>idobata4j-core</artifactId>
    <version>0.9.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.uphyca.idobata/idobata4j-core/
implementation 'com.uphyca.idobata:idobata4j-core:0.9.5'
// https://jarcasting.com/artifacts/com.uphyca.idobata/idobata4j-core/
implementation ("com.uphyca.idobata:idobata4j-core:0.9.5")
'com.uphyca.idobata:idobata4j-core:jar:0.9.5'
<dependency org="com.uphyca.idobata" name="idobata4j-core" rev="0.9.5">
  <artifact name="idobata4j-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.uphyca.idobata', module='idobata4j-core', version='0.9.5')
)
libraryDependencies += "com.uphyca.idobata" % "idobata4j-core" % "0.9.5"
[com.uphyca.idobata/idobata4j-core "0.9.5"]

Dependencies

test (5)

Group / Artifact Type Version
org.json : json jar 20140107
org.mockito : mockito-all jar 1.9.5
junit : junit jar 4.11
org.easytesting : fest-assert-core jar 2.0M10
com.pusher : pusher-java-client jar 0.3.1

Project Modules

There are no modules declared in this project.

Build Status

Idobata4J is a Idobata(https://idobata.io) API binding library for the Java language licensed under Apache License 2.0.

Supported endpoints

Endpoint Http method Java API
/api/seed GET Seed Idobata.getSeed()
/api/messages GET List Idobata.getMessages(List ids)
/api/messages GET List Idobata.getMessages(long roomId, long olderThan)
/api/messages POST Message Idobata.postMessage(long roomId, String source)
/api/messages POST Message Idobata.postMessage(long roomId, String fileName, String contentType, InputStream content)
/api/messages/${id} DELETE Message Idobata.deleteMessage(long messageId)
/api/users GET List Idobata.getUsers(List ids)
/api/users/${id} GET User Idobata.getUser(long guyId)
/api/rooms GET List Idobata.getRooms(List ids)
/api/rooms GET Room Idobata.getRoom(String organizationSlug, String roomName)
/api/rooms GET @Deprecated List Idobata.getRooms(String organizationSlug, String roomName)
/api/room/${id} GET Room Idobata.getRoom(long roomId)
/api/rooms/${id}/bots POST Bot postBot(long roomId, String botName)
/api/bots GET List getBots(List ids)
/api/bots POST Bot postBot(String botName, long organizationId)
/api/user/rooms/${id}/touch POST void Idobata.postTouch(long roomId)
/pusher/auth POST String Idobata.postPusherAuth(String channelName, String socketId)

Usage

Post a message as an user.

String email = "SET-YOUR-EMAIL";
String password = "SET-YOUR-PASSWORD";
String organizationSlug = "SET-YOUR-ORGANIZATION_SLUG";
String roomName = "SET-YOUR-ROOM-NAME";

String source = "Hello, Idobata.";

RequestInterceptor authenticator = new FormAuthenticator(email, password);
Idobata idobata = new IdobataBuilder().setRequestInterceptor(authenticator)
                                      .build();

Room room = idobata.getRoom(organizationSlug, roomName);
idobata.postMessage(room.getId(), source);

Post a message as a bot.

String apiToken = "SET-YOUR-API-TOKEN";
String organizationSlug = "SET-YOUR-ORGANIZATION_SLUG";
String roomName = "SET-YOUR-ROOM-NAME";

String source = "Hello, Idobata.";

RequestInterceptor authenticator = new TokenAuthenticator(apiToken);
Idobata idobata = new IdobataBuilder().setRequestInterceptor(authenticator)
                                      .build();

Room room = idobata.getRoom(organizationSlug, roomName);
idobata.postMessage(room.getId(), source);

Subscribing push events.

RequestInterceptor authenticator = ...
Idobata idobata = new IdobataBuilder().setRequestInterceptor(authenticator)
                                      .build();

idobata.openStream()
       .subscribeMessageCreated(new IdobataStream.Listener<MessageCreatedEvent>() {
           @Override
           public void onEvent(MessageCreatedEvent event) {
               System.out.println(event.getSenderName() + ":" + event.getBody());
           }
       })
       .subscribeMemberStatusChanged(new IdobataStream.Listener<MemberStatusChangedEvent>() {
           @Override
           public void onEvent(MemberStatusChangedEvent event) {
               System.out.println(event.getId() + ":" + event.getStatus());
           }
       });

Download

Idobata4J releases are available on Maven Central.

Gradle

compile "com.uphyca.idobata:idobata4j-core:${idobata4jVersion}"

Maven

<dependencies>
  <dependency>
    <groupId>com.uphyca.idobata</groupId>
    <artifactId>idobata4j-core</artifactId>
    <version>${idobata4j.version}</version>
  </dependency>
</dependencies>

License

Copyright 2014 uPhyca, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
com.uphyca.idobata

uPhyca, Inc.

Versions

Version
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0