public async Task <UsDay> GetUsDataOnDate(DateTime date) { using (var client = new HttpClient()) { var sourceUrl = CovidTrackingConfig.UsWithDateString(date); var targetContent = await client.GetStringAsync(sourceUrl); return(JsonConvert.DeserializeObject <UsDay>(targetContent, serializeSettings)); } }
public async Task <StateDay> GetStateDataByDate(StateCode stateCode, DateTime date) { using (var client = new HttpClient()) { var sourceUrl = CovidTrackingConfig.StateWithDateString(stateCode, date); var targetContent = await client.GetStringAsync(sourceUrl); return(JsonConvert.DeserializeObject <StateDay>(targetContent, serializeSettings)); } }
public async Task <List <StateDay> > GetHistoricStateData(StateCode stateCode = StateCode.None) { using (var client = new HttpClient()) { var sourceUrl = CovidTrackingConfig.BaseUrlString + CovidTrackingConfig.HistoricStatesString; if (stateCode != StateCode.None) { sourceUrl = CovidTrackingConfig.HistoricStateString(stateCode); } var targetContent = await client.GetStringAsync(sourceUrl); return(JsonConvert.DeserializeObject <List <StateDay> >(targetContent, serializeSettings)); } }