google-cloud-dialogflow-v2 0.11.4 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) 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/audio_config_pb.rb +1 -1
  8. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +126 -18
  9. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +1 -1
  10. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +2 -0
  11. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +9 -0
  12. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +106 -15
  13. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +19 -0
  14. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +112 -15
  15. data/lib/google/cloud/dialogflow/v2/document_pb.rb +33 -0
  16. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +21 -0
  17. data/lib/google/cloud/dialogflow/v2/documents/client.rb +426 -20
  18. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +115 -12
  19. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +242 -30
  20. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +115 -12
  21. data/lib/google/cloud/dialogflow/v2/environments/client.rb +132 -18
  22. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +40 -6
  23. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +9 -1
  24. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +1 -1
  25. data/lib/google/cloud/dialogflow/v2/intents/client.rb +161 -21
  26. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +115 -12
  27. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +1 -0
  28. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +134 -16
  29. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +31 -0
  30. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +3 -0
  31. data/lib/google/cloud/dialogflow/v2/participants/client.rb +268 -28
  32. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +106 -15
  33. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  34. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +44 -3
  35. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  36. data/lib/google/cloud/dialogflow/v2/versions/client.rb +106 -15
  37. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +1 -1
  38. data/lib/google/cloud/dialogflow/v2.rb +1 -1
  39. data/proto_docs/google/api/resource.rb +10 -71
  40. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +4 -1
  41. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +41 -8
  42. data/proto_docs/google/cloud/dialogflow/v2/document.rb +118 -0
  43. data/proto_docs/google/cloud/dialogflow/v2/gcs.rb +50 -0
  44. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +28 -0
  45. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +157 -6
  46. 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
 
@@ -387,6 +474,122 @@ module Google
387
474
  raise ::Google::Cloud::Error.from_error(e)
388
475
  end
389
476
 
477
+ ##
478
+ # Creates documents by importing data from external sources.
479
+ # Dialogflow supports up to 350 documents in each request. If you try to
480
+ # import more, Dialogflow will return an error.
481
+ #
482
+ # This method is a [long-running
483
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
484
+ # The returned `Operation` type has the following method-specific fields:
485
+ #
486
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
487
+ # - `response`: {::Google::Cloud::Dialogflow::V2::ImportDocumentsResponse ImportDocumentsResponse}
488
+ #
489
+ # @overload import_documents(request, options = nil)
490
+ # Pass arguments to `import_documents` via a request object, either of type
491
+ # {::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest} or an equivalent Hash.
492
+ #
493
+ # @param request [::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest, ::Hash]
494
+ # A request object representing the call parameters. Required. To specify no
495
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
496
+ # @param options [::Gapic::CallOptions, ::Hash]
497
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
498
+ #
499
+ # @overload import_documents(parent: nil, gcs_source: nil, document_template: nil, import_gcs_custom_metadata: nil)
500
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
501
+ # least one keyword argument is required. To specify no parameters, or to keep all
502
+ # the default parameter values, pass an empty Hash as a request object (see above).
503
+ #
504
+ # @param parent [::String]
505
+ # Required. The knowledge base to import documents into.
506
+ # Format: `projects/<Project ID>/locations/<Location
507
+ # ID>/knowledgeBases/<Knowledge Base ID>`.
508
+ # @param gcs_source [::Google::Cloud::Dialogflow::V2::GcsSources, ::Hash]
509
+ # The Google Cloud Storage location for the documents.
510
+ # The path can include a wildcard.
511
+ #
512
+ # These URIs may have the forms
513
+ # `gs://<bucket-name>/<object-name>`.
514
+ # `gs://<bucket-name>/<object-path>/*.<extension>`.
515
+ # @param document_template [::Google::Cloud::Dialogflow::V2::ImportDocumentTemplate, ::Hash]
516
+ # Required. Document template used for importing all the documents.
517
+ # @param import_gcs_custom_metadata [::Boolean]
518
+ # Whether to import custom metadata from Google Cloud Storage.
519
+ # Only valid when the document source is Google Cloud Storage URI.
520
+ #
521
+ # @yield [response, operation] Access the result along with the RPC operation
522
+ # @yieldparam response [::Gapic::Operation]
523
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
524
+ #
525
+ # @return [::Gapic::Operation]
526
+ #
527
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
528
+ #
529
+ # @example Basic example
530
+ # require "google/cloud/dialogflow/v2"
531
+ #
532
+ # # Create a client object. The client can be reused for multiple calls.
533
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
534
+ #
535
+ # # Create a request. To set request fields, pass in keyword arguments.
536
+ # request = Google::Cloud::Dialogflow::V2::ImportDocumentsRequest.new
537
+ #
538
+ # # Call the import_documents method.
539
+ # result = client.import_documents request
540
+ #
541
+ # # The returned object is of type Gapic::Operation. You can use this
542
+ # # object to check the status of an operation, cancel it, or wait
543
+ # # for results. Here is how to block until completion:
544
+ # result.wait_until_done! timeout: 60
545
+ # if result.response?
546
+ # p result.response
547
+ # else
548
+ # puts "Error!"
549
+ # end
550
+ #
551
+ def import_documents request, options = nil
552
+ raise ::ArgumentError, "request must be provided" if request.nil?
553
+
554
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest
555
+
556
+ # Converts hash and nil to an options object
557
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
558
+
559
+ # Customize the options with defaults
560
+ metadata = @config.rpcs.import_documents.metadata.to_h
561
+
562
+ # Set x-goog-api-client and x-goog-user-project headers
563
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
564
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
565
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
566
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
567
+
568
+ header_params = {}
569
+ if request.parent
570
+ header_params["parent"] = request.parent
571
+ end
572
+
573
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
574
+ metadata[:"x-goog-request-params"] ||= request_params_header
575
+
576
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
577
+ metadata: metadata,
578
+ retry_policy: @config.rpcs.import_documents.retry_policy
579
+
580
+ options.apply_defaults timeout: @config.timeout,
581
+ metadata: @config.metadata,
582
+ retry_policy: @config.retry_policy
583
+
584
+ @documents_stub.call_rpc :import_documents, request, options: options do |response, operation|
585
+ response = ::Gapic::Operation.new response, @operations_client, options: options
586
+ yield response, operation if block_given?
587
+ return response
588
+ end
589
+ rescue ::GRPC::BadStatus => e
590
+ raise ::Google::Cloud::Error.from_error(e)
591
+ end
592
+
390
593
  ##
391
594
  # Deletes the specified document.
392
595
  #
@@ -426,6 +629,28 @@ module Google
426
629
  #
427
630
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
428
631
  #
632
+ # @example Basic example
633
+ # require "google/cloud/dialogflow/v2"
634
+ #
635
+ # # Create a client object. The client can be reused for multiple calls.
636
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
637
+ #
638
+ # # Create a request. To set request fields, pass in keyword arguments.
639
+ # request = Google::Cloud::Dialogflow::V2::DeleteDocumentRequest.new
640
+ #
641
+ # # Call the delete_document method.
642
+ # result = client.delete_document request
643
+ #
644
+ # # The returned object is of type Gapic::Operation. You can use this
645
+ # # object to check the status of an operation, cancel it, or wait
646
+ # # for results. Here is how to block until completion:
647
+ # result.wait_until_done! timeout: 60
648
+ # if result.response?
649
+ # p result.response
650
+ # else
651
+ # puts "Error!"
652
+ # end
653
+ #
429
654
  def delete_document request, options = nil
430
655
  raise ::ArgumentError, "request must be provided" if request.nil?
431
656
 
@@ -443,9 +668,11 @@ module Google
443
668
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
444
669
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
445
670
 
446
- header_params = {
447
- "name" => request.name
448
- }
671
+ header_params = {}
672
+ if request.name
673
+ header_params["name"] = request.name
674
+ end
675
+
449
676
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
450
677
  metadata[:"x-goog-request-params"] ||= request_params_header
451
678
 
@@ -506,6 +733,28 @@ module Google
506
733
  #
507
734
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
508
735
  #
736
+ # @example Basic example
737
+ # require "google/cloud/dialogflow/v2"
738
+ #
739
+ # # Create a client object. The client can be reused for multiple calls.
740
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
741
+ #
742
+ # # Create a request. To set request fields, pass in keyword arguments.
743
+ # request = Google::Cloud::Dialogflow::V2::UpdateDocumentRequest.new
744
+ #
745
+ # # Call the update_document method.
746
+ # result = client.update_document request
747
+ #
748
+ # # The returned object is of type Gapic::Operation. You can use this
749
+ # # object to check the status of an operation, cancel it, or wait
750
+ # # for results. Here is how to block until completion:
751
+ # result.wait_until_done! timeout: 60
752
+ # if result.response?
753
+ # p result.response
754
+ # else
755
+ # puts "Error!"
756
+ # end
757
+ #
509
758
  def update_document request, options = nil
510
759
  raise ::ArgumentError, "request must be provided" if request.nil?
511
760
 
@@ -523,9 +772,11 @@ module Google
523
772
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
524
773
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
525
774
 
526
- header_params = {
527
- "document.name" => request.document.name
528
- }
775
+ header_params = {}
776
+ if request.document&.name
777
+ header_params["document.name"] = request.document.name
778
+ end
779
+
529
780
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
530
781
  metadata[:"x-goog-request-params"] ||= request_params_header
531
782
 
@@ -572,7 +823,7 @@ module Google
572
823
  # @param options [::Gapic::CallOptions, ::Hash]
573
824
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
574
825
  #
575
- # @overload reload_document(name: nil, content_uri: nil)
826
+ # @overload reload_document(name: nil, content_uri: nil, import_gcs_custom_metadata: nil, smart_messaging_partial_update: nil)
576
827
  # Pass arguments to `reload_document` via keyword arguments. Note that at
577
828
  # least one keyword argument is required. To specify no parameters, or to keep all
578
829
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -587,6 +838,12 @@ module Google
587
838
  #
588
839
  # For documents stored in Google Cloud Storage, these URIs must have
589
840
  # the form `gs://<bucket-name>/<object-name>`.
841
+ # @param import_gcs_custom_metadata [::Boolean]
842
+ # Optional. Whether to import custom metadata from Google Cloud Storage.
843
+ # Only valid when the document source is Google Cloud Storage URI.
844
+ # @param smart_messaging_partial_update [::Boolean]
845
+ # Optional. When enabled, the reload request is to apply partial update to the smart
846
+ # messaging allowlist.
590
847
  #
591
848
  # @yield [response, operation] Access the result along with the RPC operation
592
849
  # @yieldparam response [::Gapic::Operation]
@@ -596,6 +853,28 @@ module Google
596
853
  #
597
854
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
598
855
  #
856
+ # @example Basic example
857
+ # require "google/cloud/dialogflow/v2"
858
+ #
859
+ # # Create a client object. The client can be reused for multiple calls.
860
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
861
+ #
862
+ # # Create a request. To set request fields, pass in keyword arguments.
863
+ # request = Google::Cloud::Dialogflow::V2::ReloadDocumentRequest.new
864
+ #
865
+ # # Call the reload_document method.
866
+ # result = client.reload_document request
867
+ #
868
+ # # The returned object is of type Gapic::Operation. You can use this
869
+ # # object to check the status of an operation, cancel it, or wait
870
+ # # for results. Here is how to block until completion:
871
+ # result.wait_until_done! timeout: 60
872
+ # if result.response?
873
+ # p result.response
874
+ # else
875
+ # puts "Error!"
876
+ # end
877
+ #
599
878
  def reload_document request, options = nil
600
879
  raise ::ArgumentError, "request must be provided" if request.nil?
601
880
 
@@ -613,9 +892,11 @@ module Google
613
892
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
614
893
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
894
 
616
- header_params = {
617
- "name" => request.name
618
- }
895
+ header_params = {}
896
+ if request.name
897
+ header_params["name"] = request.name
898
+ end
899
+
619
900
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
620
901
  metadata[:"x-goog-request-params"] ||= request_params_header
621
902
 
@@ -636,6 +917,117 @@ module Google
636
917
  raise ::Google::Cloud::Error.from_error(e)
637
918
  end
638
919
 
920
+ ##
921
+ # Exports a smart messaging candidate document into the specified
922
+ # destination.
923
+ #
924
+ # This method is a [long-running
925
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
926
+ # The returned `Operation` type has the following method-specific fields:
927
+ #
928
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
929
+ # - `response`: {::Google::Cloud::Dialogflow::V2::Document Document}
930
+ #
931
+ # @overload export_document(request, options = nil)
932
+ # Pass arguments to `export_document` via a request object, either of type
933
+ # {::Google::Cloud::Dialogflow::V2::ExportDocumentRequest} or an equivalent Hash.
934
+ #
935
+ # @param request [::Google::Cloud::Dialogflow::V2::ExportDocumentRequest, ::Hash]
936
+ # A request object representing the call parameters. Required. To specify no
937
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
938
+ # @param options [::Gapic::CallOptions, ::Hash]
939
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
940
+ #
941
+ # @overload export_document(name: nil, gcs_destination: nil, export_full_content: nil, smart_messaging_partial_update: nil)
942
+ # Pass arguments to `export_document` via keyword arguments. Note that at
943
+ # least one keyword argument is required. To specify no parameters, or to keep all
944
+ # the default parameter values, pass an empty Hash as a request object (see above).
945
+ #
946
+ # @param name [::String]
947
+ # Required. The name of the document to export.
948
+ # Format: `projects/<Project ID>/locations/<Location
949
+ # ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
950
+ # @param gcs_destination [::Google::Cloud::Dialogflow::V2::GcsDestination, ::Hash]
951
+ # Cloud Storage file path to export the document.
952
+ # @param export_full_content [::Boolean]
953
+ # When enabled, export the full content of the document including empirical
954
+ # probability.
955
+ # @param smart_messaging_partial_update [::Boolean]
956
+ # When enabled, export the smart messaging allowlist document for partial
957
+ # update.
958
+ #
959
+ # @yield [response, operation] Access the result along with the RPC operation
960
+ # @yieldparam response [::Gapic::Operation]
961
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
962
+ #
963
+ # @return [::Gapic::Operation]
964
+ #
965
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
966
+ #
967
+ # @example Basic example
968
+ # require "google/cloud/dialogflow/v2"
969
+ #
970
+ # # Create a client object. The client can be reused for multiple calls.
971
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
972
+ #
973
+ # # Create a request. To set request fields, pass in keyword arguments.
974
+ # request = Google::Cloud::Dialogflow::V2::ExportDocumentRequest.new
975
+ #
976
+ # # Call the export_document method.
977
+ # result = client.export_document request
978
+ #
979
+ # # The returned object is of type Gapic::Operation. You can use this
980
+ # # object to check the status of an operation, cancel it, or wait
981
+ # # for results. Here is how to block until completion:
982
+ # result.wait_until_done! timeout: 60
983
+ # if result.response?
984
+ # p result.response
985
+ # else
986
+ # puts "Error!"
987
+ # end
988
+ #
989
+ def export_document request, options = nil
990
+ raise ::ArgumentError, "request must be provided" if request.nil?
991
+
992
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ExportDocumentRequest
993
+
994
+ # Converts hash and nil to an options object
995
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
996
+
997
+ # Customize the options with defaults
998
+ metadata = @config.rpcs.export_document.metadata.to_h
999
+
1000
+ # Set x-goog-api-client and x-goog-user-project headers
1001
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1002
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1003
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
1004
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1005
+
1006
+ header_params = {}
1007
+ if request.name
1008
+ header_params["name"] = request.name
1009
+ end
1010
+
1011
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1012
+ metadata[:"x-goog-request-params"] ||= request_params_header
1013
+
1014
+ options.apply_defaults timeout: @config.rpcs.export_document.timeout,
1015
+ metadata: metadata,
1016
+ retry_policy: @config.rpcs.export_document.retry_policy
1017
+
1018
+ options.apply_defaults timeout: @config.timeout,
1019
+ metadata: @config.metadata,
1020
+ retry_policy: @config.retry_policy
1021
+
1022
+ @documents_stub.call_rpc :export_document, request, options: options do |response, operation|
1023
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1024
+ yield response, operation if block_given?
1025
+ return response
1026
+ end
1027
+ rescue ::GRPC::BadStatus => e
1028
+ raise ::Google::Cloud::Error.from_error(e)
1029
+ end
1030
+
639
1031
  ##
640
1032
  # Configuration class for the Documents API.
641
1033
  #
@@ -787,6 +1179,11 @@ module Google
787
1179
  #
788
1180
  attr_reader :create_document
789
1181
  ##
1182
+ # RPC-specific configuration for `import_documents`
1183
+ # @return [::Gapic::Config::Method]
1184
+ #
1185
+ attr_reader :import_documents
1186
+ ##
790
1187
  # RPC-specific configuration for `delete_document`
791
1188
  # @return [::Gapic::Config::Method]
792
1189
  #
@@ -801,6 +1198,11 @@ module Google
801
1198
  # @return [::Gapic::Config::Method]
802
1199
  #
803
1200
  attr_reader :reload_document
1201
+ ##
1202
+ # RPC-specific configuration for `export_document`
1203
+ # @return [::Gapic::Config::Method]
1204
+ #
1205
+ attr_reader :export_document
804
1206
 
805
1207
  # @private
806
1208
  def initialize parent_rpcs = nil
@@ -810,12 +1212,16 @@ module Google
810
1212
  @get_document = ::Gapic::Config::Method.new get_document_config
811
1213
  create_document_config = parent_rpcs.create_document if parent_rpcs.respond_to? :create_document
812
1214
  @create_document = ::Gapic::Config::Method.new create_document_config
1215
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
1216
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
813
1217
  delete_document_config = parent_rpcs.delete_document if parent_rpcs.respond_to? :delete_document
814
1218
  @delete_document = ::Gapic::Config::Method.new delete_document_config
815
1219
  update_document_config = parent_rpcs.update_document if parent_rpcs.respond_to? :update_document
816
1220
  @update_document = ::Gapic::Config::Method.new update_document_config
817
1221
  reload_document_config = parent_rpcs.reload_document if parent_rpcs.respond_to? :reload_document
818
1222
  @reload_document = ::Gapic::Config::Method.new reload_document_config
1223
+ export_document_config = parent_rpcs.export_document if parent_rpcs.respond_to? :export_document
1224
+ @export_document = ::Gapic::Config::Method.new export_document_config
819
1225
 
820
1226
  yield self if block_given?
821
1227
  end