createComponent method
Creates a new component for an Amplify app.
May throw InternalServerException.
May throw InvalidParameterException.
May throw ResourceConflictException.
May throw ServiceQuotaExceededException.
Parameter appId :
The unique ID of the Amplify app to associate with the component.
Parameter componentToCreate :
Represents the configuration of the component to create.
Parameter environmentName :
The name of the backend environment that is a part of the Amplify app.
Parameter clientToken :
The unique client token.
Implementation
Future<CreateComponentResponse> createComponent({
required String appId,
required CreateComponentData componentToCreate,
required String environmentName,
String? clientToken,
}) async {
final $query = <String, List<String>>{
if (clientToken != null) 'clientToken': [clientToken],
};
final response = await _protocol.sendRaw(
payload: componentToCreate,
method: 'POST',
requestUri:
'/app/${Uri.encodeComponent(appId)}/environment/${Uri.encodeComponent(environmentName)}/components',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return CreateComponentResponse(
entity: Component.fromJson($json),
);
}