updateReturn method

Future<Return> updateReturn({
  1. required String returnId,
  2. required Map<String, dynamic> data,
})

Update return

Implementation

Future<Return> updateReturn({
  required String returnId,
  required Map<String, dynamic> data,
}) async {
  try {
    final response = await _client.authenticatedRequest<Map<String, dynamic>>(
      '/rest/V1/returns/$returnId',
      options: Options(method: 'PUT'),
      data: data,
    );

    if (response.statusCode == 200) {
      return Return.fromJson(response.data!);
    } else {
      throw Exception('Failed to update return: ${response.statusMessage}');
    }
  } on DioException catch (e) {
    throw Exception('Failed to update return: ${e.message}');
  } catch (e) {
    throw Exception('Failed to update return: $e');
  }
}