google-cloud-dialogflow-cx-v3 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/advanced_settings_pb.rb +32 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/agent_pb.rb +122 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/agent_services_pb.rb +82 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +1051 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/agents/credentials.rb +54 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +666 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/agents/paths.rb +151 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +52 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/audio_config_pb.rb +94 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/entity_type_pb.rb +92 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_type_services_pb.rb +67 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +766 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/credentials.rb +54 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types/paths.rb +75 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +51 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/environment_pb.rb +117 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/environment_services_pb.rb +61 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +950 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/environments/credentials.rb +54 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +666 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/environments/paths.rb +98 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +52 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/experiment_pb.rb +177 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/experiment_services_pb.rb +61 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +851 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/experiments/credentials.rb +54 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/experiments/paths.rb +102 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +51 -0
  34. data/lib/google/cloud/dialogflow/cx/v3/flow_pb.rb +145 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/flow_services_pb.rb +88 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +1200 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/flows/credentials.rb +54 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +666 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/flows/paths.rb +184 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +52 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/fulfillment_pb.rb +55 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/intent_pb.rb +97 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/intent_services_pb.rb +67 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +750 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/intents/credentials.rb +54 -0
  46. data/lib/google/cloud/dialogflow/cx/v3/intents/paths.rb +96 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +51 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/page_pb.rb +113 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/page_services_pb.rb +67 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +805 -0
  51. data/lib/google/cloud/dialogflow/cx/v3/pages/credentials.rb +54 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/pages/paths.rb +165 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +51 -0
  54. data/lib/google/cloud/dialogflow/cx/v3/response_message_pb.rb +77 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/security_settings_pb.rb +89 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +696 -0
  57. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/credentials.rb +54 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/paths.rb +157 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +51 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/security_settings_services_pb.rb +56 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/session_entity_type_pb.rb +68 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/session_entity_type_services_pb.rb +55 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +715 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/credentials.rb +54 -0
  65. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/paths.rb +137 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +51 -0
  67. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +209 -0
  68. data/lib/google/cloud/dialogflow/cx/v3/session_services_pb.rb +71 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +654 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/sessions/credentials.rb +54 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb +225 -0
  72. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +53 -0
  73. data/lib/google/cloud/dialogflow/cx/v3/test_case_pb.rb +302 -0
  74. data/lib/google/cloud/dialogflow/cx/v3/test_case_services_pb.rb +73 -0
  75. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +1324 -0
  76. data/lib/google/cloud/dialogflow/cx/v3/test_cases/credentials.rb +54 -0
  77. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +666 -0
  78. data/lib/google/cloud/dialogflow/cx/v3/test_cases/paths.rb +249 -0
  79. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +53 -0
  80. data/lib/google/cloud/dialogflow/cx/v3/transition_route_group_pb.rb +67 -0
  81. data/lib/google/cloud/dialogflow/cx/v3/transition_route_group_services_pb.rb +67 -0
  82. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +766 -0
  83. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/credentials.rb +54 -0
  84. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/paths.rb +144 -0
  85. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +51 -0
  86. data/lib/google/cloud/dialogflow/cx/v3/validation_message_pb.rb +59 -0
  87. data/lib/google/cloud/dialogflow/cx/v3/version.rb +30 -0
  88. data/lib/google/cloud/dialogflow/cx/v3/version_pb.rb +88 -0
  89. data/lib/google/cloud/dialogflow/cx/v3/version_services_pb.rb +57 -0
  90. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +792 -0
  91. data/lib/google/cloud/dialogflow/cx/v3/versions/credentials.rb +54 -0
  92. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +666 -0
  93. data/lib/google/cloud/dialogflow/cx/v3/versions/paths.rb +79 -0
  94. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +52 -0
  95. data/lib/google/cloud/dialogflow/cx/v3/webhook_pb.rb +172 -0
  96. data/lib/google/cloud/dialogflow/cx/v3/webhook_services_pb.rb +55 -0
  97. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +704 -0
  98. data/lib/google/cloud/dialogflow/cx/v3/webhooks/credentials.rb +54 -0
  99. data/lib/google/cloud/dialogflow/cx/v3/webhooks/paths.rb +96 -0
  100. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +51 -0
  101. data/lib/google/cloud/dialogflow/cx/v3.rb +53 -0
  102. data/lib/google-cloud-dialogflow-cx-v3.rb +21 -0
  103. data/proto_docs/README.md +4 -0
  104. data/proto_docs/google/api/field_behavior.rb +71 -0
  105. data/proto_docs/google/api/resource.rb +283 -0
  106. data/proto_docs/google/cloud/dialogflow/cx/v3/advanced_settings.rb +57 -0
  107. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +301 -0
  108. data/proto_docs/google/cloud/dialogflow/cx/v3/audio_config.rb +322 -0
  109. data/proto_docs/google/cloud/dialogflow/cx/v3/entity_type.rb +306 -0
  110. data/proto_docs/google/cloud/dialogflow/cx/v3/environment.rb +279 -0
  111. data/proto_docs/google/cloud/dialogflow/cx/v3/experiment.rb +438 -0
  112. data/proto_docs/google/cloud/dialogflow/cx/v3/flow.rb +438 -0
  113. data/proto_docs/google/cloud/dialogflow/cx/v3/fulfillment.rb +126 -0
  114. data/proto_docs/google/cloud/dialogflow/cx/v3/intent.rb +318 -0
  115. data/proto_docs/google/cloud/dialogflow/cx/v3/page.rb +478 -0
  116. data/proto_docs/google/cloud/dialogflow/cx/v3/response_message.rb +220 -0
  117. data/proto_docs/google/cloud/dialogflow/cx/v3/security_settings.rb +222 -0
  118. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +798 -0
  119. data/proto_docs/google/cloud/dialogflow/cx/v3/session_entity_type.rb +184 -0
  120. data/proto_docs/google/cloud/dialogflow/cx/v3/test_case.rb +757 -0
  121. data/proto_docs/google/cloud/dialogflow/cx/v3/transition_route_group.rb +195 -0
  122. data/proto_docs/google/cloud/dialogflow/cx/v3/validation_message.rb +121 -0
  123. data/proto_docs/google/cloud/dialogflow/cx/v3/version.rb +182 -0
  124. data/proto_docs/google/cloud/dialogflow/cx/v3/webhook.rb +496 -0
  125. data/proto_docs/google/longrunning/operations.rb +164 -0
  126. data/proto_docs/google/protobuf/any.rb +141 -0
  127. data/proto_docs/google/protobuf/duration.rb +98 -0
  128. data/proto_docs/google/protobuf/empty.rb +36 -0
  129. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  130. data/proto_docs/google/protobuf/struct.rb +96 -0
  131. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  132. data/proto_docs/google/rpc/status.rb +46 -0
  133. data/proto_docs/google/type/latlng.rb +38 -0
  134. metadata +326 -0
@@ -0,0 +1,750 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dialogflow/cx/v3/intent_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module CX
26
+ module V3
27
+ module Intents
28
+ ##
29
+ # Client for the Intents service.
30
+ #
31
+ # Service for managing {::Google::Cloud::Dialogflow::CX::V3::Intent Intents}.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :intents_stub
38
+
39
+ ##
40
+ # Configure the Intents Client class.
41
+ #
42
+ # See {::Google::Cloud::Dialogflow::CX::V3::Intents::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all Intents clients
48
+ # ::Google::Cloud::Dialogflow::CX::V3::Intents::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Dialogflow", "CX", "V3"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.timeout = 60.0
69
+ default_config.retry_policy = {
70
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
71
+ }
72
+
73
+ default_config
74
+ end
75
+ yield @configure if block_given?
76
+ @configure
77
+ end
78
+
79
+ ##
80
+ # Configure the Intents Client instance.
81
+ #
82
+ # The configuration is set to the derived mode, meaning that values can be changed,
83
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
84
+ # should be made on {Client.configure}.
85
+ #
86
+ # See {::Google::Cloud::Dialogflow::CX::V3::Intents::Client::Configuration}
87
+ # for a description of the configuration fields.
88
+ #
89
+ # @yield [config] Configure the Client client.
90
+ # @yieldparam config [Client::Configuration]
91
+ #
92
+ # @return [Client::Configuration]
93
+ #
94
+ def configure
95
+ yield @config if block_given?
96
+ @config
97
+ end
98
+
99
+ ##
100
+ # Create a new Intents client object.
101
+ #
102
+ # @example
103
+ #
104
+ # # Create a client using the default configuration
105
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Intents::Client.new
106
+ #
107
+ # # Create a client using a custom configuration
108
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Intents::Client.new do |config|
109
+ # config.timeout = 10.0
110
+ # end
111
+ #
112
+ # @yield [config] Configure the Intents client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ def initialize
116
+ # These require statements are intentionally placed here to initialize
117
+ # the gRPC module only when it's required.
118
+ # See https://github.com/googleapis/toolkit/issues/446
119
+ require "gapic/grpc"
120
+ require "google/cloud/dialogflow/cx/v3/intent_services_pb"
121
+
122
+ # Create the configuration object
123
+ @config = Configuration.new Client.configure
124
+
125
+ # Yield the configuration if needed
126
+ yield @config if block_given?
127
+
128
+ # Create credentials
129
+ credentials = @config.credentials
130
+ # Use self-signed JWT if the endpoint is unchanged from default,
131
+ # but only if the default endpoint does not have a region prefix.
132
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @intents_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::Dialogflow::CX::V3::Intents::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors
148
+ )
149
+ end
150
+
151
+ # Service calls
152
+
153
+ ##
154
+ # Returns the list of all intents in the specified agent.
155
+ #
156
+ # @overload list_intents(request, options = nil)
157
+ # Pass arguments to `list_intents` via a request object, either of type
158
+ # {::Google::Cloud::Dialogflow::CX::V3::ListIntentsRequest} or an equivalent Hash.
159
+ #
160
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListIntentsRequest, ::Hash]
161
+ # A request object representing the call parameters. Required. To specify no
162
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
163
+ # @param options [::Gapic::CallOptions, ::Hash]
164
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
165
+ #
166
+ # @overload list_intents(parent: nil, language_code: nil, intent_view: nil, page_size: nil, page_token: nil)
167
+ # Pass arguments to `list_intents` via keyword arguments. Note that at
168
+ # least one keyword argument is required. To specify no parameters, or to keep all
169
+ # the default parameter values, pass an empty Hash as a request object (see above).
170
+ #
171
+ # @param parent [::String]
172
+ # Required. The agent to list all intents for.
173
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
174
+ # @param language_code [::String]
175
+ # The language to list intents for. The following fields are language
176
+ # dependent:
177
+ #
178
+ # * `Intent.training_phrases.parts.text`
179
+ #
180
+ # If not specified, the agent's default language is used.
181
+ # [Many
182
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
183
+ # are supported.
184
+ # Note: languages must be enabled in the agent before they can be used.
185
+ # @param intent_view [::Google::Cloud::Dialogflow::CX::V3::IntentView]
186
+ # The resource view to apply to the returned intent.
187
+ # @param page_size [::Integer]
188
+ # The maximum number of items to return in a single page. By default 100 and
189
+ # at most 1000.
190
+ # @param page_token [::String]
191
+ # The next_page_token value returned from a previous list request.
192
+ #
193
+ # @yield [response, operation] Access the result along with the RPC operation
194
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Intent>]
195
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
196
+ #
197
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Intent>]
198
+ #
199
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
200
+ #
201
+ def list_intents request, options = nil
202
+ raise ::ArgumentError, "request must be provided" if request.nil?
203
+
204
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListIntentsRequest
205
+
206
+ # Converts hash and nil to an options object
207
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
208
+
209
+ # Customize the options with defaults
210
+ metadata = @config.rpcs.list_intents.metadata.to_h
211
+
212
+ # Set x-goog-api-client and x-goog-user-project headers
213
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
214
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
215
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
216
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
217
+
218
+ header_params = {
219
+ "parent" => request.parent
220
+ }
221
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
222
+ metadata[:"x-goog-request-params"] ||= request_params_header
223
+
224
+ options.apply_defaults timeout: @config.rpcs.list_intents.timeout,
225
+ metadata: metadata,
226
+ retry_policy: @config.rpcs.list_intents.retry_policy
227
+
228
+ options.apply_defaults timeout: @config.timeout,
229
+ metadata: @config.metadata,
230
+ retry_policy: @config.retry_policy
231
+
232
+ @intents_stub.call_rpc :list_intents, request, options: options do |response, operation|
233
+ response = ::Gapic::PagedEnumerable.new @intents_stub, :list_intents, request, response, operation, options
234
+ yield response, operation if block_given?
235
+ return response
236
+ end
237
+ rescue ::GRPC::BadStatus => e
238
+ raise ::Google::Cloud::Error.from_error(e)
239
+ end
240
+
241
+ ##
242
+ # Retrieves the specified intent.
243
+ #
244
+ # @overload get_intent(request, options = nil)
245
+ # Pass arguments to `get_intent` via a request object, either of type
246
+ # {::Google::Cloud::Dialogflow::CX::V3::GetIntentRequest} or an equivalent Hash.
247
+ #
248
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetIntentRequest, ::Hash]
249
+ # A request object representing the call parameters. Required. To specify no
250
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
251
+ # @param options [::Gapic::CallOptions, ::Hash]
252
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
253
+ #
254
+ # @overload get_intent(name: nil, language_code: nil)
255
+ # Pass arguments to `get_intent` via keyword arguments. Note that at
256
+ # least one keyword argument is required. To specify no parameters, or to keep all
257
+ # the default parameter values, pass an empty Hash as a request object (see above).
258
+ #
259
+ # @param name [::String]
260
+ # Required. The name of the intent.
261
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
262
+ # ID>/intents/<Intent ID>`.
263
+ # @param language_code [::String]
264
+ # The language to retrieve the intent for. The following fields are language
265
+ # dependent:
266
+ #
267
+ # * `Intent.training_phrases.parts.text`
268
+ #
269
+ # If not specified, the agent's default language is used.
270
+ # [Many
271
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
272
+ # are supported.
273
+ # Note: languages must be enabled in the agent before they can be used.
274
+ #
275
+ # @yield [response, operation] Access the result along with the RPC operation
276
+ # @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::Intent]
277
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
278
+ #
279
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Intent]
280
+ #
281
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
282
+ #
283
+ def get_intent request, options = nil
284
+ raise ::ArgumentError, "request must be provided" if request.nil?
285
+
286
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetIntentRequest
287
+
288
+ # Converts hash and nil to an options object
289
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
290
+
291
+ # Customize the options with defaults
292
+ metadata = @config.rpcs.get_intent.metadata.to_h
293
+
294
+ # Set x-goog-api-client and x-goog-user-project headers
295
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
296
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
297
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
298
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
299
+
300
+ header_params = {
301
+ "name" => request.name
302
+ }
303
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
304
+ metadata[:"x-goog-request-params"] ||= request_params_header
305
+
306
+ options.apply_defaults timeout: @config.rpcs.get_intent.timeout,
307
+ metadata: metadata,
308
+ retry_policy: @config.rpcs.get_intent.retry_policy
309
+
310
+ options.apply_defaults timeout: @config.timeout,
311
+ metadata: @config.metadata,
312
+ retry_policy: @config.retry_policy
313
+
314
+ @intents_stub.call_rpc :get_intent, request, options: options do |response, operation|
315
+ yield response, operation if block_given?
316
+ return response
317
+ end
318
+ rescue ::GRPC::BadStatus => e
319
+ raise ::Google::Cloud::Error.from_error(e)
320
+ end
321
+
322
+ ##
323
+ # Creates an intent in the specified agent.
324
+ #
325
+ # Note: You should always train a flow prior to sending it queries. See the
326
+ # [training
327
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
328
+ #
329
+ # @overload create_intent(request, options = nil)
330
+ # Pass arguments to `create_intent` via a request object, either of type
331
+ # {::Google::Cloud::Dialogflow::CX::V3::CreateIntentRequest} or an equivalent Hash.
332
+ #
333
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::CreateIntentRequest, ::Hash]
334
+ # A request object representing the call parameters. Required. To specify no
335
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
336
+ # @param options [::Gapic::CallOptions, ::Hash]
337
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
338
+ #
339
+ # @overload create_intent(parent: nil, intent: nil, language_code: nil)
340
+ # Pass arguments to `create_intent` via keyword arguments. Note that at
341
+ # least one keyword argument is required. To specify no parameters, or to keep all
342
+ # the default parameter values, pass an empty Hash as a request object (see above).
343
+ #
344
+ # @param parent [::String]
345
+ # Required. The agent to create an intent for.
346
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
347
+ # @param intent [::Google::Cloud::Dialogflow::CX::V3::Intent, ::Hash]
348
+ # Required. The intent to create.
349
+ # @param language_code [::String]
350
+ # The language of the following fields in `intent`:
351
+ #
352
+ # * `Intent.training_phrases.parts.text`
353
+ #
354
+ # If not specified, the agent's default language is used.
355
+ # [Many
356
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
357
+ # are supported.
358
+ # Note: languages must be enabled in the agent before they can be used.
359
+ #
360
+ # @yield [response, operation] Access the result along with the RPC operation
361
+ # @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::Intent]
362
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
363
+ #
364
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Intent]
365
+ #
366
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
367
+ #
368
+ def create_intent request, options = nil
369
+ raise ::ArgumentError, "request must be provided" if request.nil?
370
+
371
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreateIntentRequest
372
+
373
+ # Converts hash and nil to an options object
374
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
375
+
376
+ # Customize the options with defaults
377
+ metadata = @config.rpcs.create_intent.metadata.to_h
378
+
379
+ # Set x-goog-api-client and x-goog-user-project headers
380
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
381
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
382
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
383
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
384
+
385
+ header_params = {
386
+ "parent" => request.parent
387
+ }
388
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
389
+ metadata[:"x-goog-request-params"] ||= request_params_header
390
+
391
+ options.apply_defaults timeout: @config.rpcs.create_intent.timeout,
392
+ metadata: metadata,
393
+ retry_policy: @config.rpcs.create_intent.retry_policy
394
+
395
+ options.apply_defaults timeout: @config.timeout,
396
+ metadata: @config.metadata,
397
+ retry_policy: @config.retry_policy
398
+
399
+ @intents_stub.call_rpc :create_intent, request, options: options do |response, operation|
400
+ yield response, operation if block_given?
401
+ return response
402
+ end
403
+ rescue ::GRPC::BadStatus => e
404
+ raise ::Google::Cloud::Error.from_error(e)
405
+ end
406
+
407
+ ##
408
+ # Updates the specified intent.
409
+ #
410
+ # Note: You should always train a flow prior to sending it queries. See the
411
+ # [training
412
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
413
+ #
414
+ # @overload update_intent(request, options = nil)
415
+ # Pass arguments to `update_intent` via a request object, either of type
416
+ # {::Google::Cloud::Dialogflow::CX::V3::UpdateIntentRequest} or an equivalent Hash.
417
+ #
418
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::UpdateIntentRequest, ::Hash]
419
+ # A request object representing the call parameters. Required. To specify no
420
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
421
+ # @param options [::Gapic::CallOptions, ::Hash]
422
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
423
+ #
424
+ # @overload update_intent(intent: nil, language_code: nil, update_mask: nil)
425
+ # Pass arguments to `update_intent` via keyword arguments. Note that at
426
+ # least one keyword argument is required. To specify no parameters, or to keep all
427
+ # the default parameter values, pass an empty Hash as a request object (see above).
428
+ #
429
+ # @param intent [::Google::Cloud::Dialogflow::CX::V3::Intent, ::Hash]
430
+ # Required. The intent to update.
431
+ # @param language_code [::String]
432
+ # The language of the following fields in `intent`:
433
+ #
434
+ # * `Intent.training_phrases.parts.text`
435
+ #
436
+ # If not specified, the agent's default language is used.
437
+ # [Many
438
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
439
+ # are supported.
440
+ # Note: languages must be enabled in the agent before they can be used.
441
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
442
+ # The mask to control which fields get updated. If the mask is not present,
443
+ # all fields will be updated.
444
+ #
445
+ # @yield [response, operation] Access the result along with the RPC operation
446
+ # @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::Intent]
447
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
448
+ #
449
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Intent]
450
+ #
451
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
452
+ #
453
+ def update_intent request, options = nil
454
+ raise ::ArgumentError, "request must be provided" if request.nil?
455
+
456
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdateIntentRequest
457
+
458
+ # Converts hash and nil to an options object
459
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
460
+
461
+ # Customize the options with defaults
462
+ metadata = @config.rpcs.update_intent.metadata.to_h
463
+
464
+ # Set x-goog-api-client and x-goog-user-project headers
465
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
466
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
467
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
468
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
469
+
470
+ header_params = {
471
+ "intent.name" => request.intent.name
472
+ }
473
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
474
+ metadata[:"x-goog-request-params"] ||= request_params_header
475
+
476
+ options.apply_defaults timeout: @config.rpcs.update_intent.timeout,
477
+ metadata: metadata,
478
+ retry_policy: @config.rpcs.update_intent.retry_policy
479
+
480
+ options.apply_defaults timeout: @config.timeout,
481
+ metadata: @config.metadata,
482
+ retry_policy: @config.retry_policy
483
+
484
+ @intents_stub.call_rpc :update_intent, request, options: options do |response, operation|
485
+ yield response, operation if block_given?
486
+ return response
487
+ end
488
+ rescue ::GRPC::BadStatus => e
489
+ raise ::Google::Cloud::Error.from_error(e)
490
+ end
491
+
492
+ ##
493
+ # Deletes the specified intent.
494
+ #
495
+ # Note: You should always train a flow prior to sending it queries. See the
496
+ # [training
497
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
498
+ #
499
+ # @overload delete_intent(request, options = nil)
500
+ # Pass arguments to `delete_intent` via a request object, either of type
501
+ # {::Google::Cloud::Dialogflow::CX::V3::DeleteIntentRequest} or an equivalent Hash.
502
+ #
503
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DeleteIntentRequest, ::Hash]
504
+ # A request object representing the call parameters. Required. To specify no
505
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
506
+ # @param options [::Gapic::CallOptions, ::Hash]
507
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
508
+ #
509
+ # @overload delete_intent(name: nil)
510
+ # Pass arguments to `delete_intent` via keyword arguments. Note that at
511
+ # least one keyword argument is required. To specify no parameters, or to keep all
512
+ # the default parameter values, pass an empty Hash as a request object (see above).
513
+ #
514
+ # @param name [::String]
515
+ # Required. The name of the intent to delete.
516
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
517
+ # ID>/intents/<Intent ID>`.
518
+ #
519
+ # @yield [response, operation] Access the result along with the RPC operation
520
+ # @yieldparam response [::Google::Protobuf::Empty]
521
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
522
+ #
523
+ # @return [::Google::Protobuf::Empty]
524
+ #
525
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
526
+ #
527
+ def delete_intent request, options = nil
528
+ raise ::ArgumentError, "request must be provided" if request.nil?
529
+
530
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DeleteIntentRequest
531
+
532
+ # Converts hash and nil to an options object
533
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
534
+
535
+ # Customize the options with defaults
536
+ metadata = @config.rpcs.delete_intent.metadata.to_h
537
+
538
+ # Set x-goog-api-client and x-goog-user-project headers
539
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
540
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
541
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
542
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
543
+
544
+ header_params = {
545
+ "name" => request.name
546
+ }
547
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
548
+ metadata[:"x-goog-request-params"] ||= request_params_header
549
+
550
+ options.apply_defaults timeout: @config.rpcs.delete_intent.timeout,
551
+ metadata: metadata,
552
+ retry_policy: @config.rpcs.delete_intent.retry_policy
553
+
554
+ options.apply_defaults timeout: @config.timeout,
555
+ metadata: @config.metadata,
556
+ retry_policy: @config.retry_policy
557
+
558
+ @intents_stub.call_rpc :delete_intent, request, options: options do |response, operation|
559
+ yield response, operation if block_given?
560
+ return response
561
+ end
562
+ rescue ::GRPC::BadStatus => e
563
+ raise ::Google::Cloud::Error.from_error(e)
564
+ end
565
+
566
+ ##
567
+ # Configuration class for the Intents API.
568
+ #
569
+ # This class represents the configuration for Intents,
570
+ # providing control over timeouts, retry behavior, logging, transport
571
+ # parameters, and other low-level controls. Certain parameters can also be
572
+ # applied individually to specific RPCs. See
573
+ # {::Google::Cloud::Dialogflow::CX::V3::Intents::Client::Configuration::Rpcs}
574
+ # for a list of RPCs that can be configured independently.
575
+ #
576
+ # Configuration can be applied globally to all clients, or to a single client
577
+ # on construction.
578
+ #
579
+ # @example
580
+ #
581
+ # # Modify the global config, setting the timeout for
582
+ # # list_intents to 20 seconds,
583
+ # # and all remaining timeouts to 10 seconds.
584
+ # ::Google::Cloud::Dialogflow::CX::V3::Intents::Client.configure do |config|
585
+ # config.timeout = 10.0
586
+ # config.rpcs.list_intents.timeout = 20.0
587
+ # end
588
+ #
589
+ # # Apply the above configuration only to a new client.
590
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Intents::Client.new do |config|
591
+ # config.timeout = 10.0
592
+ # config.rpcs.list_intents.timeout = 20.0
593
+ # end
594
+ #
595
+ # @!attribute [rw] endpoint
596
+ # The hostname or hostname:port of the service endpoint.
597
+ # Defaults to `"dialogflow.googleapis.com"`.
598
+ # @return [::String]
599
+ # @!attribute [rw] credentials
600
+ # Credentials to send with calls. You may provide any of the following types:
601
+ # * (`String`) The path to a service account key file in JSON format
602
+ # * (`Hash`) A service account key as a Hash
603
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
604
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
605
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
606
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
607
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
608
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
609
+ # * (`nil`) indicating no credentials
610
+ # @return [::Object]
611
+ # @!attribute [rw] scope
612
+ # The OAuth scopes
613
+ # @return [::Array<::String>]
614
+ # @!attribute [rw] lib_name
615
+ # The library name as recorded in instrumentation and logging
616
+ # @return [::String]
617
+ # @!attribute [rw] lib_version
618
+ # The library version as recorded in instrumentation and logging
619
+ # @return [::String]
620
+ # @!attribute [rw] channel_args
621
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
622
+ # `GRPC::Core::Channel` object is provided as the credential.
623
+ # @return [::Hash]
624
+ # @!attribute [rw] interceptors
625
+ # An array of interceptors that are run before calls are executed.
626
+ # @return [::Array<::GRPC::ClientInterceptor>]
627
+ # @!attribute [rw] timeout
628
+ # The call timeout in seconds.
629
+ # @return [::Numeric]
630
+ # @!attribute [rw] metadata
631
+ # Additional gRPC headers to be sent with the call.
632
+ # @return [::Hash{::Symbol=>::String}]
633
+ # @!attribute [rw] retry_policy
634
+ # The retry policy. The value is a hash with the following keys:
635
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
636
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
637
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
638
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
639
+ # trigger a retry.
640
+ # @return [::Hash]
641
+ # @!attribute [rw] quota_project
642
+ # A separate project against which to charge quota.
643
+ # @return [::String]
644
+ #
645
+ class Configuration
646
+ extend ::Gapic::Config
647
+
648
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
649
+ config_attr :credentials, nil do |value|
650
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
651
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
652
+ allowed.any? { |klass| klass === value }
653
+ end
654
+ config_attr :scope, nil, ::String, ::Array, nil
655
+ config_attr :lib_name, nil, ::String, nil
656
+ config_attr :lib_version, nil, ::String, nil
657
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
658
+ config_attr :interceptors, nil, ::Array, nil
659
+ config_attr :timeout, nil, ::Numeric, nil
660
+ config_attr :metadata, nil, ::Hash, nil
661
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
662
+ config_attr :quota_project, nil, ::String, nil
663
+
664
+ # @private
665
+ def initialize parent_config = nil
666
+ @parent_config = parent_config unless parent_config.nil?
667
+
668
+ yield self if block_given?
669
+ end
670
+
671
+ ##
672
+ # Configurations for individual RPCs
673
+ # @return [Rpcs]
674
+ #
675
+ def rpcs
676
+ @rpcs ||= begin
677
+ parent_rpcs = nil
678
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
679
+ Rpcs.new parent_rpcs
680
+ end
681
+ end
682
+
683
+ ##
684
+ # Configuration RPC class for the Intents API.
685
+ #
686
+ # Includes fields providing the configuration for each RPC in this service.
687
+ # Each configuration object is of type `Gapic::Config::Method` and includes
688
+ # the following configuration fields:
689
+ #
690
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
691
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
692
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
693
+ # include the following keys:
694
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
695
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
696
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
697
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
698
+ # trigger a retry.
699
+ #
700
+ class Rpcs
701
+ ##
702
+ # RPC-specific configuration for `list_intents`
703
+ # @return [::Gapic::Config::Method]
704
+ #
705
+ attr_reader :list_intents
706
+ ##
707
+ # RPC-specific configuration for `get_intent`
708
+ # @return [::Gapic::Config::Method]
709
+ #
710
+ attr_reader :get_intent
711
+ ##
712
+ # RPC-specific configuration for `create_intent`
713
+ # @return [::Gapic::Config::Method]
714
+ #
715
+ attr_reader :create_intent
716
+ ##
717
+ # RPC-specific configuration for `update_intent`
718
+ # @return [::Gapic::Config::Method]
719
+ #
720
+ attr_reader :update_intent
721
+ ##
722
+ # RPC-specific configuration for `delete_intent`
723
+ # @return [::Gapic::Config::Method]
724
+ #
725
+ attr_reader :delete_intent
726
+
727
+ # @private
728
+ def initialize parent_rpcs = nil
729
+ list_intents_config = parent_rpcs.list_intents if parent_rpcs.respond_to? :list_intents
730
+ @list_intents = ::Gapic::Config::Method.new list_intents_config
731
+ get_intent_config = parent_rpcs.get_intent if parent_rpcs.respond_to? :get_intent
732
+ @get_intent = ::Gapic::Config::Method.new get_intent_config
733
+ create_intent_config = parent_rpcs.create_intent if parent_rpcs.respond_to? :create_intent
734
+ @create_intent = ::Gapic::Config::Method.new create_intent_config
735
+ update_intent_config = parent_rpcs.update_intent if parent_rpcs.respond_to? :update_intent
736
+ @update_intent = ::Gapic::Config::Method.new update_intent_config
737
+ delete_intent_config = parent_rpcs.delete_intent if parent_rpcs.respond_to? :delete_intent
738
+ @delete_intent = ::Gapic::Config::Method.new delete_intent_config
739
+
740
+ yield self if block_given?
741
+ end
742
+ end
743
+ end
744
+ end
745
+ end
746
+ end
747
+ end
748
+ end
749
+ end
750
+ end