Cloud Firestore V1 Client - Class Target (1.44.1)

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

A specification of a set of documents to listen to.

Generated from protobuf message google.firestore.v1.Target

Namespace

Google \ Cloud \ Firestore \ V1

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ query Google\Cloud\Firestore\V1\Target\QueryTarget

A target specified by a query.

↳ documents Google\Cloud\Firestore\V1\Target\DocumentsTarget

A target specified by a set of document names.

↳ resume_token string

A resume token from a prior TargetChange for an identical target. Using a resume token with a different target is unsupported and may fail.

↳ read_time Google\Protobuf\Timestamp

Start listening after a specific read_time. The client must know the state of matching documents at this time.

↳ target_id int

The target ID that identifies the target on the stream. Must be a positive number and non-zero. If target_id is 0 (or unspecified), the server will assign an ID for this target and return that in a TargetChange::ADD event. Once a target with target_id=0 is added, all subsequent targets must also have target_id=0. If an AddTarget request with target_id != 0 is sent to the server after a target with target_id=0 is added, the server will immediately send a response with a TargetChange::Remove event. Note that if the client sends multiple AddTarget requests without an ID, the order of IDs returned in TargetChage.target_ids are undefined. Therefore, clients should provide a target ID instead of relying on the server to assign one. If target_id is non-zero, there must not be an existing active target on this stream with the same ID.

↳ once bool

If the target should be removed once it is current and consistent.

↳ expected_count Google\Protobuf\Int32Value

The number of documents that last matched the query at the resume token or read time. This value is only relevant when a resume_type is provided. This value being present and greater than zero signals that the client wants ExistenceFilter.unchanged_names to be included in the response.

getQuery

A target specified by a query.

Returns
Type Description
Google\Cloud\Firestore\V1\Target\QueryTarget|null

hasQuery

setQuery

A target specified by a query.

Parameter
Name Description
var Google\Cloud\Firestore\V1\Target\QueryTarget
Returns
Type Description
$this

getDocuments

A target specified by a set of document names.

Returns
Type Description
Google\Cloud\Firestore\V1\Target\DocumentsTarget|null

hasDocuments

setDocuments

A target specified by a set of document names.

Parameter
Name Description
var Google\Cloud\Firestore\V1\Target\DocumentsTarget
Returns
Type Description
$this

getResumeToken

A resume token from a prior TargetChange for an identical target.

Using a resume token with a different target is unsupported and may fail.

Returns
Type Description
string

hasResumeToken

setResumeToken

A resume token from a prior TargetChange for an identical target.

Using a resume token with a different target is unsupported and may fail.

Parameter
Name Description
var string
Returns
Type Description
$this

getReadTime

Start listening after a specific read_time.

The client must know the state of matching documents at this time.

Returns
Type Description
Google\Protobuf\Timestamp|null

hasReadTime

setReadTime

Start listening after a specific read_time.

The client must know the state of matching documents at this time.

Parameter
Name Description
var Google\Protobuf\Timestamp
Returns
Type Description
$this

getTargetId

The target ID that identifies the target on the stream. Must be a positive number and non-zero.

If target_id is 0 (or unspecified), the server will assign an ID for this target and return that in a TargetChange::ADD event. Once a target with target_id=0 is added, all subsequent targets must also have target_id=0. If an AddTarget request with target_id != 0 is sent to the server after a target with target_id=0 is added, the server will immediately send a response with a TargetChange::Remove event. Note that if the client sends multiple AddTarget requests without an ID, the order of IDs returned in TargetChage.target_ids are undefined. Therefore, clients should provide a target ID instead of relying on the server to assign one. If target_id is non-zero, there must not be an existing active target on this stream with the same ID.

Returns
Type Description
int

setTargetId

The target ID that identifies the target on the stream. Must be a positive number and non-zero.

If target_id is 0 (or unspecified), the server will assign an ID for this target and return that in a TargetChange::ADD event. Once a target with target_id=0 is added, all subsequent targets must also have target_id=0. If an AddTarget request with target_id != 0 is sent to the server after a target with target_id=0 is added, the server will immediately send a response with a TargetChange::Remove event. Note that if the client sends multiple AddTarget requests without an ID, the order of IDs returned in TargetChage.target_ids are undefined. Therefore, clients should provide a target ID instead of relying on the server to assign one. If target_id is non-zero, there must not be an existing active target on this stream with the same ID.

Parameter
Name Description
var int
Returns
Type Description
$this

getOnce

If the target should be removed once it is current and consistent.

Returns
Type Description
bool

setOnce

If the target should be removed once it is current and consistent.

Parameter
Name Description
var bool
Returns
Type Description
$this

getExpectedCount

The number of documents that last matched the query at the resume token or read time.

This value is only relevant when a resume_type is provided. This value being present and greater than zero signals that the client wants ExistenceFilter.unchanged_names to be included in the response.

Returns
Type Description
Google\Protobuf\Int32Value|null

hasExpectedCount

clearExpectedCount

getExpectedCountValue

Returns the unboxed value from getExpectedCount()

The number of documents that last matched the query at the resume token or read time. This value is only relevant when a resume_type is provided. This value being present and greater than zero signals that the client wants ExistenceFilter.unchanged_names to be included in the response.

Returns
Type Description
int|null

setExpectedCount

The number of documents that last matched the query at the resume token or read time.

This value is only relevant when a resume_type is provided. This value being present and greater than zero signals that the client wants ExistenceFilter.unchanged_names to be included in the response.

Parameter
Name Description
var Google\Protobuf\Int32Value
Returns
Type Description
$this

setExpectedCountValue

Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.

The number of documents that last matched the query at the resume token or read time. This value is only relevant when a resume_type is provided. This value being present and greater than zero signals that the client wants ExistenceFilter.unchanged_names to be included in the response.

Parameter
Name Description
var int|null
Returns
Type Description
$this

getTargetType

Returns
Type Description
string

getResumeType

Returns
Type Description
string