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