in app/controllers/Api.scala [402:422]
def singleItem[T <: IndexedItem](agent: CollectorAgent[T], arn: String)(
implicit
request: RequestHeader,
writes: Writes[T],
executionContext: ExecutionContext
): Future[Result] =
ApiResult.filter {
val sources = agent.get()
sources.flatMap { datum =>
datum.data.find(_.arn == arn).map(datum.label -> Seq(_))
}.toMap
} reduce { sources =>
sources.headOption.map { case (label, items) =>
Api.itemJson(items.head, expand = true, label = Some(label)).get
} getOrElse {
throw ApiCallException(
Json.obj("arn" -> s"Item with arn $arn doesn't exist"),
NOT_FOUND
)
}
}