get method

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

Retrieves a single document with its full Markdown content.

Request parameters:

name - Required. Specifies the name of the document to retrieve. Format: documents/{uri_without_scheme} Example: documents/docs.cloud.google.com/storage/docs/creating-buckets The name must not exceed 500 characters; values longer than 500 characters will result in an INVALID_ARGUMENT error. Value must have pattern ^documents/.*$.

view - Optional. Specifies the DocumentView of the document. If unspecified, DeveloperKnowledge.GetDocument defaults to DOCUMENT_VIEW_CONTENT. Possible string values are:

  • "DOCUMENT_VIEW_UNSPECIFIED" : The default / unset value. See each API method for its default value if DocumentView is not specified.
  • "DOCUMENT_VIEW_BASIC" : Includes only the basic metadata fields: - name - uri - data_source - title - description - update_time - view - content_length_bytes This is the default of view for DeveloperKnowledge.SearchDocumentChunks.
  • "DOCUMENT_VIEW_FULL" : Includes all Document fields.
  • "DOCUMENT_VIEW_CONTENT" : Includes the DOCUMENT_VIEW_BASIC fields and the content field. This is the default of view for DeveloperKnowledge.GetDocument and DeveloperKnowledge.BatchGetDocuments.

$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 name, {
  core.String? view,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'view': ?view == null ? null : [view],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name');

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