updateDocumentVersion method

Future<void> updateDocumentVersion({
  1. required String documentId,
  2. required String versionId,
  3. String? authenticationToken,
  4. DocumentVersionStatus? versionStatus,
})

Changes the status of the document version to ACTIVE.

Amazon WorkDocs also sets its document container to ACTIVE. This is the last step in a document upload, after the client uploads the document to an S3-presigned URL returned by InitiateDocumentVersionUpload.

May throw EntityNotExistsException. May throw ProhibitedStateException. May throw ConcurrentModificationException. May throw InvalidOperationException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw FailedDependencyException. May throw ServiceUnavailableException.

Parameter documentId : The ID of the document.

Parameter versionId : The version ID of the document.

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

Parameter versionStatus : The status of the version.

Implementation

Future<void> updateDocumentVersion({
  required String documentId,
  required String versionId,
  String? authenticationToken,
  DocumentVersionStatus? versionStatus,
}) async {
  ArgumentError.checkNotNull(documentId, 'documentId');
  _s.validateStringLength(
    'documentId',
    documentId,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(versionId, 'versionId');
  _s.validateStringLength(
    'versionId',
    versionId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'authenticationToken',
    authenticationToken,
    1,
    8199,
  );
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $payload = <String, dynamic>{
    if (versionStatus != null) 'VersionStatus': versionStatus.toValue(),
  };
  await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/api/v1/documents/${Uri.encodeComponent(documentId)}/versions/${Uri.encodeComponent(versionId)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}