public static NetSpeedInfo GetDeviceNetSpeed(string host, LoginInfoEx loginInfo) { string url = string.Format(DEVICE_NETSPEED_URL_FORMAT, host, loginInfo.Info.stok); string args = DEVICE_NETSPEED_REQUEST_PAYLOAD_FORMAT; string responseStr = HttpUtils.Post(url, args, HttpUtils.RequestType.Json, HttpUtils.DefaultUserAgent, loginInfo.Cookies); CheckResponse(responseStr); try { CommonResponse <NetSpeedInfo> response = JsonConvert.DeserializeObject <CommonResponse <NetSpeedInfo> >(responseStr); return(response.data); } catch (Exception ex) { throw new HiWiFiApiException($"[HiWiFiAPI]Unkown Error, Message: {ex.Message}\r\nResponse: {responseStr}"); } }
public static IEnumerable <DeviceInfo> GetDeviceStatus(string host, LoginInfoEx loginInfo) { string url = string.Format(DEVICES_STATUS_URL_FORMAT, host, loginInfo.Info.stok); string args = string.Format(DEVICE_STATUS_REQUEST_PAYLOAD_FORMAT, DateTime.Now.ToString("yyyyMMdd")); string responseStr = HttpUtils.Post(url, args, HttpUtils.RequestType.Json, HttpUtils.DefaultUserAgent, loginInfo.Cookies); CheckResponse(responseStr); try { CommonResponse <MuticallResultCollection <DeviceMethodResultData> > response = JsonConvert.DeserializeObject <CommonResponse <MuticallResultCollection <DeviceMethodResultData> > >(responseStr); IEnumerable <DeviceInfo> result = response.data.results[0].result.data.list; return(result); } catch (Exception ex) { throw new HiWiFiApiException($"[HiWiFiAPI]Unkown Error, Message: {ex.Message}\r\nResponse: {responseStr}"); } }