# Cloud Firestore V1 API - Class Google::Cloud::Firestore::V1::WriteRequest (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::WriteRequest.

The request for [Firestore.Write](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Firestore-Client#Google__Cloud__Firestore__V1__Firestore__Client_write_instance_ "Google::Cloud::Firestore::V1::Firestore::Client#write (method)").


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.

<br />

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.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #database

    def database() -> ::String

**Returns**

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

### #database=

    def database=(value) -> ::String

**Parameter**

- **value** (::String) --- Required. The database name. In the format: `projects/{project_id}/databases/{database_id}`. This is only required in the first message.
**Returns**

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

### #labels

    def labels() -> ::Google::Protobuf::Map{::String => ::String}

**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- Labels associated with this write request.

### #labels=

    def labels=(value) -> ::Google::Protobuf::Map{::String => ::String}

**Parameter**

- **value** (::Google::Protobuf::Map{::String =\> ::String}) --- Labels associated with this write request.
**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- Labels associated with this write request.

### #stream_id

    def stream_id() -> ::String

**Returns**

- (::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.

### #stream_id=

    def stream_id=(value) -> ::String

**Parameter**

- **value** (::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.
**Returns**

- (::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.

### #stream_token

    def stream_token() -> ::String

**Returns**

- (::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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-WriteResponse "Google::Cloud::Firestore::V1::WriteResponse (class)") 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.

### #stream_token=

    def stream_token=(value) -> ::String

**Parameter**

- **value** (::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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-WriteResponse "Google::Cloud::Firestore::V1::WriteResponse (class)") 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**

- (::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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-WriteResponse "Google::Cloud::Firestore::V1::WriteResponse (class)") 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.

### #writes

    def writes() -> ::Array<::Google::Cloud::Firestore::V1::Write>

**Returns**

- (::Array\<[::Google::Cloud::Firestore::V1::Write](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/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.

### #writes=

    def writes=(value) -> ::Array<::Google::Cloud::Firestore::V1::Write>

**Parameter**

- **value** (::Array\<[::Google::Cloud::Firestore::V1::Write](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/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.
**Returns**

- (::Array\<[::Google::Cloud::Firestore::V1::Write](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/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.