public async Task <QuickType.RawAirData> GetDeviceRawAirDataAsync(QuickType.DevicesDevice d, DateTime from, DateTime to, bool fahrenheit) { var fromstr = FormatIso8601(from); var tostr = FormatIso8601(to); //fromstr = "2020-02-20T04:00:00.000Z"; //tostr = "2020-02-20T05:00:00.000Z"; var url = $"devices/{d.DeviceType}/{d.DeviceId}/air-data/raw?from={fromstr}&to={tostr}&limit=360&desc=true&fahrenheit={fahrenheit.ToString().ToLower()}"; var content = await SendAsync(url); var raw = QuickType.RawAirData.FromJson(content); raw.SetDevice(d); return(raw); }
public async Task <QuickType.RawAirData> GetDevice5MinAirDataAsync(QuickType.DevicesDevice d, DateTime from, DateTime to, bool fahrenheit) { //shouldn't really need to use the autogenerated The5MinAvgAirData type var fromstr = FormatIso8601(from); var tostr = FormatIso8601(to); //fromstr = "2020-02-20T04:00:00.000Z"; //tostr = "2020-02-20T05:00:00.000Z"; var url = $"devices/{d.DeviceType}/{d.DeviceId}/air-data/5-min-avg?from={fromstr}&to={tostr}&limit=360&desc=true&fahrenheit={fahrenheit.ToString().ToLower()}"; var content = await SendAsync(url); var raw = QuickType.RawAirData.FromJson(content); raw.SetDevice(d); return(raw); }
public async Task <QuickType.RawAirData> GetDeviceRawAirDataAsync(QuickType.DevicesDevice d, DateTime from, DateTime to, bool fahrenheit) { var fromstr = FormatIso8601(from); var tostr = FormatIso8601(to); //fromstr = "2020-02-20T04:00:00.000Z"; //tostr = "2020-02-20T05:00:00.000Z"; var url = $"devices/{d.DeviceType}/{d.DeviceId}/air-data/raw?from={fromstr}&to={tostr}&limit=360&desc=true&fahrenheit={fahrenheit.ToString().ToLower()}"; var content = await GetAsync(url); var file = Path.Combine(Environment.CurrentDirectory, d.Name + ".json"); Console.WriteLine($"Writing raw API response to {file}"); File.WriteAllText(file, content); var raw = QuickType.RawAirData.FromJson(content); raw.SetDevice(d); return(raw); }