in app/services/GithubAPI.scala [211:228]
override def branchesForProject(projectId: String): Future[Either[circe.Error, Seq[Branch]]] = {
getHttp
.singleRequest(makeRequest("repos",s"${URLEncoder.encode(projectId, StandardCharsets.UTF_8)}/branches"))
.flatMap(response=>{
response.status match {
case StatusCodes.OK=>
unmarshalContent[Seq[GitHubBranch]](consumeResponseContent(response)).map(_.map(_.map(_.mapToGitlab)))
case StatusCodes.NotFound=>
logger.error(s"Project $projectId does not exist when trying to get branches")
Future.failed(new RuntimeException("Project does not exist"))
case _=>
consumeResponseContent(response).flatMap(content=> {
logger.error(s"Could not get branches for $projectId, server returned ${response.status} ${content.utf8String}")
Future.failed(new RuntimeException("External server error"))
})
}
})
}