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 DeactivatingLastSystemUserException. May throw EntityNotExistsException. May throw FailedDependencyException. May throw IllegalUserStateException. May throw InvalidArgumentException. May throw ProhibitedStateException. May throw ServiceUnavailableException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException.

Parameter userId : The ID of the user.

Parameter authenticationToken : Amazon WorkDocs authentication token. Not required when using Amazon Web Services 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 Power user 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 {
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $payload = <String, dynamic>{
    if (givenName != null) 'GivenName': givenName,
    if (grantPoweruserPrivileges != null)
      'GrantPoweruserPrivileges': grantPoweruserPrivileges.value,
    if (locale != null) 'Locale': locale.value,
    if (storageRule != null) 'StorageRule': storageRule,
    if (surname != null) 'Surname': surname,
    if (timeZoneId != null) 'TimeZoneId': timeZoneId,
    if (type != null) 'Type': type.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/api/v1/users/${Uri.encodeComponent(userId)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return UpdateUserResponse.fromJson(response);
}