google-cloud-dialogflow-v2 0.6.4 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) 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 +11 -2
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +9 -9
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +24 -18
  7. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
  8. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
  9. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +49 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_records.rb +50 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +479 -0
  12. data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
  13. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
  14. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
  15. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +7 -24
  16. data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
  17. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +22 -33
  18. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +2 -2
  19. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +205 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
  28. data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
  29. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
  30. data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
  31. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
  32. data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
  33. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
  34. data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
  35. data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
  39. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +11 -38
  40. data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
  41. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +26 -47
  42. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
  43. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +2 -2
  44. data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
  45. data/lib/google/cloud/dialogflow/v2/environments/client.rb +17 -11
  46. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
  47. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
  48. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
  49. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +8 -39
  50. data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
  51. data/lib/google/cloud/dialogflow/v2/intents/client.rb +23 -48
  52. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
  53. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +1 -1
  54. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
  55. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
  56. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
  57. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
  58. data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
  59. data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
  60. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +172 -0
  61. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
  62. data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
  63. data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
  64. data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
  65. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +258 -0
  66. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +6 -22
  67. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +21 -31
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +2 -2
  70. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  71. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +14 -6
  72. data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
  73. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +43 -21
  74. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +3 -3
  75. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  76. data/proto_docs/google/api/field_behavior.rb +6 -0
  77. data/proto_docs/google/api/resource.rb +50 -14
  78. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -2
  79. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +259 -0
  80. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
  81. data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
  82. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
  83. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
  84. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +510 -0
  85. data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
  86. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
  87. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +18 -1
  88. data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
  89. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +20 -3
  90. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
  91. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +503 -0
  92. data/proto_docs/google/cloud/dialogflow/v2/session.rb +52 -7
  93. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
  94. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  95. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
  96. data/proto_docs/google/longrunning/operations.rb +17 -3
  97. data/proto_docs/google/protobuf/any.rb +5 -2
  98. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  99. data/proto_docs/google/type/latlng.rb +2 -2
  100. metadata +59 -9
@@ -0,0 +1,119 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Dialogflow
23
+ module V2
24
+ module Documents
25
+ # Path helper methods for the Documents API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Document resource string.
29
+ #
30
+ # @overload document_path(project:, knowledge_base:, document:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}`
34
+ #
35
+ # @param project [String]
36
+ # @param knowledge_base [String]
37
+ # @param document [String]
38
+ #
39
+ # @overload document_path(project:, location:, knowledge_base:, document:)
40
+ # The resource will be in the following format:
41
+ #
42
+ # `projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}`
43
+ #
44
+ # @param project [String]
45
+ # @param location [String]
46
+ # @param knowledge_base [String]
47
+ # @param document [String]
48
+ #
49
+ # @return [::String]
50
+ def document_path **args
51
+ resources = {
52
+ "document:knowledge_base:project" => (proc do |project:, knowledge_base:, document:|
53
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
54
+ raise ::ArgumentError, "knowledge_base cannot contain /" if knowledge_base.to_s.include? "/"
55
+
56
+ "projects/#{project}/knowledgeBases/#{knowledge_base}/documents/#{document}"
57
+ end),
58
+ "document:knowledge_base:location:project" => (proc do |project:, location:, knowledge_base:, document:|
59
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
60
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
61
+ raise ::ArgumentError, "knowledge_base cannot contain /" if knowledge_base.to_s.include? "/"
62
+
63
+ "projects/#{project}/locations/#{location}/knowledgeBases/#{knowledge_base}/documents/#{document}"
64
+ end)
65
+ }
66
+
67
+ resource = resources[args.keys.sort.join(":")]
68
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
69
+ resource.call(**args)
70
+ end
71
+
72
+ ##
73
+ # Create a fully-qualified KnowledgeBase resource string.
74
+ #
75
+ # @overload knowledge_base_path(project:, knowledge_base:)
76
+ # The resource will be in the following format:
77
+ #
78
+ # `projects/{project}/knowledgeBases/{knowledge_base}`
79
+ #
80
+ # @param project [String]
81
+ # @param knowledge_base [String]
82
+ #
83
+ # @overload knowledge_base_path(project:, location:, knowledge_base:)
84
+ # The resource will be in the following format:
85
+ #
86
+ # `projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}`
87
+ #
88
+ # @param project [String]
89
+ # @param location [String]
90
+ # @param knowledge_base [String]
91
+ #
92
+ # @return [::String]
93
+ def knowledge_base_path **args
94
+ resources = {
95
+ "knowledge_base:project" => (proc do |project:, knowledge_base:|
96
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
97
+
98
+ "projects/#{project}/knowledgeBases/#{knowledge_base}"
99
+ end),
100
+ "knowledge_base:location:project" => (proc do |project:, location:, knowledge_base:|
101
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
102
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
103
+
104
+ "projects/#{project}/locations/#{location}/knowledgeBases/#{knowledge_base}"
105
+ end)
106
+ }
107
+
108
+ resource = resources[args.keys.sort.join(":")]
109
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
110
+ resource.call(**args)
111
+ end
112
+
113
+ extend self
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -24,34 +24,7 @@ module Google
24
24
  module Dialogflow
25
25
  module V2
26
26
  module EntityTypes
27
- # Entities are extracted from user input and represent parameters that are
28
- # meaningful to your application. For example, a date range, a proper name
29
- # such as a geographic location or landmark, and so on. Entities represent
30
- # actionable data for your application.
31
- #
32
- # When you define an entity, you can also include synonyms that all map to
33
- # that entity. For example, "soft drink", "soda", "pop", and so on.
34
- #
35
- # There are three types of entities:
36
- #
37
- # * **System** - entities that are defined by the Dialogflow API for common
38
- # data types such as date, time, currency, and so on. A system entity is
39
- # represented by the `EntityType` type.
40
- #
41
- # * **Custom** - entities that are defined by you that represent
42
- # actionable data that is meaningful to your application. For example,
43
- # you could define a `pizza.sauce` entity for red or white pizza sauce,
44
- # a `pizza.cheese` entity for the different types of cheese on a pizza,
45
- # a `pizza.topping` entity for different toppings, and so on. A custom
46
- # entity is represented by the `EntityType` type.
47
- #
48
- # * **User** - entities that are built for an individual user such as
49
- # favorites, preferences, playlists, and so on. A user entity is
50
- # represented by the [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] type.
51
- #
52
- # For more information about entity types, see the
53
- # [Dialogflow
54
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
27
+ # Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType].
55
28
  class Service
56
29
 
57
30
  include GRPC::GenericService
@@ -61,39 +34,39 @@ module Google
61
34
  self.service_name = 'google.cloud.dialogflow.v2.EntityTypes'
62
35
 
63
36
  # Returns the list of all entity types in the specified agent.
64
- rpc :ListEntityTypes, ListEntityTypesRequest, ListEntityTypesResponse
37
+ rpc :ListEntityTypes, ::Google::Cloud::Dialogflow::V2::ListEntityTypesRequest, ::Google::Cloud::Dialogflow::V2::ListEntityTypesResponse
65
38
  # Retrieves the specified entity type.
66
- rpc :GetEntityType, GetEntityTypeRequest, EntityType
39
+ rpc :GetEntityType, ::Google::Cloud::Dialogflow::V2::GetEntityTypeRequest, ::Google::Cloud::Dialogflow::V2::EntityType
67
40
  # Creates an entity type in the specified agent.
68
- rpc :CreateEntityType, CreateEntityTypeRequest, EntityType
41
+ rpc :CreateEntityType, ::Google::Cloud::Dialogflow::V2::CreateEntityTypeRequest, ::Google::Cloud::Dialogflow::V2::EntityType
69
42
  # Updates the specified entity type.
70
- rpc :UpdateEntityType, UpdateEntityTypeRequest, EntityType
43
+ rpc :UpdateEntityType, ::Google::Cloud::Dialogflow::V2::UpdateEntityTypeRequest, ::Google::Cloud::Dialogflow::V2::EntityType
71
44
  # Deletes the specified entity type.
72
- rpc :DeleteEntityType, DeleteEntityTypeRequest, Google::Protobuf::Empty
45
+ rpc :DeleteEntityType, ::Google::Cloud::Dialogflow::V2::DeleteEntityTypeRequest, ::Google::Protobuf::Empty
73
46
  # Updates/Creates multiple entity types in the specified agent.
74
47
  #
75
48
  # Operation <response: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]>
76
- rpc :BatchUpdateEntityTypes, BatchUpdateEntityTypesRequest, Google::Longrunning::Operation
49
+ rpc :BatchUpdateEntityTypes, ::Google::Cloud::Dialogflow::V2::BatchUpdateEntityTypesRequest, ::Google::Longrunning::Operation
77
50
  # Deletes entity types in the specified agent.
78
51
  #
79
52
  # Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
80
- rpc :BatchDeleteEntityTypes, BatchDeleteEntityTypesRequest, Google::Longrunning::Operation
53
+ rpc :BatchDeleteEntityTypes, ::Google::Cloud::Dialogflow::V2::BatchDeleteEntityTypesRequest, ::Google::Longrunning::Operation
81
54
  # Creates multiple new entities in the specified entity type.
82
55
  #
83
56
  # Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
84
- rpc :BatchCreateEntities, BatchCreateEntitiesRequest, Google::Longrunning::Operation
57
+ rpc :BatchCreateEntities, ::Google::Cloud::Dialogflow::V2::BatchCreateEntitiesRequest, ::Google::Longrunning::Operation
85
58
  # Updates or creates multiple entities in the specified entity type. This
86
59
  # method does not affect entities in the entity type that aren't explicitly
87
60
  # specified in the request.
88
61
  #
89
62
  #
90
63
  # Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
91
- rpc :BatchUpdateEntities, BatchUpdateEntitiesRequest, Google::Longrunning::Operation
64
+ rpc :BatchUpdateEntities, ::Google::Cloud::Dialogflow::V2::BatchUpdateEntitiesRequest, ::Google::Longrunning::Operation
92
65
  # Deletes entities in the specified entity type.
93
66
  #
94
67
  #
95
68
  # Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
96
- rpc :BatchDeleteEntities, BatchDeleteEntitiesRequest, Google::Longrunning::Operation
69
+ rpc :BatchDeleteEntities, ::Google::Cloud::Dialogflow::V2::BatchDeleteEntitiesRequest, ::Google::Longrunning::Operation
97
70
  end
98
71
 
99
72
  Stub = Service.rpc_stub_class
@@ -32,34 +32,7 @@ module Google
32
32
  module Dialogflow
33
33
  module V2
34
34
  ##
35
- # Entities are extracted from user input and represent parameters that are
36
- # meaningful to your application. For example, a date range, a proper name
37
- # such as a geographic location or landmark, and so on. Entities represent
38
- # actionable data for your application.
39
- #
40
- # When you define an entity, you can also include synonyms that all map to
41
- # that entity. For example, "soft drink", "soda", "pop", and so on.
42
- #
43
- # There are three types of entities:
44
- #
45
- # * **System** - entities that are defined by the Dialogflow API for common
46
- # data types such as date, time, currency, and so on. A system entity is
47
- # represented by the `EntityType` type.
48
- #
49
- # * **Custom** - entities that are defined by you that represent
50
- # actionable data that is meaningful to your application. For example,
51
- # you could define a `pizza.sauce` entity for red or white pizza sauce,
52
- # a `pizza.cheese` entity for the different types of cheese on a pizza,
53
- # a `pizza.topping` entity for different toppings, and so on. A custom
54
- # entity is represented by the `EntityType` type.
55
- #
56
- # * **User** - entities that are built for an individual user such as
57
- # favorites, preferences, playlists, and so on. A user entity is
58
- # represented by the {::Google::Cloud::Dialogflow::V2::SessionEntityType SessionEntityType} type.
59
- #
60
- # For more information about entity types, see the
61
- # [Dialogflow
62
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
35
+ # Service for managing {::Google::Cloud::Dialogflow::V2::EntityType EntityTypes}.
63
36
  #
64
37
  # To load this service and instantiate a client:
65
38
  #
@@ -27,34 +27,7 @@ module Google
27
27
  ##
28
28
  # Client for the EntityTypes service.
29
29
  #
30
- # Entities are extracted from user input and represent parameters that are
31
- # meaningful to your application. For example, a date range, a proper name
32
- # such as a geographic location or landmark, and so on. Entities represent
33
- # actionable data for your application.
34
- #
35
- # When you define an entity, you can also include synonyms that all map to
36
- # that entity. For example, "soft drink", "soda", "pop", and so on.
37
- #
38
- # There are three types of entities:
39
- #
40
- # * **System** - entities that are defined by the Dialogflow API for common
41
- # data types such as date, time, currency, and so on. A system entity is
42
- # represented by the `EntityType` type.
43
- #
44
- # * **Custom** - entities that are defined by you that represent
45
- # actionable data that is meaningful to your application. For example,
46
- # you could define a `pizza.sauce` entity for red or white pizza sauce,
47
- # a `pizza.cheese` entity for the different types of cheese on a pizza,
48
- # a `pizza.topping` entity for different toppings, and so on. A custom
49
- # entity is represented by the `EntityType` type.
50
- #
51
- # * **User** - entities that are built for an individual user such as
52
- # favorites, preferences, playlists, and so on. A user entity is
53
- # represented by the {::Google::Cloud::Dialogflow::V2::SessionEntityType SessionEntityType} type.
54
- #
55
- # For more information about entity types, see the
56
- # [Dialogflow
57
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
30
+ # Service for managing {::Google::Cloud::Dialogflow::V2::EntityType EntityTypes}.
58
31
  #
59
32
  class Client
60
33
  include Paths
@@ -87,7 +60,7 @@ module Google
87
60
  parent_config = while namespace.any?
88
61
  parent_name = namespace.join "::"
89
62
  parent_const = const_get parent_name
90
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
91
64
  namespace.pop
92
65
  end
93
66
  default_config = Client::Configuration.new parent_config
@@ -95,9 +68,9 @@ module Google
95
68
  default_config.timeout = 60.0
96
69
  default_config.retry_policy = {
97
70
  initial_delay: 0.1,
98
- max_delay: 60.0,
99
- multiplier: 1.3,
100
- retry_codes: ["UNAVAILABLE"]
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [14]
101
74
  }
102
75
 
103
76
  default_config
@@ -161,7 +134,13 @@ module Google
161
134
 
162
135
  # Create credentials
163
136
  credentials = @config.credentials
164
- credentials ||= Credentials.default scope: @config.scope
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
165
144
  if credentials.is_a?(String) || credentials.is_a?(Hash)
166
145
  credentials = Credentials.new credentials, scope: @config.scope
167
146
  end
@@ -1044,14 +1023,14 @@ module Google
1044
1023
 
1045
1024
  config_attr :endpoint, "dialogflow.googleapis.com", ::String
1046
1025
  config_attr :credentials, nil do |value|
1047
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1026
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1048
1027
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1049
1028
  allowed.any? { |klass| klass === value }
1050
1029
  end
1051
1030
  config_attr :scope, nil, ::String, ::Array, nil
1052
1031
  config_attr :lib_name, nil, ::String, nil
1053
1032
  config_attr :lib_version, nil, ::String, nil
1054
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1033
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1055
1034
  config_attr :interceptors, nil, ::Array, nil
1056
1035
  config_attr :timeout, nil, ::Numeric, nil
1057
1036
  config_attr :metadata, nil, ::Hash, nil
@@ -1072,7 +1051,7 @@ module Google
1072
1051
  def rpcs
1073
1052
  @rpcs ||= begin
1074
1053
  parent_rpcs = nil
1075
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1054
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1076
1055
  Rpcs.new parent_rpcs
1077
1056
  end
1078
1057
  end
@@ -1084,7 +1063,7 @@ module Google
1084
1063
  # Each configuration object is of type `Gapic::Config::Method` and includes
1085
1064
  # the following configuration fields:
1086
1065
  #
1087
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1066
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1088
1067
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1089
1068
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1090
1069
  # include the following keys:
@@ -1148,25 +1127,25 @@ module Google
1148
1127
 
1149
1128
  # @private
1150
1129
  def initialize parent_rpcs = nil
1151
- list_entity_types_config = parent_rpcs&.list_entity_types if parent_rpcs&.respond_to? :list_entity_types
1130
+ list_entity_types_config = parent_rpcs.list_entity_types if parent_rpcs.respond_to? :list_entity_types
1152
1131
  @list_entity_types = ::Gapic::Config::Method.new list_entity_types_config
1153
- get_entity_type_config = parent_rpcs&.get_entity_type if parent_rpcs&.respond_to? :get_entity_type
1132
+ get_entity_type_config = parent_rpcs.get_entity_type if parent_rpcs.respond_to? :get_entity_type
1154
1133
  @get_entity_type = ::Gapic::Config::Method.new get_entity_type_config
1155
- create_entity_type_config = parent_rpcs&.create_entity_type if parent_rpcs&.respond_to? :create_entity_type
1134
+ create_entity_type_config = parent_rpcs.create_entity_type if parent_rpcs.respond_to? :create_entity_type
1156
1135
  @create_entity_type = ::Gapic::Config::Method.new create_entity_type_config
1157
- update_entity_type_config = parent_rpcs&.update_entity_type if parent_rpcs&.respond_to? :update_entity_type
1136
+ update_entity_type_config = parent_rpcs.update_entity_type if parent_rpcs.respond_to? :update_entity_type
1158
1137
  @update_entity_type = ::Gapic::Config::Method.new update_entity_type_config
1159
- delete_entity_type_config = parent_rpcs&.delete_entity_type if parent_rpcs&.respond_to? :delete_entity_type
1138
+ delete_entity_type_config = parent_rpcs.delete_entity_type if parent_rpcs.respond_to? :delete_entity_type
1160
1139
  @delete_entity_type = ::Gapic::Config::Method.new delete_entity_type_config
1161
- batch_update_entity_types_config = parent_rpcs&.batch_update_entity_types if parent_rpcs&.respond_to? :batch_update_entity_types
1140
+ batch_update_entity_types_config = parent_rpcs.batch_update_entity_types if parent_rpcs.respond_to? :batch_update_entity_types
1162
1141
  @batch_update_entity_types = ::Gapic::Config::Method.new batch_update_entity_types_config
1163
- batch_delete_entity_types_config = parent_rpcs&.batch_delete_entity_types if parent_rpcs&.respond_to? :batch_delete_entity_types
1142
+ batch_delete_entity_types_config = parent_rpcs.batch_delete_entity_types if parent_rpcs.respond_to? :batch_delete_entity_types
1164
1143
  @batch_delete_entity_types = ::Gapic::Config::Method.new batch_delete_entity_types_config
1165
- batch_create_entities_config = parent_rpcs&.batch_create_entities if parent_rpcs&.respond_to? :batch_create_entities
1144
+ batch_create_entities_config = parent_rpcs.batch_create_entities if parent_rpcs.respond_to? :batch_create_entities
1166
1145
  @batch_create_entities = ::Gapic::Config::Method.new batch_create_entities_config
1167
- batch_update_entities_config = parent_rpcs&.batch_update_entities if parent_rpcs&.respond_to? :batch_update_entities
1146
+ batch_update_entities_config = parent_rpcs.batch_update_entities if parent_rpcs.respond_to? :batch_update_entities
1168
1147
  @batch_update_entities = ::Gapic::Config::Method.new batch_update_entities_config
1169
- batch_delete_entities_config = parent_rpcs&.batch_delete_entities if parent_rpcs&.respond_to? :batch_delete_entities
1148
+ batch_delete_entities_config = parent_rpcs.batch_delete_entities if parent_rpcs.respond_to? :batch_delete_entities
1170
1149
  @batch_delete_entities = ::Gapic::Config::Method.new batch_delete_entities_config
1171
1150
 
1172
1151
  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 below allows API services to override the 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 collection.
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&.respond_to?(:rpcs)
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 milliseconds
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&.list_operations if parent_rpcs&.respond_to? :list_operations
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&.get_operation if parent_rpcs&.respond_to? :get_operation
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&.delete_operation if parent_rpcs&.respond_to? :delete_operation
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&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
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