getReturn method

Future<Return> getReturn(
  1. String returnId
)

Get return details

Implementation

Future<Return> getReturn(String returnId) async {
  try {
    final response = await _client.authenticatedRequest<Map<String, dynamic>>(
      '/rest/V1/returns/$returnId',
    );

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