getDocument method

Future<GetDocumentResponse> getDocument({
  1. required String documentId,
  2. String? authenticationToken,
  3. bool? includeCustomMetadata,
})

Retrieves details of a document.

May throw EntityNotExistsException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw InvalidArgumentException. May throw FailedDependencyException. May throw ServiceUnavailableException. May throw InvalidPasswordException.

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 includeCustomMetadata : Set this to TRUE to include custom metadata in the response.

Implementation

Future<GetDocumentResponse> getDocument({
  required String documentId,
  String? authenticationToken,
  bool? includeCustomMetadata,
}) async {
  ArgumentError.checkNotNull(documentId, 'documentId');
  _s.validateStringLength(
    'documentId',
    documentId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'authenticationToken',
    authenticationToken,
    1,
    8199,
  );
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $query = <String, List<String>>{
    if (includeCustomMetadata != null)
      'includeCustomMetadata': [includeCustomMetadata.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/api/v1/documents/${Uri.encodeComponent(documentId)}',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetDocumentResponse.fromJson(response);
}