Cloud Firestore V1 Client - Class WriteRequest (1.44.1)

Reference documentation and code samples for the Cloud Firestore V1 Client class WriteRequest.

The request for Firestore.Write.

The first request creates a stream, or resumes an existing one from a token. When creating a new stream, the server replies with a response containing only an ID and a token, to use in the next request. When resuming a stream, the server first streams any responses later than the given token, then a response containing only an up-to-date token, to use in the next request.

Generated from protobuf message google.firestore.v1.WriteRequest

Namespace

Google \ Cloud \ Firestore \ V1

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ database string

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

↳ stream_id string

The ID of the write stream to resume. This may only be set in the first message. When left empty, a new write stream will be created.

↳ writes array<Google\Cloud\Firestore\V1\Write>

The writes to apply. Always executed atomically and in order. This must be empty on the first request. This may be empty on the last request. This must not be empty on all other requests.

↳ stream_token string

A stream token that was previously sent by the server. The client should set this field to the token from the most recent WriteResponse it has received. This acknowledges that the client has received responses up to this token. After sending this token, earlier tokens may not be used anymore. The server may close the stream if there are too many unacknowledged responses. Leave this field unset when creating a new stream. To resume a stream at a specific point, set this field and the stream_id field. Leave this field unset when creating a new stream.

↳ labels array|Google\Protobuf\Internal\MapField

Labels associated with this write request.

getDatabase

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

This is only required in the first message.

Returns
Type Description
string

setDatabase

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

This is only required in the first message.

Parameter
Name Description
var string
Returns
Type Description
$this

getStreamId

The ID of the write stream to resume.

This may only be set in the first message. When left empty, a new write stream will be created.

Returns
Type Description
string

setStreamId

The ID of the write stream to resume.

This may only be set in the first message. When left empty, a new write stream will be created.

Parameter
Name Description
var string
Returns
Type Description
$this

getWrites

The writes to apply.

Always executed atomically and in order. This must be empty on the first request. This may be empty on the last request. This must not be empty on all other requests.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setWrites

The writes to apply.

Always executed atomically and in order. This must be empty on the first request. This may be empty on the last request. This must not be empty on all other requests.

Parameter
Name Description
var array<Google\Cloud\Firestore\V1\Write>
Returns
Type Description
$this

getStreamToken

A stream token that was previously sent by the server.

The client should set this field to the token from the most recent WriteResponse it has received. This acknowledges that the client has received responses up to this token. After sending this token, earlier tokens may not be used anymore. The server may close the stream if there are too many unacknowledged responses. Leave this field unset when creating a new stream. To resume a stream at a specific point, set this field and the stream_id field. Leave this field unset when creating a new stream.

Returns
Type Description
string

setStreamToken

A stream token that was previously sent by the server.

The client should set this field to the token from the most recent WriteResponse it has received. This acknowledges that the client has received responses up to this token. After sending this token, earlier tokens may not be used anymore. The server may close the stream if there are too many unacknowledged responses. Leave this field unset when creating a new stream. To resume a stream at a specific point, set this field and the stream_id field. Leave this field unset when creating a new stream.

Parameter
Name Description
var string
Returns
Type Description
$this

getLabels

Labels associated with this write request.

Returns
Type Description
Google\Protobuf\Internal\MapField

setLabels

Labels associated with this write request.

Parameter
Name Description
var array|Google\Protobuf\Internal\MapField
Returns
Type Description
$this