google-cloud-dialogflow-v2 0.7.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +8 -8
  3. data/README.md +1 -1
  4. data/lib/google/cloud/dialogflow/v2.rb +2 -0
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +16 -5
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +18 -10
  7. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +4 -4
  8. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
  9. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +1 -2
  10. data/lib/google/cloud/dialogflow/v2/answer_records.rb +1 -2
  11. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +3 -7
  12. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +2 -5
  13. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +72 -0
  14. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +2 -5
  15. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +44 -3
  16. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +2 -5
  17. data/lib/google/cloud/dialogflow/v2/documents/client.rb +2 -5
  18. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +4 -4
  19. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +28 -7
  20. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +30 -12
  21. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +4 -4
  22. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
  23. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
  24. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +21 -0
  25. data/lib/google/cloud/dialogflow/v2/environments/client.rb +413 -6
  26. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +145 -5
  27. data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
  28. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
  29. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
  30. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +457 -0
  31. data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
  32. data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
  33. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +20 -2
  34. data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
  35. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +4 -4
  36. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +96 -12
  37. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +2 -5
  38. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +9 -0
  39. data/lib/google/cloud/dialogflow/v2/participants/client.rb +3 -9
  40. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +76 -0
  41. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +2 -5
  42. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +72 -0
  43. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  44. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +3 -9
  45. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +110 -0
  46. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  47. data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
  48. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
  49. data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
  50. data/lib/google/cloud/dialogflow/v2/versions/client.rb +706 -0
  51. data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
  52. data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
  53. data/proto_docs/google/api/field_behavior.rb +7 -1
  54. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +9 -16
  55. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +14 -2
  56. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +170 -5
  57. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
  58. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +9 -1
  59. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +22 -0
  60. data/proto_docs/google/cloud/dialogflow/v2/session.rb +4 -0
  61. data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
  62. metadata +27 -7
@@ -0,0 +1,69 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dialogflow/v2/version.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/api/client_pb'
8
+ require 'google/api/field_behavior_pb'
9
+ require 'google/api/resource_pb'
10
+ require 'google/protobuf/empty_pb'
11
+ require 'google/protobuf/field_mask_pb'
12
+ require 'google/protobuf/timestamp_pb'
13
+ Google::Protobuf::DescriptorPool.generated_pool.build do
14
+ add_file("google/cloud/dialogflow/v2/version.proto", :syntax => :proto3) do
15
+ add_message "google.cloud.dialogflow.v2.Version" do
16
+ optional :name, :string, 1
17
+ optional :description, :string, 2
18
+ optional :version_number, :int32, 3
19
+ optional :create_time, :message, 4, "google.protobuf.Timestamp"
20
+ optional :status, :enum, 6, "google.cloud.dialogflow.v2.Version.VersionStatus"
21
+ end
22
+ add_enum "google.cloud.dialogflow.v2.Version.VersionStatus" do
23
+ value :VERSION_STATUS_UNSPECIFIED, 0
24
+ value :IN_PROGRESS, 1
25
+ value :READY, 2
26
+ value :FAILED, 3
27
+ end
28
+ add_message "google.cloud.dialogflow.v2.ListVersionsRequest" do
29
+ optional :parent, :string, 1
30
+ optional :page_size, :int32, 2
31
+ optional :page_token, :string, 3
32
+ end
33
+ add_message "google.cloud.dialogflow.v2.ListVersionsResponse" do
34
+ repeated :versions, :message, 1, "google.cloud.dialogflow.v2.Version"
35
+ optional :next_page_token, :string, 2
36
+ end
37
+ add_message "google.cloud.dialogflow.v2.GetVersionRequest" do
38
+ optional :name, :string, 1
39
+ end
40
+ add_message "google.cloud.dialogflow.v2.CreateVersionRequest" do
41
+ optional :parent, :string, 1
42
+ optional :version, :message, 2, "google.cloud.dialogflow.v2.Version"
43
+ end
44
+ add_message "google.cloud.dialogflow.v2.UpdateVersionRequest" do
45
+ optional :version, :message, 1, "google.cloud.dialogflow.v2.Version"
46
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
47
+ end
48
+ add_message "google.cloud.dialogflow.v2.DeleteVersionRequest" do
49
+ optional :name, :string, 1
50
+ end
51
+ end
52
+ end
53
+
54
+ module Google
55
+ module Cloud
56
+ module Dialogflow
57
+ module V2
58
+ Version = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Version").msgclass
59
+ Version::VersionStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Version.VersionStatus").enummodule
60
+ ListVersionsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListVersionsRequest").msgclass
61
+ ListVersionsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListVersionsResponse").msgclass
62
+ GetVersionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetVersionRequest").msgclass
63
+ CreateVersionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.CreateVersionRequest").msgclass
64
+ UpdateVersionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateVersionRequest").msgclass
65
+ DeleteVersionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteVersionRequest").msgclass
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,59 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dialogflow/v2/version.proto for package 'google.cloud.dialogflow.v2'
3
+ # Original file comments:
4
+ # Copyright 2021 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/cloud/dialogflow/v2/version_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module Versions
27
+ # Service for managing [Versions][google.cloud.dialogflow.v2.Version].
28
+ class Service
29
+
30
+ include GRPC::GenericService
31
+
32
+ self.marshal_class_method = :encode
33
+ self.unmarshal_class_method = :decode
34
+ self.service_name = 'google.cloud.dialogflow.v2.Versions'
35
+
36
+ # Returns the list of all versions of the specified agent.
37
+ rpc :ListVersions, ::Google::Cloud::Dialogflow::V2::ListVersionsRequest, ::Google::Cloud::Dialogflow::V2::ListVersionsResponse
38
+ # Retrieves the specified agent version.
39
+ rpc :GetVersion, ::Google::Cloud::Dialogflow::V2::GetVersionRequest, ::Google::Cloud::Dialogflow::V2::Version
40
+ # Creates an agent version.
41
+ #
42
+ # The new version points to the agent instance in the "default" environment.
43
+ rpc :CreateVersion, ::Google::Cloud::Dialogflow::V2::CreateVersionRequest, ::Google::Cloud::Dialogflow::V2::Version
44
+ # Updates the specified agent version.
45
+ #
46
+ # Note that this method does not allow you to update the state of the agent
47
+ # the given version points to. It allows you to update only mutable
48
+ # properties of the version resource.
49
+ rpc :UpdateVersion, ::Google::Cloud::Dialogflow::V2::UpdateVersionRequest, ::Google::Cloud::Dialogflow::V2::Version
50
+ # Delete the specified agent version.
51
+ rpc :DeleteVersion, ::Google::Cloud::Dialogflow::V2::DeleteVersionRequest, ::Google::Protobuf::Empty
52
+ end
53
+
54
+ Stub = Service.rpc_stub_class
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,49 @@
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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/dialogflow/v2/version"
24
+
25
+ require "google/cloud/dialogflow/v2/versions/credentials"
26
+ require "google/cloud/dialogflow/v2/versions/paths"
27
+ require "google/cloud/dialogflow/v2/versions/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Dialogflow
32
+ module V2
33
+ ##
34
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Version Versions}.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/dialogflow/v2/versions"
39
+ # client = ::Google::Cloud::Dialogflow::V2::Versions::Client.new
40
+ #
41
+ module Versions
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "versions", "helpers.rb"
49
+ require "google/cloud/dialogflow/v2/versions/helpers" if ::File.file? helper_path
@@ -0,0 +1,706 @@
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/v2/version_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module Versions
27
+ ##
28
+ # Client for the Versions service.
29
+ #
30
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Version Versions}.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :versions_stub
37
+
38
+ ##
39
+ # Configure the Versions Client class.
40
+ #
41
+ # See {::Google::Cloud::Dialogflow::V2::Versions::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all Versions clients:
47
+ #
48
+ # ::Google::Cloud::Dialogflow::V2::Versions::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", "V2"]
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 Versions 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::V2::Versions::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 Versions client object.
101
+ #
102
+ # ## Examples
103
+ #
104
+ # To create a new Versions client with the default
105
+ # configuration:
106
+ #
107
+ # client = ::Google::Cloud::Dialogflow::V2::Versions::Client.new
108
+ #
109
+ # To create a new Versions client with a custom
110
+ # configuration:
111
+ #
112
+ # client = ::Google::Cloud::Dialogflow::V2::Versions::Client.new do |config|
113
+ # config.timeout = 10.0
114
+ # end
115
+ #
116
+ # @yield [config] Configure the Versions client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ def initialize
120
+ # These require statements are intentionally placed here to initialize
121
+ # the gRPC module only when it's required.
122
+ # See https://github.com/googleapis/toolkit/issues/446
123
+ require "gapic/grpc"
124
+ require "google/cloud/dialogflow/v2/version_services_pb"
125
+
126
+ # Create the configuration object
127
+ @config = Configuration.new Client.configure
128
+
129
+ # Yield the configuration if needed
130
+ yield @config if block_given?
131
+
132
+ # Create credentials
133
+ credentials = @config.credentials
134
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
137
+ @config.endpoint == Client.configure.endpoint &&
138
+ !@config.endpoint.split(".").first.include?("-")
139
+ credentials ||= Credentials.default scope: @config.scope,
140
+ enable_self_signed_jwt: enable_self_signed_jwt
141
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
142
+ credentials = Credentials.new credentials, scope: @config.scope
143
+ end
144
+ @quota_project_id = @config.quota_project
145
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
+
147
+ @versions_stub = ::Gapic::ServiceStub.new(
148
+ ::Google::Cloud::Dialogflow::V2::Versions::Stub,
149
+ credentials: credentials,
150
+ endpoint: @config.endpoint,
151
+ channel_args: @config.channel_args,
152
+ interceptors: @config.interceptors
153
+ )
154
+ end
155
+
156
+ # Service calls
157
+
158
+ ##
159
+ # Returns the list of all versions of the specified agent.
160
+ #
161
+ # @overload list_versions(request, options = nil)
162
+ # Pass arguments to `list_versions` via a request object, either of type
163
+ # {::Google::Cloud::Dialogflow::V2::ListVersionsRequest} or an equivalent Hash.
164
+ #
165
+ # @param request [::Google::Cloud::Dialogflow::V2::ListVersionsRequest, ::Hash]
166
+ # A request object representing the call parameters. Required. To specify no
167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
168
+ # @param options [::Gapic::CallOptions, ::Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
170
+ #
171
+ # @overload list_versions(parent: nil, page_size: nil, page_token: nil)
172
+ # Pass arguments to `list_versions` via keyword arguments. Note that at
173
+ # least one keyword argument is required. To specify no parameters, or to keep all
174
+ # the default parameter values, pass an empty Hash as a request object (see above).
175
+ #
176
+ # @param parent [::String]
177
+ # Required. The agent to list all versions from.
178
+ # Supported formats:
179
+ # - `projects/<Project ID>/agent`
180
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
181
+ # @param page_size [::Integer]
182
+ # Optional. The maximum number of items to return in a single page. By default 100 and
183
+ # at most 1000.
184
+ # @param page_token [::String]
185
+ # Optional. The next_page_token value returned from a previous list request.
186
+ #
187
+ # @yield [response, operation] Access the result along with the RPC operation
188
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Version>]
189
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
190
+ #
191
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Version>]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
194
+ #
195
+ def list_versions request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListVersionsRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ metadata = @config.rpcs.list_versions.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
210
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
211
+
212
+ header_params = {
213
+ "parent" => request.parent
214
+ }
215
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
216
+ metadata[:"x-goog-request-params"] ||= request_params_header
217
+
218
+ options.apply_defaults timeout: @config.rpcs.list_versions.timeout,
219
+ metadata: metadata,
220
+ retry_policy: @config.rpcs.list_versions.retry_policy
221
+ options.apply_defaults metadata: @config.metadata,
222
+ retry_policy: @config.retry_policy
223
+
224
+ @versions_stub.call_rpc :list_versions, request, options: options do |response, operation|
225
+ response = ::Gapic::PagedEnumerable.new @versions_stub, :list_versions, request, response, operation, options
226
+ yield response, operation if block_given?
227
+ return response
228
+ end
229
+ rescue ::GRPC::BadStatus => e
230
+ raise ::Google::Cloud::Error.from_error(e)
231
+ end
232
+
233
+ ##
234
+ # Retrieves the specified agent version.
235
+ #
236
+ # @overload get_version(request, options = nil)
237
+ # Pass arguments to `get_version` via a request object, either of type
238
+ # {::Google::Cloud::Dialogflow::V2::GetVersionRequest} or an equivalent Hash.
239
+ #
240
+ # @param request [::Google::Cloud::Dialogflow::V2::GetVersionRequest, ::Hash]
241
+ # A request object representing the call parameters. Required. To specify no
242
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
243
+ # @param options [::Gapic::CallOptions, ::Hash]
244
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
245
+ #
246
+ # @overload get_version(name: nil)
247
+ # Pass arguments to `get_version` via keyword arguments. Note that at
248
+ # least one keyword argument is required. To specify no parameters, or to keep all
249
+ # the default parameter values, pass an empty Hash as a request object (see above).
250
+ #
251
+ # @param name [::String]
252
+ # Required. The name of the version.
253
+ # Supported formats:
254
+ # - `projects/<Project ID>/agent/versions/<Version ID>`
255
+ # - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
256
+ # ID>`
257
+ #
258
+ # @yield [response, operation] Access the result along with the RPC operation
259
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Version]
260
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
261
+ #
262
+ # @return [::Google::Cloud::Dialogflow::V2::Version]
263
+ #
264
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
265
+ #
266
+ def get_version request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetVersionRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ metadata = @config.rpcs.get_version.metadata.to_h
276
+
277
+ # Set x-goog-api-client and x-goog-user-project headers
278
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
281
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
282
+
283
+ header_params = {
284
+ "name" => request.name
285
+ }
286
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
287
+ metadata[:"x-goog-request-params"] ||= request_params_header
288
+
289
+ options.apply_defaults timeout: @config.rpcs.get_version.timeout,
290
+ metadata: metadata,
291
+ retry_policy: @config.rpcs.get_version.retry_policy
292
+ options.apply_defaults metadata: @config.metadata,
293
+ retry_policy: @config.retry_policy
294
+
295
+ @versions_stub.call_rpc :get_version, request, options: options do |response, operation|
296
+ yield response, operation if block_given?
297
+ return response
298
+ end
299
+ rescue ::GRPC::BadStatus => e
300
+ raise ::Google::Cloud::Error.from_error(e)
301
+ end
302
+
303
+ ##
304
+ # Creates an agent version.
305
+ #
306
+ # The new version points to the agent instance in the "default" environment.
307
+ #
308
+ # @overload create_version(request, options = nil)
309
+ # Pass arguments to `create_version` via a request object, either of type
310
+ # {::Google::Cloud::Dialogflow::V2::CreateVersionRequest} or an equivalent Hash.
311
+ #
312
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateVersionRequest, ::Hash]
313
+ # A request object representing the call parameters. Required. To specify no
314
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
315
+ # @param options [::Gapic::CallOptions, ::Hash]
316
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
317
+ #
318
+ # @overload create_version(parent: nil, version: nil)
319
+ # Pass arguments to `create_version` via keyword arguments. Note that at
320
+ # least one keyword argument is required. To specify no parameters, or to keep all
321
+ # the default parameter values, pass an empty Hash as a request object (see above).
322
+ #
323
+ # @param parent [::String]
324
+ # Required. The agent to create a version for.
325
+ # Supported formats:
326
+ # - `projects/<Project ID>/agent`
327
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
328
+ # @param version [::Google::Cloud::Dialogflow::V2::Version, ::Hash]
329
+ # Required. The version to create.
330
+ #
331
+ # @yield [response, operation] Access the result along with the RPC operation
332
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Version]
333
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
334
+ #
335
+ # @return [::Google::Cloud::Dialogflow::V2::Version]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
338
+ #
339
+ def create_version request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateVersionRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ metadata = @config.rpcs.create_version.metadata.to_h
349
+
350
+ # Set x-goog-api-client and x-goog-user-project headers
351
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
354
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ header_params = {
357
+ "parent" => request.parent
358
+ }
359
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
360
+ metadata[:"x-goog-request-params"] ||= request_params_header
361
+
362
+ options.apply_defaults timeout: @config.rpcs.create_version.timeout,
363
+ metadata: metadata,
364
+ retry_policy: @config.rpcs.create_version.retry_policy
365
+ options.apply_defaults metadata: @config.metadata,
366
+ retry_policy: @config.retry_policy
367
+
368
+ @versions_stub.call_rpc :create_version, request, options: options do |response, operation|
369
+ yield response, operation if block_given?
370
+ return response
371
+ end
372
+ rescue ::GRPC::BadStatus => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Updates the specified agent version.
378
+ #
379
+ # Note that this method does not allow you to update the state of the agent
380
+ # the given version points to. It allows you to update only mutable
381
+ # properties of the version resource.
382
+ #
383
+ # @overload update_version(request, options = nil)
384
+ # Pass arguments to `update_version` via a request object, either of type
385
+ # {::Google::Cloud::Dialogflow::V2::UpdateVersionRequest} or an equivalent Hash.
386
+ #
387
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateVersionRequest, ::Hash]
388
+ # A request object representing the call parameters. Required. To specify no
389
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
390
+ # @param options [::Gapic::CallOptions, ::Hash]
391
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
392
+ #
393
+ # @overload update_version(version: nil, update_mask: nil)
394
+ # Pass arguments to `update_version` via keyword arguments. Note that at
395
+ # least one keyword argument is required. To specify no parameters, or to keep all
396
+ # the default parameter values, pass an empty Hash as a request object (see above).
397
+ #
398
+ # @param version [::Google::Cloud::Dialogflow::V2::Version, ::Hash]
399
+ # Required. The version to update.
400
+ # Supported formats:
401
+ # - `projects/<Project ID>/agent/versions/<Version ID>`
402
+ # - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
403
+ # ID>`
404
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
405
+ # Required. The mask to control which fields get updated.
406
+ #
407
+ # @yield [response, operation] Access the result along with the RPC operation
408
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Version]
409
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
410
+ #
411
+ # @return [::Google::Cloud::Dialogflow::V2::Version]
412
+ #
413
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
414
+ #
415
+ def update_version request, options = nil
416
+ raise ::ArgumentError, "request must be provided" if request.nil?
417
+
418
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateVersionRequest
419
+
420
+ # Converts hash and nil to an options object
421
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
422
+
423
+ # Customize the options with defaults
424
+ metadata = @config.rpcs.update_version.metadata.to_h
425
+
426
+ # Set x-goog-api-client and x-goog-user-project headers
427
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
428
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
429
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
430
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ header_params = {
433
+ "version.name" => request.version.name
434
+ }
435
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
436
+ metadata[:"x-goog-request-params"] ||= request_params_header
437
+
438
+ options.apply_defaults timeout: @config.rpcs.update_version.timeout,
439
+ metadata: metadata,
440
+ retry_policy: @config.rpcs.update_version.retry_policy
441
+ options.apply_defaults metadata: @config.metadata,
442
+ retry_policy: @config.retry_policy
443
+
444
+ @versions_stub.call_rpc :update_version, request, options: options do |response, operation|
445
+ yield response, operation if block_given?
446
+ return response
447
+ end
448
+ rescue ::GRPC::BadStatus => e
449
+ raise ::Google::Cloud::Error.from_error(e)
450
+ end
451
+
452
+ ##
453
+ # Delete the specified agent version.
454
+ #
455
+ # @overload delete_version(request, options = nil)
456
+ # Pass arguments to `delete_version` via a request object, either of type
457
+ # {::Google::Cloud::Dialogflow::V2::DeleteVersionRequest} or an equivalent Hash.
458
+ #
459
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteVersionRequest, ::Hash]
460
+ # A request object representing the call parameters. Required. To specify no
461
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
462
+ # @param options [::Gapic::CallOptions, ::Hash]
463
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
464
+ #
465
+ # @overload delete_version(name: nil)
466
+ # Pass arguments to `delete_version` via keyword arguments. Note that at
467
+ # least one keyword argument is required. To specify no parameters, or to keep all
468
+ # the default parameter values, pass an empty Hash as a request object (see above).
469
+ #
470
+ # @param name [::String]
471
+ # Required. The name of the version to delete.
472
+ # Supported formats:
473
+ # - `projects/<Project ID>/agent/versions/<Version ID>`
474
+ # - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
475
+ # ID>`
476
+ #
477
+ # @yield [response, operation] Access the result along with the RPC operation
478
+ # @yieldparam response [::Google::Protobuf::Empty]
479
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
480
+ #
481
+ # @return [::Google::Protobuf::Empty]
482
+ #
483
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
484
+ #
485
+ def delete_version request, options = nil
486
+ raise ::ArgumentError, "request must be provided" if request.nil?
487
+
488
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteVersionRequest
489
+
490
+ # Converts hash and nil to an options object
491
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
492
+
493
+ # Customize the options with defaults
494
+ metadata = @config.rpcs.delete_version.metadata.to_h
495
+
496
+ # Set x-goog-api-client and x-goog-user-project headers
497
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
498
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
499
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
500
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
501
+
502
+ header_params = {
503
+ "name" => request.name
504
+ }
505
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
506
+ metadata[:"x-goog-request-params"] ||= request_params_header
507
+
508
+ options.apply_defaults timeout: @config.rpcs.delete_version.timeout,
509
+ metadata: metadata,
510
+ retry_policy: @config.rpcs.delete_version.retry_policy
511
+ options.apply_defaults metadata: @config.metadata,
512
+ retry_policy: @config.retry_policy
513
+
514
+ @versions_stub.call_rpc :delete_version, request, options: options do |response, operation|
515
+ yield response, operation if block_given?
516
+ return response
517
+ end
518
+ rescue ::GRPC::BadStatus => e
519
+ raise ::Google::Cloud::Error.from_error(e)
520
+ end
521
+
522
+ ##
523
+ # Configuration class for the Versions API.
524
+ #
525
+ # This class represents the configuration for Versions,
526
+ # providing control over timeouts, retry behavior, logging, transport
527
+ # parameters, and other low-level controls. Certain parameters can also be
528
+ # applied individually to specific RPCs. See
529
+ # {::Google::Cloud::Dialogflow::V2::Versions::Client::Configuration::Rpcs}
530
+ # for a list of RPCs that can be configured independently.
531
+ #
532
+ # Configuration can be applied globally to all clients, or to a single client
533
+ # on construction.
534
+ #
535
+ # # Examples
536
+ #
537
+ # To modify the global config, setting the timeout for list_versions
538
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
539
+ #
540
+ # ::Google::Cloud::Dialogflow::V2::Versions::Client.configure do |config|
541
+ # config.timeout = 10.0
542
+ # config.rpcs.list_versions.timeout = 20.0
543
+ # end
544
+ #
545
+ # To apply the above configuration only to a new client:
546
+ #
547
+ # client = ::Google::Cloud::Dialogflow::V2::Versions::Client.new do |config|
548
+ # config.timeout = 10.0
549
+ # config.rpcs.list_versions.timeout = 20.0
550
+ # end
551
+ #
552
+ # @!attribute [rw] endpoint
553
+ # The hostname or hostname:port of the service endpoint.
554
+ # Defaults to `"dialogflow.googleapis.com"`.
555
+ # @return [::String]
556
+ # @!attribute [rw] credentials
557
+ # Credentials to send with calls. You may provide any of the following types:
558
+ # * (`String`) The path to a service account key file in JSON format
559
+ # * (`Hash`) A service account key as a Hash
560
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
561
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
562
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
563
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
564
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
565
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
566
+ # * (`nil`) indicating no credentials
567
+ # @return [::Object]
568
+ # @!attribute [rw] scope
569
+ # The OAuth scopes
570
+ # @return [::Array<::String>]
571
+ # @!attribute [rw] lib_name
572
+ # The library name as recorded in instrumentation and logging
573
+ # @return [::String]
574
+ # @!attribute [rw] lib_version
575
+ # The library version as recorded in instrumentation and logging
576
+ # @return [::String]
577
+ # @!attribute [rw] channel_args
578
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
579
+ # `GRPC::Core::Channel` object is provided as the credential.
580
+ # @return [::Hash]
581
+ # @!attribute [rw] interceptors
582
+ # An array of interceptors that are run before calls are executed.
583
+ # @return [::Array<::GRPC::ClientInterceptor>]
584
+ # @!attribute [rw] timeout
585
+ # The call timeout in seconds.
586
+ # @return [::Numeric]
587
+ # @!attribute [rw] metadata
588
+ # Additional gRPC headers to be sent with the call.
589
+ # @return [::Hash{::Symbol=>::String}]
590
+ # @!attribute [rw] retry_policy
591
+ # The retry policy. The value is a hash with the following keys:
592
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
593
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
594
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
595
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
596
+ # trigger a retry.
597
+ # @return [::Hash]
598
+ # @!attribute [rw] quota_project
599
+ # A separate project against which to charge quota.
600
+ # @return [::String]
601
+ #
602
+ class Configuration
603
+ extend ::Gapic::Config
604
+
605
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
606
+ config_attr :credentials, nil do |value|
607
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
608
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
609
+ allowed.any? { |klass| klass === value }
610
+ end
611
+ config_attr :scope, nil, ::String, ::Array, nil
612
+ config_attr :lib_name, nil, ::String, nil
613
+ config_attr :lib_version, nil, ::String, nil
614
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
615
+ config_attr :interceptors, nil, ::Array, nil
616
+ config_attr :timeout, nil, ::Numeric, nil
617
+ config_attr :metadata, nil, ::Hash, nil
618
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
619
+ config_attr :quota_project, nil, ::String, nil
620
+
621
+ # @private
622
+ def initialize parent_config = nil
623
+ @parent_config = parent_config unless parent_config.nil?
624
+
625
+ yield self if block_given?
626
+ end
627
+
628
+ ##
629
+ # Configurations for individual RPCs
630
+ # @return [Rpcs]
631
+ #
632
+ def rpcs
633
+ @rpcs ||= begin
634
+ parent_rpcs = nil
635
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
636
+ Rpcs.new parent_rpcs
637
+ end
638
+ end
639
+
640
+ ##
641
+ # Configuration RPC class for the Versions API.
642
+ #
643
+ # Includes fields providing the configuration for each RPC in this service.
644
+ # Each configuration object is of type `Gapic::Config::Method` and includes
645
+ # the following configuration fields:
646
+ #
647
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
648
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
649
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
650
+ # include the following keys:
651
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
652
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
653
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
654
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
655
+ # trigger a retry.
656
+ #
657
+ class Rpcs
658
+ ##
659
+ # RPC-specific configuration for `list_versions`
660
+ # @return [::Gapic::Config::Method]
661
+ #
662
+ attr_reader :list_versions
663
+ ##
664
+ # RPC-specific configuration for `get_version`
665
+ # @return [::Gapic::Config::Method]
666
+ #
667
+ attr_reader :get_version
668
+ ##
669
+ # RPC-specific configuration for `create_version`
670
+ # @return [::Gapic::Config::Method]
671
+ #
672
+ attr_reader :create_version
673
+ ##
674
+ # RPC-specific configuration for `update_version`
675
+ # @return [::Gapic::Config::Method]
676
+ #
677
+ attr_reader :update_version
678
+ ##
679
+ # RPC-specific configuration for `delete_version`
680
+ # @return [::Gapic::Config::Method]
681
+ #
682
+ attr_reader :delete_version
683
+
684
+ # @private
685
+ def initialize parent_rpcs = nil
686
+ list_versions_config = parent_rpcs.list_versions if parent_rpcs.respond_to? :list_versions
687
+ @list_versions = ::Gapic::Config::Method.new list_versions_config
688
+ get_version_config = parent_rpcs.get_version if parent_rpcs.respond_to? :get_version
689
+ @get_version = ::Gapic::Config::Method.new get_version_config
690
+ create_version_config = parent_rpcs.create_version if parent_rpcs.respond_to? :create_version
691
+ @create_version = ::Gapic::Config::Method.new create_version_config
692
+ update_version_config = parent_rpcs.update_version if parent_rpcs.respond_to? :update_version
693
+ @update_version = ::Gapic::Config::Method.new update_version_config
694
+ delete_version_config = parent_rpcs.delete_version if parent_rpcs.respond_to? :delete_version
695
+ @delete_version = ::Gapic::Config::Method.new delete_version_config
696
+
697
+ yield self if block_given?
698
+ end
699
+ end
700
+ end
701
+ end
702
+ end
703
+ end
704
+ end
705
+ end
706
+ end