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.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +66 -2
  4. data/lib/google/cloud/dialogflow/v2.rb +13 -2
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +26 -15
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +40 -23
  7. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
  8. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
  9. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +48 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records.rb +49 -0
  12. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +478 -0
  13. data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
  14. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
  15. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
  16. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +8 -25
  17. data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
  18. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +22 -33
  19. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +74 -2
  20. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +246 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
  29. data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
  30. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
  31. data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
  33. data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
  34. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
  35. data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
  40. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +40 -46
  41. data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
  42. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +54 -54
  43. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
  44. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
  45. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
  46. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +24 -3
  47. data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
  48. data/lib/google/cloud/dialogflow/v2/environments/client.rb +428 -12
  49. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +145 -5
  50. data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
  51. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +460 -0
  54. data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
  55. data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
  56. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
  57. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
  58. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
  59. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +29 -42
  60. data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
  61. data/lib/google/cloud/dialogflow/v2/intents/client.rb +52 -51
  62. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
  63. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +97 -13
  64. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
  65. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
  66. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
  67. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
  68. data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
  69. data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
  70. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +181 -0
  71. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
  72. data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
  73. data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
  74. data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
  75. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +334 -0
  76. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +7 -23
  77. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
  78. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +21 -31
  79. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +74 -2
  80. data/lib/google/cloud/dialogflow/v2/session_pb.rb +2 -0
  81. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +15 -7
  82. data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
  83. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +43 -21
  84. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +113 -3
  85. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  86. data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
  87. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
  88. data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
  89. data/lib/google/cloud/dialogflow/v2/versions/client.rb +709 -0
  90. data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
  91. data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
  92. data/proto_docs/google/api/field_behavior.rb +6 -0
  93. data/proto_docs/google/api/resource.rb +50 -14
  94. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -2
  95. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +252 -0
  96. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
  97. data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
  98. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
  99. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
  100. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +522 -0
  101. data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
  102. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
  103. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +188 -6
  104. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
  105. data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
  106. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +29 -4
  107. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
  108. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +525 -0
  109. data/proto_docs/google/cloud/dialogflow/v2/session.rb +56 -7
  110. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
  111. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  112. data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
  113. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
  114. data/proto_docs/google/longrunning/operations.rb +17 -3
  115. data/proto_docs/google/protobuf/any.rb +5 -2
  116. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  117. data/proto_docs/google/type/latlng.rb +2 -2
  118. metadata +81 -11
@@ -0,0 +1,100 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dialogflow/v2/answer_record.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/api/client_pb'
8
+ require 'google/api/field_behavior_pb'
9
+ require 'google/api/resource_pb'
10
+ require 'google/cloud/dialogflow/v2/participant_pb'
11
+ require 'google/protobuf/empty_pb'
12
+ require 'google/protobuf/field_mask_pb'
13
+ require 'google/protobuf/timestamp_pb'
14
+ Google::Protobuf::DescriptorPool.generated_pool.build do
15
+ add_file("google/cloud/dialogflow/v2/answer_record.proto", :syntax => :proto3) do
16
+ add_message "google.cloud.dialogflow.v2.AnswerRecord" do
17
+ optional :name, :string, 1
18
+ optional :answer_feedback, :message, 2, "google.cloud.dialogflow.v2.AnswerFeedback"
19
+ oneof :record do
20
+ optional :agent_assistant_record, :message, 4, "google.cloud.dialogflow.v2.AgentAssistantRecord"
21
+ end
22
+ end
23
+ add_message "google.cloud.dialogflow.v2.ListAnswerRecordsRequest" do
24
+ optional :parent, :string, 1
25
+ optional :filter, :string, 2
26
+ optional :page_size, :int32, 3
27
+ optional :page_token, :string, 4
28
+ end
29
+ add_message "google.cloud.dialogflow.v2.ListAnswerRecordsResponse" do
30
+ repeated :answer_records, :message, 1, "google.cloud.dialogflow.v2.AnswerRecord"
31
+ optional :next_page_token, :string, 2
32
+ end
33
+ add_message "google.cloud.dialogflow.v2.UpdateAnswerRecordRequest" do
34
+ optional :answer_record, :message, 1, "google.cloud.dialogflow.v2.AnswerRecord"
35
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
36
+ end
37
+ add_message "google.cloud.dialogflow.v2.AnswerFeedback" do
38
+ optional :correctness_level, :enum, 1, "google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel"
39
+ optional :clicked, :bool, 3
40
+ optional :click_time, :message, 5, "google.protobuf.Timestamp"
41
+ optional :displayed, :bool, 4
42
+ optional :display_time, :message, 6, "google.protobuf.Timestamp"
43
+ oneof :detail_feedback do
44
+ optional :agent_assistant_detail_feedback, :message, 2, "google.cloud.dialogflow.v2.AgentAssistantFeedback"
45
+ end
46
+ end
47
+ add_enum "google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel" do
48
+ value :CORRECTNESS_LEVEL_UNSPECIFIED, 0
49
+ value :NOT_CORRECT, 1
50
+ value :PARTIALLY_CORRECT, 2
51
+ value :FULLY_CORRECT, 3
52
+ end
53
+ add_message "google.cloud.dialogflow.v2.AgentAssistantFeedback" do
54
+ optional :answer_relevance, :enum, 1, "google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance"
55
+ optional :document_correctness, :enum, 2, "google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness"
56
+ optional :document_efficiency, :enum, 3, "google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency"
57
+ end
58
+ add_enum "google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance" do
59
+ value :ANSWER_RELEVANCE_UNSPECIFIED, 0
60
+ value :IRRELEVANT, 1
61
+ value :RELEVANT, 2
62
+ end
63
+ add_enum "google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness" do
64
+ value :DOCUMENT_CORRECTNESS_UNSPECIFIED, 0
65
+ value :INCORRECT, 1
66
+ value :CORRECT, 2
67
+ end
68
+ add_enum "google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency" do
69
+ value :DOCUMENT_EFFICIENCY_UNSPECIFIED, 0
70
+ value :INEFFICIENT, 1
71
+ value :EFFICIENT, 2
72
+ end
73
+ add_message "google.cloud.dialogflow.v2.AgentAssistantRecord" do
74
+ oneof :answer do
75
+ optional :article_suggestion_answer, :message, 5, "google.cloud.dialogflow.v2.ArticleAnswer"
76
+ optional :faq_answer, :message, 6, "google.cloud.dialogflow.v2.FaqAnswer"
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ module Google
83
+ module Cloud
84
+ module Dialogflow
85
+ module V2
86
+ AnswerRecord = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AnswerRecord").msgclass
87
+ ListAnswerRecordsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListAnswerRecordsRequest").msgclass
88
+ ListAnswerRecordsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListAnswerRecordsResponse").msgclass
89
+ UpdateAnswerRecordRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateAnswerRecordRequest").msgclass
90
+ AnswerFeedback = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AnswerFeedback").msgclass
91
+ AnswerFeedback::CorrectnessLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel").enummodule
92
+ AgentAssistantFeedback = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AgentAssistantFeedback").msgclass
93
+ AgentAssistantFeedback::AnswerRelevance = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance").enummodule
94
+ AgentAssistantFeedback::DocumentCorrectness = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness").enummodule
95
+ AgentAssistantFeedback::DocumentEfficiency = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency").enummodule
96
+ AgentAssistantRecord = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AgentAssistantRecord").msgclass
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,48 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dialogflow/v2/answer_record.proto for package 'google.cloud.dialogflow.v2'
3
+ # Original file comments:
4
+ # Copyright 2021 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
+ require 'grpc'
20
+ require 'google/cloud/dialogflow/v2/answer_record_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module AnswerRecords
27
+ # Service for managing [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
28
+ class Service
29
+
30
+ include ::GRPC::GenericService
31
+
32
+ self.marshal_class_method = :encode
33
+ self.unmarshal_class_method = :decode
34
+ self.service_name = 'google.cloud.dialogflow.v2.AnswerRecords'
35
+
36
+ # Returns the list of all answer records in the specified project in reverse
37
+ # chronological order.
38
+ rpc :ListAnswerRecords, ::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest, ::Google::Cloud::Dialogflow::V2::ListAnswerRecordsResponse
39
+ # Updates the specified answer record.
40
+ rpc :UpdateAnswerRecord, ::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest, ::Google::Cloud::Dialogflow::V2::AnswerRecord
41
+ end
42
+
43
+ Stub = Service.rpc_stub_class
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/dialogflow/v2/version"
24
+
25
+ require "google/cloud/dialogflow/v2/answer_records/credentials"
26
+ require "google/cloud/dialogflow/v2/answer_records/paths"
27
+ require "google/cloud/dialogflow/v2/answer_records/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Dialogflow
32
+ module V2
33
+ ##
34
+ # Service for managing {::Google::Cloud::Dialogflow::V2::AnswerRecord AnswerRecords}.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/dialogflow/v2/answer_records"
39
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new
40
+ #
41
+ module AnswerRecords
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "answer_records", "helpers.rb"
49
+ require "google/cloud/dialogflow/v2/answer_records/helpers" if ::File.file? helper_path
@@ -0,0 +1,478 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dialogflow/v2/answer_record_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module AnswerRecords
27
+ ##
28
+ # Client for the AnswerRecords service.
29
+ #
30
+ # Service for managing {::Google::Cloud::Dialogflow::V2::AnswerRecord AnswerRecords}.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :answer_records_stub
37
+
38
+ ##
39
+ # Configure the AnswerRecords Client class.
40
+ #
41
+ # See {::Google::Cloud::Dialogflow::V2::AnswerRecords::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all AnswerRecords clients:
47
+ #
48
+ # ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.timeout = 60.0
69
+ default_config.retry_policy = {
70
+ initial_delay: 0.1,
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the AnswerRecords Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::Dialogflow::V2::AnswerRecords::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new AnswerRecords client object.
104
+ #
105
+ # ## Examples
106
+ #
107
+ # To create a new AnswerRecords client with the default
108
+ # configuration:
109
+ #
110
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new
111
+ #
112
+ # To create a new AnswerRecords client with a custom
113
+ # configuration:
114
+ #
115
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the AnswerRecords client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ def initialize
123
+ # These require statements are intentionally placed here to initialize
124
+ # the gRPC module only when it's required.
125
+ # See https://github.com/googleapis/toolkit/issues/446
126
+ require "gapic/grpc"
127
+ require "google/cloud/dialogflow/v2/answer_record_services_pb"
128
+
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
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
144
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @answer_records_stub = ::Gapic::ServiceStub.new(
151
+ ::Google::Cloud::Dialogflow::V2::AnswerRecords::Stub,
152
+ credentials: credentials,
153
+ endpoint: @config.endpoint,
154
+ channel_args: @config.channel_args,
155
+ interceptors: @config.interceptors
156
+ )
157
+ end
158
+
159
+ # Service calls
160
+
161
+ ##
162
+ # Returns the list of all answer records in the specified project in reverse
163
+ # chronological order.
164
+ #
165
+ # @overload list_answer_records(request, options = nil)
166
+ # Pass arguments to `list_answer_records` via a request object, either of type
167
+ # {::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest} or an equivalent Hash.
168
+ #
169
+ # @param request [::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest, ::Hash]
170
+ # A request object representing the call parameters. Required. To specify no
171
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
172
+ # @param options [::Gapic::CallOptions, ::Hash]
173
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
174
+ #
175
+ # @overload list_answer_records(parent: nil, filter: nil, page_size: nil, page_token: nil)
176
+ # Pass arguments to `list_answer_records` via keyword arguments. Note that at
177
+ # least one keyword argument is required. To specify no parameters, or to keep all
178
+ # the default parameter values, pass an empty Hash as a request object (see above).
179
+ #
180
+ # @param parent [::String]
181
+ # Required. The project to list all answer records for in reverse
182
+ # chronological order. Format: `projects/<Project ID>/locations/<Location
183
+ # ID>`.
184
+ # @param filter [::String]
185
+ # Required. Filters to restrict results to specific answer records.
186
+ # Filter on answer record type. Currently predicates on `type` is supported,
187
+ # valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
188
+ #
189
+ # For more information about filtering, see
190
+ # [API Filtering](https://aip.dev/160).
191
+ # @param page_size [::Integer]
192
+ # Optional. The maximum number of records to return in a single page.
193
+ # The server may return fewer records than this. If unspecified, we use 10.
194
+ # The maximum is 100.
195
+ # @param page_token [::String]
196
+ # Optional. The
197
+ # {::Google::Cloud::Dialogflow::V2::ListAnswerRecordsResponse#next_page_token ListAnswerRecordsResponse.next_page_token}
198
+ # value returned from a previous list request used to continue listing on
199
+ # the next page.
200
+ #
201
+ # @yield [response, operation] Access the result along with the RPC operation
202
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::AnswerRecord>]
203
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
204
+ #
205
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::AnswerRecord>]
206
+ #
207
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
208
+ #
209
+ def list_answer_records request, options = nil
210
+ raise ::ArgumentError, "request must be provided" if request.nil?
211
+
212
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest
213
+
214
+ # Converts hash and nil to an options object
215
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
216
+
217
+ # Customize the options with defaults
218
+ metadata = @config.rpcs.list_answer_records.metadata.to_h
219
+
220
+ # Set x-goog-api-client and x-goog-user-project headers
221
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
222
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
223
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
224
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
225
+
226
+ header_params = {
227
+ "parent" => request.parent
228
+ }
229
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
230
+ metadata[:"x-goog-request-params"] ||= request_params_header
231
+
232
+ options.apply_defaults timeout: @config.rpcs.list_answer_records.timeout,
233
+ metadata: metadata,
234
+ retry_policy: @config.rpcs.list_answer_records.retry_policy
235
+ options.apply_defaults metadata: @config.metadata,
236
+ retry_policy: @config.retry_policy
237
+
238
+ @answer_records_stub.call_rpc :list_answer_records, request, options: options do |response, operation|
239
+ response = ::Gapic::PagedEnumerable.new @answer_records_stub, :list_answer_records, request, response, operation, options
240
+ yield response, operation if block_given?
241
+ return response
242
+ end
243
+ rescue ::GRPC::BadStatus => e
244
+ raise ::Google::Cloud::Error.from_error(e)
245
+ end
246
+
247
+ ##
248
+ # Updates the specified answer record.
249
+ #
250
+ # @overload update_answer_record(request, options = nil)
251
+ # Pass arguments to `update_answer_record` via a request object, either of type
252
+ # {::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest} or an equivalent Hash.
253
+ #
254
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest, ::Hash]
255
+ # A request object representing the call parameters. Required. To specify no
256
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
257
+ # @param options [::Gapic::CallOptions, ::Hash]
258
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
259
+ #
260
+ # @overload update_answer_record(answer_record: nil, update_mask: nil)
261
+ # Pass arguments to `update_answer_record` via keyword arguments. Note that at
262
+ # least one keyword argument is required. To specify no parameters, or to keep all
263
+ # the default parameter values, pass an empty Hash as a request object (see above).
264
+ #
265
+ # @param answer_record [::Google::Cloud::Dialogflow::V2::AnswerRecord, ::Hash]
266
+ # Required. Answer record to update.
267
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
268
+ # Required. The mask to control which fields get updated.
269
+ #
270
+ # @yield [response, operation] Access the result along with the RPC operation
271
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::AnswerRecord]
272
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
273
+ #
274
+ # @return [::Google::Cloud::Dialogflow::V2::AnswerRecord]
275
+ #
276
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
277
+ #
278
+ def update_answer_record request, options = nil
279
+ raise ::ArgumentError, "request must be provided" if request.nil?
280
+
281
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest
282
+
283
+ # Converts hash and nil to an options object
284
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
285
+
286
+ # Customize the options with defaults
287
+ metadata = @config.rpcs.update_answer_record.metadata.to_h
288
+
289
+ # Set x-goog-api-client and x-goog-user-project headers
290
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
291
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
292
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
293
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
294
+
295
+ header_params = {
296
+ "answer_record.name" => request.answer_record.name
297
+ }
298
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
299
+ metadata[:"x-goog-request-params"] ||= request_params_header
300
+
301
+ options.apply_defaults timeout: @config.rpcs.update_answer_record.timeout,
302
+ metadata: metadata,
303
+ retry_policy: @config.rpcs.update_answer_record.retry_policy
304
+ options.apply_defaults metadata: @config.metadata,
305
+ retry_policy: @config.retry_policy
306
+
307
+ @answer_records_stub.call_rpc :update_answer_record, request, options: options do |response, operation|
308
+ yield response, operation if block_given?
309
+ return response
310
+ end
311
+ rescue ::GRPC::BadStatus => e
312
+ raise ::Google::Cloud::Error.from_error(e)
313
+ end
314
+
315
+ ##
316
+ # Configuration class for the AnswerRecords API.
317
+ #
318
+ # This class represents the configuration for AnswerRecords,
319
+ # providing control over timeouts, retry behavior, logging, transport
320
+ # parameters, and other low-level controls. Certain parameters can also be
321
+ # applied individually to specific RPCs. See
322
+ # {::Google::Cloud::Dialogflow::V2::AnswerRecords::Client::Configuration::Rpcs}
323
+ # for a list of RPCs that can be configured independently.
324
+ #
325
+ # Configuration can be applied globally to all clients, or to a single client
326
+ # on construction.
327
+ #
328
+ # # Examples
329
+ #
330
+ # To modify the global config, setting the timeout for list_answer_records
331
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
332
+ #
333
+ # ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.configure do |config|
334
+ # config.timeout = 10.0
335
+ # config.rpcs.list_answer_records.timeout = 20.0
336
+ # end
337
+ #
338
+ # To apply the above configuration only to a new client:
339
+ #
340
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new do |config|
341
+ # config.timeout = 10.0
342
+ # config.rpcs.list_answer_records.timeout = 20.0
343
+ # end
344
+ #
345
+ # @!attribute [rw] endpoint
346
+ # The hostname or hostname:port of the service endpoint.
347
+ # Defaults to `"dialogflow.googleapis.com"`.
348
+ # @return [::String]
349
+ # @!attribute [rw] credentials
350
+ # Credentials to send with calls. You may provide any of the following types:
351
+ # * (`String`) The path to a service account key file in JSON format
352
+ # * (`Hash`) A service account key as a Hash
353
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
354
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
355
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
356
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
357
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
358
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
359
+ # * (`nil`) indicating no credentials
360
+ # @return [::Object]
361
+ # @!attribute [rw] scope
362
+ # The OAuth scopes
363
+ # @return [::Array<::String>]
364
+ # @!attribute [rw] lib_name
365
+ # The library name as recorded in instrumentation and logging
366
+ # @return [::String]
367
+ # @!attribute [rw] lib_version
368
+ # The library version as recorded in instrumentation and logging
369
+ # @return [::String]
370
+ # @!attribute [rw] channel_args
371
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
372
+ # `GRPC::Core::Channel` object is provided as the credential.
373
+ # @return [::Hash]
374
+ # @!attribute [rw] interceptors
375
+ # An array of interceptors that are run before calls are executed.
376
+ # @return [::Array<::GRPC::ClientInterceptor>]
377
+ # @!attribute [rw] timeout
378
+ # The call timeout in seconds.
379
+ # @return [::Numeric]
380
+ # @!attribute [rw] metadata
381
+ # Additional gRPC headers to be sent with the call.
382
+ # @return [::Hash{::Symbol=>::String}]
383
+ # @!attribute [rw] retry_policy
384
+ # The retry policy. The value is a hash with the following keys:
385
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
386
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
387
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
388
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
389
+ # trigger a retry.
390
+ # @return [::Hash]
391
+ # @!attribute [rw] quota_project
392
+ # A separate project against which to charge quota.
393
+ # @return [::String]
394
+ #
395
+ class Configuration
396
+ extend ::Gapic::Config
397
+
398
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
399
+ config_attr :credentials, nil do |value|
400
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
401
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
402
+ allowed.any? { |klass| klass === value }
403
+ end
404
+ config_attr :scope, nil, ::String, ::Array, nil
405
+ config_attr :lib_name, nil, ::String, nil
406
+ config_attr :lib_version, nil, ::String, nil
407
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
408
+ config_attr :interceptors, nil, ::Array, nil
409
+ config_attr :timeout, nil, ::Numeric, nil
410
+ config_attr :metadata, nil, ::Hash, nil
411
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
412
+ config_attr :quota_project, nil, ::String, nil
413
+
414
+ # @private
415
+ def initialize parent_config = nil
416
+ @parent_config = parent_config unless parent_config.nil?
417
+
418
+ yield self if block_given?
419
+ end
420
+
421
+ ##
422
+ # Configurations for individual RPCs
423
+ # @return [Rpcs]
424
+ #
425
+ def rpcs
426
+ @rpcs ||= begin
427
+ parent_rpcs = nil
428
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
429
+ Rpcs.new parent_rpcs
430
+ end
431
+ end
432
+
433
+ ##
434
+ # Configuration RPC class for the AnswerRecords API.
435
+ #
436
+ # Includes fields providing the configuration for each RPC in this service.
437
+ # Each configuration object is of type `Gapic::Config::Method` and includes
438
+ # the following configuration fields:
439
+ #
440
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
441
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
442
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
443
+ # include the following keys:
444
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
445
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
446
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
447
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
448
+ # trigger a retry.
449
+ #
450
+ class Rpcs
451
+ ##
452
+ # RPC-specific configuration for `list_answer_records`
453
+ # @return [::Gapic::Config::Method]
454
+ #
455
+ attr_reader :list_answer_records
456
+ ##
457
+ # RPC-specific configuration for `update_answer_record`
458
+ # @return [::Gapic::Config::Method]
459
+ #
460
+ attr_reader :update_answer_record
461
+
462
+ # @private
463
+ def initialize parent_rpcs = nil
464
+ list_answer_records_config = parent_rpcs.list_answer_records if parent_rpcs.respond_to? :list_answer_records
465
+ @list_answer_records = ::Gapic::Config::Method.new list_answer_records_config
466
+ update_answer_record_config = parent_rpcs.update_answer_record if parent_rpcs.respond_to? :update_answer_record
467
+ @update_answer_record = ::Gapic::Config::Method.new update_answer_record_config
468
+
469
+ yield self if block_given?
470
+ end
471
+ end
472
+ end
473
+ end
474
+ end
475
+ end
476
+ end
477
+ end
478
+ end