createApi method

Future<CreateApiResponse> createApi({
  1. required EventConfig eventConfig,
  2. required String name,
  3. String? ownerContact,
  4. Map<String, String>? tags,
})

Creates an Api object. Use this operation to create an AppSync API with your preferred configuration, such as an Event API that provides real-time message publishing and message subscriptions over WebSockets.

May throw BadRequestException. May throw ConcurrentModificationException. May throw InternalFailureException. May throw ServiceQuotaExceededException. May throw UnauthorizedException.

Parameter eventConfig : The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.

Parameter name : The name for the Api.

Parameter ownerContact : The owner contact information for the Api.

Implementation

Future<CreateApiResponse> createApi({
  required EventConfig eventConfig,
  required String name,
  String? ownerContact,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'eventConfig': eventConfig,
    'name': name,
    if (ownerContact != null) 'ownerContact': ownerContact,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v2/apis',
    exceptionFnMap: _exceptionFns,
  );
  return CreateApiResponse.fromJson(response);
}