getConversations method
Gets all conversation of current chatwoot client instance
Implementation
@override
Future<List<ChatwootConversation>> getConversations() async {
try {
final createResponse = await _dio.get(
"/public/api/v1/inboxes/${ChatwootClientApiInterceptor.INTERCEPTOR_INBOX_IDENTIFIER_PLACEHOLDER}/contacts/${ChatwootClientApiInterceptor.INTERCEPTOR_CONTACT_IDENTIFIER_PLACEHOLDER}/conversations");
if ((createResponse.statusCode ?? 0).isBetween(199, 300)) {
return (createResponse.data as List<dynamic>)
.map(((json) => ChatwootConversation.fromJson(json)))
.toList();
} else {
throw ChatwootClientException(
createResponse.statusMessage ?? "unknown error",
ChatwootClientExceptionType.GET_CONVERSATION_FAILED);
}
} on DioException catch (e) {
throw ChatwootClientException(
e.message ?? "", ChatwootClientExceptionType.GET_CONVERSATION_FAILED);
}
}