getCustomApiKeyStatus method

String getCustomApiKeyStatus(
  1. String truncatedApiKey
)

Implementation

String getCustomApiKeyStatus(String truncatedApiKey) {
  final config = getGlobalConfig();
  final responses = config.customApiKeyResponses;
  if (responses == null) return 'new';

  final approved = (responses['approved'] as List?)?.cast<String>();
  final rejected = (responses['rejected'] as List?)?.cast<String>();
  if (approved?.contains(truncatedApiKey) == true) return 'approved';
  if (rejected?.contains(truncatedApiKey) == true) return 'rejected';
  return 'new';
}