google-cloud-dialogflow 0.14.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/AUTHENTICATION.md +51 -59
- data/LICENSE.md +203 -0
- data/MIGRATING.md +445 -0
- data/README.md +35 -25
- data/lib/{google/cloud/dialogflow/v2/doc/google/protobuf/empty.rb → google-cloud-dialogflow.rb} +4 -14
- data/lib/google/cloud/dialogflow.rb +256 -506
- data/lib/google/cloud/dialogflow/version.rb +1 -1
- metadata +63 -86
- data/LICENSE +0 -201
- data/lib/google/cloud/dialogflow/v2.rb +0 -598
- data/lib/google/cloud/dialogflow/v2/agent_pb.rb +0 -121
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +0 -111
- data/lib/google/cloud/dialogflow/v2/agents_client.rb +0 -807
- data/lib/google/cloud/dialogflow/v2/agents_client_config.json +0 -71
- data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -96
- data/lib/google/cloud/dialogflow/v2/context_pb.rb +0 -63
- data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +0 -75
- data/lib/google/cloud/dialogflow/v2/contexts_client.rb +0 -519
- data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +0 -56
- data/lib/google/cloud/dialogflow/v2/credentials.rb +0 -42
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +0 -247
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/audio_config.rb +0 -341
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +0 -116
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +0 -305
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +0 -937
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +0 -498
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +0 -130
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/validation_result.rb +0 -71
- data/lib/google/cloud/dialogflow/v2/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +0 -31
- data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +0 -125
- data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +0 -105
- data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +0 -994
- data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +0 -76
- data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -367
- data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +0 -93
- data/lib/google/cloud/dialogflow/v2/intents_client.rb +0 -760
- data/lib/google/cloud/dialogflow/v2/intents_client_config.json +0 -61
- data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +0 -65
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +0 -93
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +0 -504
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +0 -51
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -141
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +0 -56
- data/lib/google/cloud/dialogflow/v2/sessions_client.rb +0 -337
- data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +0 -36
- data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -36
- data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -46
@@ -1,121 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# source: google/cloud/dialogflow/v2/agent.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/validation_result_pb'
|
12
|
-
require 'google/longrunning/operations_pb'
|
13
|
-
require 'google/protobuf/empty_pb'
|
14
|
-
require 'google/protobuf/field_mask_pb'
|
15
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
16
|
-
add_message "google.cloud.dialogflow.v2.Agent" do
|
17
|
-
optional :parent, :string, 1
|
18
|
-
optional :display_name, :string, 2
|
19
|
-
optional :default_language_code, :string, 3
|
20
|
-
repeated :supported_language_codes, :string, 4
|
21
|
-
optional :time_zone, :string, 5
|
22
|
-
optional :description, :string, 6
|
23
|
-
optional :avatar_uri, :string, 7
|
24
|
-
optional :enable_logging, :bool, 8
|
25
|
-
optional :match_mode, :enum, 9, "google.cloud.dialogflow.v2.Agent.MatchMode"
|
26
|
-
optional :classification_threshold, :float, 10
|
27
|
-
optional :api_version, :enum, 14, "google.cloud.dialogflow.v2.Agent.ApiVersion"
|
28
|
-
optional :tier, :enum, 15, "google.cloud.dialogflow.v2.Agent.Tier"
|
29
|
-
end
|
30
|
-
add_enum "google.cloud.dialogflow.v2.Agent.MatchMode" do
|
31
|
-
value :MATCH_MODE_UNSPECIFIED, 0
|
32
|
-
value :MATCH_MODE_HYBRID, 1
|
33
|
-
value :MATCH_MODE_ML_ONLY, 2
|
34
|
-
end
|
35
|
-
add_enum "google.cloud.dialogflow.v2.Agent.ApiVersion" do
|
36
|
-
value :API_VERSION_UNSPECIFIED, 0
|
37
|
-
value :API_VERSION_V1, 1
|
38
|
-
value :API_VERSION_V2, 2
|
39
|
-
value :API_VERSION_V2_BETA_1, 3
|
40
|
-
end
|
41
|
-
add_enum "google.cloud.dialogflow.v2.Agent.Tier" do
|
42
|
-
value :TIER_UNSPECIFIED, 0
|
43
|
-
value :TIER_STANDARD, 1
|
44
|
-
value :TIER_ENTERPRISE, 2
|
45
|
-
value :TIER_ENTERPRISE_PLUS, 3
|
46
|
-
end
|
47
|
-
add_message "google.cloud.dialogflow.v2.GetAgentRequest" do
|
48
|
-
optional :parent, :string, 1
|
49
|
-
end
|
50
|
-
add_message "google.cloud.dialogflow.v2.SetAgentRequest" do
|
51
|
-
optional :agent, :message, 1, "google.cloud.dialogflow.v2.Agent"
|
52
|
-
optional :update_mask, :message, 2, "google.protobuf.FieldMask"
|
53
|
-
end
|
54
|
-
add_message "google.cloud.dialogflow.v2.DeleteAgentRequest" do
|
55
|
-
optional :parent, :string, 1
|
56
|
-
end
|
57
|
-
add_message "google.cloud.dialogflow.v2.SearchAgentsRequest" do
|
58
|
-
optional :parent, :string, 1
|
59
|
-
optional :page_size, :int32, 2
|
60
|
-
optional :page_token, :string, 3
|
61
|
-
end
|
62
|
-
add_message "google.cloud.dialogflow.v2.SearchAgentsResponse" do
|
63
|
-
repeated :agents, :message, 1, "google.cloud.dialogflow.v2.Agent"
|
64
|
-
optional :next_page_token, :string, 2
|
65
|
-
end
|
66
|
-
add_message "google.cloud.dialogflow.v2.TrainAgentRequest" do
|
67
|
-
optional :parent, :string, 1
|
68
|
-
end
|
69
|
-
add_message "google.cloud.dialogflow.v2.ExportAgentRequest" do
|
70
|
-
optional :parent, :string, 1
|
71
|
-
optional :agent_uri, :string, 2
|
72
|
-
end
|
73
|
-
add_message "google.cloud.dialogflow.v2.ExportAgentResponse" do
|
74
|
-
oneof :agent do
|
75
|
-
optional :agent_uri, :string, 1
|
76
|
-
optional :agent_content, :bytes, 2
|
77
|
-
end
|
78
|
-
end
|
79
|
-
add_message "google.cloud.dialogflow.v2.ImportAgentRequest" do
|
80
|
-
optional :parent, :string, 1
|
81
|
-
oneof :agent do
|
82
|
-
optional :agent_uri, :string, 2
|
83
|
-
optional :agent_content, :bytes, 3
|
84
|
-
end
|
85
|
-
end
|
86
|
-
add_message "google.cloud.dialogflow.v2.RestoreAgentRequest" do
|
87
|
-
optional :parent, :string, 1
|
88
|
-
oneof :agent do
|
89
|
-
optional :agent_uri, :string, 2
|
90
|
-
optional :agent_content, :bytes, 3
|
91
|
-
end
|
92
|
-
end
|
93
|
-
add_message "google.cloud.dialogflow.v2.GetValidationResultRequest" do
|
94
|
-
optional :parent, :string, 1
|
95
|
-
optional :language_code, :string, 3
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
module Google
|
100
|
-
module Cloud
|
101
|
-
module Dialogflow
|
102
|
-
module V2
|
103
|
-
Agent = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Agent").msgclass
|
104
|
-
Agent::MatchMode = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Agent.MatchMode").enummodule
|
105
|
-
Agent::ApiVersion = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Agent.ApiVersion").enummodule
|
106
|
-
Agent::Tier = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Agent.Tier").enummodule
|
107
|
-
GetAgentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetAgentRequest").msgclass
|
108
|
-
SetAgentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SetAgentRequest").msgclass
|
109
|
-
DeleteAgentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteAgentRequest").msgclass
|
110
|
-
SearchAgentsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SearchAgentsRequest").msgclass
|
111
|
-
SearchAgentsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SearchAgentsResponse").msgclass
|
112
|
-
TrainAgentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.TrainAgentRequest").msgclass
|
113
|
-
ExportAgentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ExportAgentRequest").msgclass
|
114
|
-
ExportAgentResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ExportAgentResponse").msgclass
|
115
|
-
ImportAgentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ImportAgentRequest").msgclass
|
116
|
-
RestoreAgentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.RestoreAgentRequest").msgclass
|
117
|
-
GetValidationResultRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetValidationResultRequest").msgclass
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# Source: google/cloud/dialogflow/v2/agent.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/agent_pb'
|
22
|
-
|
23
|
-
module Google
|
24
|
-
module Cloud
|
25
|
-
module Dialogflow
|
26
|
-
module V2
|
27
|
-
module Agents
|
28
|
-
# Agents are best described as Natural Language Understanding (NLU) modules
|
29
|
-
# that transform user requests into actionable data. You can include agents
|
30
|
-
# in your app, product, or service to determine user intent and respond to the
|
31
|
-
# user in a natural way.
|
32
|
-
#
|
33
|
-
# After you create an agent, you can add [Intents][google.cloud.dialogflow.v2.Intents], [Contexts][google.cloud.dialogflow.v2.Contexts],
|
34
|
-
# [Entity Types][google.cloud.dialogflow.v2.EntityTypes], [Webhooks][google.cloud.dialogflow.v2.WebhookRequest], and so on to
|
35
|
-
# manage the flow of a conversation and match user input to predefined intents
|
36
|
-
# and actions.
|
37
|
-
#
|
38
|
-
# You can create an agent using both Dialogflow Standard Edition and
|
39
|
-
# Dialogflow Enterprise Edition. For details, see
|
40
|
-
# [Dialogflow
|
41
|
-
# Editions](https://cloud.google.com/dialogflow/docs/editions).
|
42
|
-
#
|
43
|
-
# You can save your agent for backup or versioning by exporting the agent by
|
44
|
-
# using the [ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent] method. You can import a saved
|
45
|
-
# agent by using the [ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent] method.
|
46
|
-
#
|
47
|
-
# Dialogflow provides several
|
48
|
-
# [prebuilt
|
49
|
-
# agents](https://cloud.google.com/dialogflow/docs/agents-prebuilt)
|
50
|
-
# for common conversation scenarios such as determining a date and time,
|
51
|
-
# converting currency, and so on.
|
52
|
-
#
|
53
|
-
# For more information about agents, see the
|
54
|
-
# [Dialogflow
|
55
|
-
# documentation](https://cloud.google.com/dialogflow/docs/agents-overview).
|
56
|
-
class Service
|
57
|
-
|
58
|
-
include GRPC::GenericService
|
59
|
-
|
60
|
-
self.marshal_class_method = :encode
|
61
|
-
self.unmarshal_class_method = :decode
|
62
|
-
self.service_name = 'google.cloud.dialogflow.v2.Agents'
|
63
|
-
|
64
|
-
# Retrieves the specified agent.
|
65
|
-
rpc :GetAgent, GetAgentRequest, Agent
|
66
|
-
# Creates/updates the specified agent.
|
67
|
-
rpc :SetAgent, SetAgentRequest, Agent
|
68
|
-
# Deletes the specified agent.
|
69
|
-
rpc :DeleteAgent, DeleteAgentRequest, Google::Protobuf::Empty
|
70
|
-
# Returns the list of agents.
|
71
|
-
#
|
72
|
-
# Since there is at most one conversational agent per project, this method is
|
73
|
-
# useful primarily for listing all agents across projects the caller has
|
74
|
-
# access to. One can achieve that with a wildcard project collection id "-".
|
75
|
-
# Refer to [List
|
76
|
-
# Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
77
|
-
rpc :SearchAgents, SearchAgentsRequest, SearchAgentsResponse
|
78
|
-
# Trains the specified agent.
|
79
|
-
#
|
80
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
81
|
-
rpc :TrainAgent, TrainAgentRequest, Google::Longrunning::Operation
|
82
|
-
# Exports the specified agent to a ZIP file.
|
83
|
-
#
|
84
|
-
# Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]>
|
85
|
-
rpc :ExportAgent, ExportAgentRequest, Google::Longrunning::Operation
|
86
|
-
# Imports the specified agent from a ZIP file.
|
87
|
-
#
|
88
|
-
# Uploads new intents and entity types without deleting the existing ones.
|
89
|
-
# Intents and entity types with the same name are replaced with the new
|
90
|
-
# versions from ImportAgentRequest.
|
91
|
-
#
|
92
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
93
|
-
rpc :ImportAgent, ImportAgentRequest, Google::Longrunning::Operation
|
94
|
-
# Restores the specified agent from a ZIP file.
|
95
|
-
#
|
96
|
-
# Replaces the current agent version with a new one. All the intents and
|
97
|
-
# entity types in the older version are deleted.
|
98
|
-
#
|
99
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
100
|
-
rpc :RestoreAgent, RestoreAgentRequest, Google::Longrunning::Operation
|
101
|
-
# Gets agent validation result. Agent validation is performed during
|
102
|
-
# training time and is updated automatically when training is completed.
|
103
|
-
rpc :GetValidationResult, GetValidationResultRequest, ValidationResult
|
104
|
-
end
|
105
|
-
|
106
|
-
Stub = Service.rpc_stub_class
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,807 +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/agent.proto,
|
18
|
-
# and updates to that file get reflected here through a refresh process.
|
19
|
-
# For the short term, the refresh process will only be runnable by Google
|
20
|
-
# engineers.
|
21
|
-
|
22
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
require "google/gax/operation"
|
28
|
-
require "google/longrunning/operations_client"
|
29
|
-
|
30
|
-
require "google/cloud/dialogflow/v2/agent_pb"
|
31
|
-
require "google/cloud/dialogflow/v2/credentials"
|
32
|
-
require "google/cloud/dialogflow/version"
|
33
|
-
|
34
|
-
module Google
|
35
|
-
module Cloud
|
36
|
-
module Dialogflow
|
37
|
-
module V2
|
38
|
-
# Agents are best described as Natural Language Understanding (NLU) modules
|
39
|
-
# that transform user requests into actionable data. You can include agents
|
40
|
-
# in your app, product, or service to determine user intent and respond to the
|
41
|
-
# user in a natural way.
|
42
|
-
#
|
43
|
-
# After you create an agent, you can add {Google::Cloud::Dialogflow::V2::Intents Intents}, {Google::Cloud::Dialogflow::V2::Contexts Contexts},
|
44
|
-
# {Google::Cloud::Dialogflow::V2::EntityTypes Entity Types}, {Google::Cloud::Dialogflow::V2::WebhookRequest Webhooks}, and so on to
|
45
|
-
# manage the flow of a conversation and match user input to predefined intents
|
46
|
-
# and actions.
|
47
|
-
#
|
48
|
-
# You can create an agent using both Dialogflow Standard Edition and
|
49
|
-
# Dialogflow Enterprise Edition. For details, see
|
50
|
-
# [Dialogflow
|
51
|
-
# Editions](https://cloud.google.com/dialogflow/docs/editions).
|
52
|
-
#
|
53
|
-
# You can save your agent for backup or versioning by exporting the agent by
|
54
|
-
# using the {Google::Cloud::Dialogflow::V2::Agents::ExportAgent ExportAgent} method. You can import a saved
|
55
|
-
# agent by using the {Google::Cloud::Dialogflow::V2::Agents::ImportAgent ImportAgent} method.
|
56
|
-
#
|
57
|
-
# Dialogflow provides several
|
58
|
-
# [prebuilt
|
59
|
-
# agents](https://cloud.google.com/dialogflow/docs/agents-prebuilt)
|
60
|
-
# for common conversation scenarios such as determining a date and time,
|
61
|
-
# converting currency, and so on.
|
62
|
-
#
|
63
|
-
# For more information about agents, see the
|
64
|
-
# [Dialogflow
|
65
|
-
# documentation](https://cloud.google.com/dialogflow/docs/agents-overview).
|
66
|
-
#
|
67
|
-
# @!attribute [r] agents_stub
|
68
|
-
# @return [Google::Cloud::Dialogflow::V2::Agents::Stub]
|
69
|
-
class AgentsClient
|
70
|
-
# @private
|
71
|
-
attr_reader :agents_stub
|
72
|
-
|
73
|
-
# The default address of the service.
|
74
|
-
SERVICE_ADDRESS = "dialogflow.googleapis.com".freeze
|
75
|
-
|
76
|
-
# The default port of the service.
|
77
|
-
DEFAULT_SERVICE_PORT = 443
|
78
|
-
|
79
|
-
# The default set of gRPC interceptors.
|
80
|
-
GRPC_INTERCEPTORS = []
|
81
|
-
|
82
|
-
DEFAULT_TIMEOUT = 30
|
83
|
-
|
84
|
-
PAGE_DESCRIPTORS = {
|
85
|
-
"search_agents" => Google::Gax::PageDescriptor.new(
|
86
|
-
"page_token",
|
87
|
-
"next_page_token",
|
88
|
-
"agents")
|
89
|
-
}.freeze
|
90
|
-
|
91
|
-
private_constant :PAGE_DESCRIPTORS
|
92
|
-
|
93
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
94
|
-
# this service.
|
95
|
-
ALL_SCOPES = [
|
96
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
97
|
-
"https://www.googleapis.com/auth/dialogflow"
|
98
|
-
].freeze
|
99
|
-
|
100
|
-
# @private
|
101
|
-
class OperationsClient < Google::Longrunning::OperationsClient
|
102
|
-
self::SERVICE_ADDRESS = AgentsClient::SERVICE_ADDRESS
|
103
|
-
self::GRPC_INTERCEPTORS = AgentsClient::GRPC_INTERCEPTORS
|
104
|
-
end
|
105
|
-
|
106
|
-
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
107
|
-
"projects/{project}"
|
108
|
-
)
|
109
|
-
|
110
|
-
private_constant :PROJECT_PATH_TEMPLATE
|
111
|
-
|
112
|
-
# Returns a fully-qualified project resource name string.
|
113
|
-
# @param project [String]
|
114
|
-
# @return [String]
|
115
|
-
def self.project_path project
|
116
|
-
PROJECT_PATH_TEMPLATE.render(
|
117
|
-
:"project" => project
|
118
|
-
)
|
119
|
-
end
|
120
|
-
|
121
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
122
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
123
|
-
# be many types.
|
124
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
125
|
-
# authenticating requests made by this client.
|
126
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
127
|
-
# credentials for this client.
|
128
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
129
|
-
# credentials for this client.
|
130
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
131
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
132
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
133
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
134
|
-
# metadata for requests, generally, to give OAuth credentials.
|
135
|
-
# @param scopes [Array<String>]
|
136
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
137
|
-
# an updater_proc is supplied.
|
138
|
-
# @param client_config [Hash]
|
139
|
-
# A Hash for call options for each method. See
|
140
|
-
# Google::Gax#construct_settings for the structure of
|
141
|
-
# this data. Falls back to the default config if not specified
|
142
|
-
# or the specified config is missing data points.
|
143
|
-
# @param timeout [Numeric]
|
144
|
-
# The default timeout, in seconds, for calls made through this client.
|
145
|
-
# @param metadata [Hash]
|
146
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
147
|
-
# @param service_address [String]
|
148
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
149
|
-
# @param service_port [Integer]
|
150
|
-
# Override for the service port, or `nil` to leave as the default.
|
151
|
-
# @param exception_transformer [Proc]
|
152
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
153
|
-
# custom error handling.
|
154
|
-
def initialize \
|
155
|
-
credentials: nil,
|
156
|
-
scopes: ALL_SCOPES,
|
157
|
-
client_config: {},
|
158
|
-
timeout: DEFAULT_TIMEOUT,
|
159
|
-
metadata: nil,
|
160
|
-
service_address: nil,
|
161
|
-
service_port: nil,
|
162
|
-
exception_transformer: nil,
|
163
|
-
lib_name: nil,
|
164
|
-
lib_version: ""
|
165
|
-
# These require statements are intentionally placed here to initialize
|
166
|
-
# the gRPC module only when it's required.
|
167
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
168
|
-
require "google/gax/grpc"
|
169
|
-
require "google/cloud/dialogflow/v2/agent_services_pb"
|
170
|
-
|
171
|
-
credentials ||= Google::Cloud::Dialogflow::V2::Credentials.default
|
172
|
-
|
173
|
-
@operations_client = OperationsClient.new(
|
174
|
-
credentials: credentials,
|
175
|
-
scopes: scopes,
|
176
|
-
client_config: client_config,
|
177
|
-
timeout: timeout,
|
178
|
-
lib_name: lib_name,
|
179
|
-
service_address: service_address,
|
180
|
-
service_port: service_port,
|
181
|
-
lib_version: lib_version,
|
182
|
-
metadata: metadata,
|
183
|
-
)
|
184
|
-
|
185
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
186
|
-
updater_proc = Google::Cloud::Dialogflow::V2::Credentials.new(credentials).updater_proc
|
187
|
-
end
|
188
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
189
|
-
channel = credentials
|
190
|
-
end
|
191
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
192
|
-
chan_creds = credentials
|
193
|
-
end
|
194
|
-
if credentials.is_a?(Proc)
|
195
|
-
updater_proc = credentials
|
196
|
-
end
|
197
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
198
|
-
updater_proc = credentials.updater_proc
|
199
|
-
end
|
200
|
-
|
201
|
-
package_version = Google::Cloud::Dialogflow::VERSION
|
202
|
-
|
203
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
204
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
205
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
206
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
207
|
-
google_api_client.freeze
|
208
|
-
|
209
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
210
|
-
headers.merge!(metadata) unless metadata.nil?
|
211
|
-
client_config_file = Pathname.new(__dir__).join(
|
212
|
-
"agents_client_config.json"
|
213
|
-
)
|
214
|
-
defaults = client_config_file.open do |f|
|
215
|
-
Google::Gax.construct_settings(
|
216
|
-
"google.cloud.dialogflow.v2.Agents",
|
217
|
-
JSON.parse(f.read),
|
218
|
-
client_config,
|
219
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
220
|
-
timeout,
|
221
|
-
page_descriptors: PAGE_DESCRIPTORS,
|
222
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
223
|
-
metadata: headers
|
224
|
-
)
|
225
|
-
end
|
226
|
-
|
227
|
-
# Allow overriding the service path/port in subclasses.
|
228
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
229
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
230
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
231
|
-
@agents_stub = Google::Gax::Grpc.create_stub(
|
232
|
-
service_path,
|
233
|
-
port,
|
234
|
-
chan_creds: chan_creds,
|
235
|
-
channel: channel,
|
236
|
-
updater_proc: updater_proc,
|
237
|
-
scopes: scopes,
|
238
|
-
interceptors: interceptors,
|
239
|
-
&Google::Cloud::Dialogflow::V2::Agents::Stub.method(:new)
|
240
|
-
)
|
241
|
-
|
242
|
-
@set_agent = Google::Gax.create_api_call(
|
243
|
-
@agents_stub.method(:set_agent),
|
244
|
-
defaults["set_agent"],
|
245
|
-
exception_transformer: exception_transformer,
|
246
|
-
params_extractor: proc do |request|
|
247
|
-
{'agent.parent' => request.agent.parent}
|
248
|
-
end
|
249
|
-
)
|
250
|
-
@delete_agent = Google::Gax.create_api_call(
|
251
|
-
@agents_stub.method(:delete_agent),
|
252
|
-
defaults["delete_agent"],
|
253
|
-
exception_transformer: exception_transformer,
|
254
|
-
params_extractor: proc do |request|
|
255
|
-
{'parent' => request.parent}
|
256
|
-
end
|
257
|
-
)
|
258
|
-
@get_agent = Google::Gax.create_api_call(
|
259
|
-
@agents_stub.method(:get_agent),
|
260
|
-
defaults["get_agent"],
|
261
|
-
exception_transformer: exception_transformer,
|
262
|
-
params_extractor: proc do |request|
|
263
|
-
{'parent' => request.parent}
|
264
|
-
end
|
265
|
-
)
|
266
|
-
@search_agents = Google::Gax.create_api_call(
|
267
|
-
@agents_stub.method(:search_agents),
|
268
|
-
defaults["search_agents"],
|
269
|
-
exception_transformer: exception_transformer,
|
270
|
-
params_extractor: proc do |request|
|
271
|
-
{'parent' => request.parent}
|
272
|
-
end
|
273
|
-
)
|
274
|
-
@train_agent = Google::Gax.create_api_call(
|
275
|
-
@agents_stub.method(:train_agent),
|
276
|
-
defaults["train_agent"],
|
277
|
-
exception_transformer: exception_transformer,
|
278
|
-
params_extractor: proc do |request|
|
279
|
-
{'parent' => request.parent}
|
280
|
-
end
|
281
|
-
)
|
282
|
-
@export_agent = Google::Gax.create_api_call(
|
283
|
-
@agents_stub.method(:export_agent),
|
284
|
-
defaults["export_agent"],
|
285
|
-
exception_transformer: exception_transformer,
|
286
|
-
params_extractor: proc do |request|
|
287
|
-
{'parent' => request.parent}
|
288
|
-
end
|
289
|
-
)
|
290
|
-
@import_agent = Google::Gax.create_api_call(
|
291
|
-
@agents_stub.method(:import_agent),
|
292
|
-
defaults["import_agent"],
|
293
|
-
exception_transformer: exception_transformer,
|
294
|
-
params_extractor: proc do |request|
|
295
|
-
{'parent' => request.parent}
|
296
|
-
end
|
297
|
-
)
|
298
|
-
@restore_agent = Google::Gax.create_api_call(
|
299
|
-
@agents_stub.method(:restore_agent),
|
300
|
-
defaults["restore_agent"],
|
301
|
-
exception_transformer: exception_transformer,
|
302
|
-
params_extractor: proc do |request|
|
303
|
-
{'parent' => request.parent}
|
304
|
-
end
|
305
|
-
)
|
306
|
-
@get_validation_result = Google::Gax.create_api_call(
|
307
|
-
@agents_stub.method(:get_validation_result),
|
308
|
-
defaults["get_validation_result"],
|
309
|
-
exception_transformer: exception_transformer,
|
310
|
-
params_extractor: proc do |request|
|
311
|
-
{'parent' => request.parent}
|
312
|
-
end
|
313
|
-
)
|
314
|
-
end
|
315
|
-
|
316
|
-
# Service calls
|
317
|
-
|
318
|
-
# Creates/updates the specified agent.
|
319
|
-
#
|
320
|
-
# @param agent [Google::Cloud::Dialogflow::V2::Agent | Hash]
|
321
|
-
# Required. The agent to update.
|
322
|
-
# A hash of the same form as `Google::Cloud::Dialogflow::V2::Agent`
|
323
|
-
# can also be provided.
|
324
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
325
|
-
# Optional. The mask to control which fields get updated.
|
326
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
327
|
-
# can also be provided.
|
328
|
-
# @param options [Google::Gax::CallOptions]
|
329
|
-
# Overrides the default settings for this call, e.g, timeout,
|
330
|
-
# retries, etc.
|
331
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
332
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::Agent]
|
333
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
334
|
-
# @return [Google::Cloud::Dialogflow::V2::Agent]
|
335
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
336
|
-
# @example
|
337
|
-
# require "google/cloud/dialogflow"
|
338
|
-
#
|
339
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
340
|
-
#
|
341
|
-
# # TODO: Initialize `agent`:
|
342
|
-
# agent = {}
|
343
|
-
# response = agents_client.set_agent(agent)
|
344
|
-
|
345
|
-
def set_agent \
|
346
|
-
agent,
|
347
|
-
update_mask: nil,
|
348
|
-
options: nil,
|
349
|
-
&block
|
350
|
-
req = {
|
351
|
-
agent: agent,
|
352
|
-
update_mask: update_mask
|
353
|
-
}.delete_if { |_, v| v.nil? }
|
354
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::SetAgentRequest)
|
355
|
-
@set_agent.call(req, options, &block)
|
356
|
-
end
|
357
|
-
|
358
|
-
# Deletes the specified agent.
|
359
|
-
#
|
360
|
-
# @param parent [String]
|
361
|
-
# Required. The project that the agent to delete is associated with.
|
362
|
-
# Format: `projects/<Project ID>`.
|
363
|
-
# @param options [Google::Gax::CallOptions]
|
364
|
-
# Overrides the default settings for this call, e.g, timeout,
|
365
|
-
# retries, etc.
|
366
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
367
|
-
# @yieldparam result []
|
368
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
369
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
370
|
-
# @example
|
371
|
-
# require "google/cloud/dialogflow"
|
372
|
-
#
|
373
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
374
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
375
|
-
# agents_client.delete_agent(formatted_parent)
|
376
|
-
|
377
|
-
def delete_agent \
|
378
|
-
parent,
|
379
|
-
options: nil,
|
380
|
-
&block
|
381
|
-
req = {
|
382
|
-
parent: parent
|
383
|
-
}.delete_if { |_, v| v.nil? }
|
384
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteAgentRequest)
|
385
|
-
@delete_agent.call(req, options, &block)
|
386
|
-
nil
|
387
|
-
end
|
388
|
-
|
389
|
-
# Retrieves the specified agent.
|
390
|
-
#
|
391
|
-
# @param parent [String]
|
392
|
-
# Required. The project that the agent to fetch is associated with.
|
393
|
-
# Format: `projects/<Project ID>`.
|
394
|
-
# @param options [Google::Gax::CallOptions]
|
395
|
-
# Overrides the default settings for this call, e.g, timeout,
|
396
|
-
# retries, etc.
|
397
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
398
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::Agent]
|
399
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
400
|
-
# @return [Google::Cloud::Dialogflow::V2::Agent]
|
401
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
402
|
-
# @example
|
403
|
-
# require "google/cloud/dialogflow"
|
404
|
-
#
|
405
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
406
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
407
|
-
# response = agents_client.get_agent(formatted_parent)
|
408
|
-
|
409
|
-
def get_agent \
|
410
|
-
parent,
|
411
|
-
options: nil,
|
412
|
-
&block
|
413
|
-
req = {
|
414
|
-
parent: parent
|
415
|
-
}.delete_if { |_, v| v.nil? }
|
416
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetAgentRequest)
|
417
|
-
@get_agent.call(req, options, &block)
|
418
|
-
end
|
419
|
-
|
420
|
-
# Returns the list of agents.
|
421
|
-
#
|
422
|
-
# Since there is at most one conversational agent per project, this method is
|
423
|
-
# useful primarily for listing all agents across projects the caller has
|
424
|
-
# access to. One can achieve that with a wildcard project collection id "-".
|
425
|
-
# Refer to [List
|
426
|
-
# Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
427
|
-
#
|
428
|
-
# @param parent [String]
|
429
|
-
# Required. The project to list agents from.
|
430
|
-
# Format: `projects/<Project ID or '-'>`.
|
431
|
-
# @param page_size [Integer]
|
432
|
-
# The maximum number of resources contained in the underlying API
|
433
|
-
# response. If page streaming is performed per-resource, this
|
434
|
-
# parameter does not affect the return value. If page streaming is
|
435
|
-
# performed per-page, this determines the maximum number of
|
436
|
-
# resources in a page.
|
437
|
-
# @param options [Google::Gax::CallOptions]
|
438
|
-
# Overrides the default settings for this call, e.g, timeout,
|
439
|
-
# retries, etc.
|
440
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
441
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::Agent>]
|
442
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
443
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::Agent>]
|
444
|
-
# An enumerable of Google::Cloud::Dialogflow::V2::Agent instances.
|
445
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
446
|
-
# operations such as per-page iteration or access to the response
|
447
|
-
# object.
|
448
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
449
|
-
# @example
|
450
|
-
# require "google/cloud/dialogflow"
|
451
|
-
#
|
452
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
453
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
454
|
-
#
|
455
|
-
# # Iterate over all results.
|
456
|
-
# agents_client.search_agents(formatted_parent).each do |element|
|
457
|
-
# # Process element.
|
458
|
-
# end
|
459
|
-
#
|
460
|
-
# # Or iterate over results one page at a time.
|
461
|
-
# agents_client.search_agents(formatted_parent).each_page do |page|
|
462
|
-
# # Process each page at a time.
|
463
|
-
# page.each do |element|
|
464
|
-
# # Process element.
|
465
|
-
# end
|
466
|
-
# end
|
467
|
-
|
468
|
-
def search_agents \
|
469
|
-
parent,
|
470
|
-
page_size: nil,
|
471
|
-
options: nil,
|
472
|
-
&block
|
473
|
-
req = {
|
474
|
-
parent: parent,
|
475
|
-
page_size: page_size
|
476
|
-
}.delete_if { |_, v| v.nil? }
|
477
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::SearchAgentsRequest)
|
478
|
-
@search_agents.call(req, options, &block)
|
479
|
-
end
|
480
|
-
|
481
|
-
# Trains the specified agent.
|
482
|
-
#
|
483
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
484
|
-
#
|
485
|
-
# @param parent [String]
|
486
|
-
# Required. The project that the agent to train is associated with.
|
487
|
-
# Format: `projects/<Project ID>`.
|
488
|
-
# @param options [Google::Gax::CallOptions]
|
489
|
-
# Overrides the default settings for this call, e.g, timeout,
|
490
|
-
# retries, etc.
|
491
|
-
# @return [Google::Gax::Operation]
|
492
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
493
|
-
# @example
|
494
|
-
# require "google/cloud/dialogflow"
|
495
|
-
#
|
496
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
497
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
498
|
-
#
|
499
|
-
# # Register a callback during the method call.
|
500
|
-
# operation = agents_client.train_agent(formatted_parent) do |op|
|
501
|
-
# raise op.results.message if op.error?
|
502
|
-
# op_results = op.results
|
503
|
-
# # Process the results.
|
504
|
-
#
|
505
|
-
# metadata = op.metadata
|
506
|
-
# # Process the metadata.
|
507
|
-
# end
|
508
|
-
#
|
509
|
-
# # Or use the return value to register a callback.
|
510
|
-
# operation.on_done do |op|
|
511
|
-
# raise op.results.message if op.error?
|
512
|
-
# op_results = op.results
|
513
|
-
# # Process the results.
|
514
|
-
#
|
515
|
-
# metadata = op.metadata
|
516
|
-
# # Process the metadata.
|
517
|
-
# end
|
518
|
-
#
|
519
|
-
# # Manually reload the operation.
|
520
|
-
# operation.reload!
|
521
|
-
#
|
522
|
-
# # Or block until the operation completes, triggering callbacks on
|
523
|
-
# # completion.
|
524
|
-
# operation.wait_until_done!
|
525
|
-
|
526
|
-
def train_agent \
|
527
|
-
parent,
|
528
|
-
options: nil
|
529
|
-
req = {
|
530
|
-
parent: parent
|
531
|
-
}.delete_if { |_, v| v.nil? }
|
532
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::TrainAgentRequest)
|
533
|
-
operation = Google::Gax::Operation.new(
|
534
|
-
@train_agent.call(req, options),
|
535
|
-
@operations_client,
|
536
|
-
Google::Protobuf::Empty,
|
537
|
-
Google::Protobuf::Struct,
|
538
|
-
call_options: options
|
539
|
-
)
|
540
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
541
|
-
operation
|
542
|
-
end
|
543
|
-
|
544
|
-
# Exports the specified agent to a ZIP file.
|
545
|
-
#
|
546
|
-
# Operation <response: {Google::Cloud::Dialogflow::V2::ExportAgentResponse ExportAgentResponse}>
|
547
|
-
#
|
548
|
-
# @param parent [String]
|
549
|
-
# Required. The project that the agent to export is associated with.
|
550
|
-
# Format: `projects/<Project ID>`.
|
551
|
-
# @param agent_uri [String]
|
552
|
-
# Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/)
|
553
|
-
# URI to export the agent to.
|
554
|
-
# The format of this URI must be `gs://<bucket-name>/<object-name>`.
|
555
|
-
# If left unspecified, the serialized agent is returned inline.
|
556
|
-
# @param options [Google::Gax::CallOptions]
|
557
|
-
# Overrides the default settings for this call, e.g, timeout,
|
558
|
-
# retries, etc.
|
559
|
-
# @return [Google::Gax::Operation]
|
560
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
561
|
-
# @example
|
562
|
-
# require "google/cloud/dialogflow"
|
563
|
-
#
|
564
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
565
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
566
|
-
#
|
567
|
-
# # Register a callback during the method call.
|
568
|
-
# operation = agents_client.export_agent(formatted_parent) do |op|
|
569
|
-
# raise op.results.message if op.error?
|
570
|
-
# op_results = op.results
|
571
|
-
# # Process the results.
|
572
|
-
#
|
573
|
-
# metadata = op.metadata
|
574
|
-
# # Process the metadata.
|
575
|
-
# end
|
576
|
-
#
|
577
|
-
# # Or use the return value to register a callback.
|
578
|
-
# operation.on_done do |op|
|
579
|
-
# raise op.results.message if op.error?
|
580
|
-
# op_results = op.results
|
581
|
-
# # Process the results.
|
582
|
-
#
|
583
|
-
# metadata = op.metadata
|
584
|
-
# # Process the metadata.
|
585
|
-
# end
|
586
|
-
#
|
587
|
-
# # Manually reload the operation.
|
588
|
-
# operation.reload!
|
589
|
-
#
|
590
|
-
# # Or block until the operation completes, triggering callbacks on
|
591
|
-
# # completion.
|
592
|
-
# operation.wait_until_done!
|
593
|
-
|
594
|
-
def export_agent \
|
595
|
-
parent,
|
596
|
-
agent_uri: nil,
|
597
|
-
options: nil
|
598
|
-
req = {
|
599
|
-
parent: parent,
|
600
|
-
agent_uri: agent_uri
|
601
|
-
}.delete_if { |_, v| v.nil? }
|
602
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ExportAgentRequest)
|
603
|
-
operation = Google::Gax::Operation.new(
|
604
|
-
@export_agent.call(req, options),
|
605
|
-
@operations_client,
|
606
|
-
Google::Cloud::Dialogflow::V2::ExportAgentResponse,
|
607
|
-
Google::Protobuf::Struct,
|
608
|
-
call_options: options
|
609
|
-
)
|
610
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
611
|
-
operation
|
612
|
-
end
|
613
|
-
|
614
|
-
# Imports the specified agent from a ZIP file.
|
615
|
-
#
|
616
|
-
# Uploads new intents and entity types without deleting the existing ones.
|
617
|
-
# Intents and entity types with the same name are replaced with the new
|
618
|
-
# versions from ImportAgentRequest.
|
619
|
-
#
|
620
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
621
|
-
#
|
622
|
-
# @param parent [String]
|
623
|
-
# Required. The project that the agent to import is associated with.
|
624
|
-
# Format: `projects/<Project ID>`.
|
625
|
-
# @param agent_uri [String]
|
626
|
-
# The URI to a Google Cloud Storage file containing the agent to import.
|
627
|
-
# Note: The URI must start with "gs://".
|
628
|
-
# @param agent_content [String]
|
629
|
-
# Zip compressed raw byte content for agent.
|
630
|
-
# @param options [Google::Gax::CallOptions]
|
631
|
-
# Overrides the default settings for this call, e.g, timeout,
|
632
|
-
# retries, etc.
|
633
|
-
# @return [Google::Gax::Operation]
|
634
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
635
|
-
# @example
|
636
|
-
# require "google/cloud/dialogflow"
|
637
|
-
#
|
638
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
639
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
640
|
-
#
|
641
|
-
# # Register a callback during the method call.
|
642
|
-
# operation = agents_client.import_agent(formatted_parent) do |op|
|
643
|
-
# raise op.results.message if op.error?
|
644
|
-
# op_results = op.results
|
645
|
-
# # Process the results.
|
646
|
-
#
|
647
|
-
# metadata = op.metadata
|
648
|
-
# # Process the metadata.
|
649
|
-
# end
|
650
|
-
#
|
651
|
-
# # Or use the return value to register a callback.
|
652
|
-
# operation.on_done do |op|
|
653
|
-
# raise op.results.message if op.error?
|
654
|
-
# op_results = op.results
|
655
|
-
# # Process the results.
|
656
|
-
#
|
657
|
-
# metadata = op.metadata
|
658
|
-
# # Process the metadata.
|
659
|
-
# end
|
660
|
-
#
|
661
|
-
# # Manually reload the operation.
|
662
|
-
# operation.reload!
|
663
|
-
#
|
664
|
-
# # Or block until the operation completes, triggering callbacks on
|
665
|
-
# # completion.
|
666
|
-
# operation.wait_until_done!
|
667
|
-
|
668
|
-
def import_agent \
|
669
|
-
parent,
|
670
|
-
agent_uri: nil,
|
671
|
-
agent_content: nil,
|
672
|
-
options: nil
|
673
|
-
req = {
|
674
|
-
parent: parent,
|
675
|
-
agent_uri: agent_uri,
|
676
|
-
agent_content: agent_content
|
677
|
-
}.delete_if { |_, v| v.nil? }
|
678
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ImportAgentRequest)
|
679
|
-
operation = Google::Gax::Operation.new(
|
680
|
-
@import_agent.call(req, options),
|
681
|
-
@operations_client,
|
682
|
-
Google::Protobuf::Empty,
|
683
|
-
Google::Protobuf::Struct,
|
684
|
-
call_options: options
|
685
|
-
)
|
686
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
687
|
-
operation
|
688
|
-
end
|
689
|
-
|
690
|
-
# Restores the specified agent from a ZIP file.
|
691
|
-
#
|
692
|
-
# Replaces the current agent version with a new one. All the intents and
|
693
|
-
# entity types in the older version are deleted.
|
694
|
-
#
|
695
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
696
|
-
#
|
697
|
-
# @param parent [String]
|
698
|
-
# Required. The project that the agent to restore is associated with.
|
699
|
-
# Format: `projects/<Project ID>`.
|
700
|
-
# @param agent_uri [String]
|
701
|
-
# The URI to a Google Cloud Storage file containing the agent to restore.
|
702
|
-
# Note: The URI must start with "gs://".
|
703
|
-
# @param agent_content [String]
|
704
|
-
# Zip compressed raw byte content for agent.
|
705
|
-
# @param options [Google::Gax::CallOptions]
|
706
|
-
# Overrides the default settings for this call, e.g, timeout,
|
707
|
-
# retries, etc.
|
708
|
-
# @return [Google::Gax::Operation]
|
709
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
710
|
-
# @example
|
711
|
-
# require "google/cloud/dialogflow"
|
712
|
-
#
|
713
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
714
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
715
|
-
#
|
716
|
-
# # Register a callback during the method call.
|
717
|
-
# operation = agents_client.restore_agent(formatted_parent) do |op|
|
718
|
-
# raise op.results.message if op.error?
|
719
|
-
# op_results = op.results
|
720
|
-
# # Process the results.
|
721
|
-
#
|
722
|
-
# metadata = op.metadata
|
723
|
-
# # Process the metadata.
|
724
|
-
# end
|
725
|
-
#
|
726
|
-
# # Or use the return value to register a callback.
|
727
|
-
# operation.on_done do |op|
|
728
|
-
# raise op.results.message if op.error?
|
729
|
-
# op_results = op.results
|
730
|
-
# # Process the results.
|
731
|
-
#
|
732
|
-
# metadata = op.metadata
|
733
|
-
# # Process the metadata.
|
734
|
-
# end
|
735
|
-
#
|
736
|
-
# # Manually reload the operation.
|
737
|
-
# operation.reload!
|
738
|
-
#
|
739
|
-
# # Or block until the operation completes, triggering callbacks on
|
740
|
-
# # completion.
|
741
|
-
# operation.wait_until_done!
|
742
|
-
|
743
|
-
def restore_agent \
|
744
|
-
parent,
|
745
|
-
agent_uri: nil,
|
746
|
-
agent_content: nil,
|
747
|
-
options: nil
|
748
|
-
req = {
|
749
|
-
parent: parent,
|
750
|
-
agent_uri: agent_uri,
|
751
|
-
agent_content: agent_content
|
752
|
-
}.delete_if { |_, v| v.nil? }
|
753
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::RestoreAgentRequest)
|
754
|
-
operation = Google::Gax::Operation.new(
|
755
|
-
@restore_agent.call(req, options),
|
756
|
-
@operations_client,
|
757
|
-
Google::Protobuf::Empty,
|
758
|
-
Google::Protobuf::Struct,
|
759
|
-
call_options: options
|
760
|
-
)
|
761
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
762
|
-
operation
|
763
|
-
end
|
764
|
-
|
765
|
-
# Gets agent validation result. Agent validation is performed during
|
766
|
-
# training time and is updated automatically when training is completed.
|
767
|
-
#
|
768
|
-
# @param parent [String]
|
769
|
-
# Required. The project that the agent is associated with.
|
770
|
-
# Format: `projects/<Project ID>`.
|
771
|
-
# @param language_code [String]
|
772
|
-
# Optional. The language for which you want a validation result. If not
|
773
|
-
# specified, the agent's default language is used. [Many
|
774
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
775
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
776
|
-
# be used.
|
777
|
-
# @param options [Google::Gax::CallOptions]
|
778
|
-
# Overrides the default settings for this call, e.g, timeout,
|
779
|
-
# retries, etc.
|
780
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
781
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::ValidationResult]
|
782
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
783
|
-
# @return [Google::Cloud::Dialogflow::V2::ValidationResult]
|
784
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
785
|
-
# @example
|
786
|
-
# require "google/cloud/dialogflow"
|
787
|
-
#
|
788
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
789
|
-
# response = agents_client.get_validation_result
|
790
|
-
|
791
|
-
def get_validation_result \
|
792
|
-
parent: nil,
|
793
|
-
language_code: nil,
|
794
|
-
options: nil,
|
795
|
-
&block
|
796
|
-
req = {
|
797
|
-
parent: parent,
|
798
|
-
language_code: language_code
|
799
|
-
}.delete_if { |_, v| v.nil? }
|
800
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetValidationResultRequest)
|
801
|
-
@get_validation_result.call(req, options, &block)
|
802
|
-
end
|
803
|
-
end
|
804
|
-
end
|
805
|
-
end
|
806
|
-
end
|
807
|
-
end
|