google-cloud-dialogflow-v2 0.12.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +7 -25
  4. data/README.md +1 -1
  5. data/lib/google/cloud/dialogflow/v2/agents/client.rb +1 -0
  6. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +0 -1
  7. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -2
  8. data/lib/google/cloud/dialogflow/v2/conversation_dataset_pb.rb +92 -0
  9. data/lib/google/cloud/dialogflow/v2/conversation_dataset_services_pb.rb +81 -0
  10. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +849 -0
  11. data/lib/google/cloud/dialogflow/v2/conversation_datasets/credentials.rb +52 -0
  12. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +767 -0
  13. data/lib/google/cloud/dialogflow/v2/conversation_datasets/paths.rb +69 -0
  14. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +53 -0
  15. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +0 -1
  16. data/lib/google/cloud/dialogflow/v2/conversation_model_pb.rb +205 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_model_services_pb.rb +98 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +1257 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_models/credentials.rb +52 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +767 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_models/paths.rb +179 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +50 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +0 -1
  24. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +31 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +27 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +250 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +767 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +31 -9
  29. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +1 -0
  30. data/lib/google/cloud/dialogflow/v2/document_pb.rb +51 -0
  31. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +21 -0
  32. data/lib/google/cloud/dialogflow/v2/documents/client.rb +272 -2
  33. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +1 -0
  34. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +8 -1
  35. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +0 -1
  36. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -2
  37. data/lib/google/cloud/dialogflow/v2/intents/client.rb +1 -0
  38. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +1 -0
  39. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +28 -1
  40. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +22 -2
  41. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +3 -0
  42. data/lib/google/cloud/dialogflow/v2/participants/client.rb +115 -7
  43. data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -1
  44. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  45. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -1
  46. data/lib/google/cloud/dialogflow/v2.rb +4 -0
  47. data/proto_docs/google/api/resource.rb +10 -71
  48. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +4 -1
  49. data/proto_docs/google/cloud/dialogflow/v2/conversation_dataset.rb +211 -0
  50. data/proto_docs/google/cloud/dialogflow/v2/conversation_model.rb +522 -0
  51. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +100 -2
  52. data/proto_docs/google/cloud/dialogflow/v2/document.rb +157 -0
  53. data/proto_docs/google/cloud/dialogflow/v2/gcs.rb +50 -0
  54. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +28 -0
  55. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +123 -65
  56. metadata +21 -3
@@ -82,20 +82,42 @@ module Google
82
82
  ##
83
83
  # Create a fully-qualified ConversationModel resource string.
84
84
  #
85
- # The resource will be in the following format:
85
+ # @overload conversation_model_path(project:, conversation_model:)
86
+ # The resource will be in the following format:
86
87
  #
87
- # `projects/{project}/locations/{location}/conversationModels/{conversation_model}`
88
+ # `projects/{project}/conversationModels/{conversation_model}`
88
89
  #
89
- # @param project [String]
90
- # @param location [String]
91
- # @param conversation_model [String]
90
+ # @param project [String]
91
+ # @param conversation_model [String]
92
+ #
93
+ # @overload conversation_model_path(project:, location:, conversation_model:)
94
+ # The resource will be in the following format:
95
+ #
96
+ # `projects/{project}/locations/{location}/conversationModels/{conversation_model}`
97
+ #
98
+ # @param project [String]
99
+ # @param location [String]
100
+ # @param conversation_model [String]
92
101
  #
93
102
  # @return [::String]
94
- def conversation_model_path project:, location:, conversation_model:
95
- raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
96
- raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
103
+ def conversation_model_path **args
104
+ resources = {
105
+ "conversation_model:project" => (proc do |project:, conversation_model:|
106
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
107
+
108
+ "projects/#{project}/conversationModels/#{conversation_model}"
109
+ end),
110
+ "conversation_model:location:project" => (proc do |project:, location:, conversation_model:|
111
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
112
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
97
113
 
98
- "projects/#{project}/locations/#{location}/conversationModels/#{conversation_model}"
114
+ "projects/#{project}/locations/#{location}/conversationModels/#{conversation_model}"
115
+ end)
116
+ }
117
+
118
+ resource = resources[args.keys.sort.join(":")]
119
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
120
+ resource.call(**args)
99
121
  end
100
122
 
101
123
  ##
@@ -24,6 +24,7 @@ require "google/cloud/dialogflow/v2/version"
24
24
 
25
25
  require "google/cloud/dialogflow/v2/conversation_profiles/credentials"
26
26
  require "google/cloud/dialogflow/v2/conversation_profiles/paths"
27
+ require "google/cloud/dialogflow/v2/conversation_profiles/operations"
27
28
  require "google/cloud/dialogflow/v2/conversation_profiles/client"
28
29
 
29
30
  module Google
@@ -5,6 +5,7 @@ require 'google/api/annotations_pb'
5
5
  require 'google/api/client_pb'
6
6
  require 'google/api/field_behavior_pb'
7
7
  require 'google/api/resource_pb'
8
+ require 'google/cloud/dialogflow/v2/gcs_pb'
8
9
  require 'google/longrunning/operations_pb'
9
10
  require 'google/protobuf/field_mask_pb'
10
11
  require 'google/protobuf/timestamp_pb'
@@ -21,6 +22,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
21
22
  optional :enable_auto_reload, :bool, 11
22
23
  optional :latest_reload_status, :message, 12, "google.cloud.dialogflow.v2.Document.ReloadStatus"
23
24
  map :metadata, :string, :string, 7
25
+ optional :state, :enum, 13, "google.cloud.dialogflow.v2.Document.State"
24
26
  oneof :source do
25
27
  optional :content_uri, :string, 5
26
28
  optional :raw_content, :bytes, 9
@@ -35,6 +37,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
35
37
  value :FAQ, 1
36
38
  value :EXTRACTIVE_QA, 2
37
39
  value :ARTICLE_SUGGESTION, 3
40
+ value :AGENT_FACING_SMART_REPLY, 4
41
+ end
42
+ add_enum "google.cloud.dialogflow.v2.Document.State" do
43
+ value :STATE_UNSPECIFIED, 0
44
+ value :CREATING, 1
45
+ value :ACTIVE, 2
46
+ value :UPDATING, 3
47
+ value :RELOADING, 4
48
+ value :DELETING, 5
38
49
  end
39
50
  add_message "google.cloud.dialogflow.v2.GetDocumentRequest" do
40
51
  optional :name, :string, 1
@@ -43,6 +54,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
43
54
  optional :parent, :string, 1
44
55
  optional :page_size, :int32, 2
45
56
  optional :page_token, :string, 3
57
+ optional :filter, :string, 4
46
58
  end
47
59
  add_message "google.cloud.dialogflow.v2.ListDocumentsResponse" do
48
60
  repeated :documents, :message, 1, "google.cloud.dialogflow.v2.Document"
@@ -52,6 +64,22 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
52
64
  optional :parent, :string, 1
53
65
  optional :document, :message, 2, "google.cloud.dialogflow.v2.Document"
54
66
  end
67
+ add_message "google.cloud.dialogflow.v2.ImportDocumentsRequest" do
68
+ optional :parent, :string, 1
69
+ optional :document_template, :message, 3, "google.cloud.dialogflow.v2.ImportDocumentTemplate"
70
+ optional :import_gcs_custom_metadata, :bool, 4
71
+ oneof :source do
72
+ optional :gcs_source, :message, 2, "google.cloud.dialogflow.v2.GcsSources"
73
+ end
74
+ end
75
+ add_message "google.cloud.dialogflow.v2.ImportDocumentTemplate" do
76
+ optional :mime_type, :string, 1
77
+ repeated :knowledge_types, :enum, 2, "google.cloud.dialogflow.v2.Document.KnowledgeType"
78
+ map :metadata, :string, :string, 3
79
+ end
80
+ add_message "google.cloud.dialogflow.v2.ImportDocumentsResponse" do
81
+ repeated :warnings, :message, 1, "google.rpc.Status"
82
+ end
55
83
  add_message "google.cloud.dialogflow.v2.DeleteDocumentRequest" do
56
84
  optional :name, :string, 1
57
85
  end
@@ -61,12 +89,29 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
61
89
  end
62
90
  add_message "google.cloud.dialogflow.v2.ReloadDocumentRequest" do
63
91
  optional :name, :string, 1
92
+ optional :import_gcs_custom_metadata, :bool, 4
93
+ optional :smart_messaging_partial_update, :bool, 5
64
94
  oneof :source do
65
95
  optional :content_uri, :string, 3
66
96
  end
67
97
  end
98
+ add_message "google.cloud.dialogflow.v2.ExportDocumentRequest" do
99
+ optional :name, :string, 1
100
+ optional :export_full_content, :bool, 3
101
+ optional :smart_messaging_partial_update, :bool, 5
102
+ oneof :destination do
103
+ optional :gcs_destination, :message, 2, "google.cloud.dialogflow.v2.GcsDestination"
104
+ end
105
+ end
106
+ add_message "google.cloud.dialogflow.v2.ExportOperationMetadata" do
107
+ optional :exported_gcs_destination, :message, 1, "google.cloud.dialogflow.v2.GcsDestination"
108
+ end
68
109
  add_message "google.cloud.dialogflow.v2.KnowledgeOperationMetadata" do
69
110
  optional :state, :enum, 1, "google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State"
111
+ optional :knowledge_base, :string, 3
112
+ oneof :operation_metadata do
113
+ optional :export_operation_metadata, :message, 4, "google.cloud.dialogflow.v2.ExportOperationMetadata"
114
+ end
70
115
  end
71
116
  add_enum "google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State" do
72
117
  value :STATE_UNSPECIFIED, 0
@@ -84,13 +129,19 @@ module Google
84
129
  Document = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document").msgclass
85
130
  Document::ReloadStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document.ReloadStatus").msgclass
86
131
  Document::KnowledgeType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document.KnowledgeType").enummodule
132
+ Document::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document.State").enummodule
87
133
  GetDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetDocumentRequest").msgclass
88
134
  ListDocumentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListDocumentsRequest").msgclass
89
135
  ListDocumentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListDocumentsResponse").msgclass
90
136
  CreateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.CreateDocumentRequest").msgclass
137
+ ImportDocumentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ImportDocumentsRequest").msgclass
138
+ ImportDocumentTemplate = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ImportDocumentTemplate").msgclass
139
+ ImportDocumentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ImportDocumentsResponse").msgclass
91
140
  DeleteDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteDocumentRequest").msgclass
92
141
  UpdateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateDocumentRequest").msgclass
93
142
  ReloadDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ReloadDocumentRequest").msgclass
143
+ ExportDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ExportDocumentRequest").msgclass
144
+ ExportOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ExportOperationMetadata").msgclass
94
145
  KnowledgeOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.KnowledgeOperationMetadata").msgclass
95
146
  KnowledgeOperationMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State").enummodule
96
147
  end
@@ -46,6 +46,17 @@ module Google
46
46
  # - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
47
47
  # - `response`: [Document][google.cloud.dialogflow.v2.Document]
48
48
  rpc :CreateDocument, ::Google::Cloud::Dialogflow::V2::CreateDocumentRequest, ::Google::Longrunning::Operation
49
+ # Creates documents by importing data from external sources.
50
+ # Dialogflow supports up to 350 documents in each request. If you try to
51
+ # import more, Dialogflow will return an error.
52
+ #
53
+ # This method is a [long-running
54
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
55
+ # The returned `Operation` type has the following method-specific fields:
56
+ #
57
+ # - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
58
+ # - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
59
+ rpc :ImportDocuments, ::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest, ::Google::Longrunning::Operation
49
60
  # Deletes the specified document.
50
61
  #
51
62
  # This method is a [long-running
@@ -80,6 +91,16 @@ module Google
80
91
  # Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
81
92
  # only use `projects.knowledgeBases.documents`.
82
93
  rpc :ReloadDocument, ::Google::Cloud::Dialogflow::V2::ReloadDocumentRequest, ::Google::Longrunning::Operation
94
+ # Exports a smart messaging candidate document into the specified
95
+ # destination.
96
+ #
97
+ # This method is a [long-running
98
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
99
+ # The returned `Operation` type has the following method-specific fields:
100
+ #
101
+ # - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
102
+ # - `response`: [Document][google.cloud.dialogflow.v2.Document]
103
+ rpc :ExportDocument, ::Google::Cloud::Dialogflow::V2::ExportDocumentRequest, ::Google::Longrunning::Operation
83
104
  end
84
105
 
85
106
  Stub = Service.rpc_stub_class
@@ -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>]
@@ -451,6 +474,122 @@ module Google
451
474
  raise ::Google::Cloud::Error.from_error(e)
452
475
  end
453
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
+
454
593
  ##
455
594
  # Deletes the specified document.
456
595
  #
@@ -684,7 +823,7 @@ module Google
684
823
  # @param options [::Gapic::CallOptions, ::Hash]
685
824
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
686
825
  #
687
- # @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)
688
827
  # Pass arguments to `reload_document` via keyword arguments. Note that at
689
828
  # least one keyword argument is required. To specify no parameters, or to keep all
690
829
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -699,6 +838,12 @@ module Google
699
838
  #
700
839
  # For documents stored in Google Cloud Storage, these URIs must have
701
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.
702
847
  #
703
848
  # @yield [response, operation] Access the result along with the RPC operation
704
849
  # @yieldparam response [::Gapic::Operation]
@@ -772,6 +917,117 @@ module Google
772
917
  raise ::Google::Cloud::Error.from_error(e)
773
918
  end
774
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
+
775
1031
  ##
776
1032
  # Configuration class for the Documents API.
777
1033
  #
@@ -923,6 +1179,11 @@ module Google
923
1179
  #
924
1180
  attr_reader :create_document
925
1181
  ##
1182
+ # RPC-specific configuration for `import_documents`
1183
+ # @return [::Gapic::Config::Method]
1184
+ #
1185
+ attr_reader :import_documents
1186
+ ##
926
1187
  # RPC-specific configuration for `delete_document`
927
1188
  # @return [::Gapic::Config::Method]
928
1189
  #
@@ -937,6 +1198,11 @@ module Google
937
1198
  # @return [::Gapic::Config::Method]
938
1199
  #
939
1200
  attr_reader :reload_document
1201
+ ##
1202
+ # RPC-specific configuration for `export_document`
1203
+ # @return [::Gapic::Config::Method]
1204
+ #
1205
+ attr_reader :export_document
940
1206
 
941
1207
  # @private
942
1208
  def initialize parent_rpcs = nil
@@ -946,12 +1212,16 @@ module Google
946
1212
  @get_document = ::Gapic::Config::Method.new get_document_config
947
1213
  create_document_config = parent_rpcs.create_document if parent_rpcs.respond_to? :create_document
948
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
949
1217
  delete_document_config = parent_rpcs.delete_document if parent_rpcs.respond_to? :delete_document
950
1218
  @delete_document = ::Gapic::Config::Method.new delete_document_config
951
1219
  update_document_config = parent_rpcs.update_document if parent_rpcs.respond_to? :update_document
952
1220
  @update_document = ::Gapic::Config::Method.new update_document_config
953
1221
  reload_document_config = parent_rpcs.reload_document if parent_rpcs.respond_to? :reload_document
954
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
955
1225
 
956
1226
  yield self if block_given?
957
1227
  end
@@ -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
 
@@ -2,11 +2,16 @@
2
2
  # source: google/cloud/dialogflow/v2/gcs.proto
3
3
 
4
4
  require 'google/api/field_behavior_pb'
5
- require 'google/api/annotations_pb'
6
5
  require 'google/protobuf'
7
6
 
8
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
8
  add_file("google/cloud/dialogflow/v2/gcs.proto", :syntax => :proto3) do
9
+ add_message "google.cloud.dialogflow.v2.GcsSources" do
10
+ repeated :uris, :string, 2
11
+ end
12
+ add_message "google.cloud.dialogflow.v2.GcsDestination" do
13
+ optional :uri, :string, 1
14
+ end
10
15
  end
11
16
  end
12
17
 
@@ -14,6 +19,8 @@ module Google
14
19
  module Cloud
15
20
  module Dialogflow
16
21
  module V2
22
+ GcsSources = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GcsSources").msgclass
23
+ GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GcsDestination").msgclass
17
24
  end
18
25
  end
19
26
  end
@@ -2,7 +2,6 @@
2
2
  # source: google/cloud/dialogflow/v2/human_agent_assistant_event.proto
3
3
 
4
4
  require 'google/cloud/dialogflow/v2/participant_pb'
5
- require 'google/api/annotations_pb'
6
5
  require 'google/protobuf'
7
6
 
8
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
@@ -5,10 +5,8 @@ require 'google/api/annotations_pb'
5
5
  require 'google/api/client_pb'
6
6
  require 'google/api/field_behavior_pb'
7
7
  require 'google/api/resource_pb'
8
- require 'google/cloud/dialogflow/v2/audio_config_pb'
9
8
  require 'google/cloud/dialogflow/v2/context_pb'
10
9
  require 'google/longrunning/operations_pb'
11
- require 'google/protobuf/duration_pb'
12
10
  require 'google/protobuf/empty_pb'
13
11
  require 'google/protobuf/field_mask_pb'
14
12
  require 'google/protobuf/struct_pb'
@@ -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
 
@@ -20,6 +20,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
20
20
  optional :parent, :string, 1
21
21
  optional :page_size, :int32, 2
22
22
  optional :page_token, :string, 3
23
+ optional :filter, :string, 4
23
24
  end
24
25
  add_message "google.cloud.dialogflow.v2.ListKnowledgeBasesResponse" do
25
26
  repeated :knowledge_bases, :message, 1, "google.cloud.dialogflow.v2.KnowledgeBase"