#escalade-hipchat HipChat API Scala wrapper library.
##Getting Started
- Create an API token. (Refer to Official API Documentation)
- Instantiate Rooms or Users class.
// for HipChat Cloud
val rooms = new com.zaneli.escalade.hipchat.Rooms(<API token>)
val users = new com.zaneli.escalade.hipchat.Users(<API token>)
// for HipChat Server
val rooms = new com.zaneli.escalade.hipchat.Rooms("http://example.hipchatserver.com", <API token>)
val users = new com.zaneli.escalade.hipchat.Users("http://example.hipchatserver.com", <API token>)
- Execute
callmethod.
rooms.list.call
users.show.call(<user_id>)
##About Call Method
- All objects corresponding to each API have a
callmethod.
val (res, rate) = rooms.list.call
val (res, rate) = users.show.call(<user_id>)
- All
callmethods 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
testmethod for testing token. (Refer to Testing a token)
val result = rooms.list.test
val result = users.show.test
- All
testmethods return ascala.util.Try. If the token is valid,scala.util.Successwill be returned. Otherwise,scala.util.Failurewill 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.2</version>
</dependency>
</dependencies>
###build.sbt resolvers += "Zaneli Repository" at "http://www.zaneli.com/repositories"
libraryDependencies ++= {
Seq("com.zaneli" %% "escalade-hipchat" % "0.0.2")
}
