listDocuments method
Lists documents.
Request parameters:
parent - Required. The parent resource name. In the format:
projects/{project_id}/databases/{database_id}/documents or
projects/{project_id}/databases/{database_id}/documents/{document_path}.
For example: projects/my-project/databases/my-database/documents or
projects/my-project/databases/my-database/documents/chatrooms/my-chatroom
Value must have pattern ^projects/\[^/\]+/databases/\[^/\]+/documents$.
collectionId - Required. The collection ID, relative to parent, to
list. For example: chatrooms or messages.
mask_fieldPaths - The list of field paths in the mask. See
Document.fields for a field path syntax reference.
orderBy - The order to sort results by. For example: priority desc, name.
pageSize - The maximum number of documents to return.
pageToken - The next_page_token value returned from a previous List
request, if any.
readTime - Reads documents as they were at the given time. This may not
be older than 270 seconds.
showMissing - If the list should show missing documents. A missing
document is a document that does not exist but has sub-documents. These
documents will be returned with a key but will not have fields,
Document.create_time, or Document.update_time set. Requests with
show_missing may not specify where or order_by.
transaction - Reads documents in a transaction.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a ListDocumentsResponse.
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<ListDocumentsResponse> listDocuments(
core.String parent,
core.String collectionId, {
core.List<core.String>? mask_fieldPaths,
core.String? orderBy,
core.int? pageSize,
core.String? pageToken,
core.String? readTime,
core.bool? showMissing,
core.String? transaction,
core.String? $fields,
}) async {
final _queryParams = <core.String, core.List<core.String>>{
if (mask_fieldPaths != null) 'mask.fieldPaths': mask_fieldPaths,
if (orderBy != null) 'orderBy': [orderBy],
if (pageSize != null) 'pageSize': ['${pageSize}'],
if (pageToken != null) 'pageToken': [pageToken],
if (readTime != null) 'readTime': [readTime],
if (showMissing != null) 'showMissing': ['${showMissing}'],
if (transaction != null) 'transaction': [transaction],
if ($fields != null) 'fields': [$fields],
};
final _url = 'v1beta1/' +
core.Uri.encodeFull('$parent') +
'/' +
commons.escapeVariable('$collectionId');
final _response = await _requester.request(
_url,
'GET',
queryParams: _queryParams,
);
return ListDocumentsResponse.fromJson(
_response as core.Map<core.String, core.dynamic>);
}