google-cloud-dialogflow-v2 0.6.4 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +188 -190
- data/README.md +66 -2
- data/lib/google/cloud/dialogflow/v2.rb +13 -2
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +26 -15
- data/lib/google/cloud/dialogflow/v2/agents/client.rb +40 -23
- data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
- data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
- data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
- data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +48 -0
- data/lib/google/cloud/dialogflow/v2/answer_records.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +478 -0
- data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
- data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
- data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +8 -25
- data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
- data/lib/google/cloud/dialogflow/v2/contexts/client.rb +22 -33
- data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +74 -2
- data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
- data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +246 -0
- data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
- data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
- data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
- data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
- data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
- data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
- data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
- data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
- data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
- data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +40 -46
- data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
- data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +54 -54
- data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
- data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
- data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
- data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +24 -3
- data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/environments/client.rb +428 -12
- data/lib/google/cloud/dialogflow/v2/environments/paths.rb +145 -5
- data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
- data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +460 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
- data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
- data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
- data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
- data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +29 -42
- data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
- data/lib/google/cloud/dialogflow/v2/intents/client.rb +52 -51
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
- data/lib/google/cloud/dialogflow/v2/intents/paths.rb +97 -13
- data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
- data/lib/google/cloud/dialogflow/v2/participant_pb.rb +181 -0
- data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
- data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
- data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/participants/paths.rb +334 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +7 -23
- data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
- data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +21 -31
- data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +74 -2
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +2 -0
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +15 -7
- data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
- data/lib/google/cloud/dialogflow/v2/sessions/client.rb +43 -21
- data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +113 -3
- data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
- data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
- data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/versions/client.rb +709 -0
- data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -2
- data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +252 -0
- data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
- data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
- data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
- data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
- data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +522 -0
- data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
- data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
- data/proto_docs/google/cloud/dialogflow/v2/environment.rb +188 -6
- data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
- data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
- data/proto_docs/google/cloud/dialogflow/v2/intent.rb +29 -4
- data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
- data/proto_docs/google/cloud/dialogflow/v2/participant.rb +525 -0
- data/proto_docs/google/cloud/dialogflow/v2/session.rb +56 -7
- data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
- data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
- data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
- data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- data/proto_docs/google/type/latlng.rb +2 -2
- metadata +81 -11
@@ -18,11 +18,19 @@
|
|
18
18
|
|
19
19
|
require "google/cloud/dialogflow/v2/agents"
|
20
20
|
require "google/cloud/dialogflow/v2/contexts"
|
21
|
-
require "google/cloud/dialogflow/v2/entity_types"
|
22
|
-
require "google/cloud/dialogflow/v2/environments"
|
23
21
|
require "google/cloud/dialogflow/v2/intents"
|
22
|
+
require "google/cloud/dialogflow/v2/entity_types"
|
24
23
|
require "google/cloud/dialogflow/v2/session_entity_types"
|
25
24
|
require "google/cloud/dialogflow/v2/sessions"
|
25
|
+
require "google/cloud/dialogflow/v2/participants"
|
26
|
+
require "google/cloud/dialogflow/v2/answer_records"
|
27
|
+
require "google/cloud/dialogflow/v2/conversations"
|
28
|
+
require "google/cloud/dialogflow/v2/conversation_profiles"
|
29
|
+
require "google/cloud/dialogflow/v2/documents"
|
30
|
+
require "google/cloud/dialogflow/v2/fulfillments"
|
31
|
+
require "google/cloud/dialogflow/v2/environments"
|
32
|
+
require "google/cloud/dialogflow/v2/knowledge_bases"
|
33
|
+
require "google/cloud/dialogflow/v2/versions"
|
26
34
|
require "google/cloud/dialogflow/v2/version"
|
27
35
|
|
28
36
|
module Google
|
@@ -39,3 +47,6 @@ module Google
|
|
39
47
|
end
|
40
48
|
end
|
41
49
|
end
|
50
|
+
|
51
|
+
helper_path = ::File.join __dir__, "v2", "_helpers.rb"
|
52
|
+
require "google/cloud/dialogflow/v2/_helpers" if ::File.file? helper_path
|
@@ -27,18 +27,22 @@ module Google
|
|
27
27
|
# Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
|
28
28
|
class Service
|
29
29
|
|
30
|
-
include GRPC::GenericService
|
30
|
+
include ::GRPC::GenericService
|
31
31
|
|
32
32
|
self.marshal_class_method = :encode
|
33
33
|
self.unmarshal_class_method = :decode
|
34
34
|
self.service_name = 'google.cloud.dialogflow.v2.Agents'
|
35
35
|
|
36
36
|
# Retrieves the specified agent.
|
37
|
-
rpc :GetAgent, GetAgentRequest, Agent
|
37
|
+
rpc :GetAgent, ::Google::Cloud::Dialogflow::V2::GetAgentRequest, ::Google::Cloud::Dialogflow::V2::Agent
|
38
38
|
# Creates/updates the specified agent.
|
39
|
-
|
39
|
+
#
|
40
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
41
|
+
# [training
|
42
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
43
|
+
rpc :SetAgent, ::Google::Cloud::Dialogflow::V2::SetAgentRequest, ::Google::Cloud::Dialogflow::V2::Agent
|
40
44
|
# Deletes the specified agent.
|
41
|
-
rpc :DeleteAgent, DeleteAgentRequest, Google::Protobuf::Empty
|
45
|
+
rpc :DeleteAgent, ::Google::Cloud::Dialogflow::V2::DeleteAgentRequest, ::Google::Protobuf::Empty
|
42
46
|
# Returns the list of agents.
|
43
47
|
#
|
44
48
|
# Since there is at most one conversational agent per project, this method is
|
@@ -46,15 +50,16 @@ module Google
|
|
46
50
|
# access to. One can achieve that with a wildcard project collection id "-".
|
47
51
|
# Refer to [List
|
48
52
|
# Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
49
|
-
rpc :SearchAgents, SearchAgentsRequest, SearchAgentsResponse
|
53
|
+
rpc :SearchAgents, ::Google::Cloud::Dialogflow::V2::SearchAgentsRequest, ::Google::Cloud::Dialogflow::V2::SearchAgentsResponse
|
50
54
|
# Trains the specified agent.
|
51
55
|
#
|
52
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
53
|
-
rpc :TrainAgent, TrainAgentRequest, Google::Longrunning::Operation
|
54
|
-
# Exports the specified agent to a ZIP file.
|
55
56
|
#
|
56
|
-
#
|
57
|
-
|
57
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
58
|
+
# [training
|
59
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
60
|
+
rpc :TrainAgent, ::Google::Cloud::Dialogflow::V2::TrainAgentRequest, ::Google::Longrunning::Operation
|
61
|
+
# Exports the specified agent to a ZIP file.
|
62
|
+
rpc :ExportAgent, ::Google::Cloud::Dialogflow::V2::ExportAgentRequest, ::Google::Longrunning::Operation
|
58
63
|
# Imports the specified agent from a ZIP file.
|
59
64
|
#
|
60
65
|
# Uploads new intents and entity types without deleting the existing ones.
|
@@ -65,10 +70,13 @@ module Google
|
|
65
70
|
# call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train
|
66
71
|
# explicitly.
|
67
72
|
#
|
68
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
69
73
|
# An operation which tracks when importing is complete. It only tracks
|
70
74
|
# when the draft agent is updated not when it is done training.
|
71
|
-
|
75
|
+
#
|
76
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
77
|
+
# [training
|
78
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
79
|
+
rpc :ImportAgent, ::Google::Cloud::Dialogflow::V2::ImportAgentRequest, ::Google::Longrunning::Operation
|
72
80
|
# Restores the specified agent from a ZIP file.
|
73
81
|
#
|
74
82
|
# Replaces the current agent version with a new one. All the intents and
|
@@ -78,13 +86,16 @@ module Google
|
|
78
86
|
# completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it
|
79
87
|
# returns in order to train explicitly.
|
80
88
|
#
|
81
|
-
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
82
89
|
# An operation which tracks when restoring is complete. It only tracks
|
83
90
|
# when the draft agent is updated not when it is done training.
|
84
|
-
|
91
|
+
#
|
92
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
93
|
+
# [training
|
94
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
95
|
+
rpc :RestoreAgent, ::Google::Cloud::Dialogflow::V2::RestoreAgentRequest, ::Google::Longrunning::Operation
|
85
96
|
# Gets agent validation result. Agent validation is performed during
|
86
97
|
# training time and is updated automatically when training is completed.
|
87
|
-
rpc :GetValidationResult, GetValidationResultRequest, ValidationResult
|
98
|
+
rpc :GetValidationResult, ::Google::Cloud::Dialogflow::V2::GetValidationResultRequest, ::Google::Cloud::Dialogflow::V2::ValidationResult
|
88
99
|
end
|
89
100
|
|
90
101
|
Stub = Service.rpc_stub_class
|
@@ -60,7 +60,7 @@ module Google
|
|
60
60
|
parent_config = while namespace.any?
|
61
61
|
parent_name = namespace.join "::"
|
62
62
|
parent_const = const_get parent_name
|
63
|
-
break parent_const.configure if parent_const
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
64
|
namespace.pop
|
65
65
|
end
|
66
66
|
default_config = Client::Configuration.new parent_config
|
@@ -68,9 +68,9 @@ module Google
|
|
68
68
|
default_config.timeout = 60.0
|
69
69
|
default_config.retry_policy = {
|
70
70
|
initial_delay: 0.1,
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: [14]
|
74
74
|
}
|
75
75
|
|
76
76
|
default_config
|
@@ -134,7 +134,13 @@ module Google
|
|
134
134
|
|
135
135
|
# Create credentials
|
136
136
|
credentials = @config.credentials
|
137
|
-
|
137
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
138
|
+
# but only if the default endpoint does not have a region prefix.
|
139
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
140
|
+
@config.endpoint == Client.configure.endpoint &&
|
141
|
+
!@config.endpoint.split(".").first.include?("-")
|
142
|
+
credentials ||= Credentials.default scope: @config.scope,
|
143
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
138
144
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
139
145
|
credentials = Credentials.new credentials, scope: @config.scope
|
140
146
|
end
|
@@ -234,6 +240,10 @@ module Google
|
|
234
240
|
##
|
235
241
|
# Creates/updates the specified agent.
|
236
242
|
#
|
243
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
244
|
+
# [training
|
245
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
246
|
+
#
|
237
247
|
# @overload set_agent(request, options = nil)
|
238
248
|
# Pass arguments to `set_agent` via a request object, either of type
|
239
249
|
# {::Google::Cloud::Dialogflow::V2::SetAgentRequest} or an equivalent Hash.
|
@@ -448,7 +458,10 @@ module Google
|
|
448
458
|
##
|
449
459
|
# Trains the specified agent.
|
450
460
|
#
|
451
|
-
#
|
461
|
+
#
|
462
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
463
|
+
# [training
|
464
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
452
465
|
#
|
453
466
|
# @overload train_agent(request, options = nil)
|
454
467
|
# Pass arguments to `train_agent` via a request object, either of type
|
@@ -518,8 +531,6 @@ module Google
|
|
518
531
|
##
|
519
532
|
# Exports the specified agent to a ZIP file.
|
520
533
|
#
|
521
|
-
# Operation <response: {::Google::Cloud::Dialogflow::V2::ExportAgentResponse ExportAgentResponse}>
|
522
|
-
#
|
523
534
|
# @overload export_agent(request, options = nil)
|
524
535
|
# Pass arguments to `export_agent` via a request object, either of type
|
525
536
|
# {::Google::Cloud::Dialogflow::V2::ExportAgentRequest} or an equivalent Hash.
|
@@ -601,10 +612,13 @@ module Google
|
|
601
612
|
# call {::Google::Cloud::Dialogflow::V2::Agents::Client#train_agent TrainAgent} and wait for the operation it returns in order to train
|
602
613
|
# explicitly.
|
603
614
|
#
|
604
|
-
# Operation <response: {::Google::Protobuf::Empty google.protobuf.Empty}>
|
605
615
|
# An operation which tracks when importing is complete. It only tracks
|
606
616
|
# when the draft agent is updated not when it is done training.
|
607
617
|
#
|
618
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
619
|
+
# [training
|
620
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
621
|
+
#
|
608
622
|
# @overload import_agent(request, options = nil)
|
609
623
|
# Pass arguments to `import_agent` via a request object, either of type
|
610
624
|
# {::Google::Cloud::Dialogflow::V2::ImportAgentRequest} or an equivalent Hash.
|
@@ -685,10 +699,13 @@ module Google
|
|
685
699
|
# completed yet. Please call {::Google::Cloud::Dialogflow::V2::Agents::Client#train_agent TrainAgent} and wait for the operation it
|
686
700
|
# returns in order to train explicitly.
|
687
701
|
#
|
688
|
-
# Operation <response: {::Google::Protobuf::Empty google.protobuf.Empty}>
|
689
702
|
# An operation which tracks when restoring is complete. It only tracks
|
690
703
|
# when the draft agent is updated not when it is done training.
|
691
704
|
#
|
705
|
+
# Note: You should always train an agent prior to sending it queries. See the
|
706
|
+
# [training
|
707
|
+
# documentation](https://cloud.google.com/dialogflow/es/docs/training).
|
708
|
+
#
|
692
709
|
# @overload restore_agent(request, options = nil)
|
693
710
|
# Pass arguments to `restore_agent` via a request object, either of type
|
694
711
|
# {::Google::Cloud::Dialogflow::V2::RestoreAgentRequest} or an equivalent Hash.
|
@@ -918,14 +935,14 @@ module Google
|
|
918
935
|
|
919
936
|
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
920
937
|
config_attr :credentials, nil do |value|
|
921
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
938
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
922
939
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
923
940
|
allowed.any? { |klass| klass === value }
|
924
941
|
end
|
925
942
|
config_attr :scope, nil, ::String, ::Array, nil
|
926
943
|
config_attr :lib_name, nil, ::String, nil
|
927
944
|
config_attr :lib_version, nil, ::String, nil
|
928
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
945
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
929
946
|
config_attr :interceptors, nil, ::Array, nil
|
930
947
|
config_attr :timeout, nil, ::Numeric, nil
|
931
948
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -946,7 +963,7 @@ module Google
|
|
946
963
|
def rpcs
|
947
964
|
@rpcs ||= begin
|
948
965
|
parent_rpcs = nil
|
949
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
966
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
950
967
|
Rpcs.new parent_rpcs
|
951
968
|
end
|
952
969
|
end
|
@@ -958,7 +975,7 @@ module Google
|
|
958
975
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
959
976
|
# the following configuration fields:
|
960
977
|
#
|
961
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
978
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
962
979
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
963
980
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
964
981
|
# include the following keys:
|
@@ -1017,23 +1034,23 @@ module Google
|
|
1017
1034
|
|
1018
1035
|
# @private
|
1019
1036
|
def initialize parent_rpcs = nil
|
1020
|
-
get_agent_config = parent_rpcs
|
1037
|
+
get_agent_config = parent_rpcs.get_agent if parent_rpcs.respond_to? :get_agent
|
1021
1038
|
@get_agent = ::Gapic::Config::Method.new get_agent_config
|
1022
|
-
set_agent_config = parent_rpcs
|
1039
|
+
set_agent_config = parent_rpcs.set_agent if parent_rpcs.respond_to? :set_agent
|
1023
1040
|
@set_agent = ::Gapic::Config::Method.new set_agent_config
|
1024
|
-
delete_agent_config = parent_rpcs
|
1041
|
+
delete_agent_config = parent_rpcs.delete_agent if parent_rpcs.respond_to? :delete_agent
|
1025
1042
|
@delete_agent = ::Gapic::Config::Method.new delete_agent_config
|
1026
|
-
search_agents_config = parent_rpcs
|
1043
|
+
search_agents_config = parent_rpcs.search_agents if parent_rpcs.respond_to? :search_agents
|
1027
1044
|
@search_agents = ::Gapic::Config::Method.new search_agents_config
|
1028
|
-
train_agent_config = parent_rpcs
|
1045
|
+
train_agent_config = parent_rpcs.train_agent if parent_rpcs.respond_to? :train_agent
|
1029
1046
|
@train_agent = ::Gapic::Config::Method.new train_agent_config
|
1030
|
-
export_agent_config = parent_rpcs
|
1047
|
+
export_agent_config = parent_rpcs.export_agent if parent_rpcs.respond_to? :export_agent
|
1031
1048
|
@export_agent = ::Gapic::Config::Method.new export_agent_config
|
1032
|
-
import_agent_config = parent_rpcs
|
1049
|
+
import_agent_config = parent_rpcs.import_agent if parent_rpcs.respond_to? :import_agent
|
1033
1050
|
@import_agent = ::Gapic::Config::Method.new import_agent_config
|
1034
|
-
restore_agent_config = parent_rpcs
|
1051
|
+
restore_agent_config = parent_rpcs.restore_agent if parent_rpcs.respond_to? :restore_agent
|
1035
1052
|
@restore_agent = ::Gapic::Config::Method.new restore_agent_config
|
1036
|
-
get_validation_result_config = parent_rpcs
|
1053
|
+
get_validation_result_config = parent_rpcs.get_validation_result if parent_rpcs.respond_to? :get_validation_result
|
1037
1054
|
@get_validation_result = ::Gapic::Config::Method.new get_validation_result_config
|
1038
1055
|
|
1039
1056
|
yield self if block_given?
|
@@ -103,8 +103,13 @@ module Google
|
|
103
103
|
# Lists operations that match the specified filter in the request. If the
|
104
104
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
105
105
|
#
|
106
|
-
# NOTE: the `name` binding
|
107
|
-
# to use different resource name schemes, such as `users/*/operations`.
|
106
|
+
# NOTE: the `name` binding allows API services to override the binding
|
107
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
108
|
+
# override the binding, API services can add a binding such as
|
109
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
110
|
+
# For backwards compatibility, the default name includes the operations
|
111
|
+
# collection id, however overriding users must ensure the name binding
|
112
|
+
# is the parent resource, without the operations collection id.
|
108
113
|
#
|
109
114
|
# @overload list_operations(request, options = nil)
|
110
115
|
# Pass arguments to `list_operations` via a request object, either of type
|
@@ -122,7 +127,7 @@ module Google
|
|
122
127
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
123
128
|
#
|
124
129
|
# @param name [::String]
|
125
|
-
# The name of the operation
|
130
|
+
# The name of the operation's parent resource.
|
126
131
|
# @param filter [::String]
|
127
132
|
# The standard list filter.
|
128
133
|
# @param page_size [::Integer]
|
@@ -390,6 +395,79 @@ module Google
|
|
390
395
|
raise ::Google::Cloud::Error.from_error(e)
|
391
396
|
end
|
392
397
|
|
398
|
+
##
|
399
|
+
# Waits for the specified long-running operation until it is done or reaches
|
400
|
+
# at most a specified timeout, returning the latest state. If the operation
|
401
|
+
# is already done, the latest state is immediately returned. If the timeout
|
402
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
|
+
# timeout is used. If the server does not support this method, it returns
|
404
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
405
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
406
|
+
# state before the specified timeout (including immediately), meaning even an
|
407
|
+
# immediate response is no guarantee that the operation is done.
|
408
|
+
#
|
409
|
+
# @overload wait_operation(request, options = nil)
|
410
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
411
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
412
|
+
#
|
413
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
414
|
+
# A request object representing the call parameters. Required. To specify no
|
415
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
416
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
417
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
418
|
+
#
|
419
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
420
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
421
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
422
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
423
|
+
#
|
424
|
+
# @param name [::String]
|
425
|
+
# The name of the operation resource to wait on.
|
426
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
427
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
428
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
429
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
430
|
+
#
|
431
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
432
|
+
# @yieldparam response [::Gapic::Operation]
|
433
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
434
|
+
#
|
435
|
+
# @return [::Gapic::Operation]
|
436
|
+
#
|
437
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
438
|
+
#
|
439
|
+
def wait_operation request, options = nil
|
440
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
441
|
+
|
442
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
443
|
+
|
444
|
+
# Converts hash and nil to an options object
|
445
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
446
|
+
|
447
|
+
# Customize the options with defaults
|
448
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
449
|
+
|
450
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
451
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
452
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
453
|
+
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
393
471
|
##
|
394
472
|
# Configuration class for the Operations API.
|
395
473
|
#
|
@@ -475,14 +553,14 @@ module Google
|
|
475
553
|
|
476
554
|
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
477
555
|
config_attr :credentials, nil do |value|
|
478
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
556
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
479
557
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
480
558
|
allowed.any? { |klass| klass === value }
|
481
559
|
end
|
482
560
|
config_attr :scope, nil, ::String, ::Array, nil
|
483
561
|
config_attr :lib_name, nil, ::String, nil
|
484
562
|
config_attr :lib_version, nil, ::String, nil
|
485
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
563
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
486
564
|
config_attr :interceptors, nil, ::Array, nil
|
487
565
|
config_attr :timeout, nil, ::Numeric, nil
|
488
566
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -503,7 +581,7 @@ module Google
|
|
503
581
|
def rpcs
|
504
582
|
@rpcs ||= begin
|
505
583
|
parent_rpcs = nil
|
506
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
584
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
507
585
|
Rpcs.new parent_rpcs
|
508
586
|
end
|
509
587
|
end
|
@@ -515,7 +593,7 @@ module Google
|
|
515
593
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
594
|
# the following configuration fields:
|
517
595
|
#
|
518
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
597
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
598
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
599
|
# include the following keys:
|
@@ -546,17 +624,24 @@ module Google
|
|
546
624
|
# @return [::Gapic::Config::Method]
|
547
625
|
#
|
548
626
|
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
549
632
|
|
550
633
|
# @private
|
551
634
|
def initialize parent_rpcs = nil
|
552
|
-
list_operations_config = parent_rpcs
|
635
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
553
636
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
554
|
-
get_operation_config = parent_rpcs
|
637
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
555
638
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
556
|
-
delete_operation_config = parent_rpcs
|
639
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
557
640
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
|
-
cancel_operation_config = parent_rpcs
|
641
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
559
642
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
560
645
|
|
561
646
|
yield self if block_given?
|
562
647
|
end
|
@@ -27,15 +27,54 @@ module Google
|
|
27
27
|
##
|
28
28
|
# Create a fully-qualified Agent resource string.
|
29
29
|
#
|
30
|
+
# @overload agent_path(project:)
|
31
|
+
# The resource will be in the following format:
|
32
|
+
#
|
33
|
+
# `projects/{project}/agent`
|
34
|
+
#
|
35
|
+
# @param project [String]
|
36
|
+
#
|
37
|
+
# @overload agent_path(project:, location:)
|
38
|
+
# The resource will be in the following format:
|
39
|
+
#
|
40
|
+
# `projects/{project}/locations/{location}/agent`
|
41
|
+
#
|
42
|
+
# @param project [String]
|
43
|
+
# @param location [String]
|
44
|
+
#
|
45
|
+
# @return [::String]
|
46
|
+
def agent_path **args
|
47
|
+
resources = {
|
48
|
+
"project" => (proc do |project:|
|
49
|
+
"projects/#{project}/agent"
|
50
|
+
end),
|
51
|
+
"location:project" => (proc do |project:, location:|
|
52
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
53
|
+
|
54
|
+
"projects/#{project}/locations/#{location}/agent"
|
55
|
+
end)
|
56
|
+
}
|
57
|
+
|
58
|
+
resource = resources[args.keys.sort.join(":")]
|
59
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
60
|
+
resource.call(**args)
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Create a fully-qualified Location resource string.
|
65
|
+
#
|
30
66
|
# The resource will be in the following format:
|
31
67
|
#
|
32
|
-
# `projects/{project}/
|
68
|
+
# `projects/{project}/locations/{location}`
|
33
69
|
#
|
34
70
|
# @param project [String]
|
71
|
+
# @param location [String]
|
35
72
|
#
|
36
73
|
# @return [::String]
|
37
|
-
def
|
38
|
-
"
|
74
|
+
def location_path project:, location:
|
75
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
76
|
+
|
77
|
+
"projects/#{project}/locations/#{location}"
|
39
78
|
end
|
40
79
|
|
41
80
|
##
|