messages method

Future<ChannelMessages> messages(
  1. Channel channel,
  2. Authentication authentication
)

Implementation

Future<ChannelMessages> messages(
    Channel channel, Authentication authentication) async {
  http.Response response = await _httpService.getWithFilter(
    '/api/v1/channels.messages',
    ChannelFilter(channel),
    authentication,
  );

  if (response.statusCode == 200) {
    if (response.body.isNotEmpty == true) {
      return ChannelMessages.fromMap(jsonDecode(response.body));
    } else {
      return ChannelMessages();
    }
  }
  throw RocketChatException(response.body);
}