get method

Future<Document> get(
  1. String documentId, {
  2. String? suggestionsViewMode,
  3. String? $fields,
})

Gets the latest version of the specified document.

Request parameters:

documentId - The ID of the document to retrieve.

suggestionsViewMode - The suggestions view mode to apply to the document. This allows viewing the document with all suggestions inline, accepted or rejected. If one is not specified, DEFAULT_FOR_CURRENT_ACCESS is used. Possible string values are:

  • "DEFAULT_FOR_CURRENT_ACCESS" : The SuggestionsViewMode applied to the returned document depends on the user's current access level. If the user only has view access, PREVIEW_WITHOUT_SUGGESTIONS is applied. Otherwise, SUGGESTIONS_INLINE is applied. This is the default suggestions view mode.
  • "SUGGESTIONS_INLINE" : The returned document has suggestions inline. Suggested changes will be differentiated from base content within the document. Requests to retrieve a document using this mode will return a 403 error if the user does not have permission to view suggested changes.
  • "PREVIEW_SUGGESTIONS_ACCEPTED" : The returned document is a preview with all suggested changes accepted. Requests to retrieve a document using this mode will return a 403 error if the user does not have permission to view suggested changes.
  • "PREVIEW_WITHOUT_SUGGESTIONS" : The returned document is a preview with all suggested changes rejected if there are any suggestions in the document.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Document.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Document> get(
  core.String documentId, {
  core.String? suggestionsViewMode,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (suggestionsViewMode != null)
      'suggestionsViewMode': [suggestionsViewMode],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/documents/' + commons.escapeVariable('$documentId');

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return Document.fromJson(response_ as core.Map<core.String, core.dynamic>);
}