# Cloud Firestore V1 API - Class Google::Cloud::Firestore::V1::Target (v2.4.0)

2.4.0 (latest) 2.3.0 2.2.1 2.1.1 2.0.1 1.3.0 1.2.0 1.1.1 1.0.0 0.14.0 0.13.0 0.12.0 0.11.1 0.10.0 0.9.0 0.8.0 0.7.1 0.6.0 0.5.0 0.4.8 Reference documentation and code samples for the Cloud Firestore V1 API class Google::Cloud::Firestore::V1::Target.

A specification of a set of documents to listen to.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #documents

    def documents() -> ::Google::Cloud::Firestore::V1::Target::DocumentsTarget

**Returns**

- ([::Google::Cloud::Firestore::V1::Target::DocumentsTarget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Target-DocumentsTarget)) --- A target specified by a set of document names.


  Note: The following fields are mutually exclusive: `documents`, `query`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #documents=

    def documents=(value) -> ::Google::Cloud::Firestore::V1::Target::DocumentsTarget

**Parameter**

- **value** ([::Google::Cloud::Firestore::V1::Target::DocumentsTarget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Target-DocumentsTarget)) --- A target specified by a set of document names.


  Note: The following fields are mutually exclusive: `documents`, `query`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Firestore::V1::Target::DocumentsTarget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Target-DocumentsTarget)) --- A target specified by a set of document names.


  Note: The following fields are mutually exclusive: `documents`, `query`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #expected_count

    def expected_count() -> ::Google::Protobuf::Int32Value

**Returns**

- ([::Google::Protobuf::Int32Value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/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.

### #expected_count=

    def expected_count=(value) -> ::Google::Protobuf::Int32Value

**Parameter**

- **value** ([::Google::Protobuf::Int32Value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/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.
**Returns**

- ([::Google::Protobuf::Int32Value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/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.

### #once

    def once() -> ::Boolean

**Returns**

- (::Boolean) --- If the target should be removed once it is current and consistent.

### #once=

    def once=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- If the target should be removed once it is current and consistent.
**Returns**

- (::Boolean) --- If the target should be removed once it is current and consistent.

### #query

    def query() -> ::Google::Cloud::Firestore::V1::Target::QueryTarget

**Returns**

- ([::Google::Cloud::Firestore::V1::Target::QueryTarget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Target-QueryTarget)) --- A target specified by a query.


  Note: The following fields are mutually exclusive: `query`, `documents`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #query=

    def query=(value) -> ::Google::Cloud::Firestore::V1::Target::QueryTarget

**Parameter**

- **value** ([::Google::Cloud::Firestore::V1::Target::QueryTarget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Target-QueryTarget)) --- A target specified by a query.


  Note: The following fields are mutually exclusive: `query`, `documents`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Firestore::V1::Target::QueryTarget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Target-QueryTarget)) --- A target specified by a query.


  Note: The following fields are mutually exclusive: `query`, `documents`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #read_time

    def read_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Protobuf-Timestamp)) --- Start listening after a specific `read_time`.


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

  Note: The following fields are mutually exclusive: `read_time`, `resume_token`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #read_time=

    def read_time=(value) -> ::Google::Protobuf::Timestamp

**Parameter**

- **value** ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Protobuf-Timestamp)) --- Start listening after a specific `read_time`.


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

  Note: The following fields are mutually exclusive: `read_time`, `resume_token`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Protobuf-Timestamp)) --- Start listening after a specific `read_time`.


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

  Note: The following fields are mutually exclusive: `read_time`, `resume_token`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #resume_token

    def resume_token() -> ::String

**Returns**

- (::String) --- A resume token from a prior [TargetChange](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-TargetChange "Google::Cloud::Firestore::V1::TargetChange (class)") for an identical target.


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

  Note: The following fields are mutually exclusive: `resume_token`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #resume_token=

    def resume_token=(value) -> ::String

**Parameter**

- **value** (::String) --- A resume token from a prior [TargetChange](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-TargetChange "Google::Cloud::Firestore::V1::TargetChange (class)") for an identical target.


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

  Note: The following fields are mutually exclusive: `resume_token`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- (::String) --- A resume token from a prior [TargetChange](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-TargetChange "Google::Cloud::Firestore::V1::TargetChange (class)") for an identical target.


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

  Note: The following fields are mutually exclusive: `resume_token`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #target_id

    def target_id() -> ::Integer

**Returns**

- (::Integer) --- 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 `TargetChange.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.

### #target_id=

    def target_id=(value) -> ::Integer

**Parameter**

- **value** (::Integer) --- 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 `TargetChange.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**

- (::Integer) --- 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 `TargetChange.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.