google-cloud-dialogflow 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +38 -1
- data/lib/google/cloud/dialogflow.rb +56 -1
- data/lib/google/cloud/dialogflow/v2.rb +107 -28
- data/lib/google/cloud/dialogflow/v2/agents_client.rb +55 -26
- data/lib/google/cloud/dialogflow/v2/contexts_client.rb +77 -34
- data/lib/google/cloud/dialogflow/v2/credentials.rb +40 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +0 -11
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +0 -11
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +0 -11
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +0 -11
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +0 -11
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +0 -11
- data/lib/google/cloud/dialogflow/v2/doc/google/longrunning/operations.rb +92 -0
- data/lib/google/cloud/dialogflow/{credentials.rb → v2/doc/google/protobuf/empty.rb} +12 -14
- data/lib/google/cloud/dialogflow/v2/doc/overview.rb +26 -1
- data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +89 -44
- data/lib/google/cloud/dialogflow/v2/intents_client.rb +77 -35
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +67 -29
- data/lib/google/cloud/dialogflow/v2/sessions_client.rb +31 -12
- metadata +37 -7
@@ -15,17 +15,6 @@
|
|
15
15
|
module Google
|
16
16
|
module Cloud
|
17
17
|
module Dialogflow
|
18
|
-
##
|
19
|
-
# # Dialogflow API Contents
|
20
|
-
#
|
21
|
-
# | Class | Description |
|
22
|
-
# | ----- | ----------- |
|
23
|
-
# | [SessionEntityTypesClient][] | Entities are extracted from user input and represent parameters that are meaningful to your application. |
|
24
|
-
# | [Data Types][] | Data types for Google::Cloud::Dialogflow::V2 |
|
25
|
-
#
|
26
|
-
# [SessionEntityTypesClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dialogflow/latest/google/cloud/dialogflow/v2/sessionentitytypesclient
|
27
|
-
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dialogflow/latest/google/cloud/dialogflow/v2/datatypes
|
28
|
-
#
|
29
18
|
module V2
|
30
19
|
# Represents a session entity type.
|
31
20
|
#
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module Google
|
16
|
+
module Longrunning
|
17
|
+
# This resource represents a long-running operation that is the result of a
|
18
|
+
# network API call.
|
19
|
+
# @!attribute [rw] name
|
20
|
+
# @return [String]
|
21
|
+
# The server-assigned name, which is only unique within the same service that
|
22
|
+
# originally returns it. If you use the default HTTP mapping, the
|
23
|
+
# +name+ should have the format of +operations/some/unique/name+.
|
24
|
+
# @!attribute [rw] metadata
|
25
|
+
# @return [Google::Protobuf::Any]
|
26
|
+
# Service-specific metadata associated with the operation. It typically
|
27
|
+
# contains progress information and common metadata such as create time.
|
28
|
+
# Some services might not provide such metadata. Any method that returns a
|
29
|
+
# long-running operation should document the metadata type, if any.
|
30
|
+
# @!attribute [rw] done
|
31
|
+
# @return [true, false]
|
32
|
+
# If the value is +false+, it means the operation is still in progress.
|
33
|
+
# If true, the operation is completed, and either +error+ or +response+ is
|
34
|
+
# available.
|
35
|
+
# @!attribute [rw] error
|
36
|
+
# @return [Google::Rpc::Status]
|
37
|
+
# The error result of the operation in case of failure or cancellation.
|
38
|
+
# @!attribute [rw] response
|
39
|
+
# @return [Google::Protobuf::Any]
|
40
|
+
# The normal response of the operation in case of success. If the original
|
41
|
+
# method returns no data on success, such as +Delete+, the response is
|
42
|
+
# +google.protobuf.Empty+. If the original method is standard
|
43
|
+
# +Get+/+Create+/+Update+, the response should be the resource. For other
|
44
|
+
# methods, the response should have the type +XxxResponse+, where +Xxx+
|
45
|
+
# is the original method name. For example, if the original method name
|
46
|
+
# is +TakeSnapshot()+, the inferred response type is
|
47
|
+
# +TakeSnapshotResponse+.
|
48
|
+
class Operation; end
|
49
|
+
|
50
|
+
# The request message for {Google::Longrunning::Operations::GetOperation Operations::GetOperation}.
|
51
|
+
# @!attribute [rw] name
|
52
|
+
# @return [String]
|
53
|
+
# The name of the operation resource.
|
54
|
+
class GetOperationRequest; end
|
55
|
+
|
56
|
+
# The request message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
57
|
+
# @!attribute [rw] name
|
58
|
+
# @return [String]
|
59
|
+
# The name of the operation collection.
|
60
|
+
# @!attribute [rw] filter
|
61
|
+
# @return [String]
|
62
|
+
# The standard list filter.
|
63
|
+
# @!attribute [rw] page_size
|
64
|
+
# @return [Integer]
|
65
|
+
# The standard list page size.
|
66
|
+
# @!attribute [rw] page_token
|
67
|
+
# @return [String]
|
68
|
+
# The standard list page token.
|
69
|
+
class ListOperationsRequest; end
|
70
|
+
|
71
|
+
# The response message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
72
|
+
# @!attribute [rw] operations
|
73
|
+
# @return [Array<Google::Longrunning::Operation>]
|
74
|
+
# A list of operations that matches the specified filter in the request.
|
75
|
+
# @!attribute [rw] next_page_token
|
76
|
+
# @return [String]
|
77
|
+
# The standard List next-page token.
|
78
|
+
class ListOperationsResponse; end
|
79
|
+
|
80
|
+
# The request message for {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}.
|
81
|
+
# @!attribute [rw] name
|
82
|
+
# @return [String]
|
83
|
+
# The name of the operation resource to be cancelled.
|
84
|
+
class CancelOperationRequest; end
|
85
|
+
|
86
|
+
# The request message for {Google::Longrunning::Operations::DeleteOperation Operations::DeleteOperation}.
|
87
|
+
# @!attribute [rw] name
|
88
|
+
# @return [String]
|
89
|
+
# The name of the operation resource to be deleted.
|
90
|
+
class DeleteOperationRequest; end
|
91
|
+
end
|
92
|
+
end
|
@@ -12,19 +12,17 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require "googleauth"
|
16
|
-
|
17
15
|
module Google
|
18
|
-
module
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
16
|
+
module Protobuf
|
17
|
+
# A generic empty message that you can re-use to avoid defining duplicated
|
18
|
+
# empty messages in your APIs. A typical example is to use it as the request
|
19
|
+
# or the response type of an API method. For instance:
|
20
|
+
#
|
21
|
+
# service Foo {
|
22
|
+
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
23
|
+
# }
|
24
|
+
#
|
25
|
+
# The JSON representation for +Empty+ is empty JSON object +{}+.
|
26
|
+
class Empty; end
|
29
27
|
end
|
30
|
-
end
|
28
|
+
end
|
@@ -30,7 +30,7 @@ module Google
|
|
30
30
|
#
|
31
31
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
32
32
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
33
|
-
# 3. [Enable the Dialogflow API.](https://console.cloud.google.com/apis/
|
33
|
+
# 3. [Enable the Dialogflow API.](https://console.cloud.google.com/apis/library/dialogflow.googleapis.com)
|
34
34
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
35
35
|
#
|
36
36
|
# ### Installation
|
@@ -46,6 +46,31 @@ module Google
|
|
46
46
|
#
|
47
47
|
# [Product Documentation]: https://cloud.google.com/dialogflow
|
48
48
|
#
|
49
|
+
# ## Enabling Logging
|
50
|
+
#
|
51
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
52
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
53
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
54
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
55
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
56
|
+
#
|
57
|
+
# Configuring a Ruby stdlib logger:
|
58
|
+
#
|
59
|
+
# ```ruby
|
60
|
+
# require "logger"
|
61
|
+
#
|
62
|
+
# module MyLogger
|
63
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
64
|
+
# def logger
|
65
|
+
# LOGGER
|
66
|
+
# end
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
70
|
+
# module GRPC
|
71
|
+
# extend MyLogger
|
72
|
+
# end
|
73
|
+
# ```
|
49
74
|
#
|
50
75
|
module Dialogflow
|
51
76
|
module V2
|
@@ -27,7 +27,7 @@ require "google/gax/operation"
|
|
27
27
|
require "google/longrunning/operations_client"
|
28
28
|
|
29
29
|
require "google/cloud/dialogflow/v2/entity_type_pb"
|
30
|
-
require "google/cloud/dialogflow/credentials"
|
30
|
+
require "google/cloud/dialogflow/v2/credentials"
|
31
31
|
|
32
32
|
module Google
|
33
33
|
module Cloud
|
@@ -72,6 +72,9 @@ module Google
|
|
72
72
|
# The default port of the service.
|
73
73
|
DEFAULT_SERVICE_PORT = 443
|
74
74
|
|
75
|
+
# The default set of gRPC interceptors.
|
76
|
+
GRPC_INTERCEPTORS = []
|
77
|
+
|
75
78
|
DEFAULT_TIMEOUT = 30
|
76
79
|
|
77
80
|
PAGE_DESCRIPTORS = {
|
@@ -89,8 +92,10 @@ module Google
|
|
89
92
|
"https://www.googleapis.com/auth/cloud-platform"
|
90
93
|
].freeze
|
91
94
|
|
95
|
+
# @private
|
92
96
|
class OperationsClient < Google::Longrunning::OperationsClient
|
93
97
|
self::SERVICE_ADDRESS = EntityTypesClient::SERVICE_ADDRESS
|
98
|
+
self::GRPC_INTERCEPTORS = EntityTypesClient::GRPC_INTERCEPTORS
|
94
99
|
end
|
95
100
|
|
96
101
|
PROJECT_AGENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
@@ -149,11 +154,18 @@ module Google
|
|
149
154
|
# or the specified config is missing data points.
|
150
155
|
# @param timeout [Numeric]
|
151
156
|
# The default timeout, in seconds, for calls made through this client.
|
157
|
+
# @param metadata [Hash]
|
158
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
159
|
+
# @param exception_transformer [Proc]
|
160
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
161
|
+
# custom error handling.
|
152
162
|
def initialize \
|
153
163
|
credentials: nil,
|
154
164
|
scopes: ALL_SCOPES,
|
155
165
|
client_config: {},
|
156
166
|
timeout: DEFAULT_TIMEOUT,
|
167
|
+
metadata: nil,
|
168
|
+
exception_transformer: nil,
|
157
169
|
lib_name: nil,
|
158
170
|
lib_version: ""
|
159
171
|
# These require statements are intentionally placed here to initialize
|
@@ -162,7 +174,7 @@ module Google
|
|
162
174
|
require "google/gax/grpc"
|
163
175
|
require "google/cloud/dialogflow/v2/entity_type_services_pb"
|
164
176
|
|
165
|
-
credentials ||= Google::Cloud::Dialogflow::Credentials.default
|
177
|
+
credentials ||= Google::Cloud::Dialogflow::V2::Credentials.default
|
166
178
|
|
167
179
|
@operations_client = OperationsClient.new(
|
168
180
|
credentials: credentials,
|
@@ -174,7 +186,7 @@ module Google
|
|
174
186
|
)
|
175
187
|
|
176
188
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
177
|
-
updater_proc = Google::Cloud::Dialogflow::Credentials.new(credentials).updater_proc
|
189
|
+
updater_proc = Google::Cloud::Dialogflow::V2::Credentials.new(credentials).updater_proc
|
178
190
|
end
|
179
191
|
if credentials.is_a?(GRPC::Core::Channel)
|
180
192
|
channel = credentials
|
@@ -198,6 +210,7 @@ module Google
|
|
198
210
|
google_api_client.freeze
|
199
211
|
|
200
212
|
headers = { :"x-goog-api-client" => google_api_client }
|
213
|
+
headers.merge!(metadata) unless metadata.nil?
|
201
214
|
client_config_file = Pathname.new(__dir__).join(
|
202
215
|
"entity_types_client_config.json"
|
203
216
|
)
|
@@ -210,13 +223,14 @@ module Google
|
|
210
223
|
timeout,
|
211
224
|
page_descriptors: PAGE_DESCRIPTORS,
|
212
225
|
errors: Google::Gax::Grpc::API_ERRORS,
|
213
|
-
|
226
|
+
metadata: headers
|
214
227
|
)
|
215
228
|
end
|
216
229
|
|
217
230
|
# Allow overriding the service path/port in subclasses.
|
218
231
|
service_path = self.class::SERVICE_ADDRESS
|
219
232
|
port = self.class::DEFAULT_SERVICE_PORT
|
233
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
220
234
|
@entity_types_stub = Google::Gax::Grpc.create_stub(
|
221
235
|
service_path,
|
222
236
|
port,
|
@@ -224,48 +238,59 @@ module Google
|
|
224
238
|
channel: channel,
|
225
239
|
updater_proc: updater_proc,
|
226
240
|
scopes: scopes,
|
241
|
+
interceptors: interceptors,
|
227
242
|
&Google::Cloud::Dialogflow::V2::EntityTypes::Stub.method(:new)
|
228
243
|
)
|
229
244
|
|
230
245
|
@list_entity_types = Google::Gax.create_api_call(
|
231
246
|
@entity_types_stub.method(:list_entity_types),
|
232
|
-
defaults["list_entity_types"]
|
247
|
+
defaults["list_entity_types"],
|
248
|
+
exception_transformer: exception_transformer
|
233
249
|
)
|
234
250
|
@get_entity_type = Google::Gax.create_api_call(
|
235
251
|
@entity_types_stub.method(:get_entity_type),
|
236
|
-
defaults["get_entity_type"]
|
252
|
+
defaults["get_entity_type"],
|
253
|
+
exception_transformer: exception_transformer
|
237
254
|
)
|
238
255
|
@create_entity_type = Google::Gax.create_api_call(
|
239
256
|
@entity_types_stub.method(:create_entity_type),
|
240
|
-
defaults["create_entity_type"]
|
257
|
+
defaults["create_entity_type"],
|
258
|
+
exception_transformer: exception_transformer
|
241
259
|
)
|
242
260
|
@update_entity_type = Google::Gax.create_api_call(
|
243
261
|
@entity_types_stub.method(:update_entity_type),
|
244
|
-
defaults["update_entity_type"]
|
262
|
+
defaults["update_entity_type"],
|
263
|
+
exception_transformer: exception_transformer
|
245
264
|
)
|
246
265
|
@delete_entity_type = Google::Gax.create_api_call(
|
247
266
|
@entity_types_stub.method(:delete_entity_type),
|
248
|
-
defaults["delete_entity_type"]
|
267
|
+
defaults["delete_entity_type"],
|
268
|
+
exception_transformer: exception_transformer
|
249
269
|
)
|
250
270
|
@batch_update_entity_types = Google::Gax.create_api_call(
|
251
271
|
@entity_types_stub.method(:batch_update_entity_types),
|
252
|
-
defaults["batch_update_entity_types"]
|
272
|
+
defaults["batch_update_entity_types"],
|
273
|
+
exception_transformer: exception_transformer
|
253
274
|
)
|
254
275
|
@batch_delete_entity_types = Google::Gax.create_api_call(
|
255
276
|
@entity_types_stub.method(:batch_delete_entity_types),
|
256
|
-
defaults["batch_delete_entity_types"]
|
277
|
+
defaults["batch_delete_entity_types"],
|
278
|
+
exception_transformer: exception_transformer
|
257
279
|
)
|
258
280
|
@batch_create_entities = Google::Gax.create_api_call(
|
259
281
|
@entity_types_stub.method(:batch_create_entities),
|
260
|
-
defaults["batch_create_entities"]
|
282
|
+
defaults["batch_create_entities"],
|
283
|
+
exception_transformer: exception_transformer
|
261
284
|
)
|
262
285
|
@batch_update_entities = Google::Gax.create_api_call(
|
263
286
|
@entity_types_stub.method(:batch_update_entities),
|
264
|
-
defaults["batch_update_entities"]
|
287
|
+
defaults["batch_update_entities"],
|
288
|
+
exception_transformer: exception_transformer
|
265
289
|
)
|
266
290
|
@batch_delete_entities = Google::Gax.create_api_call(
|
267
291
|
@entity_types_stub.method(:batch_delete_entities),
|
268
|
-
defaults["batch_delete_entities"]
|
292
|
+
defaults["batch_delete_entities"],
|
293
|
+
exception_transformer: exception_transformer
|
269
294
|
)
|
270
295
|
end
|
271
296
|
|
@@ -291,6 +316,9 @@ module Google
|
|
291
316
|
# @param options [Google::Gax::CallOptions]
|
292
317
|
# Overrides the default settings for this call, e.g, timeout,
|
293
318
|
# retries, etc.
|
319
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
320
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::EntityType>]
|
321
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
294
322
|
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::EntityType>]
|
295
323
|
# An enumerable of Google::Cloud::Dialogflow::V2::EntityType instances.
|
296
324
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -298,9 +326,9 @@ module Google
|
|
298
326
|
# object.
|
299
327
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
300
328
|
# @example
|
301
|
-
# require "google/cloud/dialogflow
|
329
|
+
# require "google/cloud/dialogflow"
|
302
330
|
#
|
303
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
331
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
304
332
|
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
305
333
|
#
|
306
334
|
# # Iterate over all results.
|
@@ -320,14 +348,15 @@ module Google
|
|
320
348
|
parent,
|
321
349
|
language_code: nil,
|
322
350
|
page_size: nil,
|
323
|
-
options: nil
|
351
|
+
options: nil,
|
352
|
+
&block
|
324
353
|
req = {
|
325
354
|
parent: parent,
|
326
355
|
language_code: language_code,
|
327
356
|
page_size: page_size
|
328
357
|
}.delete_if { |_, v| v.nil? }
|
329
358
|
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ListEntityTypesRequest)
|
330
|
-
@list_entity_types.call(req, options)
|
359
|
+
@list_entity_types.call(req, options, &block)
|
331
360
|
end
|
332
361
|
|
333
362
|
# Retrieves the specified entity type.
|
@@ -344,25 +373,29 @@ module Google
|
|
344
373
|
# @param options [Google::Gax::CallOptions]
|
345
374
|
# Overrides the default settings for this call, e.g, timeout,
|
346
375
|
# retries, etc.
|
376
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
377
|
+
# @yieldparam result [Google::Cloud::Dialogflow::V2::EntityType]
|
378
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
347
379
|
# @return [Google::Cloud::Dialogflow::V2::EntityType]
|
348
380
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
349
381
|
# @example
|
350
|
-
# require "google/cloud/dialogflow
|
382
|
+
# require "google/cloud/dialogflow"
|
351
383
|
#
|
352
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
384
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
353
385
|
# formatted_name = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
354
386
|
# response = entity_types_client.get_entity_type(formatted_name)
|
355
387
|
|
356
388
|
def get_entity_type \
|
357
389
|
name,
|
358
390
|
language_code: nil,
|
359
|
-
options: nil
|
391
|
+
options: nil,
|
392
|
+
&block
|
360
393
|
req = {
|
361
394
|
name: name,
|
362
395
|
language_code: language_code
|
363
396
|
}.delete_if { |_, v| v.nil? }
|
364
397
|
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetEntityTypeRequest)
|
365
|
-
@get_entity_type.call(req, options)
|
398
|
+
@get_entity_type.call(req, options, &block)
|
366
399
|
end
|
367
400
|
|
368
401
|
# Creates an entity type in the specified agent.
|
@@ -383,12 +416,15 @@ module Google
|
|
383
416
|
# @param options [Google::Gax::CallOptions]
|
384
417
|
# Overrides the default settings for this call, e.g, timeout,
|
385
418
|
# retries, etc.
|
419
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
420
|
+
# @yieldparam result [Google::Cloud::Dialogflow::V2::EntityType]
|
421
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
386
422
|
# @return [Google::Cloud::Dialogflow::V2::EntityType]
|
387
423
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
388
424
|
# @example
|
389
|
-
# require "google/cloud/dialogflow
|
425
|
+
# require "google/cloud/dialogflow"
|
390
426
|
#
|
391
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
427
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
392
428
|
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
393
429
|
#
|
394
430
|
# # TODO: Initialize +entity_type+:
|
@@ -399,14 +435,15 @@ module Google
|
|
399
435
|
parent,
|
400
436
|
entity_type,
|
401
437
|
language_code: nil,
|
402
|
-
options: nil
|
438
|
+
options: nil,
|
439
|
+
&block
|
403
440
|
req = {
|
404
441
|
parent: parent,
|
405
442
|
entity_type: entity_type,
|
406
443
|
language_code: language_code
|
407
444
|
}.delete_if { |_, v| v.nil? }
|
408
445
|
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::CreateEntityTypeRequest)
|
409
|
-
@create_entity_type.call(req, options)
|
446
|
+
@create_entity_type.call(req, options, &block)
|
410
447
|
end
|
411
448
|
|
412
449
|
# Updates the specified entity type.
|
@@ -429,12 +466,15 @@ module Google
|
|
429
466
|
# @param options [Google::Gax::CallOptions]
|
430
467
|
# Overrides the default settings for this call, e.g, timeout,
|
431
468
|
# retries, etc.
|
469
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
470
|
+
# @yieldparam result [Google::Cloud::Dialogflow::V2::EntityType]
|
471
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
432
472
|
# @return [Google::Cloud::Dialogflow::V2::EntityType]
|
433
473
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
434
474
|
# @example
|
435
|
-
# require "google/cloud/dialogflow
|
475
|
+
# require "google/cloud/dialogflow"
|
436
476
|
#
|
437
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
477
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
438
478
|
#
|
439
479
|
# # TODO: Initialize +entity_type+:
|
440
480
|
# entity_type = {}
|
@@ -444,14 +484,15 @@ module Google
|
|
444
484
|
entity_type,
|
445
485
|
language_code: nil,
|
446
486
|
update_mask: nil,
|
447
|
-
options: nil
|
487
|
+
options: nil,
|
488
|
+
&block
|
448
489
|
req = {
|
449
490
|
entity_type: entity_type,
|
450
491
|
language_code: language_code,
|
451
492
|
update_mask: update_mask
|
452
493
|
}.delete_if { |_, v| v.nil? }
|
453
494
|
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::UpdateEntityTypeRequest)
|
454
|
-
@update_entity_type.call(req, options)
|
495
|
+
@update_entity_type.call(req, options, &block)
|
455
496
|
end
|
456
497
|
|
457
498
|
# Deletes the specified entity type.
|
@@ -462,22 +503,26 @@ module Google
|
|
462
503
|
# @param options [Google::Gax::CallOptions]
|
463
504
|
# Overrides the default settings for this call, e.g, timeout,
|
464
505
|
# retries, etc.
|
506
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
507
|
+
# @yieldparam result []
|
508
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
465
509
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
466
510
|
# @example
|
467
|
-
# require "google/cloud/dialogflow
|
511
|
+
# require "google/cloud/dialogflow"
|
468
512
|
#
|
469
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
513
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
470
514
|
# formatted_name = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
471
515
|
# entity_types_client.delete_entity_type(formatted_name)
|
472
516
|
|
473
517
|
def delete_entity_type \
|
474
518
|
name,
|
475
|
-
options: nil
|
519
|
+
options: nil,
|
520
|
+
&block
|
476
521
|
req = {
|
477
522
|
name: name
|
478
523
|
}.delete_if { |_, v| v.nil? }
|
479
524
|
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteEntityTypeRequest)
|
480
|
-
@delete_entity_type.call(req, options)
|
525
|
+
@delete_entity_type.call(req, options, &block)
|
481
526
|
nil
|
482
527
|
end
|
483
528
|
|
@@ -514,9 +559,9 @@ module Google
|
|
514
559
|
# @return [Google::Gax::Operation]
|
515
560
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
516
561
|
# @example
|
517
|
-
# require "google/cloud/dialogflow
|
562
|
+
# require "google/cloud/dialogflow"
|
518
563
|
#
|
519
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
564
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
520
565
|
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
521
566
|
#
|
522
567
|
# # Register a callback during the method call.
|
@@ -589,9 +634,9 @@ module Google
|
|
589
634
|
# @return [Google::Gax::Operation]
|
590
635
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
591
636
|
# @example
|
592
|
-
# require "google/cloud/dialogflow
|
637
|
+
# require "google/cloud/dialogflow"
|
593
638
|
#
|
594
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
639
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
595
640
|
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
596
641
|
#
|
597
642
|
# # TODO: Initialize +entity_type_names+:
|
@@ -668,9 +713,9 @@ module Google
|
|
668
713
|
# @return [Google::Gax::Operation]
|
669
714
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
670
715
|
# @example
|
671
|
-
# require "google/cloud/dialogflow
|
716
|
+
# require "google/cloud/dialogflow"
|
672
717
|
#
|
673
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
718
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
674
719
|
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
675
720
|
#
|
676
721
|
# # TODO: Initialize +entities+:
|
@@ -754,9 +799,9 @@ module Google
|
|
754
799
|
# @return [Google::Gax::Operation]
|
755
800
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
756
801
|
# @example
|
757
|
-
# require "google/cloud/dialogflow
|
802
|
+
# require "google/cloud/dialogflow"
|
758
803
|
#
|
759
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
804
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
760
805
|
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
761
806
|
#
|
762
807
|
# # TODO: Initialize +entities+:
|
@@ -837,9 +882,9 @@ module Google
|
|
837
882
|
# @return [Google::Gax::Operation]
|
838
883
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
839
884
|
# @example
|
840
|
-
# require "google/cloud/dialogflow
|
885
|
+
# require "google/cloud/dialogflow"
|
841
886
|
#
|
842
|
-
# entity_types_client = Google::Cloud::Dialogflow::
|
887
|
+
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
843
888
|
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
844
889
|
#
|
845
890
|
# # TODO: Initialize +entity_values+:
|