google-cloud-dialogflow 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +8 -0
- data/LICENSE +201 -0
- data/README.md +32 -0
- data/lib/google/cloud/dialogflow.rb +452 -0
- data/lib/google/cloud/dialogflow/credentials.rb +30 -0
- data/lib/google/cloud/dialogflow/v2.rb +454 -0
- data/lib/google/cloud/dialogflow/v2/agent_pb.rb +87 -0
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +104 -0
- data/lib/google/cloud/dialogflow/v2/agents_client.rb +639 -0
- data/lib/google/cloud/dialogflow/v2/agents_client_config.json +56 -0
- data/lib/google/cloud/dialogflow/v2/context_pb.rb +59 -0
- data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +71 -0
- data/lib/google/cloud/dialogflow/v2/contexts_client.rb +445 -0
- data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +56 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +223 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +115 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +290 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +714 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +451 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +134 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +124 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +73 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +64 -0
- data/lib/google/cloud/dialogflow/v2/doc/overview.rb +55 -0
- data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +120 -0
- data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +105 -0
- data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +900 -0
- data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +76 -0
- data/lib/google/cloud/dialogflow/v2/intent_pb.rb +274 -0
- data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +91 -0
- data/lib/google/cloud/dialogflow/v2/intents_client.rb +684 -0
- data/lib/google/cloud/dialogflow/v2/intents_client_config.json +61 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +61 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +64 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +413 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +51 -0
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +127 -0
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +55 -0
- data/lib/google/cloud/dialogflow/v2/sessions_client.rb +286 -0
- data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +36 -0
- data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +42 -0
- metadata +142 -0
@@ -0,0 +1,61 @@
|
|
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
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/dialogflow/v2/session_entity_type.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/cloud/dialogflow/v2/entity_type_pb'
|
8
|
+
require 'google/protobuf/empty_pb'
|
9
|
+
require 'google/protobuf/field_mask_pb'
|
10
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
+
add_message "google.cloud.dialogflow.v2.SessionEntityType" do
|
12
|
+
optional :name, :string, 1
|
13
|
+
optional :entity_override_mode, :enum, 2, "google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode"
|
14
|
+
repeated :entities, :message, 3, "google.cloud.dialogflow.v2.EntityType.Entity"
|
15
|
+
end
|
16
|
+
add_enum "google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode" do
|
17
|
+
value :ENTITY_OVERRIDE_MODE_UNSPECIFIED, 0
|
18
|
+
value :ENTITY_OVERRIDE_MODE_OVERRIDE, 1
|
19
|
+
value :ENTITY_OVERRIDE_MODE_SUPPLEMENT, 2
|
20
|
+
end
|
21
|
+
add_message "google.cloud.dialogflow.v2.ListSessionEntityTypesRequest" do
|
22
|
+
optional :parent, :string, 1
|
23
|
+
optional :page_size, :int32, 2
|
24
|
+
optional :page_token, :string, 3
|
25
|
+
end
|
26
|
+
add_message "google.cloud.dialogflow.v2.ListSessionEntityTypesResponse" do
|
27
|
+
repeated :session_entity_types, :message, 1, "google.cloud.dialogflow.v2.SessionEntityType"
|
28
|
+
optional :next_page_token, :string, 2
|
29
|
+
end
|
30
|
+
add_message "google.cloud.dialogflow.v2.GetSessionEntityTypeRequest" do
|
31
|
+
optional :name, :string, 1
|
32
|
+
end
|
33
|
+
add_message "google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest" do
|
34
|
+
optional :parent, :string, 1
|
35
|
+
optional :session_entity_type, :message, 2, "google.cloud.dialogflow.v2.SessionEntityType"
|
36
|
+
end
|
37
|
+
add_message "google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest" do
|
38
|
+
optional :session_entity_type, :message, 1, "google.cloud.dialogflow.v2.SessionEntityType"
|
39
|
+
optional :update_mask, :message, 2, "google.protobuf.FieldMask"
|
40
|
+
end
|
41
|
+
add_message "google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest" do
|
42
|
+
optional :name, :string, 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
module Google
|
47
|
+
module Cloud
|
48
|
+
module Dialogflow
|
49
|
+
module V2
|
50
|
+
SessionEntityType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SessionEntityType").msgclass
|
51
|
+
SessionEntityType::EntityOverrideMode = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode").enummodule
|
52
|
+
ListSessionEntityTypesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListSessionEntityTypesRequest").msgclass
|
53
|
+
ListSessionEntityTypesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListSessionEntityTypesResponse").msgclass
|
54
|
+
GetSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetSessionEntityTypeRequest").msgclass
|
55
|
+
CreateSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest").msgclass
|
56
|
+
UpdateSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest").msgclass
|
57
|
+
DeleteSessionEntityTypeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest").msgclass
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,64 @@
|
|
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 2018 Google Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/dialogflow/v2/session_entity_type_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dialogflow
|
25
|
+
module V2
|
26
|
+
module SessionEntityTypes
|
27
|
+
# Entities are extracted from user input and represent parameters that are
|
28
|
+
# meaningful to your application. For example, a date range, a proper name
|
29
|
+
# such as a geographic location or landmark, and so on. Entities represent
|
30
|
+
# actionable data for your application.
|
31
|
+
#
|
32
|
+
# Session entity types are referred to as **User** entity types and are
|
33
|
+
# entities that are built for an individual user such as
|
34
|
+
# favorites, preferences, playlists, and so on. You can redefine a session
|
35
|
+
# entity type at the session level.
|
36
|
+
#
|
37
|
+
# For more information about entity types, see the
|
38
|
+
# [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
39
|
+
class Service
|
40
|
+
|
41
|
+
include GRPC::GenericService
|
42
|
+
|
43
|
+
self.marshal_class_method = :encode
|
44
|
+
self.unmarshal_class_method = :decode
|
45
|
+
self.service_name = 'google.cloud.dialogflow.v2.SessionEntityTypes'
|
46
|
+
|
47
|
+
# Returns the list of all session entity types in the specified session.
|
48
|
+
rpc :ListSessionEntityTypes, ListSessionEntityTypesRequest, ListSessionEntityTypesResponse
|
49
|
+
# Retrieves the specified session entity type.
|
50
|
+
rpc :GetSessionEntityType, GetSessionEntityTypeRequest, SessionEntityType
|
51
|
+
# Creates a session entity type.
|
52
|
+
rpc :CreateSessionEntityType, CreateSessionEntityTypeRequest, SessionEntityType
|
53
|
+
# Updates the specified session entity type.
|
54
|
+
rpc :UpdateSessionEntityType, UpdateSessionEntityTypeRequest, SessionEntityType
|
55
|
+
# Deletes the specified session entity type.
|
56
|
+
rpc :DeleteSessionEntityType, DeleteSessionEntityTypeRequest, Google::Protobuf::Empty
|
57
|
+
end
|
58
|
+
|
59
|
+
Stub = Service.rpc_stub_class
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,413 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#
|
15
|
+
# 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
|
+
require "json"
|
23
|
+
require "pathname"
|
24
|
+
|
25
|
+
require "google/gax"
|
26
|
+
|
27
|
+
require "google/cloud/dialogflow/v2/session_entity_type_pb"
|
28
|
+
require "google/cloud/dialogflow/credentials"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module Dialogflow
|
33
|
+
module V2
|
34
|
+
# Entities are extracted from user input and represent parameters that are
|
35
|
+
# meaningful to your application. For example, a date range, a proper name
|
36
|
+
# such as a geographic location or landmark, and so on. Entities represent
|
37
|
+
# actionable data for your application.
|
38
|
+
#
|
39
|
+
# Session entity types are referred to as **User** entity types and are
|
40
|
+
# entities that are built for an individual user such as
|
41
|
+
# favorites, preferences, playlists, and so on. You can redefine a session
|
42
|
+
# entity type at the session level.
|
43
|
+
#
|
44
|
+
# For more information about entity types, see the
|
45
|
+
# [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
46
|
+
#
|
47
|
+
# @!attribute [r] session_entity_types_stub
|
48
|
+
# @return [Google::Cloud::Dialogflow::V2::SessionEntityTypes::Stub]
|
49
|
+
class SessionEntityTypesClient
|
50
|
+
attr_reader :session_entity_types_stub
|
51
|
+
|
52
|
+
# The default address of the service.
|
53
|
+
SERVICE_ADDRESS = "dialogflow.googleapis.com".freeze
|
54
|
+
|
55
|
+
# The default port of the service.
|
56
|
+
DEFAULT_SERVICE_PORT = 443
|
57
|
+
|
58
|
+
DEFAULT_TIMEOUT = 30
|
59
|
+
|
60
|
+
PAGE_DESCRIPTORS = {
|
61
|
+
"list_session_entity_types" => Google::Gax::PageDescriptor.new(
|
62
|
+
"page_token",
|
63
|
+
"next_page_token",
|
64
|
+
"session_entity_types")
|
65
|
+
}.freeze
|
66
|
+
|
67
|
+
private_constant :PAGE_DESCRIPTORS
|
68
|
+
|
69
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
70
|
+
# this service.
|
71
|
+
ALL_SCOPES = [
|
72
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
73
|
+
].freeze
|
74
|
+
|
75
|
+
|
76
|
+
SESSION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
77
|
+
"projects/{project}/agent/sessions/{session}"
|
78
|
+
)
|
79
|
+
|
80
|
+
private_constant :SESSION_PATH_TEMPLATE
|
81
|
+
|
82
|
+
SESSION_ENTITY_TYPE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
83
|
+
"projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}"
|
84
|
+
)
|
85
|
+
|
86
|
+
private_constant :SESSION_ENTITY_TYPE_PATH_TEMPLATE
|
87
|
+
|
88
|
+
# Returns a fully-qualified session resource name string.
|
89
|
+
# @param project [String]
|
90
|
+
# @param session [String]
|
91
|
+
# @return [String]
|
92
|
+
def self.session_path project, session
|
93
|
+
SESSION_PATH_TEMPLATE.render(
|
94
|
+
:"project" => project,
|
95
|
+
:"session" => session
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Returns a fully-qualified session_entity_type resource name string.
|
100
|
+
# @param project [String]
|
101
|
+
# @param session [String]
|
102
|
+
# @param entity_type [String]
|
103
|
+
# @return [String]
|
104
|
+
def self.session_entity_type_path project, session, entity_type
|
105
|
+
SESSION_ENTITY_TYPE_PATH_TEMPLATE.render(
|
106
|
+
:"project" => project,
|
107
|
+
:"session" => session,
|
108
|
+
:"entity_type" => entity_type
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
113
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
114
|
+
# be many types.
|
115
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
116
|
+
# authenticating requests made by this client.
|
117
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
118
|
+
# credentials for this client.
|
119
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
120
|
+
# credentials for this client.
|
121
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
122
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
123
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
124
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
125
|
+
# metadata for requests, generally, to give OAuth credentials.
|
126
|
+
# @param scopes [Array<String>]
|
127
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
128
|
+
# an updater_proc is supplied.
|
129
|
+
# @param client_config [Hash]
|
130
|
+
# A Hash for call options for each method. See
|
131
|
+
# Google::Gax#construct_settings for the structure of
|
132
|
+
# this data. Falls back to the default config if not specified
|
133
|
+
# or the specified config is missing data points.
|
134
|
+
# @param timeout [Numeric]
|
135
|
+
# The default timeout, in seconds, for calls made through this client.
|
136
|
+
def initialize \
|
137
|
+
credentials: nil,
|
138
|
+
scopes: ALL_SCOPES,
|
139
|
+
client_config: {},
|
140
|
+
timeout: DEFAULT_TIMEOUT,
|
141
|
+
lib_name: nil,
|
142
|
+
lib_version: ""
|
143
|
+
# These require statements are intentionally placed here to initialize
|
144
|
+
# the gRPC module only when it's required.
|
145
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
146
|
+
require "google/gax/grpc"
|
147
|
+
require "google/cloud/dialogflow/v2/session_entity_type_services_pb"
|
148
|
+
|
149
|
+
credentials ||= Google::Cloud::Dialogflow::Credentials.default
|
150
|
+
|
151
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
152
|
+
updater_proc = Google::Cloud::Dialogflow::Credentials.new(credentials).updater_proc
|
153
|
+
end
|
154
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
155
|
+
channel = credentials
|
156
|
+
end
|
157
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
158
|
+
chan_creds = credentials
|
159
|
+
end
|
160
|
+
if credentials.is_a?(Proc)
|
161
|
+
updater_proc = credentials
|
162
|
+
end
|
163
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
164
|
+
updater_proc = credentials.updater_proc
|
165
|
+
end
|
166
|
+
|
167
|
+
package_version = Gem.loaded_specs['google-cloud-dialogflow'].version.version
|
168
|
+
|
169
|
+
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
170
|
+
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
171
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
172
|
+
google_api_client << " grpc/#{GRPC::VERSION}"
|
173
|
+
google_api_client.freeze
|
174
|
+
|
175
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
176
|
+
client_config_file = Pathname.new(__dir__).join(
|
177
|
+
"session_entity_types_client_config.json"
|
178
|
+
)
|
179
|
+
defaults = client_config_file.open do |f|
|
180
|
+
Google::Gax.construct_settings(
|
181
|
+
"google.cloud.dialogflow.v2.SessionEntityTypes",
|
182
|
+
JSON.parse(f.read),
|
183
|
+
client_config,
|
184
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
185
|
+
timeout,
|
186
|
+
page_descriptors: PAGE_DESCRIPTORS,
|
187
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
188
|
+
kwargs: headers
|
189
|
+
)
|
190
|
+
end
|
191
|
+
|
192
|
+
# Allow overriding the service path/port in subclasses.
|
193
|
+
service_path = self.class::SERVICE_ADDRESS
|
194
|
+
port = self.class::DEFAULT_SERVICE_PORT
|
195
|
+
@session_entity_types_stub = Google::Gax::Grpc.create_stub(
|
196
|
+
service_path,
|
197
|
+
port,
|
198
|
+
chan_creds: chan_creds,
|
199
|
+
channel: channel,
|
200
|
+
updater_proc: updater_proc,
|
201
|
+
scopes: scopes,
|
202
|
+
&Google::Cloud::Dialogflow::V2::SessionEntityTypes::Stub.method(:new)
|
203
|
+
)
|
204
|
+
|
205
|
+
@list_session_entity_types = Google::Gax.create_api_call(
|
206
|
+
@session_entity_types_stub.method(:list_session_entity_types),
|
207
|
+
defaults["list_session_entity_types"]
|
208
|
+
)
|
209
|
+
@get_session_entity_type = Google::Gax.create_api_call(
|
210
|
+
@session_entity_types_stub.method(:get_session_entity_type),
|
211
|
+
defaults["get_session_entity_type"]
|
212
|
+
)
|
213
|
+
@create_session_entity_type = Google::Gax.create_api_call(
|
214
|
+
@session_entity_types_stub.method(:create_session_entity_type),
|
215
|
+
defaults["create_session_entity_type"]
|
216
|
+
)
|
217
|
+
@update_session_entity_type = Google::Gax.create_api_call(
|
218
|
+
@session_entity_types_stub.method(:update_session_entity_type),
|
219
|
+
defaults["update_session_entity_type"]
|
220
|
+
)
|
221
|
+
@delete_session_entity_type = Google::Gax.create_api_call(
|
222
|
+
@session_entity_types_stub.method(:delete_session_entity_type),
|
223
|
+
defaults["delete_session_entity_type"]
|
224
|
+
)
|
225
|
+
end
|
226
|
+
|
227
|
+
# Service calls
|
228
|
+
|
229
|
+
# Returns the list of all session entity types in the specified session.
|
230
|
+
#
|
231
|
+
# @param parent [String]
|
232
|
+
# Required. The session to list all session entity types from.
|
233
|
+
# Format: +projects/<Project ID>/agent/sessions/<Session ID>+.
|
234
|
+
# @param page_size [Integer]
|
235
|
+
# The maximum number of resources contained in the underlying API
|
236
|
+
# response. If page streaming is performed per-resource, this
|
237
|
+
# parameter does not affect the return value. If page streaming is
|
238
|
+
# performed per-page, this determines the maximum number of
|
239
|
+
# resources in a page.
|
240
|
+
# @param options [Google::Gax::CallOptions]
|
241
|
+
# Overrides the default settings for this call, e.g, timeout,
|
242
|
+
# retries, etc.
|
243
|
+
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::SessionEntityType>]
|
244
|
+
# An enumerable of Google::Cloud::Dialogflow::V2::SessionEntityType instances.
|
245
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
246
|
+
# operations such as per-page iteration or access to the response
|
247
|
+
# object.
|
248
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
249
|
+
# @example
|
250
|
+
# require "google/cloud/dialogflow/v2"
|
251
|
+
#
|
252
|
+
# session_entity_types_client = Google::Cloud::Dialogflow::V2::SessionEntityTypes.new
|
253
|
+
# formatted_parent = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_path("[PROJECT]", "[SESSION]")
|
254
|
+
#
|
255
|
+
# # Iterate over all results.
|
256
|
+
# session_entity_types_client.list_session_entity_types(formatted_parent).each do |element|
|
257
|
+
# # Process element.
|
258
|
+
# end
|
259
|
+
#
|
260
|
+
# # Or iterate over results one page at a time.
|
261
|
+
# session_entity_types_client.list_session_entity_types(formatted_parent).each_page do |page|
|
262
|
+
# # Process each page at a time.
|
263
|
+
# page.each do |element|
|
264
|
+
# # Process element.
|
265
|
+
# end
|
266
|
+
# end
|
267
|
+
|
268
|
+
def list_session_entity_types \
|
269
|
+
parent,
|
270
|
+
page_size: nil,
|
271
|
+
options: nil
|
272
|
+
req = {
|
273
|
+
parent: parent,
|
274
|
+
page_size: page_size
|
275
|
+
}.delete_if { |_, v| v.nil? }
|
276
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ListSessionEntityTypesRequest)
|
277
|
+
@list_session_entity_types.call(req, options)
|
278
|
+
end
|
279
|
+
|
280
|
+
# Retrieves the specified session entity type.
|
281
|
+
#
|
282
|
+
# @param name [String]
|
283
|
+
# Required. The name of the session entity type. Format:
|
284
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
285
|
+
# Display Name>+.
|
286
|
+
# @param options [Google::Gax::CallOptions]
|
287
|
+
# Overrides the default settings for this call, e.g, timeout,
|
288
|
+
# retries, etc.
|
289
|
+
# @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
|
290
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
291
|
+
# @example
|
292
|
+
# require "google/cloud/dialogflow/v2"
|
293
|
+
#
|
294
|
+
# session_entity_types_client = Google::Cloud::Dialogflow::V2::SessionEntityTypes.new
|
295
|
+
# formatted_name = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_entity_type_path("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
|
296
|
+
# response = session_entity_types_client.get_session_entity_type(formatted_name)
|
297
|
+
|
298
|
+
def get_session_entity_type \
|
299
|
+
name,
|
300
|
+
options: nil
|
301
|
+
req = {
|
302
|
+
name: name
|
303
|
+
}.delete_if { |_, v| v.nil? }
|
304
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetSessionEntityTypeRequest)
|
305
|
+
@get_session_entity_type.call(req, options)
|
306
|
+
end
|
307
|
+
|
308
|
+
# Creates a session entity type.
|
309
|
+
#
|
310
|
+
# @param parent [String]
|
311
|
+
# Required. The session to create a session entity type for.
|
312
|
+
# Format: +projects/<Project ID>/agent/sessions/<Session ID>+.
|
313
|
+
# @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
|
314
|
+
# Required. The session entity type to create.
|
315
|
+
# A hash of the same form as `Google::Cloud::Dialogflow::V2::SessionEntityType`
|
316
|
+
# can also be provided.
|
317
|
+
# @param options [Google::Gax::CallOptions]
|
318
|
+
# Overrides the default settings for this call, e.g, timeout,
|
319
|
+
# retries, etc.
|
320
|
+
# @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
|
321
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
322
|
+
# @example
|
323
|
+
# require "google/cloud/dialogflow/v2"
|
324
|
+
#
|
325
|
+
# session_entity_types_client = Google::Cloud::Dialogflow::V2::SessionEntityTypes.new
|
326
|
+
# formatted_parent = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_path("[PROJECT]", "[SESSION]")
|
327
|
+
#
|
328
|
+
# # TODO: Initialize +session_entity_type+:
|
329
|
+
# session_entity_type = {}
|
330
|
+
# response = session_entity_types_client.create_session_entity_type(formatted_parent, session_entity_type)
|
331
|
+
|
332
|
+
def create_session_entity_type \
|
333
|
+
parent,
|
334
|
+
session_entity_type,
|
335
|
+
options: nil
|
336
|
+
req = {
|
337
|
+
parent: parent,
|
338
|
+
session_entity_type: session_entity_type
|
339
|
+
}.delete_if { |_, v| v.nil? }
|
340
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::CreateSessionEntityTypeRequest)
|
341
|
+
@create_session_entity_type.call(req, options)
|
342
|
+
end
|
343
|
+
|
344
|
+
# Updates the specified session entity type.
|
345
|
+
#
|
346
|
+
# @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
|
347
|
+
# Required. The entity type to update. Format:
|
348
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
349
|
+
# Display Name>+.
|
350
|
+
# A hash of the same form as `Google::Cloud::Dialogflow::V2::SessionEntityType`
|
351
|
+
# can also be provided.
|
352
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
353
|
+
# Optional. The mask to control which fields get updated.
|
354
|
+
# A hash of the same form as `Google::Protobuf::FieldMask`
|
355
|
+
# can also be provided.
|
356
|
+
# @param options [Google::Gax::CallOptions]
|
357
|
+
# Overrides the default settings for this call, e.g, timeout,
|
358
|
+
# retries, etc.
|
359
|
+
# @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
|
360
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
361
|
+
# @example
|
362
|
+
# require "google/cloud/dialogflow/v2"
|
363
|
+
#
|
364
|
+
# session_entity_types_client = Google::Cloud::Dialogflow::V2::SessionEntityTypes.new
|
365
|
+
#
|
366
|
+
# # TODO: Initialize +session_entity_type+:
|
367
|
+
# session_entity_type = {}
|
368
|
+
# response = session_entity_types_client.update_session_entity_type(session_entity_type)
|
369
|
+
|
370
|
+
def update_session_entity_type \
|
371
|
+
session_entity_type,
|
372
|
+
update_mask: nil,
|
373
|
+
options: nil
|
374
|
+
req = {
|
375
|
+
session_entity_type: session_entity_type,
|
376
|
+
update_mask: update_mask
|
377
|
+
}.delete_if { |_, v| v.nil? }
|
378
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::UpdateSessionEntityTypeRequest)
|
379
|
+
@update_session_entity_type.call(req, options)
|
380
|
+
end
|
381
|
+
|
382
|
+
# Deletes the specified session entity type.
|
383
|
+
#
|
384
|
+
# @param name [String]
|
385
|
+
# Required. The name of the entity type to delete. Format:
|
386
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
387
|
+
# Display Name>+.
|
388
|
+
# @param options [Google::Gax::CallOptions]
|
389
|
+
# Overrides the default settings for this call, e.g, timeout,
|
390
|
+
# retries, etc.
|
391
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
392
|
+
# @example
|
393
|
+
# require "google/cloud/dialogflow/v2"
|
394
|
+
#
|
395
|
+
# session_entity_types_client = Google::Cloud::Dialogflow::V2::SessionEntityTypes.new
|
396
|
+
# formatted_name = Google::Cloud::Dialogflow::V2::SessionEntityTypesClient.session_entity_type_path("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]")
|
397
|
+
# session_entity_types_client.delete_session_entity_type(formatted_name)
|
398
|
+
|
399
|
+
def delete_session_entity_type \
|
400
|
+
name,
|
401
|
+
options: nil
|
402
|
+
req = {
|
403
|
+
name: name
|
404
|
+
}.delete_if { |_, v| v.nil? }
|
405
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteSessionEntityTypeRequest)
|
406
|
+
@delete_session_entity_type.call(req, options)
|
407
|
+
nil
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|