google-cloud-dialogflow 0.15.0 → 1.0.0
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 +397 -0
- data/README.md +35 -25
- data/lib/{google/cloud/dialogflow/v2/doc/google/protobuf/empty.rb → google-cloud-dialogflow.rb} +4 -14
- data/lib/google/cloud/dialogflow.rb +368 -506
- data/lib/google/cloud/dialogflow/version.rb +1 -1
- metadata +88 -83
- data/LICENSE +0 -201
- data/lib/google/cloud/dialogflow/v2.rb +0 -598
- data/lib/google/cloud/dialogflow/v2/agent_pb.rb +0 -121
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +0 -111
- data/lib/google/cloud/dialogflow/v2/agents_client.rb +0 -810
- data/lib/google/cloud/dialogflow/v2/agents_client_config.json +0 -71
- data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -96
- data/lib/google/cloud/dialogflow/v2/context_pb.rb +0 -63
- data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +0 -75
- data/lib/google/cloud/dialogflow/v2/contexts_client.rb +0 -522
- data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +0 -56
- data/lib/google/cloud/dialogflow/v2/credentials.rb +0 -42
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +0 -247
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/audio_config.rb +0 -341
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +0 -116
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +0 -305
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +0 -937
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +0 -498
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +0 -130
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/validation_result.rb +0 -71
- data/lib/google/cloud/dialogflow/v2/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +0 -31
- data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +0 -125
- data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +0 -105
- data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +0 -997
- data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +0 -76
- data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -367
- data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +0 -93
- data/lib/google/cloud/dialogflow/v2/intents_client.rb +0 -763
- data/lib/google/cloud/dialogflow/v2/intents_client_config.json +0 -61
- data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +0 -65
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +0 -93
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +0 -507
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +0 -51
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -141
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +0 -56
- data/lib/google/cloud/dialogflow/v2/sessions_client.rb +0 -340
- data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +0 -36
- data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -36
- data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -46
@@ -1,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,810 +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
|
-
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
211
|
-
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
212
|
-
end
|
213
|
-
headers.merge!(metadata) unless metadata.nil?
|
214
|
-
client_config_file = Pathname.new(__dir__).join(
|
215
|
-
"agents_client_config.json"
|
216
|
-
)
|
217
|
-
defaults = client_config_file.open do |f|
|
218
|
-
Google::Gax.construct_settings(
|
219
|
-
"google.cloud.dialogflow.v2.Agents",
|
220
|
-
JSON.parse(f.read),
|
221
|
-
client_config,
|
222
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
223
|
-
timeout,
|
224
|
-
page_descriptors: PAGE_DESCRIPTORS,
|
225
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
226
|
-
metadata: headers
|
227
|
-
)
|
228
|
-
end
|
229
|
-
|
230
|
-
# Allow overriding the service path/port in subclasses.
|
231
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
232
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
233
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
234
|
-
@agents_stub = Google::Gax::Grpc.create_stub(
|
235
|
-
service_path,
|
236
|
-
port,
|
237
|
-
chan_creds: chan_creds,
|
238
|
-
channel: channel,
|
239
|
-
updater_proc: updater_proc,
|
240
|
-
scopes: scopes,
|
241
|
-
interceptors: interceptors,
|
242
|
-
&Google::Cloud::Dialogflow::V2::Agents::Stub.method(:new)
|
243
|
-
)
|
244
|
-
|
245
|
-
@set_agent = Google::Gax.create_api_call(
|
246
|
-
@agents_stub.method(:set_agent),
|
247
|
-
defaults["set_agent"],
|
248
|
-
exception_transformer: exception_transformer,
|
249
|
-
params_extractor: proc do |request|
|
250
|
-
{'agent.parent' => request.agent.parent}
|
251
|
-
end
|
252
|
-
)
|
253
|
-
@delete_agent = Google::Gax.create_api_call(
|
254
|
-
@agents_stub.method(:delete_agent),
|
255
|
-
defaults["delete_agent"],
|
256
|
-
exception_transformer: exception_transformer,
|
257
|
-
params_extractor: proc do |request|
|
258
|
-
{'parent' => request.parent}
|
259
|
-
end
|
260
|
-
)
|
261
|
-
@get_agent = Google::Gax.create_api_call(
|
262
|
-
@agents_stub.method(:get_agent),
|
263
|
-
defaults["get_agent"],
|
264
|
-
exception_transformer: exception_transformer,
|
265
|
-
params_extractor: proc do |request|
|
266
|
-
{'parent' => request.parent}
|
267
|
-
end
|
268
|
-
)
|
269
|
-
@search_agents = Google::Gax.create_api_call(
|
270
|
-
@agents_stub.method(:search_agents),
|
271
|
-
defaults["search_agents"],
|
272
|
-
exception_transformer: exception_transformer,
|
273
|
-
params_extractor: proc do |request|
|
274
|
-
{'parent' => request.parent}
|
275
|
-
end
|
276
|
-
)
|
277
|
-
@train_agent = Google::Gax.create_api_call(
|
278
|
-
@agents_stub.method(:train_agent),
|
279
|
-
defaults["train_agent"],
|
280
|
-
exception_transformer: exception_transformer,
|
281
|
-
params_extractor: proc do |request|
|
282
|
-
{'parent' => request.parent}
|
283
|
-
end
|
284
|
-
)
|
285
|
-
@export_agent = Google::Gax.create_api_call(
|
286
|
-
@agents_stub.method(:export_agent),
|
287
|
-
defaults["export_agent"],
|
288
|
-
exception_transformer: exception_transformer,
|
289
|
-
params_extractor: proc do |request|
|
290
|
-
{'parent' => request.parent}
|
291
|
-
end
|
292
|
-
)
|
293
|
-
@import_agent = Google::Gax.create_api_call(
|
294
|
-
@agents_stub.method(:import_agent),
|
295
|
-
defaults["import_agent"],
|
296
|
-
exception_transformer: exception_transformer,
|
297
|
-
params_extractor: proc do |request|
|
298
|
-
{'parent' => request.parent}
|
299
|
-
end
|
300
|
-
)
|
301
|
-
@restore_agent = Google::Gax.create_api_call(
|
302
|
-
@agents_stub.method(:restore_agent),
|
303
|
-
defaults["restore_agent"],
|
304
|
-
exception_transformer: exception_transformer,
|
305
|
-
params_extractor: proc do |request|
|
306
|
-
{'parent' => request.parent}
|
307
|
-
end
|
308
|
-
)
|
309
|
-
@get_validation_result = Google::Gax.create_api_call(
|
310
|
-
@agents_stub.method(:get_validation_result),
|
311
|
-
defaults["get_validation_result"],
|
312
|
-
exception_transformer: exception_transformer,
|
313
|
-
params_extractor: proc do |request|
|
314
|
-
{'parent' => request.parent}
|
315
|
-
end
|
316
|
-
)
|
317
|
-
end
|
318
|
-
|
319
|
-
# Service calls
|
320
|
-
|
321
|
-
# Creates/updates the specified agent.
|
322
|
-
#
|
323
|
-
# @param agent [Google::Cloud::Dialogflow::V2::Agent | Hash]
|
324
|
-
# Required. The agent to update.
|
325
|
-
# A hash of the same form as `Google::Cloud::Dialogflow::V2::Agent`
|
326
|
-
# can also be provided.
|
327
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
328
|
-
# Optional. The mask to control which fields get updated.
|
329
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
330
|
-
# can also be provided.
|
331
|
-
# @param options [Google::Gax::CallOptions]
|
332
|
-
# Overrides the default settings for this call, e.g, timeout,
|
333
|
-
# retries, etc.
|
334
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
335
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::Agent]
|
336
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
337
|
-
# @return [Google::Cloud::Dialogflow::V2::Agent]
|
338
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
339
|
-
# @example
|
340
|
-
# require "google/cloud/dialogflow"
|
341
|
-
#
|
342
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
343
|
-
#
|
344
|
-
# # TODO: Initialize `agent`:
|
345
|
-
# agent = {}
|
346
|
-
# response = agents_client.set_agent(agent)
|
347
|
-
|
348
|
-
def set_agent \
|
349
|
-
agent,
|
350
|
-
update_mask: nil,
|
351
|
-
options: nil,
|
352
|
-
&block
|
353
|
-
req = {
|
354
|
-
agent: agent,
|
355
|
-
update_mask: update_mask
|
356
|
-
}.delete_if { |_, v| v.nil? }
|
357
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::SetAgentRequest)
|
358
|
-
@set_agent.call(req, options, &block)
|
359
|
-
end
|
360
|
-
|
361
|
-
# Deletes the specified agent.
|
362
|
-
#
|
363
|
-
# @param parent [String]
|
364
|
-
# Required. The project that the agent to delete is associated with.
|
365
|
-
# Format: `projects/<Project ID>`.
|
366
|
-
# @param options [Google::Gax::CallOptions]
|
367
|
-
# Overrides the default settings for this call, e.g, timeout,
|
368
|
-
# retries, etc.
|
369
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
370
|
-
# @yieldparam result []
|
371
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
372
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
373
|
-
# @example
|
374
|
-
# require "google/cloud/dialogflow"
|
375
|
-
#
|
376
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
377
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
378
|
-
# agents_client.delete_agent(formatted_parent)
|
379
|
-
|
380
|
-
def delete_agent \
|
381
|
-
parent,
|
382
|
-
options: nil,
|
383
|
-
&block
|
384
|
-
req = {
|
385
|
-
parent: parent
|
386
|
-
}.delete_if { |_, v| v.nil? }
|
387
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteAgentRequest)
|
388
|
-
@delete_agent.call(req, options, &block)
|
389
|
-
nil
|
390
|
-
end
|
391
|
-
|
392
|
-
# Retrieves the specified agent.
|
393
|
-
#
|
394
|
-
# @param parent [String]
|
395
|
-
# Required. The project that the agent to fetch is associated with.
|
396
|
-
# Format: `projects/<Project ID>`.
|
397
|
-
# @param options [Google::Gax::CallOptions]
|
398
|
-
# Overrides the default settings for this call, e.g, timeout,
|
399
|
-
# retries, etc.
|
400
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
401
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::Agent]
|
402
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
403
|
-
# @return [Google::Cloud::Dialogflow::V2::Agent]
|
404
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
405
|
-
# @example
|
406
|
-
# require "google/cloud/dialogflow"
|
407
|
-
#
|
408
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
409
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
410
|
-
# response = agents_client.get_agent(formatted_parent)
|
411
|
-
|
412
|
-
def get_agent \
|
413
|
-
parent,
|
414
|
-
options: nil,
|
415
|
-
&block
|
416
|
-
req = {
|
417
|
-
parent: parent
|
418
|
-
}.delete_if { |_, v| v.nil? }
|
419
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetAgentRequest)
|
420
|
-
@get_agent.call(req, options, &block)
|
421
|
-
end
|
422
|
-
|
423
|
-
# Returns the list of agents.
|
424
|
-
#
|
425
|
-
# Since there is at most one conversational agent per project, this method is
|
426
|
-
# useful primarily for listing all agents across projects the caller has
|
427
|
-
# access to. One can achieve that with a wildcard project collection id "-".
|
428
|
-
# Refer to [List
|
429
|
-
# Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
430
|
-
#
|
431
|
-
# @param parent [String]
|
432
|
-
# Required. The project to list agents from.
|
433
|
-
# Format: `projects/<Project ID or '-'>`.
|
434
|
-
# @param page_size [Integer]
|
435
|
-
# The maximum number of resources contained in the underlying API
|
436
|
-
# response. If page streaming is performed per-resource, this
|
437
|
-
# parameter does not affect the return value. If page streaming is
|
438
|
-
# performed per-page, this determines the maximum number of
|
439
|
-
# resources in a page.
|
440
|
-
# @param options [Google::Gax::CallOptions]
|
441
|
-
# Overrides the default settings for this call, e.g, timeout,
|
442
|
-
# retries, etc.
|
443
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
444
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::Agent>]
|
445
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
446
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::Agent>]
|
447
|
-
# An enumerable of Google::Cloud::Dialogflow::V2::Agent instances.
|
448
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
449
|
-
# operations such as per-page iteration or access to the response
|
450
|
-
# object.
|
451
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
452
|
-
# @example
|
453
|
-
# require "google/cloud/dialogflow"
|
454
|
-
#
|
455
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
456
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
457
|
-
#
|
458
|
-
# # Iterate over all results.
|
459
|
-
# agents_client.search_agents(formatted_parent).each do |element|
|
460
|
-
# # Process element.
|
461
|
-
# end
|
462
|
-
#
|
463
|
-
# # Or iterate over results one page at a time.
|
464
|
-
# agents_client.search_agents(formatted_parent).each_page do |page|
|
465
|
-
# # Process each page at a time.
|
466
|
-
# page.each do |element|
|
467
|
-
# # Process element.
|
468
|
-
# end
|
469
|
-
# end
|
470
|
-
|
471
|
-
def search_agents \
|
472
|
-
parent,
|
473
|
-
page_size: nil,
|
474
|
-
options: nil,
|
475
|
-
&block
|
476
|
-
req = {
|
477
|
-
parent: parent,
|
478
|
-
page_size: page_size
|
479
|
-
}.delete_if { |_, v| v.nil? }
|
480
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::SearchAgentsRequest)
|
481
|
-
@search_agents.call(req, options, &block)
|
482
|
-
end
|
483
|
-
|
484
|
-
# Trains the specified agent.
|
485
|
-
#
|
486
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
487
|
-
#
|
488
|
-
# @param parent [String]
|
489
|
-
# Required. The project that the agent to train is associated with.
|
490
|
-
# Format: `projects/<Project ID>`.
|
491
|
-
# @param options [Google::Gax::CallOptions]
|
492
|
-
# Overrides the default settings for this call, e.g, timeout,
|
493
|
-
# retries, etc.
|
494
|
-
# @return [Google::Gax::Operation]
|
495
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
496
|
-
# @example
|
497
|
-
# require "google/cloud/dialogflow"
|
498
|
-
#
|
499
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
500
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
501
|
-
#
|
502
|
-
# # Register a callback during the method call.
|
503
|
-
# operation = agents_client.train_agent(formatted_parent) do |op|
|
504
|
-
# raise op.results.message if op.error?
|
505
|
-
# op_results = op.results
|
506
|
-
# # Process the results.
|
507
|
-
#
|
508
|
-
# metadata = op.metadata
|
509
|
-
# # Process the metadata.
|
510
|
-
# end
|
511
|
-
#
|
512
|
-
# # Or use the return value to register a callback.
|
513
|
-
# operation.on_done do |op|
|
514
|
-
# raise op.results.message if op.error?
|
515
|
-
# op_results = op.results
|
516
|
-
# # Process the results.
|
517
|
-
#
|
518
|
-
# metadata = op.metadata
|
519
|
-
# # Process the metadata.
|
520
|
-
# end
|
521
|
-
#
|
522
|
-
# # Manually reload the operation.
|
523
|
-
# operation.reload!
|
524
|
-
#
|
525
|
-
# # Or block until the operation completes, triggering callbacks on
|
526
|
-
# # completion.
|
527
|
-
# operation.wait_until_done!
|
528
|
-
|
529
|
-
def train_agent \
|
530
|
-
parent,
|
531
|
-
options: nil
|
532
|
-
req = {
|
533
|
-
parent: parent
|
534
|
-
}.delete_if { |_, v| v.nil? }
|
535
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::TrainAgentRequest)
|
536
|
-
operation = Google::Gax::Operation.new(
|
537
|
-
@train_agent.call(req, options),
|
538
|
-
@operations_client,
|
539
|
-
Google::Protobuf::Empty,
|
540
|
-
Google::Protobuf::Struct,
|
541
|
-
call_options: options
|
542
|
-
)
|
543
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
544
|
-
operation
|
545
|
-
end
|
546
|
-
|
547
|
-
# Exports the specified agent to a ZIP file.
|
548
|
-
#
|
549
|
-
# Operation <response: {Google::Cloud::Dialogflow::V2::ExportAgentResponse ExportAgentResponse}>
|
550
|
-
#
|
551
|
-
# @param parent [String]
|
552
|
-
# Required. The project that the agent to export is associated with.
|
553
|
-
# Format: `projects/<Project ID>`.
|
554
|
-
# @param agent_uri [String]
|
555
|
-
# Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/)
|
556
|
-
# URI to export the agent to.
|
557
|
-
# The format of this URI must be `gs://<bucket-name>/<object-name>`.
|
558
|
-
# If left unspecified, the serialized agent is returned inline.
|
559
|
-
# @param options [Google::Gax::CallOptions]
|
560
|
-
# Overrides the default settings for this call, e.g, timeout,
|
561
|
-
# retries, etc.
|
562
|
-
# @return [Google::Gax::Operation]
|
563
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
564
|
-
# @example
|
565
|
-
# require "google/cloud/dialogflow"
|
566
|
-
#
|
567
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
568
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
569
|
-
#
|
570
|
-
# # Register a callback during the method call.
|
571
|
-
# operation = agents_client.export_agent(formatted_parent) do |op|
|
572
|
-
# raise op.results.message if op.error?
|
573
|
-
# op_results = op.results
|
574
|
-
# # Process the results.
|
575
|
-
#
|
576
|
-
# metadata = op.metadata
|
577
|
-
# # Process the metadata.
|
578
|
-
# end
|
579
|
-
#
|
580
|
-
# # Or use the return value to register a callback.
|
581
|
-
# operation.on_done do |op|
|
582
|
-
# raise op.results.message if op.error?
|
583
|
-
# op_results = op.results
|
584
|
-
# # Process the results.
|
585
|
-
#
|
586
|
-
# metadata = op.metadata
|
587
|
-
# # Process the metadata.
|
588
|
-
# end
|
589
|
-
#
|
590
|
-
# # Manually reload the operation.
|
591
|
-
# operation.reload!
|
592
|
-
#
|
593
|
-
# # Or block until the operation completes, triggering callbacks on
|
594
|
-
# # completion.
|
595
|
-
# operation.wait_until_done!
|
596
|
-
|
597
|
-
def export_agent \
|
598
|
-
parent,
|
599
|
-
agent_uri: nil,
|
600
|
-
options: nil
|
601
|
-
req = {
|
602
|
-
parent: parent,
|
603
|
-
agent_uri: agent_uri
|
604
|
-
}.delete_if { |_, v| v.nil? }
|
605
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ExportAgentRequest)
|
606
|
-
operation = Google::Gax::Operation.new(
|
607
|
-
@export_agent.call(req, options),
|
608
|
-
@operations_client,
|
609
|
-
Google::Cloud::Dialogflow::V2::ExportAgentResponse,
|
610
|
-
Google::Protobuf::Struct,
|
611
|
-
call_options: options
|
612
|
-
)
|
613
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
614
|
-
operation
|
615
|
-
end
|
616
|
-
|
617
|
-
# Imports the specified agent from a ZIP file.
|
618
|
-
#
|
619
|
-
# Uploads new intents and entity types without deleting the existing ones.
|
620
|
-
# Intents and entity types with the same name are replaced with the new
|
621
|
-
# versions from ImportAgentRequest.
|
622
|
-
#
|
623
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
624
|
-
#
|
625
|
-
# @param parent [String]
|
626
|
-
# Required. The project that the agent to import is associated with.
|
627
|
-
# Format: `projects/<Project ID>`.
|
628
|
-
# @param agent_uri [String]
|
629
|
-
# The URI to a Google Cloud Storage file containing the agent to import.
|
630
|
-
# Note: The URI must start with "gs://".
|
631
|
-
# @param agent_content [String]
|
632
|
-
# Zip compressed raw byte content for agent.
|
633
|
-
# @param options [Google::Gax::CallOptions]
|
634
|
-
# Overrides the default settings for this call, e.g, timeout,
|
635
|
-
# retries, etc.
|
636
|
-
# @return [Google::Gax::Operation]
|
637
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
638
|
-
# @example
|
639
|
-
# require "google/cloud/dialogflow"
|
640
|
-
#
|
641
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
642
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
643
|
-
#
|
644
|
-
# # Register a callback during the method call.
|
645
|
-
# operation = agents_client.import_agent(formatted_parent) do |op|
|
646
|
-
# raise op.results.message if op.error?
|
647
|
-
# op_results = op.results
|
648
|
-
# # Process the results.
|
649
|
-
#
|
650
|
-
# metadata = op.metadata
|
651
|
-
# # Process the metadata.
|
652
|
-
# end
|
653
|
-
#
|
654
|
-
# # Or use the return value to register a callback.
|
655
|
-
# operation.on_done do |op|
|
656
|
-
# raise op.results.message if op.error?
|
657
|
-
# op_results = op.results
|
658
|
-
# # Process the results.
|
659
|
-
#
|
660
|
-
# metadata = op.metadata
|
661
|
-
# # Process the metadata.
|
662
|
-
# end
|
663
|
-
#
|
664
|
-
# # Manually reload the operation.
|
665
|
-
# operation.reload!
|
666
|
-
#
|
667
|
-
# # Or block until the operation completes, triggering callbacks on
|
668
|
-
# # completion.
|
669
|
-
# operation.wait_until_done!
|
670
|
-
|
671
|
-
def import_agent \
|
672
|
-
parent,
|
673
|
-
agent_uri: nil,
|
674
|
-
agent_content: nil,
|
675
|
-
options: nil
|
676
|
-
req = {
|
677
|
-
parent: parent,
|
678
|
-
agent_uri: agent_uri,
|
679
|
-
agent_content: agent_content
|
680
|
-
}.delete_if { |_, v| v.nil? }
|
681
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ImportAgentRequest)
|
682
|
-
operation = Google::Gax::Operation.new(
|
683
|
-
@import_agent.call(req, options),
|
684
|
-
@operations_client,
|
685
|
-
Google::Protobuf::Empty,
|
686
|
-
Google::Protobuf::Struct,
|
687
|
-
call_options: options
|
688
|
-
)
|
689
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
690
|
-
operation
|
691
|
-
end
|
692
|
-
|
693
|
-
# Restores the specified agent from a ZIP file.
|
694
|
-
#
|
695
|
-
# Replaces the current agent version with a new one. All the intents and
|
696
|
-
# entity types in the older version are deleted.
|
697
|
-
#
|
698
|
-
# Operation <response: {Google::Protobuf::Empty}>
|
699
|
-
#
|
700
|
-
# @param parent [String]
|
701
|
-
# Required. The project that the agent to restore is associated with.
|
702
|
-
# Format: `projects/<Project ID>`.
|
703
|
-
# @param agent_uri [String]
|
704
|
-
# The URI to a Google Cloud Storage file containing the agent to restore.
|
705
|
-
# Note: The URI must start with "gs://".
|
706
|
-
# @param agent_content [String]
|
707
|
-
# Zip compressed raw byte content for agent.
|
708
|
-
# @param options [Google::Gax::CallOptions]
|
709
|
-
# Overrides the default settings for this call, e.g, timeout,
|
710
|
-
# retries, etc.
|
711
|
-
# @return [Google::Gax::Operation]
|
712
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
713
|
-
# @example
|
714
|
-
# require "google/cloud/dialogflow"
|
715
|
-
#
|
716
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
717
|
-
# formatted_parent = Google::Cloud::Dialogflow::V2::AgentsClient.project_path("[PROJECT]")
|
718
|
-
#
|
719
|
-
# # Register a callback during the method call.
|
720
|
-
# operation = agents_client.restore_agent(formatted_parent) do |op|
|
721
|
-
# raise op.results.message if op.error?
|
722
|
-
# op_results = op.results
|
723
|
-
# # Process the results.
|
724
|
-
#
|
725
|
-
# metadata = op.metadata
|
726
|
-
# # Process the metadata.
|
727
|
-
# end
|
728
|
-
#
|
729
|
-
# # Or use the return value to register a callback.
|
730
|
-
# operation.on_done do |op|
|
731
|
-
# raise op.results.message if op.error?
|
732
|
-
# op_results = op.results
|
733
|
-
# # Process the results.
|
734
|
-
#
|
735
|
-
# metadata = op.metadata
|
736
|
-
# # Process the metadata.
|
737
|
-
# end
|
738
|
-
#
|
739
|
-
# # Manually reload the operation.
|
740
|
-
# operation.reload!
|
741
|
-
#
|
742
|
-
# # Or block until the operation completes, triggering callbacks on
|
743
|
-
# # completion.
|
744
|
-
# operation.wait_until_done!
|
745
|
-
|
746
|
-
def restore_agent \
|
747
|
-
parent,
|
748
|
-
agent_uri: nil,
|
749
|
-
agent_content: nil,
|
750
|
-
options: nil
|
751
|
-
req = {
|
752
|
-
parent: parent,
|
753
|
-
agent_uri: agent_uri,
|
754
|
-
agent_content: agent_content
|
755
|
-
}.delete_if { |_, v| v.nil? }
|
756
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::RestoreAgentRequest)
|
757
|
-
operation = Google::Gax::Operation.new(
|
758
|
-
@restore_agent.call(req, options),
|
759
|
-
@operations_client,
|
760
|
-
Google::Protobuf::Empty,
|
761
|
-
Google::Protobuf::Struct,
|
762
|
-
call_options: options
|
763
|
-
)
|
764
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
765
|
-
operation
|
766
|
-
end
|
767
|
-
|
768
|
-
# Gets agent validation result. Agent validation is performed during
|
769
|
-
# training time and is updated automatically when training is completed.
|
770
|
-
#
|
771
|
-
# @param parent [String]
|
772
|
-
# Required. The project that the agent is associated with.
|
773
|
-
# Format: `projects/<Project ID>`.
|
774
|
-
# @param language_code [String]
|
775
|
-
# Optional. The language for which you want a validation result. If not
|
776
|
-
# specified, the agent's default language is used. [Many
|
777
|
-
# languages](https://cloud.google.com/dialogflow/docs/reference/language)
|
778
|
-
# are supported. Note: languages must be enabled in the agent before they can
|
779
|
-
# be used.
|
780
|
-
# @param options [Google::Gax::CallOptions]
|
781
|
-
# Overrides the default settings for this call, e.g, timeout,
|
782
|
-
# retries, etc.
|
783
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
784
|
-
# @yieldparam result [Google::Cloud::Dialogflow::V2::ValidationResult]
|
785
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
786
|
-
# @return [Google::Cloud::Dialogflow::V2::ValidationResult]
|
787
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
788
|
-
# @example
|
789
|
-
# require "google/cloud/dialogflow"
|
790
|
-
#
|
791
|
-
# agents_client = Google::Cloud::Dialogflow::Agents.new(version: :v2)
|
792
|
-
# response = agents_client.get_validation_result
|
793
|
-
|
794
|
-
def get_validation_result \
|
795
|
-
parent: nil,
|
796
|
-
language_code: nil,
|
797
|
-
options: nil,
|
798
|
-
&block
|
799
|
-
req = {
|
800
|
-
parent: parent,
|
801
|
-
language_code: language_code
|
802
|
-
}.delete_if { |_, v| v.nil? }
|
803
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetValidationResultRequest)
|
804
|
-
@get_validation_result.call(req, options, &block)
|
805
|
-
end
|
806
|
-
end
|
807
|
-
end
|
808
|
-
end
|
809
|
-
end
|
810
|
-
end
|