Documentation

Google_Service_Firestore_Resource_ProjectsDatabasesDocuments extends Google_Service_Resource
in package

The "documents" collection of methods.

Typical usage is: $firestoreService = new Google_Service_Firestore(...); $documents = $firestoreService->documents;

Table of Contents

$client  : Google_Client
$methods  : array<string|int, mixed>
$resourceName  : string
$rootUrl  : string
$serviceName  : string
$servicePath  : string
$stackParameters  : mixed
__construct()  : mixed
batchGet()  : Google_Service_Firestore_BatchGetDocumentsResponse
Gets multiple documents. Documents returned by this method are not guaranteed to be returned in the same order that they were requested.
batchWrite()  : Google_Service_Firestore_BatchWriteResponse
Applies a batch of write operations. The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the BatchWriteResponse for the success status of each write. If you require an atomically applied set of writes, use Commit instead. (documents.batchWrite)
beginTransaction()  : Google_Service_Firestore_BeginTransactionResponse
Starts a new transaction. (documents.beginTransaction)
call()  : Google_Http_Request|expectedClass
TODO: This function needs simplifying.
commit()  : Google_Service_Firestore_CommitResponse
Commits a transaction, while optionally updating documents.
createDocument()  : Google_Service_Firestore_Document
Creates a new document. (documents.createDocument)
createRequestUri()  : string
Parse/expand request parameters and create a fully qualified request uri.
delete()  : Google_Service_Firestore_FirestoreEmpty
Deletes a document. (documents.delete)
get()  : Google_Service_Firestore_Document
Gets a single document. (documents.get)
listCollectionIds()  : Google_Service_Firestore_ListCollectionIdsResponse
Lists all the collection IDs underneath a document.
listen()  : Google_Service_Firestore_ListenResponse
Listens to changes. (documents.listen)
listProjectsDatabasesDocuments()  : Google_Service_Firestore_ListDocumentsResponse
Lists documents. (documents.listProjectsDatabasesDocuments)
partitionQuery()  : Google_Service_Firestore_PartitionQueryResponse
Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results.
patch()  : Google_Service_Firestore_Document
Updates or inserts a document. (documents.patch)
rollback()  : Google_Service_Firestore_FirestoreEmpty
Rolls back a transaction. (documents.rollback)
runQuery()  : Google_Service_Firestore_RunQueryResponse
Runs a query. (documents.runQuery)
write()  : Google_Service_Firestore_WriteResponse
Streams batches of document updates and deletes, in order. (documents.write)
convertToArrayAndStripNulls()  : mixed

Properties

$methods

private array<string|int, mixed> $methods

$resourceName

private string $resourceName

$serviceName

private string $serviceName

$servicePath

private string $servicePath

$stackParameters

private mixed $stackParameters = array('alt' => array('type' => 'string', 'location' => 'query'), 'fields' => array('type' => 'string', 'location' => 'query'), 'trace' => array('type' => 'string', 'location' => 'query'), 'userIp' => array('type' => 'string', 'location' => 'query'), 'quotaUser' => array('type' => 'string', 'location' => 'query'), 'data' => array('type' => 'string', 'location' => 'body'), 'mimeType' => array('type' => 'string', 'location' => 'header'), 'uploadType' => array('type' => 'string', 'location' => 'query'), 'mediaUpload' => array('type' => 'complex', 'location' => 'query'), 'prettyPrint' => array('type' => 'string', 'location' => 'query'))

Methods

__construct()

public __construct(mixed $service, mixed $serviceName, mixed $resourceName, mixed $resource) : mixed
Parameters
$service : mixed
$serviceName : mixed
$resourceName : mixed
$resource : mixed
Return values
mixed

batchGet()

Gets multiple documents. Documents returned by this method are not guaranteed to be returned in the same order that they were requested.

public batchGet(string $database, Google_Service_Firestore_BatchGetDocumentsRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_BatchGetDocumentsResponse

(documents.batchGet)

Parameters
$database : string

Required. The database name. In the format: projects/{project_id}/databases/{database_id}.

$postBody : Google_Service_Firestore_BatchGetDocumentsRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_BatchGetDocumentsResponse

batchWrite()

Applies a batch of write operations. The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the BatchWriteResponse for the success status of each write. If you require an atomically applied set of writes, use Commit instead. (documents.batchWrite)

public batchWrite(string $database, Google_Service_Firestore_BatchWriteRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_BatchWriteResponse
Parameters
$database : string

Required. The database name. In the format: projects/{project_id}/databases/{database_id}.

$postBody : Google_Service_Firestore_BatchWriteRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_BatchWriteResponse

beginTransaction()

Starts a new transaction. (documents.beginTransaction)

public beginTransaction(string $database, Google_Service_Firestore_BeginTransactionRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_BeginTransactionResponse
Parameters
$database : string

Required. The database name. In the format: projects/{project_id}/databases/{database_id}.

$postBody : Google_Service_Firestore_BeginTransactionRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_BeginTransactionResponse

call()

TODO: This function needs simplifying.

public call( $name,  $arguments[,  $expectedClass = null ]) : Google_Http_Request|expectedClass
Parameters
$name :
$arguments :
$expectedClass : = null
  • optional, the expected class name
Tags
throws
Google_Exception
Return values
Google_Http_Request|expectedClass

commit()

Commits a transaction, while optionally updating documents.

public commit(string $database, Google_Service_Firestore_CommitRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_CommitResponse

(documents.commit)

Parameters
$database : string

Required. The database name. In the format: projects/{project_id}/databases/{database_id}.

$postBody : Google_Service_Firestore_CommitRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_CommitResponse

createDocument()

Creates a new document. (documents.createDocument)

public createDocument(string $parent, string $collectionId, Google_Service_Firestore_Document $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_Document
Parameters
$parent : string

Required. The parent resource. For example: projects/{project_id}/databases/{database_id}/documents or projects/{proje ct_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}

$collectionId : string

Required. The collection ID, relative to parent, to list. For example: chatrooms.

$postBody : Google_Service_Firestore_Document
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

string mask.fieldPaths The list of field paths in the mask. See Document.fields for a field path syntax reference.

opt_param

string documentId The client-assigned document ID to use for this document. Optional. If not specified, an ID will be assigned by the service.

Return values
Google_Service_Firestore_Document

createRequestUri()

Parse/expand request parameters and create a fully qualified request uri.

public createRequestUri(string $restPath, array<string|int, mixed> $params) : string
Parameters
$restPath : string
$params : array<string|int, mixed>
Tags
static
Return values
string

$requestUrl

delete()

Deletes a document. (documents.delete)

public delete(string $name[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_FirestoreEmpty
Parameters
$name : string

Required. The resource name of the Document to delete. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

bool currentDocument.exists When set to true, the target document must exist. When set to false, the target document must not exist.

opt_param

string currentDocument.updateTime When set, the target document must exist and have been last updated at that time.

Return values
Google_Service_Firestore_FirestoreEmpty

get()

Gets a single document. (documents.get)

public get(string $name[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_Document
Parameters
$name : string

Required. The resource name of the Document to get. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

string readTime Reads the version of the document at the given time. This may not be older than 270 seconds.

opt_param

string transaction Reads the document in a transaction.

opt_param

string mask.fieldPaths The list of field paths in the mask. See Document.fields for a field path syntax reference.

Return values
Google_Service_Firestore_Document

listCollectionIds()

Lists all the collection IDs underneath a document.

public listCollectionIds(string $parent, Google_Service_Firestore_ListCollectionIdsRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_ListCollectionIdsResponse

(documents.listCollectionIds)

Parameters
$parent : string

Required. The parent document. In the format: projects/{project_id}/databases/{database_id}/documents/{document_path}. For example: projects/my-project/databases/my-database/documents/chatrooms /my-chatroom

$postBody : Google_Service_Firestore_ListCollectionIdsRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_ListCollectionIdsResponse

listen()

Listens to changes. (documents.listen)

public listen(string $database, Google_Service_Firestore_ListenRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_ListenResponse
Parameters
$database : string

Required. The database name. In the format: projects/{project_id}/databases/{database_id}.

$postBody : Google_Service_Firestore_ListenRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_ListenResponse

listProjectsDatabasesDocuments()

Lists documents. (documents.listProjectsDatabasesDocuments)

public listProjectsDatabasesDocuments(string $parent, string $collectionId[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_ListDocumentsResponse
Parameters
$parent : string

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

$collectionId : string

Required. The collection ID, relative to parent, to list. For example: chatrooms or messages.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

string transaction Reads documents in a transaction.

opt_param

string mask.fieldPaths The list of field paths in the mask. See Document.fields for a field path syntax reference.

opt_param

int pageSize The maximum number of documents to return.

opt_param

bool 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.

opt_param

string readTime Reads documents as they were at the given time. This may not be older than 270 seconds.

opt_param

string pageToken The next_page_token value returned from a previous List request, if any.

opt_param

string orderBy The order to sort results by. For example: priority desc, name.

Return values
Google_Service_Firestore_ListDocumentsResponse

partitionQuery()

Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results.

public partitionQuery(string $parent, Google_Service_Firestore_PartitionQueryRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_PartitionQueryResponse

(documents.partitionQuery)

Parameters
$parent : string

Required. The parent resource name. In the format: projects/{project_id}/databases/{database_id}/documents. Document resource names are not supported; only database resource names can be specified.

$postBody : Google_Service_Firestore_PartitionQueryRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_PartitionQueryResponse

patch()

Updates or inserts a document. (documents.patch)

public patch(string $name, Google_Service_Firestore_Document $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_Document
Parameters
$name : string

The resource name of the document, for example projects/{project_id}/databases/{database_id}/documents/{document_path}.

$postBody : Google_Service_Firestore_Document
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

string currentDocument.updateTime When set, the target document must exist and have been last updated at that time.

opt_param

bool currentDocument.exists When set to true, the target document must exist. When set to false, the target document must not exist.

opt_param

string updateMask.fieldPaths The list of field paths in the mask. See Document.fields for a field path syntax reference.

opt_param

string mask.fieldPaths The list of field paths in the mask. See Document.fields for a field path syntax reference.

Return values
Google_Service_Firestore_Document

rollback()

Rolls back a transaction. (documents.rollback)

public rollback(string $database, Google_Service_Firestore_RollbackRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_FirestoreEmpty
Parameters
$database : string

Required. The database name. In the format: projects/{project_id}/databases/{database_id}.

$postBody : Google_Service_Firestore_RollbackRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_FirestoreEmpty

runQuery()

Runs a query. (documents.runQuery)

public runQuery(string $parent, Google_Service_Firestore_RunQueryRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_RunQueryResponse
Parameters
$parent : string

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

$postBody : Google_Service_Firestore_RunQueryRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_RunQueryResponse

write()

Streams batches of document updates and deletes, in order. (documents.write)

public write(string $database, Google_Service_Firestore_WriteRequest $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Firestore_WriteResponse
Parameters
$database : string

Required. The database name. In the format: projects/{project_id}/databases/{database_id}. This is only required in the first message.

$postBody : Google_Service_Firestore_WriteRequest
$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
Google_Service_Firestore_WriteResponse

convertToArrayAndStripNulls()

protected convertToArrayAndStripNulls(mixed $o) : mixed
Parameters
$o : mixed
Return values
mixed

Search results