listChannelMemberships method

Future<ListChannelMembershipsResponse> listChannelMemberships({
  1. required String channelArn,
  2. int? maxResults,
  3. String? nextToken,
  4. ChannelMembershipType? type,
})

Lists all channel memberships in a channel.

May throw BadRequestException. May throw ForbiddenException. May throw UnauthorizedClientException. May throw ThrottledClientException. May throw ServiceUnavailableException. May throw ServiceFailureException.

Parameter channelArn : The maximum number of channel memberships that you want returned.

Parameter maxResults : The maximum number of channel memberships that you want returned.

Parameter nextToken : The token passed by previous API calls until all requested channel memberships are returned..

Parameter type : The membership type of a user, DEFAULT or HIDDEN. Default members are always returned as part of ListChannelMemberships. Hidden members are only returned if the type filter in ListChannelMemberships equals HIDDEN. Otherwise hidden members are not returned.

Implementation

Future<ListChannelMembershipsResponse> listChannelMemberships({
  required String channelArn,
  int? maxResults,
  String? nextToken,
  ChannelMembershipType? type,
}) async {
  ArgumentError.checkNotNull(channelArn, 'channelArn');
  _s.validateStringLength(
    'channelArn',
    channelArn,
    5,
    1600,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    2048,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'max-results': [maxResults.toString()],
    if (nextToken != null) 'next-token': [nextToken],
    if (type != null) 'type': [type.toValue()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/channels/${Uri.encodeComponent(channelArn)}/memberships',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListChannelMembershipsResponse.fromJson(response);
}