setUICustomization method

Future<SetUICustomizationResponse> setUICustomization({
  1. required String userPoolId,
  2. String? css,
  3. String? clientId,
  4. Uint8List? imageFile,
})

Sets the UI customization information for a user pool's built-in app UI.

You can specify app UI customization settings for a single client (with a specific clientId) or for all clients (by setting the clientId to ALL). If you specify ALL, the default configuration will be used for every client that has no UI customization set previously. If you specify UI customization settings for a particular client, it will no longer fall back to the ALL configuration.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw NotAuthorizedException. May throw TooManyRequestsException. May throw InternalErrorException.

Parameter userPoolId : The user pool ID for the user pool.

Parameter css : The CSS values in the UI customization.

Parameter clientId : The client ID for the client app.

Parameter imageFile : The uploaded logo image for the UI customization.

Implementation

Future<SetUICustomizationResponse> setUICustomization({
  required String userPoolId,
  String? css,
  String? clientId,
  Uint8List? imageFile,
}) async {
  ArgumentError.checkNotNull(userPoolId, 'userPoolId');
  _s.validateStringLength(
    'userPoolId',
    userPoolId,
    1,
    55,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientId',
    clientId,
    1,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.SetUICustomization'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'UserPoolId': userPoolId,
      if (css != null) 'CSS': css,
      if (clientId != null) 'ClientId': clientId,
      if (imageFile != null) 'ImageFile': base64Encode(imageFile),
    },
  );

  return SetUICustomizationResponse.fromJson(jsonResponse.body);
}