google-cloud-dialogflow-v2 0.11.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +7 -25
  4. data/lib/google/cloud/dialogflow/v2/agents/client.rb +215 -27
  5. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +115 -12
  6. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +46 -6
  7. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +126 -18
  8. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +4 -0
  9. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +106 -15
  10. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +19 -0
  11. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +112 -15
  12. data/lib/google/cloud/dialogflow/v2/document_pb.rb +13 -0
  13. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +10 -0
  14. data/lib/google/cloud/dialogflow/v2/documents/client.rb +303 -20
  15. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +115 -12
  16. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +242 -30
  17. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +115 -12
  18. data/lib/google/cloud/dialogflow/v2/environments/client.rb +132 -18
  19. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +40 -6
  20. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +4 -0
  21. data/lib/google/cloud/dialogflow/v2/intents/client.rb +161 -21
  22. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +115 -12
  23. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +1 -0
  24. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +134 -16
  25. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +9 -0
  26. data/lib/google/cloud/dialogflow/v2/participants/client.rb +155 -24
  27. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +106 -15
  28. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  29. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +44 -3
  30. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  31. data/lib/google/cloud/dialogflow/v2/versions/client.rb +106 -15
  32. data/proto_docs/google/api/resource.rb +10 -71
  33. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +4 -3
  34. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +4 -1
  35. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +28 -8
  36. data/proto_docs/google/cloud/dialogflow/v2/document.rb +53 -0
  37. data/proto_docs/google/cloud/dialogflow/v2/gcs.rb +39 -0
  38. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +28 -0
  39. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +69 -0
  40. data/proto_docs/google/cloud/dialogflow/v2/session.rb +38 -33
  41. metadata +4 -3
@@ -140,6 +140,7 @@ module Google
140
140
 
141
141
  @operations_client = Operations.new do |config|
142
142
  config.credentials = credentials
143
+ config.quota_project = @quota_project_id
143
144
  config.endpoint = @config.endpoint
144
145
  end
145
146
 
@@ -174,7 +175,7 @@ module Google
174
175
  # @param options [::Gapic::CallOptions, ::Hash]
175
176
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
176
177
  #
177
- # @overload list_documents(parent: nil, page_size: nil, page_token: nil)
178
+ # @overload list_documents(parent: nil, page_size: nil, page_token: nil, filter: nil)
178
179
  # Pass arguments to `list_documents` via keyword arguments. Note that at
179
180
  # least one keyword argument is required. To specify no parameters, or to keep all
180
181
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -188,6 +189,28 @@ module Google
188
189
  # default 10 and at most 100.
189
190
  # @param page_token [::String]
190
191
  # The next_page_token value returned from a previous list request.
192
+ # @param filter [::String]
193
+ # The filter expression used to filter documents returned by the list method.
194
+ # The expression has the following syntax:
195
+ #
196
+ # <field> <operator> <value> [AND <field> <operator> <value>] ...
197
+ #
198
+ # The following fields and operators are supported:
199
+ #
200
+ # * knowledge_types with has(:) operator
201
+ # * display_name with has(:) operator
202
+ # * state with equals(=) operator
203
+ #
204
+ # Examples:
205
+ #
206
+ # * "knowledge_types:FAQ" matches documents with FAQ knowledge type.
207
+ # * "display_name:customer" matches documents whose display name contains
208
+ # "customer".
209
+ # * "state=ACTIVE" matches documents with ACTIVE state.
210
+ # * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents.
211
+ #
212
+ # For more information about filtering, see
213
+ # [API Filtering](https://aip.dev/160).
191
214
  #
192
215
  # @yield [response, operation] Access the result along with the RPC operation
193
216
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Document>]
@@ -197,6 +220,27 @@ module Google
197
220
  #
198
221
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
199
222
  #
223
+ # @example Basic example
224
+ # require "google/cloud/dialogflow/v2"
225
+ #
226
+ # # Create a client object. The client can be reused for multiple calls.
227
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
228
+ #
229
+ # # Create a request. To set request fields, pass in keyword arguments.
230
+ # request = Google::Cloud::Dialogflow::V2::ListDocumentsRequest.new
231
+ #
232
+ # # Call the list_documents method.
233
+ # result = client.list_documents request
234
+ #
235
+ # # The returned object is of type Gapic::PagedEnumerable. You can
236
+ # # iterate over all elements by calling #each, and the enumerable
237
+ # # will lazily make API calls to fetch subsequent pages. Other
238
+ # # methods are also available for managing paging directly.
239
+ # result.each do |response|
240
+ # # Each element is of type ::Google::Cloud::Dialogflow::V2::Document.
241
+ # p response
242
+ # end
243
+ #
200
244
  def list_documents request, options = nil
201
245
  raise ::ArgumentError, "request must be provided" if request.nil?
202
246
 
@@ -214,9 +258,11 @@ module Google
214
258
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
215
259
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
216
260
 
217
- header_params = {
218
- "parent" => request.parent
219
- }
261
+ header_params = {}
262
+ if request.parent
263
+ header_params["parent"] = request.parent
264
+ end
265
+
220
266
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
221
267
  metadata[:"x-goog-request-params"] ||= request_params_header
222
268
 
@@ -268,6 +314,21 @@ module Google
268
314
  #
269
315
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
270
316
  #
317
+ # @example Basic example
318
+ # require "google/cloud/dialogflow/v2"
319
+ #
320
+ # # Create a client object. The client can be reused for multiple calls.
321
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
322
+ #
323
+ # # Create a request. To set request fields, pass in keyword arguments.
324
+ # request = Google::Cloud::Dialogflow::V2::GetDocumentRequest.new
325
+ #
326
+ # # Call the get_document method.
327
+ # result = client.get_document request
328
+ #
329
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::Document.
330
+ # p result
331
+ #
271
332
  def get_document request, options = nil
272
333
  raise ::ArgumentError, "request must be provided" if request.nil?
273
334
 
@@ -285,9 +346,11 @@ module Google
285
346
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
286
347
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
287
348
 
288
- header_params = {
289
- "name" => request.name
290
- }
349
+ header_params = {}
350
+ if request.name
351
+ header_params["name"] = request.name
352
+ end
353
+
291
354
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
292
355
  metadata[:"x-goog-request-params"] ||= request_params_header
293
356
 
@@ -347,6 +410,28 @@ module Google
347
410
  #
348
411
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
349
412
  #
413
+ # @example Basic example
414
+ # require "google/cloud/dialogflow/v2"
415
+ #
416
+ # # Create a client object. The client can be reused for multiple calls.
417
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
418
+ #
419
+ # # Create a request. To set request fields, pass in keyword arguments.
420
+ # request = Google::Cloud::Dialogflow::V2::CreateDocumentRequest.new
421
+ #
422
+ # # Call the create_document method.
423
+ # result = client.create_document request
424
+ #
425
+ # # The returned object is of type Gapic::Operation. You can use this
426
+ # # object to check the status of an operation, cancel it, or wait
427
+ # # for results. Here is how to block until completion:
428
+ # result.wait_until_done! timeout: 60
429
+ # if result.response?
430
+ # p result.response
431
+ # else
432
+ # puts "Error!"
433
+ # end
434
+ #
350
435
  def create_document request, options = nil
351
436
  raise ::ArgumentError, "request must be provided" if request.nil?
352
437
 
@@ -364,9 +449,11 @@ module Google
364
449
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
365
450
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
366
451
 
367
- header_params = {
368
- "parent" => request.parent
369
- }
452
+ header_params = {}
453
+ if request.parent
454
+ header_params["parent"] = request.parent
455
+ end
456
+
370
457
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
371
458
  metadata[:"x-goog-request-params"] ||= request_params_header
372
459
 
@@ -426,6 +513,28 @@ module Google
426
513
  #
427
514
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
428
515
  #
516
+ # @example Basic example
517
+ # require "google/cloud/dialogflow/v2"
518
+ #
519
+ # # Create a client object. The client can be reused for multiple calls.
520
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
521
+ #
522
+ # # Create a request. To set request fields, pass in keyword arguments.
523
+ # request = Google::Cloud::Dialogflow::V2::DeleteDocumentRequest.new
524
+ #
525
+ # # Call the delete_document method.
526
+ # result = client.delete_document request
527
+ #
528
+ # # The returned object is of type Gapic::Operation. You can use this
529
+ # # object to check the status of an operation, cancel it, or wait
530
+ # # for results. Here is how to block until completion:
531
+ # result.wait_until_done! timeout: 60
532
+ # if result.response?
533
+ # p result.response
534
+ # else
535
+ # puts "Error!"
536
+ # end
537
+ #
429
538
  def delete_document request, options = nil
430
539
  raise ::ArgumentError, "request must be provided" if request.nil?
431
540
 
@@ -443,9 +552,11 @@ module Google
443
552
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
444
553
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
445
554
 
446
- header_params = {
447
- "name" => request.name
448
- }
555
+ header_params = {}
556
+ if request.name
557
+ header_params["name"] = request.name
558
+ end
559
+
449
560
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
450
561
  metadata[:"x-goog-request-params"] ||= request_params_header
451
562
 
@@ -506,6 +617,28 @@ module Google
506
617
  #
507
618
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
508
619
  #
620
+ # @example Basic example
621
+ # require "google/cloud/dialogflow/v2"
622
+ #
623
+ # # Create a client object. The client can be reused for multiple calls.
624
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
625
+ #
626
+ # # Create a request. To set request fields, pass in keyword arguments.
627
+ # request = Google::Cloud::Dialogflow::V2::UpdateDocumentRequest.new
628
+ #
629
+ # # Call the update_document method.
630
+ # result = client.update_document request
631
+ #
632
+ # # The returned object is of type Gapic::Operation. You can use this
633
+ # # object to check the status of an operation, cancel it, or wait
634
+ # # for results. Here is how to block until completion:
635
+ # result.wait_until_done! timeout: 60
636
+ # if result.response?
637
+ # p result.response
638
+ # else
639
+ # puts "Error!"
640
+ # end
641
+ #
509
642
  def update_document request, options = nil
510
643
  raise ::ArgumentError, "request must be provided" if request.nil?
511
644
 
@@ -523,9 +656,11 @@ module Google
523
656
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
524
657
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
525
658
 
526
- header_params = {
527
- "document.name" => request.document.name
528
- }
659
+ header_params = {}
660
+ if request.document&.name
661
+ header_params["document.name"] = request.document.name
662
+ end
663
+
529
664
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
530
665
  metadata[:"x-goog-request-params"] ||= request_params_header
531
666
 
@@ -572,7 +707,7 @@ module Google
572
707
  # @param options [::Gapic::CallOptions, ::Hash]
573
708
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
574
709
  #
575
- # @overload reload_document(name: nil, content_uri: nil)
710
+ # @overload reload_document(name: nil, content_uri: nil, import_gcs_custom_metadata: nil, smart_messaging_partial_update: nil)
576
711
  # Pass arguments to `reload_document` via keyword arguments. Note that at
577
712
  # least one keyword argument is required. To specify no parameters, or to keep all
578
713
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -587,6 +722,12 @@ module Google
587
722
  #
588
723
  # For documents stored in Google Cloud Storage, these URIs must have
589
724
  # the form `gs://<bucket-name>/<object-name>`.
725
+ # @param import_gcs_custom_metadata [::Boolean]
726
+ # Optional. Whether to import custom metadata from Google Cloud Storage.
727
+ # Only valid when the document source is Google Cloud Storage URI.
728
+ # @param smart_messaging_partial_update [::Boolean]
729
+ # Optional. When enabled, the reload request is to apply partial update to the smart
730
+ # messaging allowlist.
590
731
  #
591
732
  # @yield [response, operation] Access the result along with the RPC operation
592
733
  # @yieldparam response [::Gapic::Operation]
@@ -596,6 +737,28 @@ module Google
596
737
  #
597
738
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
598
739
  #
740
+ # @example Basic example
741
+ # require "google/cloud/dialogflow/v2"
742
+ #
743
+ # # Create a client object. The client can be reused for multiple calls.
744
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
745
+ #
746
+ # # Create a request. To set request fields, pass in keyword arguments.
747
+ # request = Google::Cloud::Dialogflow::V2::ReloadDocumentRequest.new
748
+ #
749
+ # # Call the reload_document method.
750
+ # result = client.reload_document request
751
+ #
752
+ # # The returned object is of type Gapic::Operation. You can use this
753
+ # # object to check the status of an operation, cancel it, or wait
754
+ # # for results. Here is how to block until completion:
755
+ # result.wait_until_done! timeout: 60
756
+ # if result.response?
757
+ # p result.response
758
+ # else
759
+ # puts "Error!"
760
+ # end
761
+ #
599
762
  def reload_document request, options = nil
600
763
  raise ::ArgumentError, "request must be provided" if request.nil?
601
764
 
@@ -613,9 +776,11 @@ module Google
613
776
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
614
777
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
778
 
616
- header_params = {
617
- "name" => request.name
618
- }
779
+ header_params = {}
780
+ if request.name
781
+ header_params["name"] = request.name
782
+ end
783
+
619
784
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
620
785
  metadata[:"x-goog-request-params"] ||= request_params_header
621
786
 
@@ -636,6 +801,117 @@ module Google
636
801
  raise ::Google::Cloud::Error.from_error(e)
637
802
  end
638
803
 
804
+ ##
805
+ # Exports a smart messaging candidate document into the specified
806
+ # destination.
807
+ #
808
+ # This method is a [long-running
809
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
810
+ # The returned `Operation` type has the following method-specific fields:
811
+ #
812
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
813
+ # - `response`: {::Google::Cloud::Dialogflow::V2::Document Document}
814
+ #
815
+ # @overload export_document(request, options = nil)
816
+ # Pass arguments to `export_document` via a request object, either of type
817
+ # {::Google::Cloud::Dialogflow::V2::ExportDocumentRequest} or an equivalent Hash.
818
+ #
819
+ # @param request [::Google::Cloud::Dialogflow::V2::ExportDocumentRequest, ::Hash]
820
+ # A request object representing the call parameters. Required. To specify no
821
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
822
+ # @param options [::Gapic::CallOptions, ::Hash]
823
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
824
+ #
825
+ # @overload export_document(name: nil, gcs_destination: nil, export_full_content: nil, smart_messaging_partial_update: nil)
826
+ # Pass arguments to `export_document` via keyword arguments. Note that at
827
+ # least one keyword argument is required. To specify no parameters, or to keep all
828
+ # the default parameter values, pass an empty Hash as a request object (see above).
829
+ #
830
+ # @param name [::String]
831
+ # Required. The name of the document to export.
832
+ # Format: `projects/<Project ID>/locations/<Location
833
+ # ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
834
+ # @param gcs_destination [::Google::Cloud::Dialogflow::V2::GcsDestination, ::Hash]
835
+ # Cloud Storage file path to export the document.
836
+ # @param export_full_content [::Boolean]
837
+ # When enabled, export the full content of the document including empirical
838
+ # probability.
839
+ # @param smart_messaging_partial_update [::Boolean]
840
+ # When enabled, export the smart messaging allowlist document for partial
841
+ # update.
842
+ #
843
+ # @yield [response, operation] Access the result along with the RPC operation
844
+ # @yieldparam response [::Gapic::Operation]
845
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
846
+ #
847
+ # @return [::Gapic::Operation]
848
+ #
849
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
850
+ #
851
+ # @example Basic example
852
+ # require "google/cloud/dialogflow/v2"
853
+ #
854
+ # # Create a client object. The client can be reused for multiple calls.
855
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
856
+ #
857
+ # # Create a request. To set request fields, pass in keyword arguments.
858
+ # request = Google::Cloud::Dialogflow::V2::ExportDocumentRequest.new
859
+ #
860
+ # # Call the export_document method.
861
+ # result = client.export_document request
862
+ #
863
+ # # The returned object is of type Gapic::Operation. You can use this
864
+ # # object to check the status of an operation, cancel it, or wait
865
+ # # for results. Here is how to block until completion:
866
+ # result.wait_until_done! timeout: 60
867
+ # if result.response?
868
+ # p result.response
869
+ # else
870
+ # puts "Error!"
871
+ # end
872
+ #
873
+ def export_document request, options = nil
874
+ raise ::ArgumentError, "request must be provided" if request.nil?
875
+
876
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ExportDocumentRequest
877
+
878
+ # Converts hash and nil to an options object
879
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
880
+
881
+ # Customize the options with defaults
882
+ metadata = @config.rpcs.export_document.metadata.to_h
883
+
884
+ # Set x-goog-api-client and x-goog-user-project headers
885
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
886
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
887
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
888
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
889
+
890
+ header_params = {}
891
+ if request.name
892
+ header_params["name"] = request.name
893
+ end
894
+
895
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
896
+ metadata[:"x-goog-request-params"] ||= request_params_header
897
+
898
+ options.apply_defaults timeout: @config.rpcs.export_document.timeout,
899
+ metadata: metadata,
900
+ retry_policy: @config.rpcs.export_document.retry_policy
901
+
902
+ options.apply_defaults timeout: @config.timeout,
903
+ metadata: @config.metadata,
904
+ retry_policy: @config.retry_policy
905
+
906
+ @documents_stub.call_rpc :export_document, request, options: options do |response, operation|
907
+ response = ::Gapic::Operation.new response, @operations_client, options: options
908
+ yield response, operation if block_given?
909
+ return response
910
+ end
911
+ rescue ::GRPC::BadStatus => e
912
+ raise ::Google::Cloud::Error.from_error(e)
913
+ end
914
+
639
915
  ##
640
916
  # Configuration class for the Documents API.
641
917
  #
@@ -801,6 +1077,11 @@ module Google
801
1077
  # @return [::Gapic::Config::Method]
802
1078
  #
803
1079
  attr_reader :reload_document
1080
+ ##
1081
+ # RPC-specific configuration for `export_document`
1082
+ # @return [::Gapic::Config::Method]
1083
+ #
1084
+ attr_reader :export_document
804
1085
 
805
1086
  # @private
806
1087
  def initialize parent_rpcs = nil
@@ -816,6 +1097,8 @@ module Google
816
1097
  @update_document = ::Gapic::Config::Method.new update_document_config
817
1098
  reload_document_config = parent_rpcs.reload_document if parent_rpcs.respond_to? :reload_document
818
1099
  @reload_document = ::Gapic::Config::Method.new reload_document_config
1100
+ export_document_config = parent_rpcs.export_document if parent_rpcs.respond_to? :export_document
1101
+ @export_document = ::Gapic::Config::Method.new export_document_config
819
1102
 
820
1103
  yield self if block_given?
821
1104
  end
@@ -143,6 +143,27 @@ module Google
143
143
  #
144
144
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
145
145
  #
146
+ # @example Basic example
147
+ # require "google/longrunning"
148
+ #
149
+ # # Create a client object. The client can be reused for multiple calls.
150
+ # client = Google::Longrunning::Operations::Client.new
151
+ #
152
+ # # Create a request. To set request fields, pass in keyword arguments.
153
+ # request = Google::Longrunning::ListOperationsRequest.new
154
+ #
155
+ # # Call the list_operations method.
156
+ # result = client.list_operations request
157
+ #
158
+ # # The returned object is of type Gapic::PagedEnumerable. You can
159
+ # # iterate over all elements by calling #each, and the enumerable
160
+ # # will lazily make API calls to fetch subsequent pages. Other
161
+ # # methods are also available for managing paging directly.
162
+ # result.each do |response|
163
+ # # Each element is of type ::Google::Longrunning::Operation.
164
+ # p response
165
+ # end
166
+ #
146
167
  def list_operations request, options = nil
147
168
  raise ::ArgumentError, "request must be provided" if request.nil?
148
169
 
@@ -160,9 +181,11 @@ module Google
160
181
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
161
182
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
162
183
 
163
- header_params = {
164
- "name" => request.name
165
- }
184
+ header_params = {}
185
+ if request.name
186
+ header_params["name"] = request.name
187
+ end
188
+
166
189
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
167
190
  metadata[:"x-goog-request-params"] ||= request_params_header
168
191
 
@@ -215,6 +238,28 @@ module Google
215
238
  #
216
239
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
240
  #
241
+ # @example Basic example
242
+ # require "google/longrunning"
243
+ #
244
+ # # Create a client object. The client can be reused for multiple calls.
245
+ # client = Google::Longrunning::Operations::Client.new
246
+ #
247
+ # # Create a request. To set request fields, pass in keyword arguments.
248
+ # request = Google::Longrunning::GetOperationRequest.new
249
+ #
250
+ # # Call the get_operation method.
251
+ # result = client.get_operation request
252
+ #
253
+ # # The returned object is of type Gapic::Operation. You can use this
254
+ # # object to check the status of an operation, cancel it, or wait
255
+ # # for results. Here is how to block until completion:
256
+ # result.wait_until_done! timeout: 60
257
+ # if result.response?
258
+ # p result.response
259
+ # else
260
+ # puts "Error!"
261
+ # end
262
+ #
218
263
  def get_operation request, options = nil
219
264
  raise ::ArgumentError, "request must be provided" if request.nil?
220
265
 
@@ -232,9 +277,11 @@ module Google
232
277
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
233
278
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
234
279
 
235
- header_params = {
236
- "name" => request.name
237
- }
280
+ header_params = {}
281
+ if request.name
282
+ header_params["name"] = request.name
283
+ end
284
+
238
285
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
239
286
  metadata[:"x-goog-request-params"] ||= request_params_header
240
287
 
@@ -287,6 +334,21 @@ module Google
287
334
  #
288
335
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
336
  #
337
+ # @example Basic example
338
+ # require "google/longrunning"
339
+ #
340
+ # # Create a client object. The client can be reused for multiple calls.
341
+ # client = Google::Longrunning::Operations::Client.new
342
+ #
343
+ # # Create a request. To set request fields, pass in keyword arguments.
344
+ # request = Google::Longrunning::DeleteOperationRequest.new
345
+ #
346
+ # # Call the delete_operation method.
347
+ # result = client.delete_operation request
348
+ #
349
+ # # The returned object is of type Google::Protobuf::Empty.
350
+ # p result
351
+ #
290
352
  def delete_operation request, options = nil
291
353
  raise ::ArgumentError, "request must be provided" if request.nil?
292
354
 
@@ -304,9 +366,11 @@ module Google
304
366
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
305
367
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
368
 
307
- header_params = {
308
- "name" => request.name
309
- }
369
+ header_params = {}
370
+ if request.name
371
+ header_params["name"] = request.name
372
+ end
373
+
310
374
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
375
  metadata[:"x-goog-request-params"] ||= request_params_header
312
376
 
@@ -364,6 +428,21 @@ module Google
364
428
  #
365
429
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
366
430
  #
431
+ # @example Basic example
432
+ # require "google/longrunning"
433
+ #
434
+ # # Create a client object. The client can be reused for multiple calls.
435
+ # client = Google::Longrunning::Operations::Client.new
436
+ #
437
+ # # Create a request. To set request fields, pass in keyword arguments.
438
+ # request = Google::Longrunning::CancelOperationRequest.new
439
+ #
440
+ # # Call the cancel_operation method.
441
+ # result = client.cancel_operation request
442
+ #
443
+ # # The returned object is of type Google::Protobuf::Empty.
444
+ # p result
445
+ #
367
446
  def cancel_operation request, options = nil
368
447
  raise ::ArgumentError, "request must be provided" if request.nil?
369
448
 
@@ -381,9 +460,11 @@ module Google
381
460
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
382
461
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
462
 
384
- header_params = {
385
- "name" => request.name
386
- }
463
+ header_params = {}
464
+ if request.name
465
+ header_params["name"] = request.name
466
+ end
467
+
387
468
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
388
469
  metadata[:"x-goog-request-params"] ||= request_params_header
389
470
 
@@ -444,6 +525,28 @@ module Google
444
525
  #
445
526
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
446
527
  #
528
+ # @example Basic example
529
+ # require "google/longrunning"
530
+ #
531
+ # # Create a client object. The client can be reused for multiple calls.
532
+ # client = Google::Longrunning::Operations::Client.new
533
+ #
534
+ # # Create a request. To set request fields, pass in keyword arguments.
535
+ # request = Google::Longrunning::WaitOperationRequest.new
536
+ #
537
+ # # Call the wait_operation method.
538
+ # result = client.wait_operation request
539
+ #
540
+ # # The returned object is of type Gapic::Operation. You can use this
541
+ # # object to check the status of an operation, cancel it, or wait
542
+ # # for results. Here is how to block until completion:
543
+ # result.wait_until_done! timeout: 60
544
+ # if result.response?
545
+ # p result.response
546
+ # else
547
+ # puts "Error!"
548
+ # end
549
+ #
447
550
  def wait_operation request, options = nil
448
551
  raise ::ArgumentError, "request must be provided" if request.nil?
449
552