createTheme method

Future<CreateThemeResponse> createTheme({
  1. required String appId,
  2. required String environmentName,
  3. required CreateThemeData themeToCreate,
  4. String? clientToken,
})

Creates a theme to apply to the components in an Amplify app.

May throw InternalServerException. May throw InvalidParameterException. May throw ResourceConflictException. May throw ServiceQuotaExceededException.

Parameter appId : The unique ID of the Amplify app associated with the theme.

Parameter environmentName : The name of the backend environment that is a part of the Amplify app.

Parameter themeToCreate : Represents the configuration of the theme to create.

Parameter clientToken : The unique client token.

Implementation

Future<CreateThemeResponse> createTheme({
  required String appId,
  required String environmentName,
  required CreateThemeData themeToCreate,
  String? clientToken,
}) async {
  final $query = <String, List<String>>{
    if (clientToken != null) 'clientToken': [clientToken],
  };
  final response = await _protocol.sendRaw(
    payload: themeToCreate,
    method: 'POST',
    requestUri:
        '/app/${Uri.encodeComponent(appId)}/environment/${Uri.encodeComponent(environmentName)}/themes',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return CreateThemeResponse(
    entity: Theme.fromJson($json),
  );
}