createAppInstance method

Future<CreateAppInstanceResponse> createAppInstance({
  1. required String name,
  2. String? clientRequestToken,
  3. String? metadata,
})

Creates an Amazon Chime Messaging SDK AppInstance under an AWS Account. Only Messaging SDK customers use this API. CreateAppInstance supports idempotency behavior as described in the AWS API Standard.

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

Parameter name : The name of the app instance.

Parameter clientRequestToken : The ClientRequestToken of the app instance.

Parameter metadata : The metadata of the app instance. Limited to a 1KB string in UTF-8.

Implementation

Future<CreateAppInstanceResponse> createAppInstance({
  required String name,
  String? clientRequestToken,
  String? metadata,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    2,
    64,
  );
  _s.validateStringLength(
    'metadata',
    metadata,
    0,
    1024,
  );
  final $payload = <String, dynamic>{
    'Name': name,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (metadata != null) 'Metadata': metadata,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/app-instances',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAppInstanceResponse.fromJson(response);
}