putChannelMembershipPreferences method
Sets the membership preferences of an AppInstanceUser or
AppInstanceBot for the specified channel. The user or bot
must be a member of the channel. Only the user or bot who owns the
membership can set preferences. Users or bots in the
AppInstanceAdmin and channel moderator roles can't set
preferences for other users. Banned users or bots can't set membership
preferences for the channel from which they are banned.
May throw BadRequestException.
May throw ConflictException.
May throw ForbiddenException.
May throw ServiceFailureException.
May throw ServiceUnavailableException.
May throw ThrottledClientException.
May throw UnauthorizedClientException.
Parameter channelArn :
The ARN of the channel.
Parameter chimeBearer :
The ARN of the AppInstanceUser or AppInstanceBot
that makes the API call.
Parameter memberArn :
The ARN of the member setting the preferences.
Parameter preferences :
The channel membership preferences of an AppInstanceUser .
Implementation
Future<PutChannelMembershipPreferencesResponse>
putChannelMembershipPreferences({
required String channelArn,
required String chimeBearer,
required String memberArn,
required ChannelMembershipPreferences preferences,
}) async {
final headers = <String, String>{
'x-amz-chime-bearer': chimeBearer.toString(),
};
final $payload = <String, dynamic>{
'Preferences': preferences,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/channels/${Uri.encodeComponent(channelArn)}/memberships/${Uri.encodeComponent(memberArn)}/preferences',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return PutChannelMembershipPreferencesResponse.fromJson(response);
}