createChannel method
- required String appInstanceArn,
- required String chimeBearer,
- required String name,
- String? channelId,
- String? clientRequestToken,
- ElasticChannelConfiguration? elasticChannelConfiguration,
- ExpirationSettings? expirationSettings,
- List<
String> ? memberArns, - String? metadata,
- ChannelMode? mode,
- List<
String> ? moderatorArns, - ChannelPrivacy? privacy,
- List<
Tag> ? tags,
Creates a channel to which you can add users and send messages.
Restriction: You can't change a channel's privacy.
May throw BadRequestException.
May throw ConflictException.
May throw ForbiddenException.
May throw ResourceLimitExceededException.
May throw ServiceFailureException.
May throw ServiceUnavailableException.
May throw ThrottledClientException.
May throw UnauthorizedClientException.
Parameter appInstanceArn :
The ARN of the channel request.
Parameter chimeBearer :
The ARN of the AppInstanceUser or AppInstanceBot
that makes the API call.
Parameter name :
The name of the channel.
Parameter channelId :
An ID for the channel being created. If you do not specify an ID, a UUID
will be created for the channel.
Parameter clientRequestToken :
The client token for the request. An Idempotency token.
Parameter elasticChannelConfiguration :
The attributes required to configure and create an elastic channel. An
elastic channel can support a maximum of 1-million users, excluding
moderators.
Parameter expirationSettings :
Settings that control the interval after which the channel is
automatically deleted.
Parameter memberArns :
The ARNs of the channel members in the request.
Parameter metadata :
The metadata of the creation request. Limited to 1KB and UTF-8.
Parameter mode :
The channel mode: UNRESTRICTED or RESTRICTED.
Administrators, moderators, and channel members can add themselves and
other members to unrestricted channels. Only administrators and moderators
can add members to restricted channels.
Parameter moderatorArns :
The ARNs of the channel moderators in the request.
Parameter privacy :
The channel's privacy level: PUBLIC or PRIVATE.
Private channels aren't discoverable by users outside the channel. Public
channels are discoverable by anyone in the AppInstance.
Parameter tags :
The tags for the creation request.
Implementation
Future<CreateChannelResponse> createChannel({
required String appInstanceArn,
required String chimeBearer,
required String name,
String? channelId,
String? clientRequestToken,
ElasticChannelConfiguration? elasticChannelConfiguration,
ExpirationSettings? expirationSettings,
List<String>? memberArns,
String? metadata,
ChannelMode? mode,
List<String>? moderatorArns,
ChannelPrivacy? privacy,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'x-amz-chime-bearer': chimeBearer.toString(),
};
final $payload = <String, dynamic>{
'AppInstanceArn': appInstanceArn,
'Name': name,
if (channelId != null) 'ChannelId': channelId,
'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
if (elasticChannelConfiguration != null)
'ElasticChannelConfiguration': elasticChannelConfiguration,
if (expirationSettings != null) 'ExpirationSettings': expirationSettings,
if (memberArns != null) 'MemberArns': memberArns,
if (metadata != null) 'Metadata': metadata,
if (mode != null) 'Mode': mode.value,
if (moderatorArns != null) 'ModeratorArns': moderatorArns,
if (privacy != null) 'Privacy': privacy.value,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/channels',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateChannelResponse.fromJson(response);
}