google-cloud-dialogflow 0.15.0 → 1.0.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 +2 -1
- data/AUTHENTICATION.md +51 -59
- data/LICENSE.md +203 -0
- data/MIGRATING.md +397 -0
- data/README.md +35 -25
- data/lib/{google/cloud/dialogflow/v2/doc/google/protobuf/empty.rb → google-cloud-dialogflow.rb} +4 -14
- data/lib/google/cloud/dialogflow.rb +368 -506
- data/lib/google/cloud/dialogflow/version.rb +1 -1
- metadata +88 -83
- data/LICENSE +0 -201
- data/lib/google/cloud/dialogflow/v2.rb +0 -598
- data/lib/google/cloud/dialogflow/v2/agent_pb.rb +0 -121
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +0 -111
- data/lib/google/cloud/dialogflow/v2/agents_client.rb +0 -810
- data/lib/google/cloud/dialogflow/v2/agents_client_config.json +0 -71
- data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -96
- data/lib/google/cloud/dialogflow/v2/context_pb.rb +0 -63
- data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +0 -75
- data/lib/google/cloud/dialogflow/v2/contexts_client.rb +0 -522
- data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +0 -56
- data/lib/google/cloud/dialogflow/v2/credentials.rb +0 -42
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +0 -247
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/audio_config.rb +0 -341
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +0 -116
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +0 -305
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +0 -937
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +0 -498
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +0 -130
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/validation_result.rb +0 -71
- data/lib/google/cloud/dialogflow/v2/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +0 -31
- data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +0 -125
- data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +0 -105
- data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +0 -997
- data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +0 -76
- data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -367
- data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +0 -93
- data/lib/google/cloud/dialogflow/v2/intents_client.rb +0 -763
- data/lib/google/cloud/dialogflow/v2/intents_client_config.json +0 -61
- data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +0 -65
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +0 -93
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +0 -507
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +0 -51
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -141
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +0 -56
- data/lib/google/cloud/dialogflow/v2/sessions_client.rb +0 -340
- data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +0 -36
- data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -36
- data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -46
@@ -1,105 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# Source: google/cloud/dialogflow/v2/entity_type.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
|
-
|
20
|
-
require 'grpc'
|
21
|
-
require 'google/cloud/dialogflow/v2/entity_type_pb'
|
22
|
-
|
23
|
-
module Google
|
24
|
-
module Cloud
|
25
|
-
module Dialogflow
|
26
|
-
module V2
|
27
|
-
module EntityTypes
|
28
|
-
# Entities are extracted from user input and represent parameters that are
|
29
|
-
# meaningful to your application. For example, a date range, a proper name
|
30
|
-
# such as a geographic location or landmark, and so on. Entities represent
|
31
|
-
# actionable data for your application.
|
32
|
-
#
|
33
|
-
# When you define an entity, you can also include synonyms that all map to
|
34
|
-
# that entity. For example, "soft drink", "soda", "pop", and so on.
|
35
|
-
#
|
36
|
-
# There are three types of entities:
|
37
|
-
#
|
38
|
-
# * **System** - entities that are defined by the Dialogflow API for common
|
39
|
-
# data types such as date, time, currency, and so on. A system entity is
|
40
|
-
# represented by the `EntityType` type.
|
41
|
-
#
|
42
|
-
# * **Custom** - entities that are defined by you that represent
|
43
|
-
# actionable data that is meaningful to your application. For example,
|
44
|
-
# you could define a `pizza.sauce` entity for red or white pizza sauce,
|
45
|
-
# a `pizza.cheese` entity for the different types of cheese on a pizza,
|
46
|
-
# a `pizza.topping` entity for different toppings, and so on. A custom
|
47
|
-
# entity is represented by the `EntityType` type.
|
48
|
-
#
|
49
|
-
# * **User** - entities that are built for an individual user such as
|
50
|
-
# favorites, preferences, playlists, and so on. A user entity is
|
51
|
-
# represented by the [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] type.
|
52
|
-
#
|
53
|
-
# For more information about entity types, see the
|
54
|
-
# [Dialogflow
|
55
|
-
# documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
|
56
|
-
class Service
|
57
|
-
|
58
|
-
include GRPC::GenericService
|
59
|
-
|
60
|
-
self.marshal_class_method = :encode
|
61
|
-
self.unmarshal_class_method = :decode
|
62
|
-
self.service_name = 'google.cloud.dialogflow.v2.EntityTypes'
|
63
|
-
|
64
|
-
# Returns the list of all entity types in the specified agent.
|
65
|
-
rpc :ListEntityTypes, ListEntityTypesRequest, ListEntityTypesResponse
|
66
|
-
# Retrieves the specified entity type.
|
67
|
-
rpc :GetEntityType, GetEntityTypeRequest, EntityType
|
68
|
-
# Creates an entity type in the specified agent.
|
69
|
-
rpc :CreateEntityType, CreateEntityTypeRequest, EntityType
|
70
|
-
# Updates the specified entity type.
|
71
|
-
rpc :UpdateEntityType, UpdateEntityTypeRequest, EntityType
|
72
|
-
# Deletes the specified entity type.
|
73
|
-
rpc :DeleteEntityType, DeleteEntityTypeRequest, Google::Protobuf::Empty
|
74
|
-
# Updates/Creates multiple entity types in the specified agent.
|
75
|
-
#
|
76
|
-
# Operation <response: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]>
|
77
|
-
rpc :BatchUpdateEntityTypes, BatchUpdateEntityTypesRequest, Google::Longrunning::Operation
|
78
|
-
# Deletes entity types in the specified agent.
|
79
|
-
#
|
80
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
81
|
-
rpc :BatchDeleteEntityTypes, BatchDeleteEntityTypesRequest, Google::Longrunning::Operation
|
82
|
-
# Creates multiple new entities in the specified entity type.
|
83
|
-
#
|
84
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
85
|
-
rpc :BatchCreateEntities, BatchCreateEntitiesRequest, Google::Longrunning::Operation
|
86
|
-
# Updates or creates multiple entities in the specified entity type. This
|
87
|
-
# method does not affect entities in the entity type that aren't explicitly
|
88
|
-
# specified in the request.
|
89
|
-
#
|
90
|
-
#
|
91
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
92
|
-
rpc :BatchUpdateEntities, BatchUpdateEntitiesRequest, Google::Longrunning::Operation
|
93
|
-
# Deletes entities in the specified entity type.
|
94
|
-
#
|
95
|
-
#
|
96
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
97
|
-
rpc :BatchDeleteEntities, BatchDeleteEntitiesRequest, Google::Longrunning::Operation
|
98
|
-
end
|
99
|
-
|
100
|
-
Stub = Service.rpc_stub_class
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
@@ -1,997 +0,0 @@
|
|
1
|
-
# Copyright 2020 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
|
-
# EDITING INSTRUCTIONS
|
16
|
-
# This file was generated from the file
|
17
|
-
# https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/entity_type.proto,
|
18
|
-
# and updates to that file get reflected here through a refresh process.
|
19
|
-
# For the short term, the refresh process will only be runnable by Google
|
20
|
-
# engineers.
|
21
|
-
|
22
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
require "google/gax/operation"
|
28
|
-
require "google/longrunning/operations_client"
|
29
|
-
|
30
|
-
require "google/cloud/dialogflow/v2/entity_type_pb"
|
31
|
-
require "google/cloud/dialogflow/v2/credentials"
|
32
|
-
require "google/cloud/dialogflow/version"
|
33
|
-
|
34
|
-
module Google
|
35
|
-
module Cloud
|
36
|
-
module Dialogflow
|
37
|
-
module V2
|
38
|
-
# Entities are extracted from user input and represent parameters that are
|
39
|
-
# meaningful to your application. For example, a date range, a proper name
|
40
|
-
# such as a geographic location or landmark, and so on. Entities represent
|
41
|
-
# actionable data for your application.
|
42
|
-
#
|
43
|
-
# When you define an entity, you can also include synonyms that all map to
|
44
|
-
# that entity. For example, "soft drink", "soda", "pop", and so on.
|
45
|
-
#
|
46
|
-
# There are three types of entities:
|
47
|
-
#
|
48
|
-
# * **System** - entities that are defined by the Dialogflow API for common
|
49
|
-
# data types such as date, time, currency, and so on. A system entity is
|
50
|
-
# represented by the `EntityType` type.
|
51
|
-
#
|
52
|
-
# * **Custom** - entities that are defined by you that represent
|
53
|
-
# actionable data that is meaningful to your application. For example,
|
54
|
-
# you could define a `pizza.sauce` entity for red or white pizza sauce,
|
55
|
-
# a `pizza.cheese` entity for the different types of cheese on a pizza,
|
56
|
-
# a `pizza.topping` entity for different toppings, and so on. A custom
|
57
|
-
# entity is represented by the `EntityType` type.
|
58
|
-
#
|
59
|
-
# * **User** - entities that are built for an individual user such as
|
60
|
-
# favorites, preferences, playlists, and so on. A user entity is
|
61
|
-
# represented by the {Google::Cloud::Dialogflow::V2::SessionEntityType SessionEntityType} type.
|
62
|
-
#
|
63
|
-
# For more information about entity types, see the
|
64
|
-
# [Dialogflow
|
65
|
-
# documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
|
66
|
-
#
|
67
|
-
# @!attribute [r] entity_types_stub
|
68
|
-
# @return [Google::Cloud::Dialogflow::V2::EntityTypes::Stub]
|
69
|
-
class EntityTypesClient
|
70
|
-
# @private
|
71
|
-
attr_reader :entity_types_stub
|
72
|
-
|
73
|
-
# The default address of the service.
|
74
|
-
SERVICE_ADDRESS = "dialogflow.googleapis.com".freeze
|
75
|
-
|
76
|
-
# The default port of the service.
|
77
|
-
DEFAULT_SERVICE_PORT = 443
|
78
|
-
|
79
|
-
# The default set of gRPC interceptors.
|
80
|
-
GRPC_INTERCEPTORS = []
|
81
|
-
|
82
|
-
DEFAULT_TIMEOUT = 30
|
83
|
-
|
84
|
-
PAGE_DESCRIPTORS = {
|
85
|
-
"list_entity_types" => Google::Gax::PageDescriptor.new(
|
86
|
-
"page_token",
|
87
|
-
"next_page_token",
|
88
|
-
"entity_types")
|
89
|
-
}.freeze
|
90
|
-
|
91
|
-
private_constant :PAGE_DESCRIPTORS
|
92
|
-
|
93
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
94
|
-
# this service.
|
95
|
-
ALL_SCOPES = [
|
96
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
97
|
-
"https://www.googleapis.com/auth/dialogflow"
|
98
|
-
].freeze
|
99
|
-
|
100
|
-
# @private
|
101
|
-
class OperationsClient < Google::Longrunning::OperationsClient
|
102
|
-
self::SERVICE_ADDRESS = EntityTypesClient::SERVICE_ADDRESS
|
103
|
-
self::GRPC_INTERCEPTORS = EntityTypesClient::GRPC_INTERCEPTORS
|
104
|
-
end
|
105
|
-
|
106
|
-
ENTITY_TYPE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
107
|
-
"projects/{project}/agent/entityTypes/{entity_type}"
|
108
|
-
)
|
109
|
-
|
110
|
-
private_constant :ENTITY_TYPE_PATH_TEMPLATE
|
111
|
-
|
112
|
-
PROJECT_AGENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
113
|
-
"projects/{project}/agent"
|
114
|
-
)
|
115
|
-
|
116
|
-
private_constant :PROJECT_AGENT_PATH_TEMPLATE
|
117
|
-
|
118
|
-
# Returns a fully-qualified entity_type resource name string.
|
119
|
-
# @param project [String]
|
120
|
-
# @param entity_type [String]
|
121
|
-
# @return [String]
|
122
|
-
def self.entity_type_path project, entity_type
|
123
|
-
ENTITY_TYPE_PATH_TEMPLATE.render(
|
124
|
-
:"project" => project,
|
125
|
-
:"entity_type" => entity_type
|
126
|
-
)
|
127
|
-
end
|
128
|
-
|
129
|
-
# Returns a fully-qualified project_agent resource name string.
|
130
|
-
# @param project [String]
|
131
|
-
# @return [String]
|
132
|
-
def self.project_agent_path project
|
133
|
-
PROJECT_AGENT_PATH_TEMPLATE.render(
|
134
|
-
:"project" => project
|
135
|
-
)
|
136
|
-
end
|
137
|
-
|
138
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
139
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
140
|
-
# be many types.
|
141
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
142
|
-
# authenticating requests made by this client.
|
143
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
144
|
-
# credentials for this client.
|
145
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
146
|
-
# credentials for this client.
|
147
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
148
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
149
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
150
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
151
|
-
# metadata for requests, generally, to give OAuth credentials.
|
152
|
-
# @param scopes [Array<String>]
|
153
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
154
|
-
# an updater_proc is supplied.
|
155
|
-
# @param client_config [Hash]
|
156
|
-
# A Hash for call options for each method. See
|
157
|
-
# Google::Gax#construct_settings for the structure of
|
158
|
-
# this data. Falls back to the default config if not specified
|
159
|
-
# or the specified config is missing data points.
|
160
|
-
# @param timeout [Numeric]
|
161
|
-
# The default timeout, in seconds, for calls made through this client.
|
162
|
-
# @param metadata [Hash]
|
163
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
164
|
-
# @param service_address [String]
|
165
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
166
|
-
# @param service_port [Integer]
|
167
|
-
# Override for the service port, or `nil` to leave as the default.
|
168
|
-
# @param exception_transformer [Proc]
|
169
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
170
|
-
# custom error handling.
|
171
|
-
def initialize \
|
172
|
-
credentials: nil,
|
173
|
-
scopes: ALL_SCOPES,
|
174
|
-
client_config: {},
|
175
|
-
timeout: DEFAULT_TIMEOUT,
|
176
|
-
metadata: nil,
|
177
|
-
service_address: nil,
|
178
|
-
service_port: nil,
|
179
|
-
exception_transformer: nil,
|
180
|
-
lib_name: nil,
|
181
|
-
lib_version: ""
|
182
|
-
# These require statements are intentionally placed here to initialize
|
183
|
-
# the gRPC module only when it's required.
|
184
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
185
|
-
require "google/gax/grpc"
|
186
|
-
require "google/cloud/dialogflow/v2/entity_type_services_pb"
|
187
|
-
|
188
|
-
credentials ||= Google::Cloud::Dialogflow::V2::Credentials.default
|
189
|
-
|
190
|
-
@operations_client = OperationsClient.new(
|
191
|
-
credentials: credentials,
|
192
|
-
scopes: scopes,
|
193
|
-
client_config: client_config,
|
194
|
-
timeout: timeout,
|
195
|
-
lib_name: lib_name,
|
196
|
-
service_address: service_address,
|
197
|
-
service_port: service_port,
|
198
|
-
lib_version: lib_version,
|
199
|
-
metadata: metadata,
|
200
|
-
)
|
201
|
-
|
202
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
203
|
-
updater_proc = Google::Cloud::Dialogflow::V2::Credentials.new(credentials).updater_proc
|
204
|
-
end
|
205
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
206
|
-
channel = credentials
|
207
|
-
end
|
208
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
209
|
-
chan_creds = credentials
|
210
|
-
end
|
211
|
-
if credentials.is_a?(Proc)
|
212
|
-
updater_proc = credentials
|
213
|
-
end
|
214
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
215
|
-
updater_proc = credentials.updater_proc
|
216
|
-
end
|
217
|
-
|
218
|
-
package_version = Google::Cloud::Dialogflow::VERSION
|
219
|
-
|
220
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
221
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
222
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
223
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
224
|
-
google_api_client.freeze
|
225
|
-
|
226
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
227
|
-
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
228
|
-
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
229
|
-
end
|
230
|
-
headers.merge!(metadata) unless metadata.nil?
|
231
|
-
client_config_file = Pathname.new(__dir__).join(
|
232
|
-
"entity_types_client_config.json"
|
233
|
-
)
|
234
|
-
defaults = client_config_file.open do |f|
|
235
|
-
Google::Gax.construct_settings(
|
236
|
-
"google.cloud.dialogflow.v2.EntityTypes",
|
237
|
-
JSON.parse(f.read),
|
238
|
-
client_config,
|
239
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
240
|
-
timeout,
|
241
|
-
page_descriptors: PAGE_DESCRIPTORS,
|
242
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
243
|
-
metadata: headers
|
244
|
-
)
|
245
|
-
end
|
246
|
-
|
247
|
-
# Allow overriding the service path/port in subclasses.
|
248
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
249
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
250
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
251
|
-
@entity_types_stub = Google::Gax::Grpc.create_stub(
|
252
|
-
service_path,
|
253
|
-
port,
|
254
|
-
chan_creds: chan_creds,
|
255
|
-
channel: channel,
|
256
|
-
updater_proc: updater_proc,
|
257
|
-
scopes: scopes,
|
258
|
-
interceptors: interceptors,
|
259
|
-
&Google::Cloud::Dialogflow::V2::EntityTypes::Stub.method(:new)
|
260
|
-
)
|
261
|
-
|
262
|
-
@list_entity_types = Google::Gax.create_api_call(
|
263
|
-
@entity_types_stub.method(:list_entity_types),
|
264
|
-
defaults["list_entity_types"],
|
265
|
-
exception_transformer: exception_transformer,
|
266
|
-
params_extractor: proc do |request|
|
267
|
-
{'parent' => request.parent}
|
268
|
-
end
|
269
|
-
)
|
270
|
-
@get_entity_type = Google::Gax.create_api_call(
|
271
|
-
@entity_types_stub.method(:get_entity_type),
|
272
|
-
defaults["get_entity_type"],
|
273
|
-
exception_transformer: exception_transformer,
|
274
|
-
params_extractor: proc do |request|
|
275
|
-
{'name' => request.name}
|
276
|
-
end
|
277
|
-
)
|
278
|
-
@create_entity_type = Google::Gax.create_api_call(
|
279
|
-
@entity_types_stub.method(:create_entity_type),
|
280
|
-
defaults["create_entity_type"],
|
281
|
-
exception_transformer: exception_transformer,
|
282
|
-
params_extractor: proc do |request|
|
283
|
-
{'parent' => request.parent}
|
284
|
-
end
|
285
|
-
)
|
286
|
-
@update_entity_type = Google::Gax.create_api_call(
|
287
|
-
@entity_types_stub.method(:update_entity_type),
|
288
|
-
defaults["update_entity_type"],
|
289
|
-
exception_transformer: exception_transformer,
|
290
|
-
params_extractor: proc do |request|
|
291
|
-
{'entity_type.name' => request.entity_type.name}
|
292
|
-
end
|
293
|
-
)
|
294
|
-
@delete_entity_type = Google::Gax.create_api_call(
|
295
|
-
@entity_types_stub.method(:delete_entity_type),
|
296
|
-
defaults["delete_entity_type"],
|
297
|
-
exception_transformer: exception_transformer,
|
298
|
-
params_extractor: proc do |request|
|
299
|
-
{'name' => request.name}
|
300
|
-
end
|
301
|
-
)
|
302
|
-
@batch_update_entity_types = Google::Gax.create_api_call(
|
303
|
-
@entity_types_stub.method(:batch_update_entity_types),
|
304
|
-
defaults["batch_update_entity_types"],
|
305
|
-
exception_transformer: exception_transformer,
|
306
|
-
params_extractor: proc do |request|
|
307
|
-
{'parent' => request.parent}
|
308
|
-
end
|
309
|
-
)
|
310
|
-
@batch_delete_entity_types = Google::Gax.create_api_call(
|
311
|
-
@entity_types_stub.method(:batch_delete_entity_types),
|
312
|
-
defaults["batch_delete_entity_types"],
|
313
|
-
exception_transformer: exception_transformer,
|
314
|
-
params_extractor: proc do |request|
|
315
|
-
{'parent' => request.parent}
|
316
|
-
end
|
317
|
-
)
|
318
|
-
@batch_create_entities = Google::Gax.create_api_call(
|
319
|
-
@entity_types_stub.method(:batch_create_entities),
|
320
|
-
defaults["batch_create_entities"],
|
321
|
-
exception_transformer: exception_transformer,
|
322
|
-
params_extractor: proc do |request|
|
323
|
-
{'parent' => request.parent}
|
324
|
-
end
|
325
|
-
)
|
326
|
-
@batch_update_entities = Google::Gax.create_api_call(
|
327
|
-
@entity_types_stub.method(:batch_update_entities),
|
328
|
-
defaults["batch_update_entities"],
|
329
|
-
exception_transformer: exception_transformer,
|
330
|
-
params_extractor: proc do |request|
|
331
|
-
{'parent' => request.parent}
|
332
|
-
end
|
333
|
-
)
|
334
|
-
@batch_delete_entities = Google::Gax.create_api_call(
|
335
|
-
@entity_types_stub.method(:batch_delete_entities),
|
336
|
-
defaults["batch_delete_entities"],
|
337
|
-
exception_transformer: exception_transformer,
|
338
|
-
params_extractor: proc do |request|
|
339
|
-
{'parent' => request.parent}
|
340
|
-
end
|
341
|
-
)
|
342
|
-
end
|
343
|
-
|
344
|
-
# Service calls
|
345
|
-
|
346
|
-
# Returns the list of all entity types in the specified agent.
|
347
|
-
#
|
348
|
-
# @param parent [String]
|
349
|
-
# Required. The agent to list all entity types from.
|
350
|
-
# Format: `projects/<Project ID>/agent`.
|
351
|
-
# @param language_code [String]
|
352
|
-
# Optional. The language to list entity synonyms for. If not specified,
|
353
|
-
# the agent's default language is used.
|
354
|
-
# [Many
|
355
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
356
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
357
|
-
# be used.
|
358
|
-
# @param page_size [Integer]
|
359
|
-
# The maximum number of resources contained in the underlying API
|
360
|
-
# response. If page streaming is performed per-resource, this
|
361
|
-
# parameter does not affect the return value. If page streaming is
|
362
|
-
# performed per-page, this determines the maximum number of
|
363
|
-
# resources in a page.
|
364
|
-
# @param options [Google::Gax::CallOptions]
|
365
|
-
# Overrides the default settings for this call, e.g, timeout,
|
366
|
-
# retries, etc.
|
367
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
368
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::EntityType>]
|
369
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
370
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::EntityType>]
|
371
|
-
# An enumerable of Google::Cloud::Dialogflow::V2::EntityType instances.
|
372
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
373
|
-
# operations such as per-page iteration or access to the response
|
374
|
-
# object.
|
375
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
376
|
-
# @example
|
377
|
-
# require "google/cloud/dialogflow"
|
378
|
-
#
|
379
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
380
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
381
|
-
#
|
382
|
-
# # Iterate over all results.
|
383
|
-
# entity_types_client.list_entity_types(formatted_parent).each do |element|
|
384
|
-
# # Process element.
|
385
|
-
# end
|
386
|
-
#
|
387
|
-
# # Or iterate over results one page at a time.
|
388
|
-
# entity_types_client.list_entity_types(formatted_parent).each_page do |page|
|
389
|
-
# # Process each page at a time.
|
390
|
-
# page.each do |element|
|
391
|
-
# # Process element.
|
392
|
-
# end
|
393
|
-
# end
|
394
|
-
|
395
|
-
def list_entity_types \
|
396
|
-
parent,
|
397
|
-
language_code: nil,
|
398
|
-
page_size: nil,
|
399
|
-
options: nil,
|
400
|
-
&block
|
401
|
-
req = {
|
402
|
-
parent: parent,
|
403
|
-
language_code: language_code,
|
404
|
-
page_size: page_size
|
405
|
-
}.delete_if { |_, v| v.nil? }
|
406
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ListEntityTypesRequest)
|
407
|
-
@list_entity_types.call(req, options, &block)
|
408
|
-
end
|
409
|
-
|
410
|
-
# Retrieves the specified entity type.
|
411
|
-
#
|
412
|
-
# @param name [String]
|
413
|
-
# Required. The name of the entity type.
|
414
|
-
# Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
415
|
-
# @param language_code [String]
|
416
|
-
# Optional. The language to retrieve entity synonyms for. If not specified,
|
417
|
-
# the agent's default language is used.
|
418
|
-
# [Many
|
419
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
420
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
421
|
-
# be used.
|
422
|
-
# @param options [Google::Gax::CallOptions]
|
423
|
-
# Overrides the default settings for this call, e.g, timeout,
|
424
|
-
# retries, etc.
|
425
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
426
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::EntityType]
|
427
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
428
|
-
# @return [Google::Cloud::Dialogflow::V2::EntityType]
|
429
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
430
|
-
# @example
|
431
|
-
# require "google/cloud/dialogflow"
|
432
|
-
#
|
433
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
434
|
-
# formatted_name = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
435
|
-
# response = entity_types_client.get_entity_type(formatted_name)
|
436
|
-
|
437
|
-
def get_entity_type \
|
438
|
-
name,
|
439
|
-
language_code: nil,
|
440
|
-
options: nil,
|
441
|
-
&block
|
442
|
-
req = {
|
443
|
-
name: name,
|
444
|
-
language_code: language_code
|
445
|
-
}.delete_if { |_, v| v.nil? }
|
446
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetEntityTypeRequest)
|
447
|
-
@get_entity_type.call(req, options, &block)
|
448
|
-
end
|
449
|
-
|
450
|
-
# Creates an entity type in the specified agent.
|
451
|
-
#
|
452
|
-
# @param parent [String]
|
453
|
-
# Required. The agent to create a entity type for.
|
454
|
-
# Format: `projects/<Project ID>/agent`.
|
455
|
-
# @param entity_type [Google::Cloud::Dialogflow::V2::EntityType | Hash]
|
456
|
-
# Required. The entity type to create.
|
457
|
-
# A hash of the same form as `Google::Cloud::Dialogflow::V2::EntityType`
|
458
|
-
# can also be provided.
|
459
|
-
# @param language_code [String]
|
460
|
-
# Optional. The language of entity synonyms defined in `entity_type`. If not
|
461
|
-
# specified, the agent's default language is used.
|
462
|
-
# [Many
|
463
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
464
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
465
|
-
# be used.
|
466
|
-
# @param options [Google::Gax::CallOptions]
|
467
|
-
# Overrides the default settings for this call, e.g, timeout,
|
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]
|
472
|
-
# @return [Google::Cloud::Dialogflow::V2::EntityType]
|
473
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
474
|
-
# @example
|
475
|
-
# require "google/cloud/dialogflow"
|
476
|
-
#
|
477
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
478
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
479
|
-
#
|
480
|
-
# # TODO: Initialize `entity_type`:
|
481
|
-
# entity_type = {}
|
482
|
-
# response = entity_types_client.create_entity_type(formatted_parent, entity_type)
|
483
|
-
|
484
|
-
def create_entity_type \
|
485
|
-
parent,
|
486
|
-
entity_type,
|
487
|
-
language_code: nil,
|
488
|
-
options: nil,
|
489
|
-
&block
|
490
|
-
req = {
|
491
|
-
parent: parent,
|
492
|
-
entity_type: entity_type,
|
493
|
-
language_code: language_code
|
494
|
-
}.delete_if { |_, v| v.nil? }
|
495
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::CreateEntityTypeRequest)
|
496
|
-
@create_entity_type.call(req, options, &block)
|
497
|
-
end
|
498
|
-
|
499
|
-
# Updates the specified entity type.
|
500
|
-
#
|
501
|
-
# @param entity_type [Google::Cloud::Dialogflow::V2::EntityType | Hash]
|
502
|
-
# Required. The entity type to update.
|
503
|
-
# A hash of the same form as `Google::Cloud::Dialogflow::V2::EntityType`
|
504
|
-
# can also be provided.
|
505
|
-
# @param language_code [String]
|
506
|
-
# Optional. The language of entity synonyms defined in `entity_type`. If not
|
507
|
-
# specified, the agent's default language is used.
|
508
|
-
# [Many
|
509
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
510
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
511
|
-
# be used.
|
512
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
513
|
-
# Optional. The mask to control which fields get updated.
|
514
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
515
|
-
# can also be provided.
|
516
|
-
# @param options [Google::Gax::CallOptions]
|
517
|
-
# Overrides the default settings for this call, e.g, timeout,
|
518
|
-
# retries, etc.
|
519
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
520
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::EntityType]
|
521
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
522
|
-
# @return [Google::Cloud::Dialogflow::V2::EntityType]
|
523
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
524
|
-
# @example
|
525
|
-
# require "google/cloud/dialogflow"
|
526
|
-
#
|
527
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
528
|
-
#
|
529
|
-
# # TODO: Initialize `entity_type`:
|
530
|
-
# entity_type = {}
|
531
|
-
# response = entity_types_client.update_entity_type(entity_type)
|
532
|
-
|
533
|
-
def update_entity_type \
|
534
|
-
entity_type,
|
535
|
-
language_code: nil,
|
536
|
-
update_mask: nil,
|
537
|
-
options: nil,
|
538
|
-
&block
|
539
|
-
req = {
|
540
|
-
entity_type: entity_type,
|
541
|
-
language_code: language_code,
|
542
|
-
update_mask: update_mask
|
543
|
-
}.delete_if { |_, v| v.nil? }
|
544
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::UpdateEntityTypeRequest)
|
545
|
-
@update_entity_type.call(req, options, &block)
|
546
|
-
end
|
547
|
-
|
548
|
-
# Deletes the specified entity type.
|
549
|
-
#
|
550
|
-
# @param name [String]
|
551
|
-
# Required. The name of the entity type to delete.
|
552
|
-
# Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
553
|
-
# @param options [Google::Gax::CallOptions]
|
554
|
-
# Overrides the default settings for this call, e.g, timeout,
|
555
|
-
# retries, etc.
|
556
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
557
|
-
# @yieldparam result []
|
558
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
559
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
560
|
-
# @example
|
561
|
-
# require "google/cloud/dialogflow"
|
562
|
-
#
|
563
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
564
|
-
# formatted_name = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
565
|
-
# entity_types_client.delete_entity_type(formatted_name)
|
566
|
-
|
567
|
-
def delete_entity_type \
|
568
|
-
name,
|
569
|
-
options: nil,
|
570
|
-
&block
|
571
|
-
req = {
|
572
|
-
name: name
|
573
|
-
}.delete_if { |_, v| v.nil? }
|
574
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteEntityTypeRequest)
|
575
|
-
@delete_entity_type.call(req, options, &block)
|
576
|
-
nil
|
577
|
-
end
|
578
|
-
|
579
|
-
# Updates/Creates multiple entity types in the specified agent.
|
580
|
-
#
|
581
|
-
# Operation <response: {Google::Cloud::Dialogflow::V2::BatchUpdateEntityTypesResponse BatchUpdateEntityTypesResponse}>
|
582
|
-
#
|
583
|
-
# @param parent [String]
|
584
|
-
# Required. The name of the agent to update or create entity types in.
|
585
|
-
# Format: `projects/<Project ID>/agent`.
|
586
|
-
# @param entity_type_batch_uri [String]
|
587
|
-
# The URI to a Google Cloud Storage file containing entity types to update
|
588
|
-
# or create. The file format can either be a serialized proto (of
|
589
|
-
# EntityBatch type) or a JSON object. Note: The URI must start with
|
590
|
-
# "gs://".
|
591
|
-
# @param entity_type_batch_inline [Google::Cloud::Dialogflow::V2::EntityTypeBatch | Hash]
|
592
|
-
# The collection of entity types to update or create.
|
593
|
-
# A hash of the same form as `Google::Cloud::Dialogflow::V2::EntityTypeBatch`
|
594
|
-
# can also be provided.
|
595
|
-
# @param language_code [String]
|
596
|
-
# Optional. The language of entity synonyms defined in `entity_types`. If not
|
597
|
-
# specified, the agent's default language is used.
|
598
|
-
# [Many
|
599
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
600
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
601
|
-
# be used.
|
602
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
603
|
-
# Optional. The mask to control which fields get updated.
|
604
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
605
|
-
# can also be provided.
|
606
|
-
# @param options [Google::Gax::CallOptions]
|
607
|
-
# Overrides the default settings for this call, e.g, timeout,
|
608
|
-
# retries, etc.
|
609
|
-
# @return [Google::Gax::Operation]
|
610
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
611
|
-
# @example
|
612
|
-
# require "google/cloud/dialogflow"
|
613
|
-
#
|
614
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
615
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
616
|
-
#
|
617
|
-
# # Register a callback during the method call.
|
618
|
-
# operation = entity_types_client.batch_update_entity_types(formatted_parent) do |op|
|
619
|
-
# raise op.results.message if op.error?
|
620
|
-
# op_results = op.results
|
621
|
-
# # Process the results.
|
622
|
-
#
|
623
|
-
# metadata = op.metadata
|
624
|
-
# # Process the metadata.
|
625
|
-
# end
|
626
|
-
#
|
627
|
-
# # Or use the return value to register a callback.
|
628
|
-
# operation.on_done do |op|
|
629
|
-
# raise op.results.message if op.error?
|
630
|
-
# op_results = op.results
|
631
|
-
# # Process the results.
|
632
|
-
#
|
633
|
-
# metadata = op.metadata
|
634
|
-
# # Process the metadata.
|
635
|
-
# end
|
636
|
-
#
|
637
|
-
# # Manually reload the operation.
|
638
|
-
# operation.reload!
|
639
|
-
#
|
640
|
-
# # Or block until the operation completes, triggering callbacks on
|
641
|
-
# # completion.
|
642
|
-
# operation.wait_until_done!
|
643
|
-
|
644
|
-
def batch_update_entity_types \
|
645
|
-
parent,
|
646
|
-
entity_type_batch_uri: nil,
|
647
|
-
entity_type_batch_inline: nil,
|
648
|
-
language_code: nil,
|
649
|
-
update_mask: nil,
|
650
|
-
options: nil
|
651
|
-
req = {
|
652
|
-
parent: parent,
|
653
|
-
entity_type_batch_uri: entity_type_batch_uri,
|
654
|
-
entity_type_batch_inline: entity_type_batch_inline,
|
655
|
-
language_code: language_code,
|
656
|
-
update_mask: update_mask
|
657
|
-
}.delete_if { |_, v| v.nil? }
|
658
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::BatchUpdateEntityTypesRequest)
|
659
|
-
operation = Google::Gax::Operation.new(
|
660
|
-
@batch_update_entity_types.call(req, options),
|
661
|
-
@operations_client,
|
662
|
-
Google::Cloud::Dialogflow::V2::BatchUpdateEntityTypesResponse,
|
663
|
-
Google::Protobuf::Struct,
|
664
|
-
call_options: options
|
665
|
-
)
|
666
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
667
|
-
operation
|
668
|
-
end
|
669
|
-
|
670
|
-
# Deletes entity types in the specified agent.
|
671
|
-
#
|
672
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
673
|
-
#
|
674
|
-
# @param parent [String]
|
675
|
-
# Required. The name of the agent to delete all entities types for. Format:
|
676
|
-
# `projects/<Project ID>/agent`.
|
677
|
-
# @param entity_type_names [Array<String>]
|
678
|
-
# Required. The names entity types to delete. All names must point to the
|
679
|
-
# same agent as `parent`.
|
680
|
-
# @param options [Google::Gax::CallOptions]
|
681
|
-
# Overrides the default settings for this call, e.g, timeout,
|
682
|
-
# retries, etc.
|
683
|
-
# @return [Google::Gax::Operation]
|
684
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
685
|
-
# @example
|
686
|
-
# require "google/cloud/dialogflow"
|
687
|
-
#
|
688
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
689
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.project_agent_path("[PROJECT]")
|
690
|
-
#
|
691
|
-
# # TODO: Initialize `entity_type_names`:
|
692
|
-
# entity_type_names = []
|
693
|
-
#
|
694
|
-
# # Register a callback during the method call.
|
695
|
-
# operation = entity_types_client.batch_delete_entity_types(formatted_parent, entity_type_names) do |op|
|
696
|
-
# raise op.results.message if op.error?
|
697
|
-
# op_results = op.results
|
698
|
-
# # Process the results.
|
699
|
-
#
|
700
|
-
# metadata = op.metadata
|
701
|
-
# # Process the metadata.
|
702
|
-
# end
|
703
|
-
#
|
704
|
-
# # Or use the return value to register a callback.
|
705
|
-
# operation.on_done do |op|
|
706
|
-
# raise op.results.message if op.error?
|
707
|
-
# op_results = op.results
|
708
|
-
# # Process the results.
|
709
|
-
#
|
710
|
-
# metadata = op.metadata
|
711
|
-
# # Process the metadata.
|
712
|
-
# end
|
713
|
-
#
|
714
|
-
# # Manually reload the operation.
|
715
|
-
# operation.reload!
|
716
|
-
#
|
717
|
-
# # Or block until the operation completes, triggering callbacks on
|
718
|
-
# # completion.
|
719
|
-
# operation.wait_until_done!
|
720
|
-
|
721
|
-
def batch_delete_entity_types \
|
722
|
-
parent,
|
723
|
-
entity_type_names,
|
724
|
-
options: nil
|
725
|
-
req = {
|
726
|
-
parent: parent,
|
727
|
-
entity_type_names: entity_type_names
|
728
|
-
}.delete_if { |_, v| v.nil? }
|
729
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::BatchDeleteEntityTypesRequest)
|
730
|
-
operation = Google::Gax::Operation.new(
|
731
|
-
@batch_delete_entity_types.call(req, options),
|
732
|
-
@operations_client,
|
733
|
-
Google::Protobuf::Empty,
|
734
|
-
Google::Protobuf::Struct,
|
735
|
-
call_options: options
|
736
|
-
)
|
737
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
738
|
-
operation
|
739
|
-
end
|
740
|
-
|
741
|
-
# Creates multiple new entities in the specified entity type.
|
742
|
-
#
|
743
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
744
|
-
#
|
745
|
-
# @param parent [String]
|
746
|
-
# Required. The name of the entity type to create entities in. Format:
|
747
|
-
# `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
748
|
-
# @param entities [Array<Google::Cloud::Dialogflow::V2::EntityType::Entity | Hash>]
|
749
|
-
# Required. The entities to create.
|
750
|
-
# A hash of the same form as `Google::Cloud::Dialogflow::V2::EntityType::Entity`
|
751
|
-
# can also be provided.
|
752
|
-
# @param language_code [String]
|
753
|
-
# Optional. The language of entity synonyms defined in `entities`. If not
|
754
|
-
# specified, the agent's default language is used.
|
755
|
-
# [Many
|
756
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
757
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
758
|
-
# be used.
|
759
|
-
# @param options [Google::Gax::CallOptions]
|
760
|
-
# Overrides the default settings for this call, e.g, timeout,
|
761
|
-
# retries, etc.
|
762
|
-
# @return [Google::Gax::Operation]
|
763
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
764
|
-
# @example
|
765
|
-
# require "google/cloud/dialogflow"
|
766
|
-
#
|
767
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
768
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
769
|
-
#
|
770
|
-
# # TODO: Initialize `entities`:
|
771
|
-
# entities = []
|
772
|
-
#
|
773
|
-
# # Register a callback during the method call.
|
774
|
-
# operation = entity_types_client.batch_create_entities(formatted_parent, entities) do |op|
|
775
|
-
# raise op.results.message if op.error?
|
776
|
-
# op_results = op.results
|
777
|
-
# # Process the results.
|
778
|
-
#
|
779
|
-
# metadata = op.metadata
|
780
|
-
# # Process the metadata.
|
781
|
-
# end
|
782
|
-
#
|
783
|
-
# # Or use the return value to register a callback.
|
784
|
-
# operation.on_done do |op|
|
785
|
-
# raise op.results.message if op.error?
|
786
|
-
# op_results = op.results
|
787
|
-
# # Process the results.
|
788
|
-
#
|
789
|
-
# metadata = op.metadata
|
790
|
-
# # Process the metadata.
|
791
|
-
# end
|
792
|
-
#
|
793
|
-
# # Manually reload the operation.
|
794
|
-
# operation.reload!
|
795
|
-
#
|
796
|
-
# # Or block until the operation completes, triggering callbacks on
|
797
|
-
# # completion.
|
798
|
-
# operation.wait_until_done!
|
799
|
-
|
800
|
-
def batch_create_entities \
|
801
|
-
parent,
|
802
|
-
entities,
|
803
|
-
language_code: nil,
|
804
|
-
options: nil
|
805
|
-
req = {
|
806
|
-
parent: parent,
|
807
|
-
entities: entities,
|
808
|
-
language_code: language_code
|
809
|
-
}.delete_if { |_, v| v.nil? }
|
810
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::BatchCreateEntitiesRequest)
|
811
|
-
operation = Google::Gax::Operation.new(
|
812
|
-
@batch_create_entities.call(req, options),
|
813
|
-
@operations_client,
|
814
|
-
Google::Protobuf::Empty,
|
815
|
-
Google::Protobuf::Struct,
|
816
|
-
call_options: options
|
817
|
-
)
|
818
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
819
|
-
operation
|
820
|
-
end
|
821
|
-
|
822
|
-
# Updates or creates multiple entities in the specified entity type. This
|
823
|
-
# method does not affect entities in the entity type that aren't explicitly
|
824
|
-
# specified in the request.
|
825
|
-
#
|
826
|
-
#
|
827
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
828
|
-
#
|
829
|
-
# @param parent [String]
|
830
|
-
# Required. The name of the entity type to update or create entities in.
|
831
|
-
# Format: `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
832
|
-
# @param entities [Array<Google::Cloud::Dialogflow::V2::EntityType::Entity | Hash>]
|
833
|
-
# Required. The entities to update or create.
|
834
|
-
# A hash of the same form as `Google::Cloud::Dialogflow::V2::EntityType::Entity`
|
835
|
-
# can also be provided.
|
836
|
-
# @param language_code [String]
|
837
|
-
# Optional. The language of entity synonyms defined in `entities`. If not
|
838
|
-
# specified, the agent's default language is used.
|
839
|
-
# [Many
|
840
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
841
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
842
|
-
# be used.
|
843
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
844
|
-
# Optional. The mask to control which fields get updated.
|
845
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
846
|
-
# can also be provided.
|
847
|
-
# @param options [Google::Gax::CallOptions]
|
848
|
-
# Overrides the default settings for this call, e.g, timeout,
|
849
|
-
# retries, etc.
|
850
|
-
# @return [Google::Gax::Operation]
|
851
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
852
|
-
# @example
|
853
|
-
# require "google/cloud/dialogflow"
|
854
|
-
#
|
855
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
856
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
857
|
-
#
|
858
|
-
# # TODO: Initialize `entities`:
|
859
|
-
# entities = []
|
860
|
-
#
|
861
|
-
# # Register a callback during the method call.
|
862
|
-
# operation = entity_types_client.batch_update_entities(formatted_parent, entities) do |op|
|
863
|
-
# raise op.results.message if op.error?
|
864
|
-
# op_results = op.results
|
865
|
-
# # Process the results.
|
866
|
-
#
|
867
|
-
# metadata = op.metadata
|
868
|
-
# # Process the metadata.
|
869
|
-
# end
|
870
|
-
#
|
871
|
-
# # Or use the return value to register a callback.
|
872
|
-
# operation.on_done do |op|
|
873
|
-
# raise op.results.message if op.error?
|
874
|
-
# op_results = op.results
|
875
|
-
# # Process the results.
|
876
|
-
#
|
877
|
-
# metadata = op.metadata
|
878
|
-
# # Process the metadata.
|
879
|
-
# end
|
880
|
-
#
|
881
|
-
# # Manually reload the operation.
|
882
|
-
# operation.reload!
|
883
|
-
#
|
884
|
-
# # Or block until the operation completes, triggering callbacks on
|
885
|
-
# # completion.
|
886
|
-
# operation.wait_until_done!
|
887
|
-
|
888
|
-
def batch_update_entities \
|
889
|
-
parent,
|
890
|
-
entities,
|
891
|
-
language_code: nil,
|
892
|
-
update_mask: nil,
|
893
|
-
options: nil
|
894
|
-
req = {
|
895
|
-
parent: parent,
|
896
|
-
entities: entities,
|
897
|
-
language_code: language_code,
|
898
|
-
update_mask: update_mask
|
899
|
-
}.delete_if { |_, v| v.nil? }
|
900
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::BatchUpdateEntitiesRequest)
|
901
|
-
operation = Google::Gax::Operation.new(
|
902
|
-
@batch_update_entities.call(req, options),
|
903
|
-
@operations_client,
|
904
|
-
Google::Protobuf::Empty,
|
905
|
-
Google::Protobuf::Struct,
|
906
|
-
call_options: options
|
907
|
-
)
|
908
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
909
|
-
operation
|
910
|
-
end
|
911
|
-
|
912
|
-
# Deletes entities in the specified entity type.
|
913
|
-
#
|
914
|
-
#
|
915
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
916
|
-
#
|
917
|
-
# @param parent [String]
|
918
|
-
# Required. The name of the entity type to delete entries for. Format:
|
919
|
-
# `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
920
|
-
# @param entity_values [Array<String>]
|
921
|
-
# Required. The reference `values` of the entities to delete. Note that
|
922
|
-
# these are not fully-qualified names, i.e. they don't start with
|
923
|
-
# `projects/<Project ID>`.
|
924
|
-
# @param language_code [String]
|
925
|
-
# Optional. The language of entity synonyms defined in `entities`. If not
|
926
|
-
# specified, the agent's default language is used.
|
927
|
-
# [Many
|
928
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
929
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
930
|
-
# be used.
|
931
|
-
# @param options [Google::Gax::CallOptions]
|
932
|
-
# Overrides the default settings for this call, e.g, timeout,
|
933
|
-
# retries, etc.
|
934
|
-
# @return [Google::Gax::Operation]
|
935
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
936
|
-
# @example
|
937
|
-
# require "google/cloud/dialogflow"
|
938
|
-
#
|
939
|
-
# entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new(version: :v2)
|
940
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::EntityTypesClient.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
|
941
|
-
#
|
942
|
-
# # TODO: Initialize `entity_values`:
|
943
|
-
# entity_values = []
|
944
|
-
#
|
945
|
-
# # Register a callback during the method call.
|
946
|
-
# operation = entity_types_client.batch_delete_entities(formatted_parent, entity_values) do |op|
|
947
|
-
# raise op.results.message if op.error?
|
948
|
-
# op_results = op.results
|
949
|
-
# # Process the results.
|
950
|
-
#
|
951
|
-
# metadata = op.metadata
|
952
|
-
# # Process the metadata.
|
953
|
-
# end
|
954
|
-
#
|
955
|
-
# # Or use the return value to register a callback.
|
956
|
-
# operation.on_done do |op|
|
957
|
-
# raise op.results.message if op.error?
|
958
|
-
# op_results = op.results
|
959
|
-
# # Process the results.
|
960
|
-
#
|
961
|
-
# metadata = op.metadata
|
962
|
-
# # Process the metadata.
|
963
|
-
# end
|
964
|
-
#
|
965
|
-
# # Manually reload the operation.
|
966
|
-
# operation.reload!
|
967
|
-
#
|
968
|
-
# # Or block until the operation completes, triggering callbacks on
|
969
|
-
# # completion.
|
970
|
-
# operation.wait_until_done!
|
971
|
-
|
972
|
-
def batch_delete_entities \
|
973
|
-
parent,
|
974
|
-
entity_values,
|
975
|
-
language_code: nil,
|
976
|
-
options: nil
|
977
|
-
req = {
|
978
|
-
parent: parent,
|
979
|
-
entity_values: entity_values,
|
980
|
-
language_code: language_code
|
981
|
-
}.delete_if { |_, v| v.nil? }
|
982
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::BatchDeleteEntitiesRequest)
|
983
|
-
operation = Google::Gax::Operation.new(
|
984
|
-
@batch_delete_entities.call(req, options),
|
985
|
-
@operations_client,
|
986
|
-
Google::Protobuf::Empty,
|
987
|
-
Google::Protobuf::Struct,
|
988
|
-
call_options: options
|
989
|
-
)
|
990
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
991
|
-
operation
|
992
|
-
end
|
993
|
-
end
|
994
|
-
end
|
995
|
-
end
|
996
|
-
end
|
997
|
-
end
|