Last active
December 22, 2015 06:18
-
-
Save deanh/6429841 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get("/thing/:id", operation(getThingAuraById)) { | |
val id = params("id") | |
val Some(limit) = ParamValidator.asInteger(params.getOrElse("limit", "100")) | |
val Some(offset) = ParamValidator.asInteger(params.getOrElse("offset", "0")) | |
ParamValidator.asInteger(id) match { | |
case Some(id) => { | |
new AsyncResult { val is = | |
// this returns a Finagle Future - I want an implicit in scope here to do the | |
// conversion | |
auraClient.auraByThingId(id, limit = limit, offset = offset) map { aura => | |
JsonParticleCollectionView(aura.toList, nextThingUrl(id, offset, limit)) | |
} | |
} | |
} | |
case None => NotFound(ResponseError("Invalid id: %s".format(id))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment