getAllMessages method
Gets all messages of current DOO client instance's conversation
Implementation
@override
Future<List<DOOMessage>> getAllMessages() async {
try {
final createResponse = await _dio.get(
"/public/api/v1/inboxes/${DOOClientApiInterceptor.INTERCEPTOR_INBOX_IDENTIFIER_PLACEHOLDER}/contacts/${DOOClientApiInterceptor.INTERCEPTOR_CONTACT_IDENTIFIER_PLACEHOLDER}/conversations/${DOOClientApiInterceptor.INTERCEPTOR_CONVERSATION_IDENTIFIER_PLACEHOLDER}/messages");
if ((createResponse.statusCode ?? 0).isBetween(199, 300)) {
return (createResponse.data as List<dynamic>)
.map(((json) => DOOMessage.fromJson(json)))
.toList();
} else {
throw DOOClientException(
createResponse.statusMessage ?? "unknown error",
DOOClientExceptionType.GET_MESSAGES_FAILED);
}
} on DioException catch (e) {
throw DOOClientException(
e.message!, DOOClientExceptionType.GET_MESSAGES_FAILED);
}
}