google-cloud-dialogflow-v2 0.6.2 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +70 -2
  4. data/lib/google/cloud/dialogflow/v2.rb +13 -2
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +25 -40
  6. data/lib/google/cloud/dialogflow/v2/agents.rb +1 -28
  7. data/lib/google/cloud/dialogflow/v2/agents/client.rb +41 -100
  8. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
  9. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
  10. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +48 -0
  12. data/lib/google/cloud/dialogflow/v2/answer_records.rb +49 -0
  13. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +478 -0
  14. data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
  15. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
  16. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
  17. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +8 -25
  18. data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
  19. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +24 -63
  20. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +74 -2
  21. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +246 -0
  29. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
  30. data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
  31. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
  33. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
  34. data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
  35. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
  36. data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
  40. data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
  41. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +12 -39
  42. data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
  43. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +28 -91
  44. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
  45. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
  46. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
  47. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +24 -3
  48. data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
  49. data/lib/google/cloud/dialogflow/v2/environments/client.rb +430 -14
  50. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +104 -5
  51. data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
  54. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +460 -0
  55. data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
  56. data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
  57. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
  58. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
  59. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
  60. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +9 -40
  61. data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
  62. data/lib/google/cloud/dialogflow/v2/intents/client.rb +34 -81
  63. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
  64. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +97 -13
  65. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
  66. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
  67. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
  68. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
  69. data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
  70. data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
  71. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +172 -0
  72. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
  73. data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
  74. data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
  75. data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
  76. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +334 -0
  77. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +7 -23
  78. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
  79. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +23 -53
  80. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +74 -2
  81. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  82. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +15 -7
  83. data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
  84. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +51 -15
  85. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +113 -3
  86. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  87. data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
  88. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
  89. data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
  90. data/lib/google/cloud/dialogflow/v2/versions/client.rb +709 -0
  91. data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
  92. data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
  93. data/proto_docs/google/api/field_behavior.rb +6 -0
  94. data/proto_docs/google/api/resource.rb +50 -14
  95. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +9 -1
  96. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +252 -0
  97. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
  98. data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
  99. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
  100. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
  101. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +522 -0
  102. data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
  103. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
  104. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +187 -5
  105. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
  106. data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
  107. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +29 -4
  108. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
  109. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +503 -0
  110. data/proto_docs/google/cloud/dialogflow/v2/session.rb +52 -7
  111. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
  112. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  113. data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
  114. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
  115. data/proto_docs/google/longrunning/operations.rb +17 -3
  116. data/proto_docs/google/protobuf/any.rb +5 -2
  117. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  118. data/proto_docs/google/type/latlng.rb +2 -2
  119. metadata +73 -9
@@ -31,23 +31,7 @@ module Google
31
31
  module Dialogflow
32
32
  module V2
33
33
  ##
34
- # Entities are extracted from user input and represent parameters that are
35
- # meaningful to your application. For example, a date range, a proper name
36
- # such as a geographic location or landmark, and so on. Entities represent
37
- # actionable data for your application.
38
- #
39
- # Session entity types are referred to as **User** entity types and are
40
- # entities that are built for an individual user such as
41
- # favorites, preferences, playlists, and so on. You can redefine a session
42
- # entity type at the session level.
43
- #
44
- # Session entity methods do not work with Google Assistant integration.
45
- # Contact Dialogflow support if you need to use session entities
46
- # with Google Assistant integration.
47
- #
48
- # For more information about entity types, see the
49
- # [Dialogflow
50
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
34
+ # Service for managing {::Google::Cloud::Dialogflow::V2::SessionEntityType SessionEntityTypes}.
51
35
  #
52
36
  # To load this service and instantiate a client:
53
37
  #
@@ -27,23 +27,7 @@ module Google
27
27
  ##
28
28
  # Client for the SessionEntityTypes 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
- # Session entity types are referred to as **User** entity types and are
36
- # entities that are built for an individual user such as
37
- # favorites, preferences, playlists, and so on. You can redefine a session
38
- # entity type at the session level.
39
- #
40
- # Session entity methods do not work with Google Assistant integration.
41
- # Contact Dialogflow support if you need to use session entities
42
- # with Google Assistant integration.
43
- #
44
- # For more information about entity types, see the
45
- # [Dialogflow
46
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
30
+ # Service for managing {::Google::Cloud::Dialogflow::V2::SessionEntityType SessionEntityTypes}.
47
31
  #
48
32
  class Client
49
33
  include Paths
@@ -76,37 +60,17 @@ module Google
76
60
  parent_config = while namespace.any?
77
61
  parent_name = namespace.join "::"
78
62
  parent_const = const_get parent_name
79
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
80
64
  namespace.pop
81
65
  end
82
66
  default_config = Client::Configuration.new parent_config
83
67
 
84
- default_config.rpcs.list_session_entity_types.timeout = 60.0
85
- default_config.rpcs.list_session_entity_types.retry_policy = {
86
- initial_delay: 0.1,
87
- max_delay: 60.0,
88
- multiplier: 1.3,
89
- retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
90
- }
91
-
92
- default_config.rpcs.get_session_entity_type.timeout = 60.0
93
- default_config.rpcs.get_session_entity_type.retry_policy = {
94
- initial_delay: 0.1,
95
- max_delay: 60.0,
96
- multiplier: 1.3,
97
- retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
98
- }
99
-
100
- default_config.rpcs.create_session_entity_type.timeout = 60.0
101
-
102
- default_config.rpcs.update_session_entity_type.timeout = 60.0
103
-
104
- default_config.rpcs.delete_session_entity_type.timeout = 60.0
105
- default_config.rpcs.delete_session_entity_type.retry_policy = {
68
+ default_config.timeout = 60.0
69
+ default_config.retry_policy = {
106
70
  initial_delay: 0.1,
107
- max_delay: 60.0,
108
- multiplier: 1.3,
109
- retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [14]
110
74
  }
111
75
 
112
76
  default_config
@@ -170,7 +134,13 @@ module Google
170
134
 
171
135
  # Create credentials
172
136
  credentials = @config.credentials
173
- 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
174
144
  if credentials.is_a?(String) || credentials.is_a?(Hash)
175
145
  credentials = Credentials.new credentials, scope: @config.scope
176
146
  end
@@ -658,14 +628,14 @@ module Google
658
628
 
659
629
  config_attr :endpoint, "dialogflow.googleapis.com", ::String
660
630
  config_attr :credentials, nil do |value|
661
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
631
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
662
632
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
663
633
  allowed.any? { |klass| klass === value }
664
634
  end
665
635
  config_attr :scope, nil, ::String, ::Array, nil
666
636
  config_attr :lib_name, nil, ::String, nil
667
637
  config_attr :lib_version, nil, ::String, nil
668
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
638
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
669
639
  config_attr :interceptors, nil, ::Array, nil
670
640
  config_attr :timeout, nil, ::Numeric, nil
671
641
  config_attr :metadata, nil, ::Hash, nil
@@ -686,7 +656,7 @@ module Google
686
656
  def rpcs
687
657
  @rpcs ||= begin
688
658
  parent_rpcs = nil
689
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
659
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
690
660
  Rpcs.new parent_rpcs
691
661
  end
692
662
  end
@@ -698,7 +668,7 @@ module Google
698
668
  # Each configuration object is of type `Gapic::Config::Method` and includes
699
669
  # the following configuration fields:
700
670
  #
701
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
671
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
702
672
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
703
673
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
704
674
  # include the following keys:
@@ -737,15 +707,15 @@ module Google
737
707
 
738
708
  # @private
739
709
  def initialize parent_rpcs = nil
740
- list_session_entity_types_config = parent_rpcs&.list_session_entity_types if parent_rpcs&.respond_to? :list_session_entity_types
710
+ list_session_entity_types_config = parent_rpcs.list_session_entity_types if parent_rpcs.respond_to? :list_session_entity_types
741
711
  @list_session_entity_types = ::Gapic::Config::Method.new list_session_entity_types_config
742
- get_session_entity_type_config = parent_rpcs&.get_session_entity_type if parent_rpcs&.respond_to? :get_session_entity_type
712
+ get_session_entity_type_config = parent_rpcs.get_session_entity_type if parent_rpcs.respond_to? :get_session_entity_type
743
713
  @get_session_entity_type = ::Gapic::Config::Method.new get_session_entity_type_config
744
- create_session_entity_type_config = parent_rpcs&.create_session_entity_type if parent_rpcs&.respond_to? :create_session_entity_type
714
+ create_session_entity_type_config = parent_rpcs.create_session_entity_type if parent_rpcs.respond_to? :create_session_entity_type
745
715
  @create_session_entity_type = ::Gapic::Config::Method.new create_session_entity_type_config
746
- update_session_entity_type_config = parent_rpcs&.update_session_entity_type if parent_rpcs&.respond_to? :update_session_entity_type
716
+ update_session_entity_type_config = parent_rpcs.update_session_entity_type if parent_rpcs.respond_to? :update_session_entity_type
747
717
  @update_session_entity_type = ::Gapic::Config::Method.new update_session_entity_type_config
748
- delete_session_entity_type_config = parent_rpcs&.delete_session_entity_type if parent_rpcs&.respond_to? :delete_session_entity_type
718
+ delete_session_entity_type_config = parent_rpcs.delete_session_entity_type if parent_rpcs.respond_to? :delete_session_entity_type
749
719
  @delete_session_entity_type = ::Gapic::Config::Method.new delete_session_entity_type_config
750
720
 
751
721
  yield self if block_given?
@@ -45,10 +45,30 @@ module Google
45
45
  # @param user [String]
46
46
  # @param session [String]
47
47
  #
48
+ # @overload session_path(project:, location:, session:)
49
+ # The resource will be in the following format:
50
+ #
51
+ # `projects/{project}/locations/{location}/agent/sessions/{session}`
52
+ #
53
+ # @param project [String]
54
+ # @param location [String]
55
+ # @param session [String]
56
+ #
57
+ # @overload session_path(project:, location:, environment:, user:, session:)
58
+ # The resource will be in the following format:
59
+ #
60
+ # `projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}`
61
+ #
62
+ # @param project [String]
63
+ # @param location [String]
64
+ # @param environment [String]
65
+ # @param user [String]
66
+ # @param session [String]
67
+ #
48
68
  # @return [::String]
49
69
  def session_path **args
50
70
  resources = {
51
- "project:session" => (proc do |project:, session:|
71
+ "project:session" => (proc do |project:, session:|
52
72
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
53
73
 
54
74
  "projects/#{project}/agent/sessions/#{session}"
@@ -59,6 +79,20 @@ module Google
59
79
  raise ::ArgumentError, "user cannot contain /" if user.to_s.include? "/"
60
80
 
61
81
  "projects/#{project}/agent/environments/#{environment}/users/#{user}/sessions/#{session}"
82
+ end),
83
+ "location:project:session" => (proc do |project:, location:, session:|
84
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
85
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
86
+
87
+ "projects/#{project}/locations/#{location}/agent/sessions/#{session}"
88
+ end),
89
+ "environment:location:project:session:user" => (proc do |project:, location:, environment:, user:, session:|
90
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
91
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
92
+ raise ::ArgumentError, "environment cannot contain /" if environment.to_s.include? "/"
93
+ raise ::ArgumentError, "user cannot contain /" if user.to_s.include? "/"
94
+
95
+ "projects/#{project}/locations/#{location}/agent/environments/#{environment}/users/#{user}/sessions/#{session}"
62
96
  end)
63
97
  }
64
98
 
@@ -90,10 +124,32 @@ module Google
90
124
  # @param session [String]
91
125
  # @param entity_type [String]
92
126
  #
127
+ # @overload session_entity_type_path(project:, location:, session:, entity_type:)
128
+ # The resource will be in the following format:
129
+ #
130
+ # `projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}`
131
+ #
132
+ # @param project [String]
133
+ # @param location [String]
134
+ # @param session [String]
135
+ # @param entity_type [String]
136
+ #
137
+ # @overload session_entity_type_path(project:, location:, environment:, user:, session:, entity_type:)
138
+ # The resource will be in the following format:
139
+ #
140
+ # `projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}`
141
+ #
142
+ # @param project [String]
143
+ # @param location [String]
144
+ # @param environment [String]
145
+ # @param user [String]
146
+ # @param session [String]
147
+ # @param entity_type [String]
148
+ #
93
149
  # @return [::String]
94
150
  def session_entity_type_path **args
95
151
  resources = {
96
- "entity_type:project:session" => (proc do |project:, session:, entity_type:|
152
+ "entity_type:project:session" => (proc do |project:, session:, entity_type:|
97
153
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
98
154
  raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"
99
155
 
@@ -106,6 +162,22 @@ module Google
106
162
  raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"
107
163
 
108
164
  "projects/#{project}/agent/environments/#{environment}/users/#{user}/sessions/#{session}/entityTypes/#{entity_type}"
165
+ end),
166
+ "entity_type:location:project:session" => (proc do |project:, location:, session:, entity_type:|
167
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
168
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
169
+ raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"
170
+
171
+ "projects/#{project}/locations/#{location}/agent/sessions/#{session}/entityTypes/#{entity_type}"
172
+ end),
173
+ "entity_type:environment:location:project:session:user" => (proc do |project:, location:, environment:, user:, session:, entity_type:|
174
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
175
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
176
+ raise ::ArgumentError, "environment cannot contain /" if environment.to_s.include? "/"
177
+ raise ::ArgumentError, "user cannot contain /" if user.to_s.include? "/"
178
+ raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"
179
+
180
+ "projects/#{project}/locations/#{location}/agent/environments/#{environment}/users/#{user}/sessions/#{session}/entityTypes/#{entity_type}"
109
181
  end)
110
182
  }
111
183
 
@@ -41,6 +41,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
41
41
  repeated :session_entity_types, :message, 5, "google.cloud.dialogflow.v2.SessionEntityType"
42
42
  optional :payload, :message, 6, "google.protobuf.Struct"
43
43
  optional :sentiment_analysis_request_config, :message, 10, "google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig"
44
+ map :webhook_headers, :string, :string, 14
44
45
  end
45
46
  add_message "google.cloud.dialogflow.v2.QueryInput" do
46
47
  oneof :input do
@@ -24,13 +24,13 @@ module Google
24
24
  module Dialogflow
25
25
  module V2
26
26
  module Sessions
27
- # A session represents an interaction with a user. You retrieve user input
28
- # and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or
29
- # [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine
30
- # user intent and respond.
27
+ # A service used for session interactions.
28
+ #
29
+ # For more information, see the [API interactions
30
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
31
31
  class Service
32
32
 
33
- include GRPC::GenericService
33
+ include ::GRPC::GenericService
34
34
 
35
35
  self.marshal_class_method = :encode
36
36
  self.unmarshal_class_method = :decode
@@ -40,11 +40,19 @@ module Google
40
40
  # as a result. This method is not idempotent, because it may cause contexts
41
41
  # and session entity types to be updated, which in turn might affect
42
42
  # results of future queries.
43
- rpc :DetectIntent, DetectIntentRequest, DetectIntentResponse
43
+ #
44
+ # Note: Always use agent versions for production traffic.
45
+ # See [Versions and
46
+ # environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
47
+ rpc :DetectIntent, ::Google::Cloud::Dialogflow::V2::DetectIntentRequest, ::Google::Cloud::Dialogflow::V2::DetectIntentResponse
44
48
  # Processes a natural language query in audio format in a streaming fashion
45
49
  # and returns structured, actionable data as a result. This method is only
46
50
  # available via the gRPC API (not REST).
47
- rpc :StreamingDetectIntent, stream(StreamingDetectIntentRequest), stream(StreamingDetectIntentResponse)
51
+ #
52
+ # Note: Always use agent versions for production traffic.
53
+ # See [Versions and
54
+ # environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
55
+ rpc :StreamingDetectIntent, stream(::Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest), stream(::Google::Cloud::Dialogflow::V2::StreamingDetectIntentResponse)
48
56
  end
49
57
 
50
58
  Stub = Service.rpc_stub_class
@@ -31,10 +31,10 @@ module Google
31
31
  module Dialogflow
32
32
  module V2
33
33
  ##
34
- # A session represents an interaction with a user. You retrieve user input
35
- # and pass it to the {::Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
36
- # {::Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method to determine
37
- # user intent and respond.
34
+ # A service used for session interactions.
35
+ #
36
+ # For more information, see the [API interactions
37
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
38
38
  #
39
39
  # To load this service and instantiate a client:
40
40
  #
@@ -27,10 +27,10 @@ module Google
27
27
  ##
28
28
  # Client for the Sessions service.
29
29
  #
30
- # A session represents an interaction with a user. You retrieve user input
31
- # and pass it to the {::Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
32
- # {::Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method to determine
33
- # user intent and respond.
30
+ # A service used for session interactions.
31
+ #
32
+ # For more information, see the [API interactions
33
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
34
34
  #
35
35
  class Client
36
36
  include Paths
@@ -63,12 +63,26 @@ module Google
63
63
  parent_config = while namespace.any?
64
64
  parent_name = namespace.join "::"
65
65
  parent_const = const_get parent_name
66
- break parent_const.configure if parent_const&.respond_to? :configure
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
67
  namespace.pop
68
68
  end
69
69
  default_config = Client::Configuration.new parent_config
70
70
 
71
+ default_config.timeout = 60.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 0.1,
74
+ max_delay: 60.0,
75
+ multiplier: 1.3,
76
+ retry_codes: [14]
77
+ }
78
+
71
79
  default_config.rpcs.detect_intent.timeout = 220.0
80
+ default_config.rpcs.detect_intent.retry_policy = {
81
+ initial_delay: 0.1,
82
+ max_delay: 60.0,
83
+ multiplier: 1.3,
84
+ retry_codes: [14]
85
+ }
72
86
 
73
87
  default_config.rpcs.streaming_detect_intent.timeout = 220.0
74
88
 
@@ -133,7 +147,13 @@ module Google
133
147
 
134
148
  # Create credentials
135
149
  credentials = @config.credentials
136
- credentials ||= Credentials.default scope: @config.scope
150
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
151
+ # but only if the default endpoint does not have a region prefix.
152
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
153
+ @config.endpoint == Client.configure.endpoint &&
154
+ !@config.endpoint.split(".").first.include?("-")
155
+ credentials ||= Credentials.default scope: @config.scope,
156
+ enable_self_signed_jwt: enable_self_signed_jwt
137
157
  if credentials.is_a?(String) || credentials.is_a?(Hash)
138
158
  credentials = Credentials.new credentials, scope: @config.scope
139
159
  end
@@ -157,6 +177,10 @@ module Google
157
177
  # and session entity types to be updated, which in turn might affect
158
178
  # results of future queries.
159
179
  #
180
+ # Note: Always use agent versions for production traffic.
181
+ # See [Versions and
182
+ # environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
183
+ #
160
184
  # @overload detect_intent(request, options = nil)
161
185
  # Pass arguments to `detect_intent` via a request object, either of type
162
186
  # {::Google::Cloud::Dialogflow::V2::DetectIntentRequest} or an equivalent Hash.
@@ -177,11 +201,19 @@ module Google
177
201
  # `projects/<Project ID>/agent/sessions/<Session ID>`, or
178
202
  # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
179
203
  # ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume
180
- # default 'draft' environment. If `User ID` is not specified, we are using
181
- # "-". It's up to the API caller to choose an appropriate `Session ID` and
182
- # `User Id`. They can be a random number or some type of user and session
204
+ # default 'draft' environment (`Environment ID` might be referred to as
205
+ # environment name at some places). If `User ID` is not specified, we are
206
+ # using "-". It's up to the API caller to choose an appropriate `Session ID`
207
+ # and `User Id`. They can be a random number or some type of user and session
183
208
  # identifiers (preferably hashed). The length of the `Session ID` and
184
209
  # `User ID` must not exceed 36 characters.
210
+ #
211
+ # For more information, see the [API interactions
212
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
213
+ #
214
+ # Note: Always use agent versions for production traffic.
215
+ # See [Versions and
216
+ # environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
185
217
  # @param query_params [::Google::Cloud::Dialogflow::V2::QueryParameters, ::Hash]
186
218
  # The parameters of this query.
187
219
  # @param query_input [::Google::Cloud::Dialogflow::V2::QueryInput, ::Hash]
@@ -259,6 +291,10 @@ module Google
259
291
  # and returns structured, actionable data as a result. This method is only
260
292
  # available via the gRPC API (not REST).
261
293
  #
294
+ # Note: Always use agent versions for production traffic.
295
+ # See [Versions and
296
+ # environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
297
+ #
262
298
  # @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest, ::Hash>]
263
299
  # An enumerable of {::Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest} instances.
264
300
  # @param options [::Gapic::CallOptions, ::Hash]
@@ -393,14 +429,14 @@ module Google
393
429
 
394
430
  config_attr :endpoint, "dialogflow.googleapis.com", ::String
395
431
  config_attr :credentials, nil do |value|
396
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
432
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
397
433
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
398
434
  allowed.any? { |klass| klass === value }
399
435
  end
400
436
  config_attr :scope, nil, ::String, ::Array, nil
401
437
  config_attr :lib_name, nil, ::String, nil
402
438
  config_attr :lib_version, nil, ::String, nil
403
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
439
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
404
440
  config_attr :interceptors, nil, ::Array, nil
405
441
  config_attr :timeout, nil, ::Numeric, nil
406
442
  config_attr :metadata, nil, ::Hash, nil
@@ -421,7 +457,7 @@ module Google
421
457
  def rpcs
422
458
  @rpcs ||= begin
423
459
  parent_rpcs = nil
424
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
460
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
425
461
  Rpcs.new parent_rpcs
426
462
  end
427
463
  end
@@ -433,7 +469,7 @@ module Google
433
469
  # Each configuration object is of type `Gapic::Config::Method` and includes
434
470
  # the following configuration fields:
435
471
  #
436
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
472
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
437
473
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
438
474
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
439
475
  # include the following keys:
@@ -457,9 +493,9 @@ module Google
457
493
 
458
494
  # @private
459
495
  def initialize parent_rpcs = nil
460
- detect_intent_config = parent_rpcs&.detect_intent if parent_rpcs&.respond_to? :detect_intent
496
+ detect_intent_config = parent_rpcs.detect_intent if parent_rpcs.respond_to? :detect_intent
461
497
  @detect_intent = ::Gapic::Config::Method.new detect_intent_config
462
- streaming_detect_intent_config = parent_rpcs&.streaming_detect_intent if parent_rpcs&.respond_to? :streaming_detect_intent
498
+ streaming_detect_intent_config = parent_rpcs.streaming_detect_intent if parent_rpcs.respond_to? :streaming_detect_intent
463
499
  @streaming_detect_intent = ::Gapic::Config::Method.new streaming_detect_intent_config
464
500
 
465
501
  yield self if block_given?