getChannelMembersByIds method

Future<List<MmChannelMember>?> getChannelMembersByIds(
  1. String channelId,
  2. List<String> requestBody
)

Get channel members by ids

Get a list of channel members based on the provided user ids. ##### Permissions Must have the read_channel permission.

Parameters:

  • String channelId (required): Channel GUID

  • List<String> requestBody (required): List of user ids

Implementation

Future<List<MmChannelMember>?> getChannelMembersByIds(
  String channelId,
  List<String> requestBody,
) async {
  final response = await getChannelMembersByIdsWithHttpInfo(
    channelId,
    requestBody,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    final responseBody = await _decodeBodyBytes(response);
    return (await apiClient.deserializeAsync(responseBody, 'List<MmChannelMember>') as List)
        .cast<MmChannelMember>()
        .toList();
  }
  return null;
}