#escalade-hipchat HipChat API Scala wrapper library.
##Getting Started
- Create an API token. (Refer to Official API Documentation)
- Instantiate Rooms or Users class.
val rooms = new com.zaneli.escalade.hipchat.Rooms(<API token>)
val users = new com.zaneli.escalade.hipchat.Users(<API token>)
- Execute
call
method.
rooms.list.call
users.show.call(<user_id>)
##About Call Method
- All objects corresponding to each API have a
call
method.
val (res, rate) = rooms.list.call
val (res, rate) = users.show.call(<user_id>)
- All
call
methods return a pair, first is individual value and second isescalade.hipchat.model.RateLimit
. (Refer to Rate Limiting)
rate.limit // The number of requests you are allowed per 5 minutes.
rate.remaining // How many requests you can make before hitting the limit.
rate.reset // The next time (as a Unix timestamp) the limit will be updated.
##About Test Method
- All objects corresponding to each API have a
test
method for testing token. (Refer to Testing a token)
val result = rooms.list.test
val result = users.show.test
- All
test
methods return ascala.util.Try
. If the token is valid,scala.util.Success
will be returned. Otherwise,scala.util.Failure
will be returned.
result match {
case Success((res, rate)) => // execute call method
case Failure(e) => throw e
}
##Maven Repository
for Scala 2.10.x and Scala 2.11.x
###pom.xml com.zaneli Zaneli Repository http://www.zaneli.com/repositories
<dependencies>
<dependency>
<groupId>com.zaneli</groupId>
<artifactId>escalade-hipchat_2.11</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
###build.sbt resolvers += "Zaneli Repository" at "http://www.zaneli.com/repositories"
libraryDependencies ++= {
Seq("com.zaneli" %% "escalade-hipchat" % "0.0.1")
}