listChannelMembershipsForAppInstanceUser method

Future<ListChannelMembershipsForAppInstanceUserResponse> listChannelMembershipsForAppInstanceUser({
  1. required String chimeBearer,
  2. String? appInstanceUserArn,
  3. int? maxResults,
  4. String? nextToken,
})

Lists all channels that an AppInstanceUser or AppInstanceBot is a part of. Only an AppInstanceAdmin can call the API with a user ARN that is not their own.

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

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

Parameter appInstanceUserArn : The ARN of the user or bot.

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

Parameter nextToken : The token returned from previous API requests until the number of channel memberships is reached.

Implementation

Future<ListChannelMembershipsForAppInstanceUserResponse>
    listChannelMembershipsForAppInstanceUser({
  required String chimeBearer,
  String? appInstanceUserArn,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'x-amz-chime-bearer': chimeBearer.toString(),
  };
  final $query = <String, List<String>>{
    if (appInstanceUserArn != null)
      'app-instance-user-arn': [appInstanceUserArn],
    if (maxResults != null) 'max-results': [maxResults.toString()],
    if (nextToken != null) 'next-token': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/channels?scope=app-instance-user-memberships',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ListChannelMembershipsForAppInstanceUserResponse.fromJson(response);
}