initiateDocumentVersionUpload method

Future<InitiateDocumentVersionUploadResponse> initiateDocumentVersionUpload({
  1. String? authenticationToken,
  2. DateTime? contentCreatedTimestamp,
  3. DateTime? contentModifiedTimestamp,
  4. String? contentType,
  5. int? documentSizeInBytes,
  6. String? id,
  7. String? name,
  8. String? parentFolderId,
})

Creates a new document object and version object.

The client specifies the parent folder ID and name of the document to upload. The ID is optionally specified when creating a new version of an existing document. This is the first step to upload a document. Next, upload the document to the URL returned from the call, and then call UpdateDocumentVersion.

To cancel the document upload, call AbortDocumentVersionUpload.

May throw DraftUploadOutOfSyncException. May throw EntityAlreadyExistsException. May throw EntityNotExistsException. May throw FailedDependencyException. May throw InvalidArgumentException. May throw InvalidPasswordException. May throw LimitExceededException. May throw ProhibitedStateException. May throw ResourceAlreadyCheckedOutException. May throw ServiceUnavailableException. May throw StorageLimitExceededException. May throw StorageLimitWillExceedException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException.

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

Parameter contentCreatedTimestamp : The timestamp when the content of the document was originally created.

Parameter contentModifiedTimestamp : The timestamp when the content of the document was modified.

Parameter contentType : The content type of the document.

Parameter documentSizeInBytes : The size of the document, in bytes.

Parameter id : The ID of the document.

Parameter name : The name of the document.

Parameter parentFolderId : The ID of the parent folder.

Implementation

Future<InitiateDocumentVersionUploadResponse> initiateDocumentVersionUpload({
  String? authenticationToken,
  DateTime? contentCreatedTimestamp,
  DateTime? contentModifiedTimestamp,
  String? contentType,
  int? documentSizeInBytes,
  String? id,
  String? name,
  String? parentFolderId,
}) async {
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $payload = <String, dynamic>{
    if (contentCreatedTimestamp != null)
      'ContentCreatedTimestamp': unixTimestampToJson(contentCreatedTimestamp),
    if (contentModifiedTimestamp != null)
      'ContentModifiedTimestamp':
          unixTimestampToJson(contentModifiedTimestamp),
    if (contentType != null) 'ContentType': contentType,
    if (documentSizeInBytes != null)
      'DocumentSizeInBytes': documentSizeInBytes,
    if (id != null) 'Id': id,
    if (name != null) 'Name': name,
    if (parentFolderId != null) 'ParentFolderId': parentFolderId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/api/v1/documents',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return InitiateDocumentVersionUploadResponse.fromJson(response);
}