getHealthStatuses method

Implementation

Future<HealthVerificationStatusesResponse?> getHealthStatuses() async {
  final baseUrl = ConfigManager.current.baseUrl;
  final url = Uri.parse('$baseUrl$_healthStatusesEndpoint');
  final token = await storage.getTokenOrThrow();

  final headers = {
    'Authorization': 'Bearer $token',
  };


  try {
    final response = await http.get(
      url,
      headers: headers,
    );
    final responseDataReady = await _checkResponseData(response, 'Failed to get Health Statuses');
    if (responseDataReady) {
      final Map<String, dynamic> jsonResponse = jsonDecode(response.body);
      return HealthVerificationStatusesResponse.fromJson(jsonResponse);
    }
    return null;
  } on SDKException {
    rethrow;
  } catch (e) {
    throw SDKException.withMessage(
      'PlumCheck SDK Exeption - Failed to get Health Statuses, Description: ${e.toString()}');
  }
}