lib/google/cloud/firestore/v1/firestore/client.rb in google-cloud-firestore-v1-0.4.4 vs lib/google/cloud/firestore/v1/firestore/client.rb in google-cloud-firestore-v1-0.4.5
- old
+ new
@@ -259,10 +259,25 @@
#
# @return [::Google::Cloud::Firestore::V1::Document]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::GetDocumentRequest.new
+ #
+ # # Call the get_document method.
+ # result = client.get_document request
+ #
+ # # The returned object is of type Google::Cloud::Firestore::V1::Document.
+ # p result
+ #
def get_document request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::GetDocumentRequest
@@ -276,13 +291,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "name" => request.name
- }
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_document.timeout,
metadata: metadata,
@@ -359,10 +376,31 @@
#
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Firestore::V1::Document>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::ListDocumentsRequest.new
+ #
+ # # Call the list_documents method.
+ # result = client.list_documents request
+ #
+ # # The returned object is of type Gapic::PagedEnumerable. You can
+ # # iterate over all elements by calling #each, and the enumerable
+ # # will lazily make API calls to fetch subsequent pages. Other
+ # # methods are also available for managing paging directly.
+ # result.each do |response|
+ # # Each element is of type ::Google::Cloud::Firestore::V1::Document.
+ # p response
+ # end
+ #
def list_documents request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::ListDocumentsRequest
@@ -376,14 +414,18 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "parent" => request.parent,
- "collection_id" => request.collection_id
- }
+ header_params = {}
+ if request.parent
+ header_params["parent"] = request.parent
+ end
+ if request.collection_id
+ header_params["collection_id"] = request.collection_id
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_documents.timeout,
metadata: metadata,
@@ -446,10 +488,25 @@
#
# @return [::Google::Cloud::Firestore::V1::Document]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::UpdateDocumentRequest.new
+ #
+ # # Call the update_document method.
+ # result = client.update_document request
+ #
+ # # The returned object is of type Google::Cloud::Firestore::V1::Document.
+ # p result
+ #
def update_document request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::UpdateDocumentRequest
@@ -463,13 +520,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "document.name" => request.document.name
- }
+ header_params = {}
+ if request.document&.name
+ header_params["document.name"] = request.document.name
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.update_document.timeout,
metadata: metadata,
@@ -518,10 +577,25 @@
#
# @return [::Google::Protobuf::Empty]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::DeleteDocumentRequest.new
+ #
+ # # Call the delete_document method.
+ # result = client.delete_document request
+ #
+ # # The returned object is of type Google::Protobuf::Empty.
+ # p result
+ #
def delete_document request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::DeleteDocumentRequest
@@ -535,13 +609,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "name" => request.name
- }
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.delete_document.timeout,
metadata: metadata,
@@ -610,10 +686,28 @@
#
# @return [::Enumerable<::Google::Cloud::Firestore::V1::BatchGetDocumentsResponse>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::BatchGetDocumentsRequest.new
+ #
+ # # Call the batch_get_documents method.
+ # result = client.batch_get_documents request
+ #
+ # # The returned object is a streamed enumerable yielding elements of
+ # # type ::Google::Cloud::Firestore::V1::BatchGetDocumentsResponse.
+ # result.each do |response|
+ # p response
+ # end
+ #
def batch_get_documents request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::BatchGetDocumentsRequest
@@ -627,13 +721,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "database" => request.database
- }
+ header_params = {}
+ if request.database
+ header_params["database"] = request.database
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.batch_get_documents.timeout,
metadata: metadata,
@@ -682,10 +778,25 @@
#
# @return [::Google::Cloud::Firestore::V1::BeginTransactionResponse]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::BeginTransactionRequest.new
+ #
+ # # Call the begin_transaction method.
+ # result = client.begin_transaction request
+ #
+ # # The returned object is of type Google::Cloud::Firestore::V1::BeginTransactionResponse.
+ # p result
+ #
def begin_transaction request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::BeginTransactionRequest
@@ -699,13 +810,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "database" => request.database
- }
+ header_params = {}
+ if request.database
+ header_params["database"] = request.database
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.begin_transaction.timeout,
metadata: metadata,
@@ -757,10 +870,25 @@
#
# @return [::Google::Cloud::Firestore::V1::CommitResponse]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::CommitRequest.new
+ #
+ # # Call the commit method.
+ # result = client.commit request
+ #
+ # # The returned object is of type Google::Cloud::Firestore::V1::CommitResponse.
+ # p result
+ #
def commit request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::CommitRequest
@@ -774,13 +902,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "database" => request.database
- }
+ header_params = {}
+ if request.database
+ header_params["database"] = request.database
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.commit.timeout,
metadata: metadata,
@@ -828,10 +958,25 @@
#
# @return [::Google::Protobuf::Empty]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::RollbackRequest.new
+ #
+ # # Call the rollback method.
+ # result = client.rollback request
+ #
+ # # The returned object is of type Google::Protobuf::Empty.
+ # p result
+ #
def rollback request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::RollbackRequest
@@ -845,13 +990,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "database" => request.database
- }
+ header_params = {}
+ if request.database
+ header_params["database"] = request.database
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.rollback.timeout,
metadata: metadata,
@@ -913,10 +1060,28 @@
#
# @return [::Enumerable<::Google::Cloud::Firestore::V1::RunQueryResponse>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::RunQueryRequest.new
+ #
+ # # Call the run_query method.
+ # result = client.run_query request
+ #
+ # # The returned object is a streamed enumerable yielding elements of
+ # # type ::Google::Cloud::Firestore::V1::RunQueryResponse.
+ # result.each do |response|
+ # p response
+ # end
+ #
def run_query request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::RunQueryRequest
@@ -930,13 +1095,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "parent" => request.parent
- }
+ header_params = {}
+ if request.parent
+ header_params["parent"] = request.parent
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.run_query.timeout,
metadata: metadata,
@@ -1022,10 +1189,31 @@
#
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Firestore::V1::Cursor>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::PartitionQueryRequest.new
+ #
+ # # Call the partition_query method.
+ # result = client.partition_query request
+ #
+ # # The returned object is of type Gapic::PagedEnumerable. You can
+ # # iterate over all elements by calling #each, and the enumerable
+ # # will lazily make API calls to fetch subsequent pages. Other
+ # # methods are also available for managing paging directly.
+ # result.each do |response|
+ # # Each element is of type ::Google::Cloud::Firestore::V1::Cursor.
+ # p response
+ # end
+ #
def partition_query request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::PartitionQueryRequest
@@ -1039,13 +1227,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "parent" => request.parent
- }
+ header_params = {}
+ if request.parent
+ header_params["parent"] = request.parent
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.partition_query.timeout,
metadata: metadata,
@@ -1078,10 +1268,34 @@
#
# @return [::Enumerable<::Google::Cloud::Firestore::V1::WriteResponse>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create an input stream
+ # input = Gapic::StreamInput.new
+ #
+ # # Call the write method to start streaming.
+ # output = client.write input
+ #
+ # # Send requests on the stream. For each request, pass in keyword
+ # # arguments to set fields. Be sure to close the stream when done.
+ # input << Google::Cloud::Firestore::V1::WriteRequest.new
+ # input << Google::Cloud::Firestore::V1::WriteRequest.new
+ # input.close
+ #
+ # # Handle streamed responses. These may be interleaved with inputs.
+ # # Each response is of type ::Google::Cloud::Firestore::V1::WriteResponse.
+ # output.each do |response|
+ # p response
+ # end
+ #
def write request, options = nil
unless request.is_a? ::Enumerable
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
request = request.to_enum
end
@@ -1132,10 +1346,34 @@
#
# @return [::Enumerable<::Google::Cloud::Firestore::V1::ListenResponse>]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create an input stream
+ # input = Gapic::StreamInput.new
+ #
+ # # Call the listen method to start streaming.
+ # output = client.listen input
+ #
+ # # Send requests on the stream. For each request, pass in keyword
+ # # arguments to set fields. Be sure to close the stream when done.
+ # input << Google::Cloud::Firestore::V1::ListenRequest.new
+ # input << Google::Cloud::Firestore::V1::ListenRequest.new
+ # input.close
+ #
+ # # Handle streamed responses. These may be interleaved with inputs.
+ # # Each response is of type ::Google::Cloud::Firestore::V1::ListenResponse.
+ # output.each do |response|
+ # p response
+ # end
+ #
def listen request, options = nil
unless request.is_a? ::Enumerable
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
request = request.to_enum
end
@@ -1207,10 +1445,25 @@
#
# @return [::Google::Cloud::Firestore::V1::ListCollectionIdsResponse]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::ListCollectionIdsRequest.new
+ #
+ # # Call the list_collection_ids method.
+ # result = client.list_collection_ids request
+ #
+ # # The returned object is of type Google::Cloud::Firestore::V1::ListCollectionIdsResponse.
+ # p result
+ #
def list_collection_ids request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::ListCollectionIdsRequest
@@ -1224,13 +1477,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "parent" => request.parent
- }
+ header_params = {}
+ if request.parent
+ header_params["parent"] = request.parent
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_collection_ids.timeout,
metadata: metadata,
@@ -1292,10 +1547,25 @@
#
# @return [::Google::Cloud::Firestore::V1::BatchWriteResponse]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::BatchWriteRequest.new
+ #
+ # # Call the batch_write method.
+ # result = client.batch_write request
+ #
+ # # The returned object is of type Google::Cloud::Firestore::V1::BatchWriteResponse.
+ # p result
+ #
def batch_write request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::BatchWriteRequest
@@ -1309,13 +1579,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "database" => request.database
- }
+ header_params = {}
+ if request.database
+ header_params["database"] = request.database
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.batch_write.timeout,
metadata: metadata,
@@ -1375,10 +1647,25 @@
#
# @return [::Google::Cloud::Firestore::V1::Document]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/firestore/v1"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Firestore::V1::CreateDocumentRequest.new
+ #
+ # # Call the create_document method.
+ # result = client.create_document request
+ #
+ # # The returned object is of type Google::Cloud::Firestore::V1::Document.
+ # p result
+ #
def create_document request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::CreateDocumentRequest
@@ -1392,13 +1679,17 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "parent" => request.parent,
- "collection_id" => request.collection_id
- }
+ header_params = {}
+ if request.parent
+ header_params["parent"] = request.parent
+ end
+ if request.collection_id
+ header_params["collection_id"] = request.collection_id
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.create_document.timeout,
metadata: metadata,