getDeviceByVcodeId method
Implementation
@override
Future<Devices> getDeviceByVcodeId(String vcode, String id) async {
try {
return await dio
.get(ApiEndpoints.DEVICES,
queryParameters: {'vcode': vcode, 'device_id': id},
options: Options(
validateStatus: (status) => status == 200 || status == 404))
.then((value) {
try {
return Devices.fromJson(value.data);
} catch (e) {
logger.error(TAG, e.toString(), {'method': 'getDeviceByVcodeId'});
}
return Devices(list: []);
});
} on Exception catch (e) {
throw HttpHelper.decodeErrorResponse(e,
tag: TAG,
logger: logger,
defaultErrorMessage: 'Failed to get a device by verification code id',
meta: {'device': id, 'vcode': vcode, 'method': 'getDeviceByVcodeId'});
}
}