getSendQuota method

Future<Map<String, dynamic>> getSendQuota()

Retrieves the current SES send quota information.

Returns a map containing:

  • max24HourSend
  • maxSendRate
  • sentLast24Hours

Example:

final quota = await client.getSendQuota();
print(quota['max24HourSend']);

Implementation

Future<Map<String, dynamic>> getSendQuota() async {
  try {
    final body = 'Action=GetSendQuota&Version=2010-12-01';

    final response = await _makeRequest(method: 'POST', path: '/', body: body);

    if (response.statusCode == 200) {
      final xml = response.body;
      return {
        'max24HourSend': double.tryParse(_extractFromXml(xml, 'Max24HourSend')) ?? 0,
        'maxSendRate': double.tryParse(_extractFromXml(xml, 'MaxSendRate')) ?? 0,
        'sentLast24Hours': double.tryParse(_extractFromXml(xml, 'SentLast24Hours')) ?? 0,
      };
    } else {
      throw Exception('Failed to get send quota: ${response.statusCode}');
    }
  } catch (e) {
    // todo -archeryLogger
    rethrow;
  }
}