|
|
@@ -122,7 +122,7 @@ object EndpointResponse {
|
|
|
getAllData("https://www.balldontlie.io/api/v1/teams")
|
|
|
}
|
|
|
|
|
|
- def getGames(season: Int, teams: List[Int]): ListOfGames = {
|
|
|
+ def getGames(season: Int, teamIds: List[Int]): ListOfGames = {
|
|
|
implicit val gamesResponseR: Reader[GamesResponse] = macroR[GamesResponse]
|
|
|
|
|
|
def getAllData(
|
|
|
@@ -150,17 +150,11 @@ object EndpointResponse {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Using an array as param to team_ids[] yields a 500 error so we make
|
|
|
- // several requests instead
|
|
|
- teams.flatMap(team => {
|
|
|
- getAllData(
|
|
|
- "https://www.balldontlie.io/api/v1/games",
|
|
|
- List(
|
|
|
- "seasons[]" -> List(season).mkString(","),
|
|
|
- "team_ids[]" -> team
|
|
|
- )
|
|
|
- )
|
|
|
- })
|
|
|
+ getAllData(
|
|
|
+ "https://www.balldontlie.io/api/v1/games",
|
|
|
+ List("seasons[]" -> List(season).mkString(","))
|
|
|
+ ++ teamIds.map("team_ids[]" -> _)
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
def getStats(game_ids: List[Int]): ListOfStats = {
|