in legacy-content-import/src/main/scala/legacycontentimport/audit/Article.scala [50:74]
private def capiRequest(capiDomain: String, capiKey: String) =
Http(s"https://$capiDomain/search")
.param("api-key", capiKey)
.param("tag", "type/article")
.param("section", "help")
.param("show-tags", "keyword,series,tone,blog")
private def toArticle(result: ujson.Value): Article = {
val tagsToInclude = result("tags").arr.toList.filterNot(tag => excludedTags.contains(tag("id").str))
def tagsOfType(typeName: String) = tagsToInclude collect {
case tag if tag("type").str == typeName => tag("webTitle").str
}
Article(
title = result("webTitle").str,
url = new URI(result("webUrl").str),
publicationDate = Instant.parse(result("webPublicationDate").str),
keywords = tagsOfType("keyword").sorted,
series = tagsOfType("series").headOption,
tone = tagsOfType("tone").headOption,
blog = tagsOfType("blog").headOption
)
}