listChannelMemberships method

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

Lists all channel memberships in a channel. If you want to list the channels to which a specific app instance user belongs, see the ListChannelMembershipsForAppInstanceUser API.

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

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

Parameter chimeBearer : The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.

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 subChannelId : The ID of the SubChannel in the request.

Parameter type : The membership type of a user, DEFAULT or HIDDEN. Default members are returned as part of ListChannelMemberships if no type is specified. Hidden members are only returned if the type filter in ListChannelMemberships equals HIDDEN.

Implementation

Future<ListChannelMembershipsResponse> listChannelMemberships({
  required String channelArn,
  required String chimeBearer,
  int? maxResults,
  String? nextToken,
  String? subChannelId,
  ChannelMembershipType? type,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'x-amz-chime-bearer': chimeBearer.toString(),
  };
  final $query = <String, List<String>>{
    if (maxResults != null) 'max-results': [maxResults.toString()],
    if (nextToken != null) 'next-token': [nextToken],
    if (subChannelId != null) 'sub-channel-id': [subChannelId],
    if (type != null) 'type': [type.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/channels/${Uri.encodeComponent(channelArn)}/memberships',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ListChannelMembershipsResponse.fromJson(response);
}