google-cloud-dialogflow-v2 0.4.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +1 -1
- data/lib/google/cloud/dialogflow/v2.rb +2 -1
- data/lib/google/cloud/dialogflow/v2/agents.rb +5 -5
- data/lib/google/cloud/dialogflow/v2/agents/client.rb +212 -207
- data/lib/google/cloud/dialogflow/v2/agents/credentials.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/agents/operations.rb +109 -103
- data/lib/google/cloud/dialogflow/v2/agents/paths.rb +2 -2
- data/lib/google/cloud/dialogflow/v2/contexts.rb +3 -3
- data/lib/google/cloud/dialogflow/v2/contexts/client.rb +148 -143
- data/lib/google/cloud/dialogflow/v2/contexts/credentials.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +14 -14
- data/lib/google/cloud/dialogflow/v2/entity_types.rb +2 -2
- data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +238 -233
- data/lib/google/cloud/dialogflow/v2/entity_types/credentials.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +109 -103
- data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +3 -3
- data/lib/google/cloud/dialogflow/v2/environment_pb.rb +51 -0
- data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +45 -0
- data/lib/google/cloud/dialogflow/v2/environments.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/environments/client.rb +384 -0
- data/lib/google/cloud/dialogflow/v2/environments/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/environments/paths.rb +47 -0
- data/lib/google/cloud/dialogflow/v2/intents.rb +3 -3
- data/lib/google/cloud/dialogflow/v2/intents/client.rb +183 -178
- data/lib/google/cloud/dialogflow/v2/intents/credentials.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +109 -103
- data/lib/google/cloud/dialogflow/v2/intents/paths.rb +11 -11
- data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +130 -125
- data/lib/google/cloud/dialogflow/v2/session_entity_types/credentials.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +14 -14
- data/lib/google/cloud/dialogflow/v2/sessions.rb +3 -3
- data/lib/google/cloud/dialogflow/v2/sessions/client.rb +86 -81
- data/lib/google/cloud/dialogflow/v2/sessions/credentials.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +22 -22
- data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/dialogflow/v2/agent.rb +69 -69
- data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +45 -44
- data/proto_docs/google/cloud/dialogflow/v2/context.rb +38 -38
- data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +86 -86
- data/proto_docs/google/cloud/dialogflow/v2/environment.rb +103 -0
- data/proto_docs/google/cloud/dialogflow/v2/intent.rb +251 -250
- data/proto_docs/google/cloud/dialogflow/v2/session.rb +114 -106
- data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +35 -35
- data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +8 -8
- data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +43 -36
- data/proto_docs/google/longrunning/operations.rb +30 -30
- data/proto_docs/google/protobuf/any.rb +4 -4
- data/proto_docs/google/protobuf/duration.rb +4 -4
- data/proto_docs/google/protobuf/empty.rb +2 -2
- data/proto_docs/google/protobuf/field_mask.rb +3 -3
- data/proto_docs/google/protobuf/struct.rb +18 -18
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +6 -6
- data/proto_docs/google/type/latlng.rb +4 -4
- metadata +41 -6
- data/lib/google/cloud/common_resources_pb.rb +0 -15
@@ -33,7 +33,7 @@ module Google
|
|
33
33
|
#
|
34
34
|
# @param project [String]
|
35
35
|
#
|
36
|
-
# @return [String]
|
36
|
+
# @return [::String]
|
37
37
|
def agent_path project:
|
38
38
|
"projects/#{project}/agent"
|
39
39
|
end
|
@@ -48,9 +48,9 @@ module Google
|
|
48
48
|
# @param project [String]
|
49
49
|
# @param entity_type [String]
|
50
50
|
#
|
51
|
-
# @return [String]
|
51
|
+
# @return [::String]
|
52
52
|
def entity_type_path project:, entity_type:
|
53
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
53
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
54
54
|
|
55
55
|
"projects/#{project}/agent/entityTypes/#{entity_type}"
|
56
56
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/dialogflow/v2/environment.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/field_behavior_pb'
|
8
|
+
require 'google/api/resource_pb'
|
9
|
+
require 'google/protobuf/empty_pb'
|
10
|
+
require 'google/protobuf/field_mask_pb'
|
11
|
+
require 'google/protobuf/timestamp_pb'
|
12
|
+
require 'google/api/client_pb'
|
13
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
14
|
+
add_file("google/cloud/dialogflow/v2/environment.proto", :syntax => :proto3) do
|
15
|
+
add_message "google.cloud.dialogflow.v2.Environment" do
|
16
|
+
optional :name, :string, 1
|
17
|
+
optional :description, :string, 2
|
18
|
+
optional :agent_version, :string, 3
|
19
|
+
optional :state, :enum, 4, "google.cloud.dialogflow.v2.Environment.State"
|
20
|
+
optional :update_time, :message, 5, "google.protobuf.Timestamp"
|
21
|
+
end
|
22
|
+
add_enum "google.cloud.dialogflow.v2.Environment.State" do
|
23
|
+
value :STATE_UNSPECIFIED, 0
|
24
|
+
value :STOPPED, 1
|
25
|
+
value :LOADING, 2
|
26
|
+
value :RUNNING, 3
|
27
|
+
end
|
28
|
+
add_message "google.cloud.dialogflow.v2.ListEnvironmentsRequest" 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.ListEnvironmentsResponse" do
|
34
|
+
repeated :environments, :message, 1, "google.cloud.dialogflow.v2.Environment"
|
35
|
+
optional :next_page_token, :string, 2
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Google
|
41
|
+
module Cloud
|
42
|
+
module Dialogflow
|
43
|
+
module V2
|
44
|
+
Environment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Environment").msgclass
|
45
|
+
Environment::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Environment.State").enummodule
|
46
|
+
ListEnvironmentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListEnvironmentsRequest").msgclass
|
47
|
+
ListEnvironmentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListEnvironmentsResponse").msgclass
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/dialogflow/v2/environment.proto for package 'google.cloud.dialogflow.v2'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2020 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/environment_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dialogflow
|
25
|
+
module V2
|
26
|
+
module Environments
|
27
|
+
# Manages agent environments.
|
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.Environments'
|
35
|
+
|
36
|
+
# Returns the list of all non-draft environments of the specified agent.
|
37
|
+
rpc :ListEnvironments, ListEnvironmentsRequest, ListEnvironmentsResponse
|
38
|
+
end
|
39
|
+
|
40
|
+
Stub = Service.rpc_stub_class
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/environments/credentials"
|
26
|
+
require "google/cloud/dialogflow/v2/environments/paths"
|
27
|
+
require "google/cloud/dialogflow/v2/environments/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Dialogflow
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Manages agent environments.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/dialogflow/v2/environments"
|
39
|
+
# client = ::Google::Cloud::Dialogflow::V2::Environments::Client.new
|
40
|
+
#
|
41
|
+
module Environments
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "environments", "helpers.rb"
|
49
|
+
require "google/cloud/dialogflow/v2/environments/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,384 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/environment_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dialogflow
|
25
|
+
module V2
|
26
|
+
module Environments
|
27
|
+
##
|
28
|
+
# Client for the Environments service.
|
29
|
+
#
|
30
|
+
# Manages agent environments.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :environments_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the Environments Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::Dialogflow::V2::Environments::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# ## Example
|
45
|
+
#
|
46
|
+
# To modify the configuration for all Environments clients:
|
47
|
+
#
|
48
|
+
# ::Google::Cloud::Dialogflow::V2::Environments::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.rpcs.list_environments.timeout = 60.0
|
69
|
+
default_config.rpcs.list_environments.retry_policy = {
|
70
|
+
initial_delay: 0.1,
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: ["UNAVAILABLE", "INTERNAL"]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config
|
77
|
+
end
|
78
|
+
yield @configure if block_given?
|
79
|
+
@configure
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Configure the Environments Client instance.
|
84
|
+
#
|
85
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
86
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
87
|
+
# should be made on {Client.configure}.
|
88
|
+
#
|
89
|
+
# See {::Google::Cloud::Dialogflow::V2::Environments::Client::Configuration}
|
90
|
+
# for a description of the configuration fields.
|
91
|
+
#
|
92
|
+
# @yield [config] Configure the Client client.
|
93
|
+
# @yieldparam config [Client::Configuration]
|
94
|
+
#
|
95
|
+
# @return [Client::Configuration]
|
96
|
+
#
|
97
|
+
def configure
|
98
|
+
yield @config if block_given?
|
99
|
+
@config
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Create a new Environments client object.
|
104
|
+
#
|
105
|
+
# ## Examples
|
106
|
+
#
|
107
|
+
# To create a new Environments client with the default
|
108
|
+
# configuration:
|
109
|
+
#
|
110
|
+
# client = ::Google::Cloud::Dialogflow::V2::Environments::Client.new
|
111
|
+
#
|
112
|
+
# To create a new Environments client with a custom
|
113
|
+
# configuration:
|
114
|
+
#
|
115
|
+
# client = ::Google::Cloud::Dialogflow::V2::Environments::Client.new do |config|
|
116
|
+
# config.timeout = 10.0
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# @yield [config] Configure the Environments client.
|
120
|
+
# @yieldparam config [Client::Configuration]
|
121
|
+
#
|
122
|
+
def initialize
|
123
|
+
# These require statements are intentionally placed here to initialize
|
124
|
+
# the gRPC module only when it's required.
|
125
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
126
|
+
require "gapic/grpc"
|
127
|
+
require "google/cloud/dialogflow/v2/environment_services_pb"
|
128
|
+
|
129
|
+
# Create the configuration object
|
130
|
+
@config = Configuration.new Client.configure
|
131
|
+
|
132
|
+
# Yield the configuration if needed
|
133
|
+
yield @config if block_given?
|
134
|
+
|
135
|
+
# Create credentials
|
136
|
+
credentials = @config.credentials
|
137
|
+
credentials ||= Credentials.default scope: @config.scope
|
138
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
139
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
140
|
+
end
|
141
|
+
@quota_project_id = @config.quota_project
|
142
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
143
|
+
|
144
|
+
@environments_stub = ::Gapic::ServiceStub.new(
|
145
|
+
::Google::Cloud::Dialogflow::V2::Environments::Stub,
|
146
|
+
credentials: credentials,
|
147
|
+
endpoint: @config.endpoint,
|
148
|
+
channel_args: @config.channel_args,
|
149
|
+
interceptors: @config.interceptors
|
150
|
+
)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Service calls
|
154
|
+
|
155
|
+
##
|
156
|
+
# Returns the list of all non-draft environments of the specified agent.
|
157
|
+
#
|
158
|
+
# @overload list_environments(request, options = nil)
|
159
|
+
# Pass arguments to `list_environments` via a request object, either of type
|
160
|
+
# {::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest} or an equivalent Hash.
|
161
|
+
#
|
162
|
+
# @param request [::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest, ::Hash]
|
163
|
+
# A request object representing the call parameters. Required. To specify no
|
164
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
165
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
166
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
167
|
+
#
|
168
|
+
# @overload list_environments(parent: nil, page_size: nil, page_token: nil)
|
169
|
+
# Pass arguments to `list_environments` via keyword arguments. Note that at
|
170
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
171
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
172
|
+
#
|
173
|
+
# @param parent [::String]
|
174
|
+
# Required. The agent to list all environments from.
|
175
|
+
# Format: `projects/<Project ID>/agent`.
|
176
|
+
# @param page_size [::Integer]
|
177
|
+
# Optional. The maximum number of items to return in a single page. By default 100 and
|
178
|
+
# at most 1000.
|
179
|
+
# @param page_token [::String]
|
180
|
+
# Optional. The next_page_token value returned from a previous list request.
|
181
|
+
#
|
182
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
183
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Environment>]
|
184
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
185
|
+
#
|
186
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Environment>]
|
187
|
+
#
|
188
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
189
|
+
#
|
190
|
+
def list_environments request, options = nil
|
191
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
192
|
+
|
193
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest
|
194
|
+
|
195
|
+
# Converts hash and nil to an options object
|
196
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
197
|
+
|
198
|
+
# Customize the options with defaults
|
199
|
+
metadata = @config.rpcs.list_environments.metadata.to_h
|
200
|
+
|
201
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
202
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
203
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
204
|
+
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
|
205
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
206
|
+
|
207
|
+
header_params = {
|
208
|
+
"parent" => request.parent
|
209
|
+
}
|
210
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
211
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
212
|
+
|
213
|
+
options.apply_defaults timeout: @config.rpcs.list_environments.timeout,
|
214
|
+
metadata: metadata,
|
215
|
+
retry_policy: @config.rpcs.list_environments.retry_policy
|
216
|
+
options.apply_defaults metadata: @config.metadata,
|
217
|
+
retry_policy: @config.retry_policy
|
218
|
+
|
219
|
+
@environments_stub.call_rpc :list_environments, request, options: options do |response, operation|
|
220
|
+
response = ::Gapic::PagedEnumerable.new @environments_stub, :list_environments, request, response, operation, options
|
221
|
+
yield response, operation if block_given?
|
222
|
+
return response
|
223
|
+
end
|
224
|
+
rescue ::GRPC::BadStatus => e
|
225
|
+
raise ::Google::Cloud::Error.from_error(e)
|
226
|
+
end
|
227
|
+
|
228
|
+
##
|
229
|
+
# Configuration class for the Environments API.
|
230
|
+
#
|
231
|
+
# This class represents the configuration for Environments,
|
232
|
+
# providing control over timeouts, retry behavior, logging, transport
|
233
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
234
|
+
# applied individually to specific RPCs. See
|
235
|
+
# {::Google::Cloud::Dialogflow::V2::Environments::Client::Configuration::Rpcs}
|
236
|
+
# for a list of RPCs that can be configured independently.
|
237
|
+
#
|
238
|
+
# Configuration can be applied globally to all clients, or to a single client
|
239
|
+
# on construction.
|
240
|
+
#
|
241
|
+
# # Examples
|
242
|
+
#
|
243
|
+
# To modify the global config, setting the timeout for list_environments
|
244
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
245
|
+
#
|
246
|
+
# ::Google::Cloud::Dialogflow::V2::Environments::Client.configure do |config|
|
247
|
+
# config.timeout = 10.0
|
248
|
+
# config.rpcs.list_environments.timeout = 20.0
|
249
|
+
# end
|
250
|
+
#
|
251
|
+
# To apply the above configuration only to a new client:
|
252
|
+
#
|
253
|
+
# client = ::Google::Cloud::Dialogflow::V2::Environments::Client.new do |config|
|
254
|
+
# config.timeout = 10.0
|
255
|
+
# config.rpcs.list_environments.timeout = 20.0
|
256
|
+
# end
|
257
|
+
#
|
258
|
+
# @!attribute [rw] endpoint
|
259
|
+
# The hostname or hostname:port of the service endpoint.
|
260
|
+
# Defaults to `"dialogflow.googleapis.com"`.
|
261
|
+
# @return [::String]
|
262
|
+
# @!attribute [rw] credentials
|
263
|
+
# Credentials to send with calls. You may provide any of the following types:
|
264
|
+
# * (`String`) The path to a service account key file in JSON format
|
265
|
+
# * (`Hash`) A service account key as a Hash
|
266
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
267
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
268
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
269
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
270
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
271
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
272
|
+
# * (`nil`) indicating no credentials
|
273
|
+
# @return [::Object]
|
274
|
+
# @!attribute [rw] scope
|
275
|
+
# The OAuth scopes
|
276
|
+
# @return [::Array<::String>]
|
277
|
+
# @!attribute [rw] lib_name
|
278
|
+
# The library name as recorded in instrumentation and logging
|
279
|
+
# @return [::String]
|
280
|
+
# @!attribute [rw] lib_version
|
281
|
+
# The library version as recorded in instrumentation and logging
|
282
|
+
# @return [::String]
|
283
|
+
# @!attribute [rw] channel_args
|
284
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
285
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
286
|
+
# @return [::Hash]
|
287
|
+
# @!attribute [rw] interceptors
|
288
|
+
# An array of interceptors that are run before calls are executed.
|
289
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
290
|
+
# @!attribute [rw] timeout
|
291
|
+
# The call timeout in seconds.
|
292
|
+
# @return [::Numeric]
|
293
|
+
# @!attribute [rw] metadata
|
294
|
+
# Additional gRPC headers to be sent with the call.
|
295
|
+
# @return [::Hash{::Symbol=>::String}]
|
296
|
+
# @!attribute [rw] retry_policy
|
297
|
+
# The retry policy. The value is a hash with the following keys:
|
298
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
299
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
300
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
301
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
302
|
+
# trigger a retry.
|
303
|
+
# @return [::Hash]
|
304
|
+
# @!attribute [rw] quota_project
|
305
|
+
# A separate project against which to charge quota.
|
306
|
+
# @return [::String]
|
307
|
+
#
|
308
|
+
class Configuration
|
309
|
+
extend ::Gapic::Config
|
310
|
+
|
311
|
+
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
312
|
+
config_attr :credentials, nil do |value|
|
313
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
314
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
315
|
+
allowed.any? { |klass| klass === value }
|
316
|
+
end
|
317
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
318
|
+
config_attr :lib_name, nil, ::String, nil
|
319
|
+
config_attr :lib_version, nil, ::String, nil
|
320
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
321
|
+
config_attr :interceptors, nil, ::Array, nil
|
322
|
+
config_attr :timeout, nil, ::Numeric, nil
|
323
|
+
config_attr :metadata, nil, ::Hash, nil
|
324
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
325
|
+
config_attr :quota_project, nil, ::String, nil
|
326
|
+
|
327
|
+
# @private
|
328
|
+
def initialize parent_config = nil
|
329
|
+
@parent_config = parent_config unless parent_config.nil?
|
330
|
+
|
331
|
+
yield self if block_given?
|
332
|
+
end
|
333
|
+
|
334
|
+
##
|
335
|
+
# Configurations for individual RPCs
|
336
|
+
# @return [Rpcs]
|
337
|
+
#
|
338
|
+
def rpcs
|
339
|
+
@rpcs ||= begin
|
340
|
+
parent_rpcs = nil
|
341
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
342
|
+
Rpcs.new parent_rpcs
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
##
|
347
|
+
# Configuration RPC class for the Environments API.
|
348
|
+
#
|
349
|
+
# Includes fields providing the configuration for each RPC in this service.
|
350
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
351
|
+
# the following configuration fields:
|
352
|
+
#
|
353
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
354
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
355
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
356
|
+
# include the following keys:
|
357
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
358
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
359
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
360
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
361
|
+
# trigger a retry.
|
362
|
+
#
|
363
|
+
class Rpcs
|
364
|
+
##
|
365
|
+
# RPC-specific configuration for `list_environments`
|
366
|
+
# @return [::Gapic::Config::Method]
|
367
|
+
#
|
368
|
+
attr_reader :list_environments
|
369
|
+
|
370
|
+
# @private
|
371
|
+
def initialize parent_rpcs = nil
|
372
|
+
list_environments_config = parent_rpcs&.list_environments if parent_rpcs&.respond_to? :list_environments
|
373
|
+
@list_environments = ::Gapic::Config::Method.new list_environments_config
|
374
|
+
|
375
|
+
yield self if block_given?
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|