public List <DeviceModel> GetDeviceAll() { DeviceListResultJson deviceListResultJson = ShakeAroundApi.SearchDeviceByRange(_accessToken, 0, 49, 10000); if (deviceListResultJson.errcode != ReturnCode.请求成功) { throw new Exception(deviceListResultJson.errmsg); } return(deviceListResultJson.data.devices); }
public DeviceListResultJson UnauthorizedTest() { DeviceListResultJson deviceListResultJson = ShakeAroundApi.SearchDeviceByRange(_accessToken, 0, 1, 10000); if (deviceListResultJson.errcode != ReturnCode.请求成功 && deviceListResultJson.errcode != ReturnCode.api功能未授权) { throw new Exception(deviceListResultJson.errmsg); } return(deviceListResultJson); }
public DeviceList2ResultJson GetDeviceAll(int page, int rows) { int num = 0; if (page > 1) { num = (page - 1) * rows; } DeviceListResultJson deviceListResultJson = ShakeAroundApi.SearchDeviceByRange(_accessToken, num, rows, 10000); if (deviceListResultJson.errcode != ReturnCode.请求成功) { throw new Exception(deviceListResultJson.errmsg); } return(deviceListResultJson.data); }
public DeviceModel GetDeviceById(long id) { DeviceApply_Data_Device_Identifiers deviceApplyDataDeviceIdentifier = new DeviceApply_Data_Device_Identifiers() { device_id = id }; string str = _accessToken; List <DeviceApply_Data_Device_Identifiers> deviceApplyDataDeviceIdentifiers = new List <DeviceApply_Data_Device_Identifiers>() { deviceApplyDataDeviceIdentifier }; DeviceListResultJson deviceListResultJson = ShakeAroundApi.SearchDeviceById(str, deviceApplyDataDeviceIdentifiers, 10000); if (deviceListResultJson.errcode != ReturnCode.请求成功) { throw new Exception(deviceListResultJson.errmsg); } if (deviceListResultJson.data.devices.Count <= 0) { return(null); } return(deviceListResultJson.data.devices[0]); }