lib/google/cloud/gaming/v1/realms_service/client.rb in google-cloud-gaming-v1-0.4.0 vs lib/google/cloud/gaming/v1/realms_service/client.rb in google-cloud-gaming-v1-0.4.1

- old
+ new

@@ -220,10 +220,31 @@ # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Gaming::V1::Realm>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/gaming/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Gaming::V1::RealmsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Gaming::V1::ListRealmsRequest.new + # + # # Call the list_realms method. + # result = client.list_realms 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::Gaming::V1::Realm. + # p response + # end + # def list_realms request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Gaming::V1::ListRealmsRequest @@ -237,13 +258,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::Gaming::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_realms.timeout, metadata: metadata, @@ -290,10 +313,25 @@ # # @return [::Google::Cloud::Gaming::V1::Realm] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/gaming/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Gaming::V1::RealmsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Gaming::V1::GetRealmRequest.new + # + # # Call the get_realm method. + # result = client.get_realm request + # + # # The returned object is of type Google::Cloud::Gaming::V1::Realm. + # p result + # def get_realm request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Gaming::V1::GetRealmRequest @@ -307,13 +345,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::Gaming::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_realm.timeout, metadata: metadata, @@ -363,10 +403,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/gaming/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Gaming::V1::RealmsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Gaming::V1::CreateRealmRequest.new + # + # # Call the create_realm method. + # result = client.create_realm request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def create_realm request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Gaming::V1::CreateRealmRequest @@ -380,13 +442,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::Gaming::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.create_realm.timeout, metadata: metadata, @@ -433,10 +497,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/gaming/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Gaming::V1::RealmsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Gaming::V1::DeleteRealmRequest.new + # + # # Call the delete_realm method. + # result = client.delete_realm request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def delete_realm request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Gaming::V1::DeleteRealmRequest @@ -450,13 +536,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::Gaming::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_realm.timeout, metadata: metadata, @@ -507,10 +595,32 @@ # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/gaming/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Gaming::V1::RealmsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Gaming::V1::UpdateRealmRequest.new + # + # # Call the update_realm method. + # result = client.update_realm request + # + # # The returned object is of type Gapic::Operation. You can use this + # # object to check the status of an operation, cancel it, or wait + # # for results. Here is how to block until completion: + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "Error!" + # end + # def update_realm request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Gaming::V1::UpdateRealmRequest @@ -524,13 +634,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::Gaming::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "realm.name" => request.realm.name - } + header_params = {} + if request.realm&.name + header_params["realm.name"] = request.realm.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_realm.timeout, metadata: metadata, @@ -583,10 +695,25 @@ # # @return [::Google::Cloud::Gaming::V1::PreviewRealmUpdateResponse] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # + # @example Basic example + # require "google/cloud/gaming/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Gaming::V1::RealmsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Gaming::V1::PreviewRealmUpdateRequest.new + # + # # Call the preview_realm_update method. + # result = client.preview_realm_update request + # + # # The returned object is of type Google::Cloud::Gaming::V1::PreviewRealmUpdateResponse. + # p result + # def preview_realm_update request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Gaming::V1::PreviewRealmUpdateRequest @@ -600,12 +727,14 @@ 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::Gaming::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - header_params = { - "realm.name" => request.realm.name - } + header_params = {} + if request.realm&.name + header_params["realm.name"] = request.realm.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.preview_realm_update.timeout, metadata: metadata,