countUnreadEmails method
Counts the unread emails in the Instantly API.
Implementation
Future<int?> countUnreadEmails() async {
final response = await _dio.get<Map<String, dynamic>>(
'/unibox/emails/count/unread',
queryParameters: {
'api_key': _apiKey,
},
);
if (response.data == null) {
// TODO(@a-wallen): throw a custom exception
return null;
}
return response.data?['count'] as int?;
}