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