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.
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 +397 -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 +368 -506
  9. data/lib/google/cloud/dialogflow/version.rb +1 -1
  10. metadata +88 -83
  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 -810
  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 -522
  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 -997
  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 -763
  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 -507
  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 -340
  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,507 +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
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
202
- headers[:"x-goog-user-project"] = credentials.quota_project_id
203
- end
204
- headers.merge!(metadata) unless metadata.nil?
205
- client_config_file = Pathname.new(__dir__).join(
206
- "session_entity_types_client_config.json"
207
- )
208
- defaults = client_config_file.open do |f|
209
- Google::Gax.construct_settings(
210
- "google.cloud.dialogflow.v2.SessionEntityTypes",
211
- JSON.parse(f.read),
212
- client_config,
213
- Google::Gax::Grpc::STATUS_CODE_NAMES,
214
- timeout,
215
- page_descriptors: PAGE_DESCRIPTORS,
216
- errors: Google::Gax::Grpc::API_ERRORS,
217
- metadata: headers
218
- )
219
- end
220
-
221
- # Allow overriding the service path/port in subclasses.
222
- service_path = service_address || self.class::SERVICE_ADDRESS
223
- port = service_port || self.class::DEFAULT_SERVICE_PORT
224
- interceptors = self.class::GRPC_INTERCEPTORS
225
- @session_entity_types_stub = Google::Gax::Grpc.create_stub(
226
- service_path,
227
- port,
228
- chan_creds: chan_creds,
229
- channel: channel,
230
- updater_proc: updater_proc,
231
- scopes: scopes,
232
- interceptors: interceptors,
233
- &Google::Cloud::Dialogflow::V2::SessionEntityTypes::Stub.method(:new)
234
- )
235
-
236
- @list_session_entity_types = Google::Gax.create_api_call(
237
- @session_entity_types_stub.method(:list_session_entity_types),
238
- defaults["list_session_entity_types"],
239
- exception_transformer: exception_transformer,
240
- params_extractor: proc do |request|
241
- {'parent' => request.parent}
242
- end
243
- )
244
- @get_session_entity_type = Google::Gax.create_api_call(
245
- @session_entity_types_stub.method(:get_session_entity_type),
246
- defaults["get_session_entity_type"],
247
- exception_transformer: exception_transformer,
248
- params_extractor: proc do |request|
249
- {'name' => request.name}
250
- end
251
- )
252
- @create_session_entity_type = Google::Gax.create_api_call(
253
- @session_entity_types_stub.method(:create_session_entity_type),
254
- defaults["create_session_entity_type"],
255
- exception_transformer: exception_transformer,
256
- params_extractor: proc do |request|
257
- {'parent' => request.parent}
258
- end
259
- )
260
- @update_session_entity_type = Google::Gax.create_api_call(
261
- @session_entity_types_stub.method(:update_session_entity_type),
262
- defaults["update_session_entity_type"],
263
- exception_transformer: exception_transformer,
264
- params_extractor: proc do |request|
265
- {'session_entity_type.name' => request.session_entity_type.name}
266
- end
267
- )
268
- @delete_session_entity_type = Google::Gax.create_api_call(
269
- @session_entity_types_stub.method(:delete_session_entity_type),
270
- defaults["delete_session_entity_type"],
271
- exception_transformer: exception_transformer,
272
- params_extractor: proc do |request|
273
- {'name' => request.name}
274
- end
275
- )
276
- end
277
-
278
- # Service calls
279
-
280
- # Returns the list of all session entity types in the specified session.
281
- #
282
- # This method doesn't work with Google Assistant integration.
283
- # Contact Dialogflow support if you need to use session entities
284
- # with Google Assistant integration.
285
- #
286
- # @param parent [String]
287
- # Required. The session to list all session entity types from.
288
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
289
- # @param page_size [Integer]
290
- # The maximum number of resources contained in the underlying API
291
- # response. If page streaming is performed per-resource, this
292
- # parameter does not affect the return value. If page streaming is
293
- # performed per-page, this determines the maximum number of
294
- # resources in a page.
295
- # @param options [Google::Gax::CallOptions]
296
- # Overrides the default settings for this call, e.g, timeout,
297
- # retries, etc.
298
- # @yield [result, operation] Access the result along with the RPC operation
299
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::SessionEntityType>]
300
- # @yieldparam operation [GRPC::ActiveCall::Operation]
301
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::SessionEntityType>]
302
- # An enumerable of Google::Cloud::Dialogflow::V2::SessionEntityType instances.
303
- # See Google::Gax::PagedEnumerable documentation for other
304
- # operations such as per-page iteration or access to the response
305
- # object.
306
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
307
- # @example
308
- # require "google/cloud/dialogflow"
309
- #
310
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
311
- # formatted_parent = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_path("[PROJECT]", "[SESSION]")
312
- #
313
- # # Iterate over all results.
314
- # session_entity_types_client.list_session_entity_types(formatted_parent).each do |element|
315
- # # Process element.
316
- # end
317
- #
318
- # # Or iterate over results one page at a time.
319
- # session_entity_types_client.list_session_entity_types(formatted_parent).each_page do |page|
320
- # # Process each page at a time.
321
- # page.each do |element|
322
- # # Process element.
323
- # end
324
- # end
325
-
326
- def list_session_entity_types \
327
- parent,
328
- page_size: nil,
329
- options: nil,
330
- &block
331
- req = {
332
- parent: parent,
333
- page_size: page_size
334
- }.delete_if { |_, v| v.nil? }
335
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ListSessionEntityTypesRequest)
336
- @list_session_entity_types.call(req, options, &block)
337
- end
338
-
339
- # Retrieves the specified session entity type.
340
- #
341
- # This method doesn't work with Google Assistant integration.
342
- # Contact Dialogflow support if you need to use session entities
343
- # with Google Assistant integration.
344
- #
345
- # @param name [String]
346
- # Required. The name of the session entity type. Format:
347
- # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
348
- # Display Name>`.
349
- # @param options [Google::Gax::CallOptions]
350
- # Overrides the default settings for this call, e.g, timeout,
351
- # retries, etc.
352
- # @yield [result, operation] Access the result along with the RPC operation
353
- # @yieldparam result [Google::Cloud::Dialogflow::V2::SessionEntityType]
354
- # @yieldparam operation [GRPC::ActiveCall::Operation]
355
- # @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
356
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
357
- # @example
358
- # require "google/cloud/dialogflow"
359
- #
360
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
361
- # formatted_name = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_entity_type_path("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
362
- # response = session_entity_types_client.get_session_entity_type(formatted_name)
363
-
364
- def get_session_entity_type \
365
- name,
366
- options: nil,
367
- &block
368
- req = {
369
- name: name
370
- }.delete_if { |_, v| v.nil? }
371
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetSessionEntityTypeRequest)
372
- @get_session_entity_type.call(req, options, &block)
373
- end
374
-
375
- # Creates a session entity type.
376
- #
377
- # If the specified session entity type already exists, overrides the session
378
- # entity type.
379
- #
380
- # This method doesn't work with Google Assistant integration.
381
- # Contact Dialogflow support if you need to use session entities
382
- # with Google Assistant integration.
383
- #
384
- # @param parent [String]
385
- # Required. The session to create a session entity type for.
386
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
387
- # @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
388
- # Required. The session entity type to create.
389
- # A hash of the same form as `Google::Cloud::Dialogflow::V2::SessionEntityType`
390
- # can also be provided.
391
- # @param options [Google::Gax::CallOptions]
392
- # Overrides the default settings for this call, e.g, timeout,
393
- # retries, etc.
394
- # @yield [result, operation] Access the result along with the RPC operation
395
- # @yieldparam result [Google::Cloud::Dialogflow::V2::SessionEntityType]
396
- # @yieldparam operation [GRPC::ActiveCall::Operation]
397
- # @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
398
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
399
- # @example
400
- # require "google/cloud/dialogflow"
401
- #
402
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
403
- # formatted_parent = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_path("[PROJECT]", "[SESSION]")
404
- #
405
- # # TODO: Initialize `session_entity_type`:
406
- # session_entity_type = {}
407
- # response = session_entity_types_client.create_session_entity_type(formatted_parent, session_entity_type)
408
-
409
- def create_session_entity_type \
410
- parent,
411
- session_entity_type,
412
- options: nil,
413
- &block
414
- req = {
415
- parent: parent,
416
- session_entity_type: session_entity_type
417
- }.delete_if { |_, v| v.nil? }
418
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::CreateSessionEntityTypeRequest)
419
- @create_session_entity_type.call(req, options, &block)
420
- end
421
-
422
- # Updates the specified session entity type.
423
- #
424
- # This method doesn't work with Google Assistant integration.
425
- # Contact Dialogflow support if you need to use session entities
426
- # with Google Assistant integration.
427
- #
428
- # @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
429
- # Required. The entity type to update. Format:
430
- # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
431
- # Display Name>`.
432
- # A hash of the same form as `Google::Cloud::Dialogflow::V2::SessionEntityType`
433
- # can also be provided.
434
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
435
- # Optional. The mask to control which fields get updated.
436
- # A hash of the same form as `Google::Protobuf::FieldMask`
437
- # can also be provided.
438
- # @param options [Google::Gax::CallOptions]
439
- # Overrides the default settings for this call, e.g, timeout,
440
- # retries, etc.
441
- # @yield [result, operation] Access the result along with the RPC operation
442
- # @yieldparam result [Google::Cloud::Dialogflow::V2::SessionEntityType]
443
- # @yieldparam operation [GRPC::ActiveCall::Operation]
444
- # @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
445
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
446
- # @example
447
- # require "google/cloud/dialogflow"
448
- #
449
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
450
- #
451
- # # TODO: Initialize `session_entity_type`:
452
- # session_entity_type = {}
453
- # response = session_entity_types_client.update_session_entity_type(session_entity_type)
454
-
455
- def update_session_entity_type \
456
- session_entity_type,
457
- update_mask: nil,
458
- options: nil,
459
- &block
460
- req = {
461
- session_entity_type: session_entity_type,
462
- update_mask: update_mask
463
- }.delete_if { |_, v| v.nil? }
464
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::UpdateSessionEntityTypeRequest)
465
- @update_session_entity_type.call(req, options, &block)
466
- end
467
-
468
- # Deletes the specified session entity type.
469
- #
470
- # This method doesn't work with Google Assistant integration.
471
- # Contact Dialogflow support if you need to use session entities
472
- # with Google Assistant integration.
473
- #
474
- # @param name [String]
475
- # Required. The name of the entity type to delete. Format:
476
- # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
477
- # Display Name>`.
478
- # @param options [Google::Gax::CallOptions]
479
- # Overrides the default settings for this call, e.g, timeout,
480
- # retries, etc.
481
- # @yield [result, operation] Access the result along with the RPC operation
482
- # @yieldparam result []
483
- # @yieldparam operation [GRPC::ActiveCall::Operation]
484
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
485
- # @example
486
- # require "google/cloud/dialogflow"
487
- #
488
- # session_entity_types_client = Google::Cloud::Dialogflow::SessionEntityTypes.new(version: :v2)
489
- # formatted_name = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_entity_type_path("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
490
- # session_entity_types_client.delete_session_entity_type(formatted_name)
491
-
492
- def delete_session_entity_type \
493
- name,
494
- options: nil,
495
- &block
496
- req = {
497
- name: name
498
- }.delete_if { |_, v| v.nil? }
499
- req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteSessionEntityTypeRequest)
500
- @delete_session_entity_type.call(req, options, &block)
501
- nil
502
- end
503
- end
504
- end
505
- end
506
- end
507
- end