in client/src/main/scala/com.gu.contentapi.client/ContentApiClient.scala [108:116]
def paginateAccum[R <: ThriftStruct: Decoder, E, M](query: PaginatedApiQuery[R, E])(f: R => M, g: (M, M) => M)(
implicit
context: ExecutionContext
): Future[M] =
paginate(query)(f).map {
case Nil => throw new RuntimeException("Something went wrong with the query")
case m :: Nil => m
case ms => ms.reduce(g)
}