updateDocument method

Future<void> updateDocument({
  1. required String documentId,
  2. String? authenticationToken,
  3. String? name,
  4. String? parentFolderId,
  5. ResourceStateType? resourceState,
})

Updates the specified attributes of a document. The user must have access to both the document and its parent folder, if applicable.

May throw EntityNotExistsException. May throw EntityAlreadyExistsException. May throw LimitExceededException. May throw ProhibitedStateException. May throw ConflictingOperationException. May throw ConcurrentModificationException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw FailedDependencyException. May throw ServiceUnavailableException.

Parameter documentId : The ID of the document.

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

Parameter name : The name of the document.

Parameter parentFolderId : The ID of the parent folder.

Parameter resourceState : The resource state of the document. Only ACTIVE and RECYCLED are supported.

Implementation

Future<void> updateDocument({
  required String documentId,
  String? authenticationToken,
  String? name,
  String? parentFolderId,
  ResourceStateType? resourceState,
}) async {
  ArgumentError.checkNotNull(documentId, 'documentId');
  _s.validateStringLength(
    'documentId',
    documentId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'authenticationToken',
    authenticationToken,
    1,
    8199,
  );
  _s.validateStringLength(
    'name',
    name,
    1,
    255,
  );
  _s.validateStringLength(
    'parentFolderId',
    parentFolderId,
    1,
    128,
  );
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $payload = <String, dynamic>{
    if (name != null) 'Name': name,
    if (parentFolderId != null) 'ParentFolderId': parentFolderId,
    if (resourceState != null) 'ResourceState': resourceState.toValue(),
  };
  await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/api/v1/documents/${Uri.encodeComponent(documentId)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}