in common-lib/src/main/scala/com/gu/workflow/lib/ContentAPI.scala [54:77]
def getTagInternalName(tagId: Long)(implicit ec: ExecutionContext): Future[Option[String]] =
tagCache.get(tagId)
private def getTagInternalNameUnderlying(tagId: Long): Future[Option[String]] = {
val path = s"internal-code/tag/$tagId"
val params = List(("page-size", "0"))
val headers = getHeaders(path, params)
getRequest(path, params, headers)
.map(response => parser.parse(response.body))
.map {
case Right(a) =>
a.hcursor
.downField("response")
.downField("tag")
.downField("internalName")
.as[Option[String]]
.toOption
.get
case Left(e) =>
logger.warn("Unable to communicate with CAPI", e)
Some("Print location unavailable")
}
}