postShareDeviceViaEmail method
Implementation
@override
Future<String> postShareDeviceViaEmail(
String deviceId, String? destinationEmail) async {
try {
final String body = json.encode({
'device_id': deviceId,
'email': (destinationEmail != null) ? destinationEmail : ''
});
return await dio
.post('${ApiEndpoints.SHARE}/0', data: body)
.then((value) => value.data['vcode']);
} on Exception catch (e) {
throw HttpHelper.decodeErrorResponse(e,
tag: TAG,
logger: logger,
defaultErrorMessage: 'Failed to share this device via email',
meta: {
'device': deviceId,
'email': (destinationEmail != null) ? destinationEmail : '',
'method': 'postShareDeviceViaEmail'
});
}
}