getApplicants method

Future<List<Map<String, dynamic>>> getApplicants()

Get all applicants

Returns list of applicants with their IDs and details

Implementation

Future<List<Map<String, dynamic>>> getApplicants() async {
  try {
    final response = await _apiClient.get('/sdk/kyc-verification/applicants');
    final jsonData = json.decode(response.body);

    // Response can be a list (all applicants) or a single object (when identifier query is used)
    if (jsonData is List) {
      return jsonData.cast<Map<String, dynamic>>();
    } else {
      return [jsonData as Map<String, dynamic>];
    }
  } catch (e) {
    if (e is ApexKycException) {
      rethrow;
    }
    throw ApexKycException(
      'Failed to get applicants: ${e.toString()}',
      originalError: e,
    );
  }
}