getAccountInfoByEmail method

Future<Map<String, dynamic>?> getAccountInfoByEmail(
  1. String email
)

Fetch accountStatus (incl. connectedPlatforms) for an email. Mirrors onairos-npm: POST /getAccountInfo/email with x-api-key and body { Info: { identifier } }

Implementation

Future<Map<String, dynamic>?> getAccountInfoByEmail(String email) async {
  try {
    final normalizedEmail = email.trim().toLowerCase();
    if (normalizedEmail.isEmpty) return null;

    // Use authenticatedPost to handle secure headers (admin or developer key)
    // This delegates to native code if necessary and avoids exposing keys in Dart
    final response = await _apiKeyService.authenticatedPost(
      'getAccountInfo/email',
      body: {
        'Info': {'identifier': normalizedEmail},
      },
    );

    return response;
  } catch (e) {
    OnairosDebugHelper.log('⚠️ [EMAIL-VERIFY] getAccountInfo/email failed: $e');
    return null;
  }
}