updateUser method

Future<UpdateUserResponse> updateUser({
  1. required String userId,
  2. String? authenticationToken,
  3. String? givenName,
  4. BooleanEnumType? grantPoweruserPrivileges,
  5. LocaleType? locale,
  6. StorageRuleType? storageRule,
  7. String? surname,
  8. String? timeZoneId,
  9. UserType? type,
})

Updates the specified attributes of the specified user, and grants or revokes administrative privileges to the Amazon WorkDocs site.

May throw EntityNotExistsException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw IllegalUserStateException. May throw FailedDependencyException. May throw ServiceUnavailableException. May throw DeactivatingLastSystemUserException. May throw InvalidArgumentException.

Parameter userId : The ID of the user.

Parameter authenticationToken : Amazon WorkDocs authentication token. Not required when using AWS administrator credentials to access the API.

Parameter givenName : The given name of the user.

Parameter grantPoweruserPrivileges : Boolean value to determine whether the user is granted Poweruser privileges.

Parameter locale : The locale of the user.

Parameter storageRule : The amount of storage for the user.

Parameter surname : The surname of the user.

Parameter timeZoneId : The time zone ID of the user.

Parameter type : The type of the user.

Implementation

Future<UpdateUserResponse> updateUser({
  required String userId,
  String? authenticationToken,
  String? givenName,
  BooleanEnumType? grantPoweruserPrivileges,
  LocaleType? locale,
  StorageRuleType? storageRule,
  String? surname,
  String? timeZoneId,
  UserType? type,
}) async {
  ArgumentError.checkNotNull(userId, 'userId');
  _s.validateStringLength(
    'userId',
    userId,
    1,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'authenticationToken',
    authenticationToken,
    1,
    8199,
  );
  _s.validateStringLength(
    'givenName',
    givenName,
    1,
    64,
  );
  _s.validateStringLength(
    'surname',
    surname,
    1,
    64,
  );
  _s.validateStringLength(
    'timeZoneId',
    timeZoneId,
    1,
    256,
  );
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $payload = <String, dynamic>{
    if (givenName != null) 'GivenName': givenName,
    if (grantPoweruserPrivileges != null)
      'GrantPoweruserPrivileges': grantPoweruserPrivileges.toValue(),
    if (locale != null) 'Locale': locale.toValue(),
    if (storageRule != null) 'StorageRule': storageRule,
    if (surname != null) 'Surname': surname,
    if (timeZoneId != null) 'TimeZoneId': timeZoneId,
    if (type != null) 'Type': type.toValue(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/api/v1/users/${Uri.encodeComponent(userId)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return UpdateUserResponse.fromJson(response);
}