google-cloud-dialogflow 0.14.0 → 1.1.2

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +445 -0
  6. data/README.md +35 -25
  7. data/lib/{google/cloud/dialogflow/v2/doc/google/protobuf/empty.rb → google-cloud-dialogflow.rb} +4 -14
  8. data/lib/google/cloud/dialogflow.rb +256 -506
  9. data/lib/google/cloud/dialogflow/version.rb +1 -1
  10. metadata +63 -86
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/dialogflow/v2.rb +0 -598
  13. data/lib/google/cloud/dialogflow/v2/agent_pb.rb +0 -121
  14. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +0 -111
  15. data/lib/google/cloud/dialogflow/v2/agents_client.rb +0 -807
  16. data/lib/google/cloud/dialogflow/v2/agents_client_config.json +0 -71
  17. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -96
  18. data/lib/google/cloud/dialogflow/v2/context_pb.rb +0 -63
  19. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +0 -75
  20. data/lib/google/cloud/dialogflow/v2/contexts_client.rb +0 -519
  21. data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +0 -56
  22. data/lib/google/cloud/dialogflow/v2/credentials.rb +0 -42
  23. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +0 -247
  24. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/audio_config.rb +0 -341
  25. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +0 -116
  26. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +0 -305
  27. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +0 -937
  28. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +0 -498
  29. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +0 -130
  30. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/validation_result.rb +0 -71
  31. data/lib/google/cloud/dialogflow/v2/doc/google/longrunning/operations.rb +0 -51
  32. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +0 -131
  33. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/duration.rb +0 -91
  34. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +0 -222
  35. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +0 -74
  36. data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +0 -39
  37. data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +0 -31
  38. data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +0 -125
  39. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +0 -105
  40. data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +0 -994
  41. data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +0 -76
  42. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -367
  43. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +0 -93
  44. data/lib/google/cloud/dialogflow/v2/intents_client.rb +0 -760
  45. data/lib/google/cloud/dialogflow/v2/intents_client_config.json +0 -61
  46. data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +0 -65
  47. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +0 -93
  48. data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +0 -504
  49. data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +0 -51
  50. data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -141
  51. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +0 -56
  52. data/lib/google/cloud/dialogflow/v2/sessions_client.rb +0 -337
  53. data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +0 -36
  54. data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -36
  55. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -46
@@ -1,61 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.cloud.dialogflow.v2.Intents": {
4
- "retry_codes": {
5
- "idempotent": [
6
- "DEADLINE_EXCEEDED",
7
- "UNAVAILABLE"
8
- ],
9
- "non_idempotent": []
10
- },
11
- "retry_params": {
12
- "default": {
13
- "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 20000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 20000,
19
- "total_timeout_millis": 600000
20
- }
21
- },
22
- "methods": {
23
- "ListIntents": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "GetIntent": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "idempotent",
31
- "retry_params_name": "default"
32
- },
33
- "CreateIntent": {
34
- "timeout_millis": 60000,
35
- "retry_codes_name": "non_idempotent",
36
- "retry_params_name": "default"
37
- },
38
- "UpdateIntent": {
39
- "timeout_millis": 60000,
40
- "retry_codes_name": "non_idempotent",
41
- "retry_params_name": "default"
42
- },
43
- "DeleteIntent": {
44
- "timeout_millis": 60000,
45
- "retry_codes_name": "idempotent",
46
- "retry_params_name": "default"
47
- },
48
- "BatchUpdateIntents": {
49
- "timeout_millis": 60000,
50
- "retry_codes_name": "non_idempotent",
51
- "retry_params_name": "default"
52
- },
53
- "BatchDeleteIntents": {
54
- "timeout_millis": 60000,
55
- "retry_codes_name": "idempotent",
56
- "retry_params_name": "default"
57
- }
58
- }
59
- }
60
- }
61
- }
@@ -1,65 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/dialogflow/v2/session_entity_type.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/api/client_pb'
9
- require 'google/api/field_behavior_pb'
10
- require 'google/api/resource_pb'
11
- require 'google/cloud/dialogflow/v2/entity_type_pb'
12
- require 'google/protobuf/empty_pb'
13
- require 'google/protobuf/field_mask_pb'
14
- Google::Protobuf::DescriptorPool.generated_pool.build do
15
- add_message "google.cloud.dialogflow.v2.SessionEntityType" do
16
- optional :name, :string, 1
17
- optional :entity_override_mode, :enum, 2, "google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode"
18
- repeated :entities, :message, 3, "google.cloud.dialogflow.v2.EntityType.Entity"
19
- end
20
- add_enum "google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode" do
21
- value :ENTITY_OVERRIDE_MODE_UNSPECIFIED, 0
22
- value :ENTITY_OVERRIDE_MODE_OVERRIDE, 1
23
- value :ENTITY_OVERRIDE_MODE_SUPPLEMENT, 2
24
- end
25
- add_message "google.cloud.dialogflow.v2.ListSessionEntityTypesRequest" do
26
- optional :parent, :string, 1
27
- optional :page_size, :int32, 2
28
- optional :page_token, :string, 3
29
- end
30
- add_message "google.cloud.dialogflow.v2.ListSessionEntityTypesResponse" do
31
- repeated :session_entity_types, :message, 1, "google.cloud.dialogflow.v2.SessionEntityType"
32
- optional :next_page_token, :string, 2
33
- end
34
- add_message "google.cloud.dialogflow.v2.GetSessionEntityTypeRequest" do
35
- optional :name, :string, 1
36
- end
37
- add_message "google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest" do
38
- optional :parent, :string, 1
39
- optional :session_entity_type, :message, 2, "google.cloud.dialogflow.v2.SessionEntityType"
40
- end
41
- add_message "google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest" do
42
- optional :session_entity_type, :message, 1, "google.cloud.dialogflow.v2.SessionEntityType"
43
- optional :update_mask, :message, 2, "google.protobuf.FieldMask"
44
- end
45
- add_message "google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest" do
46
- optional :name, :string, 1
47
- end
48
- end
49
-
50
- module Google
51
- module Cloud
52
- module Dialogflow
53
- module V2
54
- SessionEntityType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SessionEntityType").msgclass
55
- SessionEntityType::EntityOverrideMode = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode").enummodule
56
- ListSessionEntityTypesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListSessionEntityTypesRequest").msgclass
57
- ListSessionEntityTypesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListSessionEntityTypesResponse").msgclass
58
- GetSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetSessionEntityTypeRequest").msgclass
59
- CreateSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest").msgclass
60
- UpdateSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest").msgclass
61
- DeleteSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest").msgclass
62
- end
63
- end
64
- end
65
- end
@@ -1,93 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # Source: google/cloud/dialogflow/v2/session_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/session_entity_type_pb'
22
-
23
- module Google
24
- module Cloud
25
- module Dialogflow
26
- module V2
27
- module SessionEntityTypes
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
- # Session entity types are referred to as **User** entity types and are
34
- # entities that are built for an individual user such as
35
- # favorites, preferences, playlists, and so on. You can redefine a session
36
- # entity type at the session level.
37
- #
38
- # Session entity methods do not work with Google Assistant integration.
39
- # Contact Dialogflow support if you need to use session entities
40
- # with Google Assistant integration.
41
- #
42
- # For more information about entity types, see the
43
- # [Dialogflow
44
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
45
- class Service
46
-
47
- include GRPC::GenericService
48
-
49
- self.marshal_class_method = :encode
50
- self.unmarshal_class_method = :decode
51
- self.service_name = 'google.cloud.dialogflow.v2.SessionEntityTypes'
52
-
53
- # Returns the list of all session entity types in the specified session.
54
- #
55
- # This method doesn't work with Google Assistant integration.
56
- # Contact Dialogflow support if you need to use session entities
57
- # with Google Assistant integration.
58
- rpc :ListSessionEntityTypes, ListSessionEntityTypesRequest, ListSessionEntityTypesResponse
59
- # Retrieves the specified session entity type.
60
- #
61
- # This method doesn't work with Google Assistant integration.
62
- # Contact Dialogflow support if you need to use session entities
63
- # with Google Assistant integration.
64
- rpc :GetSessionEntityType, GetSessionEntityTypeRequest, SessionEntityType
65
- # Creates a session entity type.
66
- #
67
- # If the specified session entity type already exists, overrides the session
68
- # entity type.
69
- #
70
- # This method doesn't work with Google Assistant integration.
71
- # Contact Dialogflow support if you need to use session entities
72
- # with Google Assistant integration.
73
- rpc :CreateSessionEntityType, CreateSessionEntityTypeRequest, SessionEntityType
74
- # Updates the specified session entity type.
75
- #
76
- # This method doesn't work with Google Assistant integration.
77
- # Contact Dialogflow support if you need to use session entities
78
- # with Google Assistant integration.
79
- rpc :UpdateSessionEntityType, UpdateSessionEntityTypeRequest, SessionEntityType
80
- # Deletes the specified session entity type.
81
- #
82
- # This method doesn't work with Google Assistant integration.
83
- # Contact Dialogflow support if you need to use session entities
84
- # with Google Assistant integration.
85
- rpc :DeleteSessionEntityType, DeleteSessionEntityTypeRequest, Google::Protobuf::Empty
86
- end
87
-
88
- Stub = Service.rpc_stub_class
89
- end
90
- end
91
- end
92
- end
93
- end
@@ -1,504 +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/session_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
-
28
- require "google/cloud/dialogflow/v2/session_entity_type_pb"
29
- require "google/cloud/dialogflow/v2/credentials"
30
- require "google/cloud/dialogflow/version"
31
-
32
- module Google
33
- module Cloud
34
- module Dialogflow
35
- module V2
36
- # Entities are extracted from user input and represent parameters that are
37
- # meaningful to your application. For example, a date range, a proper name
38
- # such as a geographic location or landmark, and so on. Entities represent
39
- # actionable data for your application.
40
- #
41
- # Session entity types are referred to as **User** entity types and are
42
- # entities that are built for an individual user such as
43
- # favorites, preferences, playlists, and so on. You can redefine a session
44
- # entity type at the session level.
45
- #
46
- # Session entity methods do not work with Google Assistant integration.
47
- # Contact Dialogflow support if you need to use session entities
48
- # with Google Assistant integration.
49
- #
50
- # For more information about entity types, see the
51
- # [Dialogflow
52
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
53
- #
54
- # @!attribute [r] session_entity_types_stub
55
- # @return [Google::Cloud::Dialogflow::V2::SessionEntityTypes::Stub]
56
- class SessionEntityTypesClient
57
- # @private
58
- attr_reader :session_entity_types_stub
59
-
60
- # The default address of the service.
61
- SERVICE_ADDRESS = "dialogflow.googleapis.com".freeze
62
-
63
- # The default port of the service.
64
- DEFAULT_SERVICE_PORT = 443
65
-
66
- # The default set of gRPC interceptors.
67
- GRPC_INTERCEPTORS = []
68
-
69
- DEFAULT_TIMEOUT = 30
70
-
71
- PAGE_DESCRIPTORS = {
72
- "list_session_entity_types" => Google::Gax::PageDescriptor.new(
73
- "page_token",
74
- "next_page_token",
75
- "session_entity_types")
76
- }.freeze
77
-
78
- private_constant :PAGE_DESCRIPTORS
79
-
80
- # The scopes needed to make gRPC calls to all of the methods defined in
81
- # this service.
82
- ALL_SCOPES = [
83
- "https://www.googleapis.com/auth/cloud-platform",
84
- "https://www.googleapis.com/auth/dialogflow"
85
- ].freeze
86
-
87
-
88
- SESSION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
89
- "projects/{project}/agent/sessions/{session}"
90
- )
91
-
92
- private_constant :SESSION_PATH_TEMPLATE
93
-
94
- SESSION_ENTITY_TYPE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
95
- "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}"
96
- )
97
-
98
- private_constant :SESSION_ENTITY_TYPE_PATH_TEMPLATE
99
-
100
- # Returns a fully-qualified session resource name string.
101
- # @param project [String]
102
- # @param session [String]
103
- # @return [String]
104
- def self.session_path project, session
105
- SESSION_PATH_TEMPLATE.render(
106
- :"project" => project,
107
- :"session" => session
108
- )
109
- end
110
-
111
- # Returns a fully-qualified session_entity_type resource name string.
112
- # @param project [String]
113
- # @param session [String]
114
- # @param entity_type [String]
115
- # @return [String]
116
- def self.session_entity_type_path project, session, entity_type
117
- SESSION_ENTITY_TYPE_PATH_TEMPLATE.render(
118
- :"project" => project,
119
- :"session" => session,
120
- :"entity_type" => entity_type
121
- )
122
- end
123
-
124
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
125
- # Provides the means for authenticating requests made by the client. This parameter can
126
- # be many types.
127
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
128
- # authenticating requests made by this client.
129
- # A `String` will be treated as the path to the keyfile to be used for the construction of
130
- # credentials for this client.
131
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
132
- # credentials for this client.
133
- # A `GRPC::Core::Channel` will be used to make calls through.
134
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
135
- # should already be composed with a `GRPC::Core::CallCredentials` object.
136
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
137
- # metadata for requests, generally, to give OAuth credentials.
138
- # @param scopes [Array<String>]
139
- # The OAuth scopes for this service. This parameter is ignored if
140
- # an updater_proc is supplied.
141
- # @param client_config [Hash]
142
- # A Hash for call options for each method. See
143
- # Google::Gax#construct_settings for the structure of
144
- # this data. Falls back to the default config if not specified
145
- # or the specified config is missing data points.
146
- # @param timeout [Numeric]
147
- # The default timeout, in seconds, for calls made through this client.
148
- # @param metadata [Hash]
149
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
150
- # @param service_address [String]
151
- # Override for the service hostname, or `nil` to leave as the default.
152
- # @param service_port [Integer]
153
- # Override for the service port, or `nil` to leave as the default.
154
- # @param exception_transformer [Proc]
155
- # An optional proc that intercepts any exceptions raised during an API call to inject
156
- # custom error handling.
157
- def initialize \
158
- credentials: nil,
159
- scopes: ALL_SCOPES,
160
- client_config: {},
161
- timeout: DEFAULT_TIMEOUT,
162
- metadata: nil,
163
- service_address: nil,
164
- service_port: nil,
165
- exception_transformer: nil,
166
- lib_name: nil,
167
- lib_version: ""
168
- # These require statements are intentionally placed here to initialize
169
- # the gRPC module only when it's required.
170
- # See https://github.com/googleapis/toolkit/issues/446
171
- require "google/gax/grpc"
172
- require "google/cloud/dialogflow/v2/session_entity_type_services_pb"
173
-
174
- credentials ||= Google::Cloud::Dialogflow::V2::Credentials.default
175
-
176
- if credentials.is_a?(String) || credentials.is_a?(Hash)
177
- updater_proc = Google::Cloud::Dialogflow::V2::Credentials.new(credentials).updater_proc
178
- end
179
- if credentials.is_a?(GRPC::Core::Channel)
180
- channel = credentials
181
- end
182
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
183
- chan_creds = credentials
184
- end
185
- if credentials.is_a?(Proc)
186
- updater_proc = credentials
187
- end
188
- if credentials.is_a?(Google::Auth::Credentials)
189
- updater_proc = credentials.updater_proc
190
- end
191
-
192
- package_version = Google::Cloud::Dialogflow::VERSION
193
-
194
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
195
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
196
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
197
- google_api_client << " grpc/#{GRPC::VERSION}"
198
- google_api_client.freeze
199
-
200
- headers = { :"x-goog-api-client" => google_api_client }
201
- headers.merge!(metadata) unless metadata.nil?
202
- client_config_file = Pathname.new(__dir__).join(
203
- "session_entity_types_client_config.json"
204
- )
205
- defaults = client_config_file.open do |f|
206
- Google::Gax.construct_settings(
207
- "google.cloud.dialogflow.v2.SessionEntityTypes",
208
- JSON.parse(f.read),
209
- client_config,
210
- Google::Gax::Grpc::STATUS_CODE_NAMES,
211
- timeout,
212
- page_descriptors: PAGE_DESCRIPTORS,
213
- errors: Google::Gax::Grpc::API_ERRORS,
214
- metadata: headers
215
- )
216
- end
217
-
218
- # Allow overriding the service path/port in subclasses.
219
- service_path = service_address || self.class::SERVICE_ADDRESS
220
- port = service_port || self.class::DEFAULT_SERVICE_PORT
221
- interceptors = self.class::GRPC_INTERCEPTORS
222
- @session_entity_types_stub = Google::Gax::Grpc.create_stub(
223
- service_path,
224
- port,
225
- chan_creds: chan_creds,
226
- channel: channel,
227
- updater_proc: updater_proc,
228
- scopes: scopes,
229
- interceptors: interceptors,
230
- &Google::Cloud::Dialogflow::V2::SessionEntityTypes::Stub.method(:new)
231
- )
232
-
233
- @list_session_entity_types = Google::Gax.create_api_call(
234
- @session_entity_types_stub.method(:list_session_entity_types),
235
- defaults["list_session_entity_types"],
236
- exception_transformer: exception_transformer,
237
- params_extractor: proc do |request|
238
- {'parent' => request.parent}
239
- end
240
- )
241
- @get_session_entity_type = Google::Gax.create_api_call(
242
- @session_entity_types_stub.method(:get_session_entity_type),
243
- defaults["get_session_entity_type"],
244
- exception_transformer: exception_transformer,
245
- params_extractor: proc do |request|
246
- {'name' => request.name}
247
- end
248
- )
249
- @create_session_entity_type = Google::Gax.create_api_call(
250
- @session_entity_types_stub.method(:create_session_entity_type),
251
- defaults["create_session_entity_type"],
252
- exception_transformer: exception_transformer,
253
- params_extractor: proc do |request|
254
- {'parent' => request.parent}
255
- end
256
- )
257
- @update_session_entity_type = Google::Gax.create_api_call(
258
- @session_entity_types_stub.method(:update_session_entity_type),
259
- defaults["update_session_entity_type"],
260
- exception_transformer: exception_transformer,
261
- params_extractor: proc do |request|
262
- {'session_entity_type.name' => request.session_entity_type.name}
263
- end
264
- )
265
- @delete_session_entity_type = Google::Gax.create_api_call(
266
- @session_entity_types_stub.method(:delete_session_entity_type),
267
- defaults["delete_session_entity_type"],
268
- exception_transformer: exception_transformer,
269
- params_extractor: proc do |request|
270
- {'name' => request.name}
271
- end
272
- )
273
- end
274
-
275
- # Service calls
276
-
277
- # Returns the list of all session entity types in the specified session.
278
- #
279
- # This method doesn't work with Google Assistant integration.
280
- # Contact Dialogflow support if you need to use session entities
281
- # with Google Assistant integration.
282
- #
283
- # @param parent [String]
284
- # Required. The session to list all session entity types from.
285
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
286
- # @param page_size [Integer]
287
- # The maximum number of resources contained in the underlying API
288
- # response. If page streaming is performed per-resource, this
289
- # parameter does not affect the return value. If page streaming is
290
- # performed per-page, this determines the maximum number of
291
- # resources in a page.
292
- # @param options [Google::Gax::CallOptions]
293
- # Overrides the default settings for this call, e.g, timeout,
294
- # retries, etc.
295
- # @yield [result, operation] Access the result along with the RPC operation
296
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::SessionEntityType>]
297
- # @yieldparam operation [GRPC::ActiveCall::Operation]
298
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::SessionEntityType>]
299
- # An enumerable of Google::Cloud::Dialogflow::V2::SessionEntityType instances.
300
- # See Google::Gax::PagedEnumerable documentation for other
301
- # operations such as per-page iteration or access to the response
302
- # object.
303
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
304
- # @example
305
- # require "google/cloud/dialogflow"
306
- #
307
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
308
- # formatted_parent = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_path("[PROJECT]", "[SESSION]")
309
- #
310
- # # Iterate over all results.
311
- # session_entity_types_client.list_session_entity_types(formatted_parent).each do |element|
312
- # # Process element.
313
- # end
314
- #
315
- # # Or iterate over results one page at a time.
316
- # session_entity_types_client.list_session_entity_types(formatted_parent).each_page do |page|
317
- # # Process each page at a time.
318
- # page.each do |element|
319
- # # Process element.
320
- # end
321
- # end
322
-
323
- def list_session_entity_types \
324
- parent,
325
- page_size: nil,
326
- options: nil,
327
- &block
328
- req = {
329
- parent: parent,
330
- page_size: page_size
331
- }.delete_if { |_, v| v.nil? }
332
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ListSessionEntityTypesRequest)
333
- @list_session_entity_types.call(req, options, &block)
334
- end
335
-
336
- # Retrieves the specified session entity type.
337
- #
338
- # This method doesn't work with Google Assistant integration.
339
- # Contact Dialogflow support if you need to use session entities
340
- # with Google Assistant integration.
341
- #
342
- # @param name [String]
343
- # Required. The name of the session entity type. Format:
344
- # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
345
- # Display Name>`.
346
- # @param options [Google::Gax::CallOptions]
347
- # Overrides the default settings for this call, e.g, timeout,
348
- # retries, etc.
349
- # @yield [result, operation] Access the result along with the RPC operation
350
- # @yieldparam result [Google::Cloud::Dialogflow::V2::SessionEntityType]
351
- # @yieldparam operation [GRPC::ActiveCall::Operation]
352
- # @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
353
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
354
- # @example
355
- # require "google/cloud/dialogflow"
356
- #
357
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
358
- # formatted_name = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_entity_type_path("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
359
- # response = session_entity_types_client.get_session_entity_type(formatted_name)
360
-
361
- def get_session_entity_type \
362
- name,
363
- options: nil,
364
- &block
365
- req = {
366
- name: name
367
- }.delete_if { |_, v| v.nil? }
368
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetSessionEntityTypeRequest)
369
- @get_session_entity_type.call(req, options, &block)
370
- end
371
-
372
- # Creates a session entity type.
373
- #
374
- # If the specified session entity type already exists, overrides the session
375
- # entity type.
376
- #
377
- # This method doesn't work with Google Assistant integration.
378
- # Contact Dialogflow support if you need to use session entities
379
- # with Google Assistant integration.
380
- #
381
- # @param parent [String]
382
- # Required. The session to create a session entity type for.
383
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
384
- # @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
385
- # Required. The session entity type to create.
386
- # A hash of the same form as `Google::Cloud::Dialogflow::V2::SessionEntityType`
387
- # can also be provided.
388
- # @param options [Google::Gax::CallOptions]
389
- # Overrides the default settings for this call, e.g, timeout,
390
- # retries, etc.
391
- # @yield [result, operation] Access the result along with the RPC operation
392
- # @yieldparam result [Google::Cloud::Dialogflow::V2::SessionEntityType]
393
- # @yieldparam operation [GRPC::ActiveCall::Operation]
394
- # @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
395
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
396
- # @example
397
- # require "google/cloud/dialogflow"
398
- #
399
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
400
- # formatted_parent = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_path("[PROJECT]", "[SESSION]")
401
- #
402
- # # TODO: Initialize `session_entity_type`:
403
- # session_entity_type = {}
404
- # response = session_entity_types_client.create_session_entity_type(formatted_parent, session_entity_type)
405
-
406
- def create_session_entity_type \
407
- parent,
408
- session_entity_type,
409
- options: nil,
410
- &block
411
- req = {
412
- parent: parent,
413
- session_entity_type: session_entity_type
414
- }.delete_if { |_, v| v.nil? }
415
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::CreateSessionEntityTypeRequest)
416
- @create_session_entity_type.call(req, options, &block)
417
- end
418
-
419
- # Updates the specified session entity type.
420
- #
421
- # This method doesn't work with Google Assistant integration.
422
- # Contact Dialogflow support if you need to use session entities
423
- # with Google Assistant integration.
424
- #
425
- # @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
426
- # Required. The entity type to update. Format:
427
- # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
428
- # Display Name>`.
429
- # A hash of the same form as `Google::Cloud::Dialogflow::V2::SessionEntityType`
430
- # can also be provided.
431
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
432
- # Optional. The mask to control which fields get updated.
433
- # A hash of the same form as `Google::Protobuf::FieldMask`
434
- # can also be provided.
435
- # @param options [Google::Gax::CallOptions]
436
- # Overrides the default settings for this call, e.g, timeout,
437
- # retries, etc.
438
- # @yield [result, operation] Access the result along with the RPC operation
439
- # @yieldparam result [Google::Cloud::Dialogflow::V2::SessionEntityType]
440
- # @yieldparam operation [GRPC::ActiveCall::Operation]
441
- # @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
442
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
443
- # @example
444
- # require "google/cloud/dialogflow"
445
- #
446
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
447
- #
448
- # # TODO: Initialize `session_entity_type`:
449
- # session_entity_type = {}
450
- # response = session_entity_types_client.update_session_entity_type(session_entity_type)
451
-
452
- def update_session_entity_type \
453
- session_entity_type,
454
- update_mask: nil,
455
- options: nil,
456
- &block
457
- req = {
458
- session_entity_type: session_entity_type,
459
- update_mask: update_mask
460
- }.delete_if { |_, v| v.nil? }
461
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::UpdateSessionEntityTypeRequest)
462
- @update_session_entity_type.call(req, options, &block)
463
- end
464
-
465
- # Deletes the specified session entity type.
466
- #
467
- # This method doesn't work with Google Assistant integration.
468
- # Contact Dialogflow support if you need to use session entities
469
- # with Google Assistant integration.
470
- #
471
- # @param name [String]
472
- # Required. The name of the entity type to delete. Format:
473
- # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
474
- # Display Name>`.
475
- # @param options [Google::Gax::CallOptions]
476
- # Overrides the default settings for this call, e.g, timeout,
477
- # retries, etc.
478
- # @yield [result, operation] Access the result along with the RPC operation
479
- # @yieldparam result []
480
- # @yieldparam operation [GRPC::ActiveCall::Operation]
481
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
482
- # @example
483
- # require "google/cloud/dialogflow"
484
- #
485
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
486
- # formatted_name = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_entity_type_path("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
487
- # session_entity_types_client.delete_session_entity_type(formatted_name)
488
-
489
- def delete_session_entity_type \
490
- name,
491
- options: nil,
492
- &block
493
- req = {
494
- name: name
495
- }.delete_if { |_, v| v.nil? }
496
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteSessionEntityTypeRequest)
497
- @delete_session_entity_type.call(req, options, &block)
498
- nil
499
- end
500
- end
501
- end
502
- end
503
- end
504
- end