public static string GetCollectionName(int week, int season, SeasonType seasonType) { return $"s_{season}_w_{week.ToString("D2")}_{seasonType.GetAbbreviation()}"; }
private async Task<List<Game>> GetGames(int season, SeasonType seasonType) { var games = new List<Game>(); using (var client = new HttpClient()) { client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _apiKey); var requestUri = $"https://api.fantasydata.net/nfl/v2/json/Schedules/{season}{seasonType.GetAbbreviation(true)}"; var response = await client.GetAsync(requestUri); if (response.IsSuccessStatusCode) { var body = await response.Content.ReadAsStringAsync(); if (body.Length > 0) { games = DeserializeGames(body); } } } return games; }