A scala client for Schedules Direct's json api
This software is extremely beta. Much of the functionality is untested. If you can help out, please check out the issues page.
sdscala
uses maven for building. You can compile it with:
mvn install
Note: sdscala
is fully async. As such, all of the api functions return a Future
for the result. The Implicits
singleton pimps Future
to have a getResult
function for blocking, which is used in this example for convenience.
import org.tinydvr.schedulesdirect.api._
import org.tinydvr.schedulesdirect.api.Implicits._
// get an access token
val token = SchedulesDirectAuthenticator.getToken(username, password).getResult.token
// create a client
val client = new SchedulesDirectAPIClient(token)
// see the headends from your location
val headEnds = client.getHeadends("USA", "19146").getResult
// add a lineup to your account
client.addLineup(headEnds.head.lineups.head.uri).getResult
// download the lineups for your account
val lineups = client.getLineups.getResult.lineups
// download the StationID / channel mapping for a lineup
val stationMap = client.getLineup(lineups.head.uri).getResult