google-cloud-dialogflow-v2 0.7.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +8 -8
  3. data/README.md +1 -1
  4. data/lib/google/cloud/dialogflow/v2.rb +2 -0
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +16 -5
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +18 -10
  7. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +4 -4
  8. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
  9. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +1 -2
  10. data/lib/google/cloud/dialogflow/v2/answer_records.rb +1 -2
  11. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +3 -7
  12. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +2 -5
  13. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +72 -0
  14. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +2 -5
  15. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +44 -3
  16. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +2 -5
  17. data/lib/google/cloud/dialogflow/v2/documents/client.rb +2 -5
  18. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +4 -4
  19. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +28 -7
  20. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +30 -12
  21. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +4 -4
  22. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
  23. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
  24. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +21 -0
  25. data/lib/google/cloud/dialogflow/v2/environments/client.rb +413 -6
  26. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +145 -5
  27. data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
  28. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
  29. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
  30. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +457 -0
  31. data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
  32. data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
  33. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +20 -2
  34. data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
  35. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +4 -4
  36. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +96 -12
  37. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +2 -5
  38. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +9 -0
  39. data/lib/google/cloud/dialogflow/v2/participants/client.rb +3 -9
  40. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +76 -0
  41. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +2 -5
  42. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +72 -0
  43. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  44. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +3 -9
  45. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +110 -0
  46. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  47. data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
  48. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
  49. data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
  50. data/lib/google/cloud/dialogflow/v2/versions/client.rb +706 -0
  51. data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
  52. data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
  53. data/proto_docs/google/api/field_behavior.rb +7 -1
  54. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +9 -16
  55. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +14 -2
  56. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +170 -5
  57. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
  58. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +9 -1
  59. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +22 -0
  60. data/proto_docs/google/cloud/dialogflow/v2/session.rb +4 -0
  61. data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
  62. metadata +27 -7
@@ -27,15 +27,155 @@ module Google
27
27
  ##
28
28
  # Create a fully-qualified Agent resource string.
29
29
  #
30
- # The resource will be in the following format:
30
+ # @overload agent_path(project:)
31
+ # The resource will be in the following format:
31
32
  #
32
- # `projects/{project}/agent`
33
+ # `projects/{project}/agent`
33
34
  #
34
- # @param project [String]
35
+ # @param project [String]
36
+ #
37
+ # @overload agent_path(project:, location:)
38
+ # The resource will be in the following format:
39
+ #
40
+ # `projects/{project}/locations/{location}/agent`
41
+ #
42
+ # @param project [String]
43
+ # @param location [String]
44
+ #
45
+ # @return [::String]
46
+ def agent_path **args
47
+ resources = {
48
+ "project" => (proc do |project:|
49
+ "projects/#{project}/agent"
50
+ end),
51
+ "location:project" => (proc do |project:, location:|
52
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
53
+
54
+ "projects/#{project}/locations/#{location}/agent"
55
+ end)
56
+ }
57
+
58
+ resource = resources[args.keys.sort.join(":")]
59
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
60
+ resource.call(**args)
61
+ end
62
+
63
+ ##
64
+ # Create a fully-qualified Environment resource string.
65
+ #
66
+ # @overload environment_path(project:, environment:)
67
+ # The resource will be in the following format:
68
+ #
69
+ # `projects/{project}/agent/environments/{environment}`
70
+ #
71
+ # @param project [String]
72
+ # @param environment [String]
73
+ #
74
+ # @overload environment_path(project:, location:, environment:)
75
+ # The resource will be in the following format:
76
+ #
77
+ # `projects/{project}/locations/{location}/agent/environments/{environment}`
78
+ #
79
+ # @param project [String]
80
+ # @param location [String]
81
+ # @param environment [String]
82
+ #
83
+ # @return [::String]
84
+ def environment_path **args
85
+ resources = {
86
+ "environment:project" => (proc do |project:, environment:|
87
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
88
+
89
+ "projects/#{project}/agent/environments/#{environment}"
90
+ end),
91
+ "environment:location:project" => (proc do |project:, location:, environment:|
92
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
93
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
94
+
95
+ "projects/#{project}/locations/#{location}/agent/environments/#{environment}"
96
+ end)
97
+ }
98
+
99
+ resource = resources[args.keys.sort.join(":")]
100
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
101
+ resource.call(**args)
102
+ end
103
+
104
+ ##
105
+ # Create a fully-qualified Fulfillment resource string.
106
+ #
107
+ # @overload fulfillment_path(project:)
108
+ # The resource will be in the following format:
109
+ #
110
+ # `projects/{project}/agent/fulfillment`
111
+ #
112
+ # @param project [String]
113
+ #
114
+ # @overload fulfillment_path(project:, location:)
115
+ # The resource will be in the following format:
116
+ #
117
+ # `projects/{project}/locations/{location}/agent/fulfillment`
118
+ #
119
+ # @param project [String]
120
+ # @param location [String]
35
121
  #
36
122
  # @return [::String]
37
- def agent_path project:
38
- "projects/#{project}/agent"
123
+ def fulfillment_path **args
124
+ resources = {
125
+ "project" => (proc do |project:|
126
+ "projects/#{project}/agent/fulfillment"
127
+ end),
128
+ "location:project" => (proc do |project:, location:|
129
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
130
+
131
+ "projects/#{project}/locations/#{location}/agent/fulfillment"
132
+ end)
133
+ }
134
+
135
+ resource = resources[args.keys.sort.join(":")]
136
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
137
+ resource.call(**args)
138
+ end
139
+
140
+ ##
141
+ # Create a fully-qualified Version resource string.
142
+ #
143
+ # @overload version_path(project:, version:)
144
+ # The resource will be in the following format:
145
+ #
146
+ # `projects/{project}/agent/versions/{version}`
147
+ #
148
+ # @param project [String]
149
+ # @param version [String]
150
+ #
151
+ # @overload version_path(project:, location:, version:)
152
+ # The resource will be in the following format:
153
+ #
154
+ # `projects/{project}/locations/{location}/agent/versions/{version}`
155
+ #
156
+ # @param project [String]
157
+ # @param location [String]
158
+ # @param version [String]
159
+ #
160
+ # @return [::String]
161
+ def version_path **args
162
+ resources = {
163
+ "project:version" => (proc do |project:, version:|
164
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
165
+
166
+ "projects/#{project}/agent/versions/#{version}"
167
+ end),
168
+ "location:project:version" => (proc do |project:, location:, version:|
169
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
170
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
171
+
172
+ "projects/#{project}/locations/#{location}/agent/versions/#{version}"
173
+ end)
174
+ }
175
+
176
+ resource = resources[args.keys.sort.join(":")]
177
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
178
+ resource.call(**args)
39
179
  end
40
180
 
41
181
  extend self
@@ -0,0 +1,59 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dialogflow/v2/fulfillment.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/protobuf/field_mask_pb'
11
+ Google::Protobuf::DescriptorPool.generated_pool.build do
12
+ add_file("google/cloud/dialogflow/v2/fulfillment.proto", :syntax => :proto3) do
13
+ add_message "google.cloud.dialogflow.v2.Fulfillment" do
14
+ optional :name, :string, 1
15
+ optional :display_name, :string, 2
16
+ optional :enabled, :bool, 4
17
+ repeated :features, :message, 5, "google.cloud.dialogflow.v2.Fulfillment.Feature"
18
+ oneof :fulfillment do
19
+ optional :generic_web_service, :message, 3, "google.cloud.dialogflow.v2.Fulfillment.GenericWebService"
20
+ end
21
+ end
22
+ add_message "google.cloud.dialogflow.v2.Fulfillment.GenericWebService" do
23
+ optional :uri, :string, 1
24
+ optional :username, :string, 2
25
+ optional :password, :string, 3
26
+ map :request_headers, :string, :string, 4
27
+ optional :is_cloud_function, :bool, 5
28
+ end
29
+ add_message "google.cloud.dialogflow.v2.Fulfillment.Feature" do
30
+ optional :type, :enum, 1, "google.cloud.dialogflow.v2.Fulfillment.Feature.Type"
31
+ end
32
+ add_enum "google.cloud.dialogflow.v2.Fulfillment.Feature.Type" do
33
+ value :TYPE_UNSPECIFIED, 0
34
+ value :SMALLTALK, 1
35
+ end
36
+ add_message "google.cloud.dialogflow.v2.GetFulfillmentRequest" do
37
+ optional :name, :string, 1
38
+ end
39
+ add_message "google.cloud.dialogflow.v2.UpdateFulfillmentRequest" do
40
+ optional :fulfillment, :message, 1, "google.cloud.dialogflow.v2.Fulfillment"
41
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
42
+ end
43
+ end
44
+ end
45
+
46
+ module Google
47
+ module Cloud
48
+ module Dialogflow
49
+ module V2
50
+ Fulfillment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Fulfillment").msgclass
51
+ Fulfillment::GenericWebService = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Fulfillment.GenericWebService").msgclass
52
+ Fulfillment::Feature = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Fulfillment.Feature").msgclass
53
+ Fulfillment::Feature::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Fulfillment.Feature.Type").enummodule
54
+ GetFulfillmentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetFulfillmentRequest").msgclass
55
+ UpdateFulfillmentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateFulfillmentRequest").msgclass
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,47 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dialogflow/v2/fulfillment.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/fulfillment_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module Fulfillments
27
+ # Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment].
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.Fulfillments'
35
+
36
+ # Retrieves the fulfillment.
37
+ rpc :GetFulfillment, ::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest, ::Google::Cloud::Dialogflow::V2::Fulfillment
38
+ # Updates the fulfillment.
39
+ rpc :UpdateFulfillment, ::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest, ::Google::Cloud::Dialogflow::V2::Fulfillment
40
+ end
41
+
42
+ Stub = Service.rpc_stub_class
43
+ end
44
+ end
45
+ end
46
+ end
47
+ 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/fulfillments/credentials"
26
+ require "google/cloud/dialogflow/v2/fulfillments/paths"
27
+ require "google/cloud/dialogflow/v2/fulfillments/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Dialogflow
32
+ module V2
33
+ ##
34
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Fulfillment Fulfillments}.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/dialogflow/v2/fulfillments"
39
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Client.new
40
+ #
41
+ module Fulfillments
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "fulfillments", "helpers.rb"
49
+ require "google/cloud/dialogflow/v2/fulfillments/helpers" if ::File.file? helper_path
@@ -0,0 +1,457 @@
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/fulfillment_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module Fulfillments
27
+ ##
28
+ # Client for the Fulfillments service.
29
+ #
30
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Fulfillment Fulfillments}.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :fulfillments_stub
37
+
38
+ ##
39
+ # Configure the Fulfillments Client class.
40
+ #
41
+ # See {::Google::Cloud::Dialogflow::V2::Fulfillments::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all Fulfillments clients:
47
+ #
48
+ # ::Google::Cloud::Dialogflow::V2::Fulfillments::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, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
71
+ }
72
+
73
+ default_config
74
+ end
75
+ yield @configure if block_given?
76
+ @configure
77
+ end
78
+
79
+ ##
80
+ # Configure the Fulfillments Client instance.
81
+ #
82
+ # The configuration is set to the derived mode, meaning that values can be changed,
83
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
84
+ # should be made on {Client.configure}.
85
+ #
86
+ # See {::Google::Cloud::Dialogflow::V2::Fulfillments::Client::Configuration}
87
+ # for a description of the configuration fields.
88
+ #
89
+ # @yield [config] Configure the Client client.
90
+ # @yieldparam config [Client::Configuration]
91
+ #
92
+ # @return [Client::Configuration]
93
+ #
94
+ def configure
95
+ yield @config if block_given?
96
+ @config
97
+ end
98
+
99
+ ##
100
+ # Create a new Fulfillments client object.
101
+ #
102
+ # ## Examples
103
+ #
104
+ # To create a new Fulfillments client with the default
105
+ # configuration:
106
+ #
107
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Client.new
108
+ #
109
+ # To create a new Fulfillments client with a custom
110
+ # configuration:
111
+ #
112
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Client.new do |config|
113
+ # config.timeout = 10.0
114
+ # end
115
+ #
116
+ # @yield [config] Configure the Fulfillments client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ def initialize
120
+ # These require statements are intentionally placed here to initialize
121
+ # the gRPC module only when it's required.
122
+ # See https://github.com/googleapis/toolkit/issues/446
123
+ require "gapic/grpc"
124
+ require "google/cloud/dialogflow/v2/fulfillment_services_pb"
125
+
126
+ # Create the configuration object
127
+ @config = Configuration.new Client.configure
128
+
129
+ # Yield the configuration if needed
130
+ yield @config if block_given?
131
+
132
+ # Create credentials
133
+ credentials = @config.credentials
134
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
137
+ @config.endpoint == Client.configure.endpoint &&
138
+ !@config.endpoint.split(".").first.include?("-")
139
+ credentials ||= Credentials.default scope: @config.scope,
140
+ enable_self_signed_jwt: enable_self_signed_jwt
141
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
142
+ credentials = Credentials.new credentials, scope: @config.scope
143
+ end
144
+ @quota_project_id = @config.quota_project
145
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
+
147
+ @fulfillments_stub = ::Gapic::ServiceStub.new(
148
+ ::Google::Cloud::Dialogflow::V2::Fulfillments::Stub,
149
+ credentials: credentials,
150
+ endpoint: @config.endpoint,
151
+ channel_args: @config.channel_args,
152
+ interceptors: @config.interceptors
153
+ )
154
+ end
155
+
156
+ # Service calls
157
+
158
+ ##
159
+ # Retrieves the fulfillment.
160
+ #
161
+ # @overload get_fulfillment(request, options = nil)
162
+ # Pass arguments to `get_fulfillment` via a request object, either of type
163
+ # {::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest} or an equivalent Hash.
164
+ #
165
+ # @param request [::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest, ::Hash]
166
+ # A request object representing the call parameters. Required. To specify no
167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
168
+ # @param options [::Gapic::CallOptions, ::Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
170
+ #
171
+ # @overload get_fulfillment(name: nil)
172
+ # Pass arguments to `get_fulfillment` via keyword arguments. Note that at
173
+ # least one keyword argument is required. To specify no parameters, or to keep all
174
+ # the default parameter values, pass an empty Hash as a request object (see above).
175
+ #
176
+ # @param name [::String]
177
+ # Required. The name of the fulfillment.
178
+ # Format: `projects/<Project ID>/agent/fulfillment`.
179
+ #
180
+ # @yield [response, operation] Access the result along with the RPC operation
181
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Fulfillment]
182
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
183
+ #
184
+ # @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
185
+ #
186
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
187
+ #
188
+ def get_fulfillment request, options = nil
189
+ raise ::ArgumentError, "request must be provided" if request.nil?
190
+
191
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest
192
+
193
+ # Converts hash and nil to an options object
194
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
195
+
196
+ # Customize the options with defaults
197
+ metadata = @config.rpcs.get_fulfillment.metadata.to_h
198
+
199
+ # Set x-goog-api-client and x-goog-user-project headers
200
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
201
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
202
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
203
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
204
+
205
+ header_params = {
206
+ "name" => request.name
207
+ }
208
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
209
+ metadata[:"x-goog-request-params"] ||= request_params_header
210
+
211
+ options.apply_defaults timeout: @config.rpcs.get_fulfillment.timeout,
212
+ metadata: metadata,
213
+ retry_policy: @config.rpcs.get_fulfillment.retry_policy
214
+ options.apply_defaults metadata: @config.metadata,
215
+ retry_policy: @config.retry_policy
216
+
217
+ @fulfillments_stub.call_rpc :get_fulfillment, request, options: options do |response, operation|
218
+ yield response, operation if block_given?
219
+ return response
220
+ end
221
+ rescue ::GRPC::BadStatus => e
222
+ raise ::Google::Cloud::Error.from_error(e)
223
+ end
224
+
225
+ ##
226
+ # Updates the fulfillment.
227
+ #
228
+ # @overload update_fulfillment(request, options = nil)
229
+ # Pass arguments to `update_fulfillment` via a request object, either of type
230
+ # {::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest} or an equivalent Hash.
231
+ #
232
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest, ::Hash]
233
+ # A request object representing the call parameters. Required. To specify no
234
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
235
+ # @param options [::Gapic::CallOptions, ::Hash]
236
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
237
+ #
238
+ # @overload update_fulfillment(fulfillment: nil, update_mask: nil)
239
+ # Pass arguments to `update_fulfillment` via keyword arguments. Note that at
240
+ # least one keyword argument is required. To specify no parameters, or to keep all
241
+ # the default parameter values, pass an empty Hash as a request object (see above).
242
+ #
243
+ # @param fulfillment [::Google::Cloud::Dialogflow::V2::Fulfillment, ::Hash]
244
+ # Required. The fulfillment to update.
245
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
246
+ # Required. The mask to control which fields get updated. If the mask is not
247
+ # present, all fields will be updated.
248
+ #
249
+ # @yield [response, operation] Access the result along with the RPC operation
250
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Fulfillment]
251
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
252
+ #
253
+ # @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
254
+ #
255
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
256
+ #
257
+ def update_fulfillment request, options = nil
258
+ raise ::ArgumentError, "request must be provided" if request.nil?
259
+
260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest
261
+
262
+ # Converts hash and nil to an options object
263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
+
265
+ # Customize the options with defaults
266
+ metadata = @config.rpcs.update_fulfillment.metadata.to_h
267
+
268
+ # Set x-goog-api-client and x-goog-user-project headers
269
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
271
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
272
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
273
+
274
+ header_params = {
275
+ "fulfillment.name" => request.fulfillment.name
276
+ }
277
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
278
+ metadata[:"x-goog-request-params"] ||= request_params_header
279
+
280
+ options.apply_defaults timeout: @config.rpcs.update_fulfillment.timeout,
281
+ metadata: metadata,
282
+ retry_policy: @config.rpcs.update_fulfillment.retry_policy
283
+ options.apply_defaults metadata: @config.metadata,
284
+ retry_policy: @config.retry_policy
285
+
286
+ @fulfillments_stub.call_rpc :update_fulfillment, request, options: options do |response, operation|
287
+ yield response, operation if block_given?
288
+ return response
289
+ end
290
+ rescue ::GRPC::BadStatus => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Configuration class for the Fulfillments API.
296
+ #
297
+ # This class represents the configuration for Fulfillments,
298
+ # providing control over timeouts, retry behavior, logging, transport
299
+ # parameters, and other low-level controls. Certain parameters can also be
300
+ # applied individually to specific RPCs. See
301
+ # {::Google::Cloud::Dialogflow::V2::Fulfillments::Client::Configuration::Rpcs}
302
+ # for a list of RPCs that can be configured independently.
303
+ #
304
+ # Configuration can be applied globally to all clients, or to a single client
305
+ # on construction.
306
+ #
307
+ # # Examples
308
+ #
309
+ # To modify the global config, setting the timeout for get_fulfillment
310
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
311
+ #
312
+ # ::Google::Cloud::Dialogflow::V2::Fulfillments::Client.configure do |config|
313
+ # config.timeout = 10.0
314
+ # config.rpcs.get_fulfillment.timeout = 20.0
315
+ # end
316
+ #
317
+ # To apply the above configuration only to a new client:
318
+ #
319
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Client.new do |config|
320
+ # config.timeout = 10.0
321
+ # config.rpcs.get_fulfillment.timeout = 20.0
322
+ # end
323
+ #
324
+ # @!attribute [rw] endpoint
325
+ # The hostname or hostname:port of the service endpoint.
326
+ # Defaults to `"dialogflow.googleapis.com"`.
327
+ # @return [::String]
328
+ # @!attribute [rw] credentials
329
+ # Credentials to send with calls. You may provide any of the following types:
330
+ # * (`String`) The path to a service account key file in JSON format
331
+ # * (`Hash`) A service account key as a Hash
332
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
333
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
334
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
335
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
336
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
337
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
338
+ # * (`nil`) indicating no credentials
339
+ # @return [::Object]
340
+ # @!attribute [rw] scope
341
+ # The OAuth scopes
342
+ # @return [::Array<::String>]
343
+ # @!attribute [rw] lib_name
344
+ # The library name as recorded in instrumentation and logging
345
+ # @return [::String]
346
+ # @!attribute [rw] lib_version
347
+ # The library version as recorded in instrumentation and logging
348
+ # @return [::String]
349
+ # @!attribute [rw] channel_args
350
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
351
+ # `GRPC::Core::Channel` object is provided as the credential.
352
+ # @return [::Hash]
353
+ # @!attribute [rw] interceptors
354
+ # An array of interceptors that are run before calls are executed.
355
+ # @return [::Array<::GRPC::ClientInterceptor>]
356
+ # @!attribute [rw] timeout
357
+ # The call timeout in seconds.
358
+ # @return [::Numeric]
359
+ # @!attribute [rw] metadata
360
+ # Additional gRPC headers to be sent with the call.
361
+ # @return [::Hash{::Symbol=>::String}]
362
+ # @!attribute [rw] retry_policy
363
+ # The retry policy. The value is a hash with the following keys:
364
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
365
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
366
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
367
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
368
+ # trigger a retry.
369
+ # @return [::Hash]
370
+ # @!attribute [rw] quota_project
371
+ # A separate project against which to charge quota.
372
+ # @return [::String]
373
+ #
374
+ class Configuration
375
+ extend ::Gapic::Config
376
+
377
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
378
+ config_attr :credentials, nil do |value|
379
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
380
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
381
+ allowed.any? { |klass| klass === value }
382
+ end
383
+ config_attr :scope, nil, ::String, ::Array, nil
384
+ config_attr :lib_name, nil, ::String, nil
385
+ config_attr :lib_version, nil, ::String, nil
386
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
387
+ config_attr :interceptors, nil, ::Array, nil
388
+ config_attr :timeout, nil, ::Numeric, nil
389
+ config_attr :metadata, nil, ::Hash, nil
390
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
391
+ config_attr :quota_project, nil, ::String, nil
392
+
393
+ # @private
394
+ def initialize parent_config = nil
395
+ @parent_config = parent_config unless parent_config.nil?
396
+
397
+ yield self if block_given?
398
+ end
399
+
400
+ ##
401
+ # Configurations for individual RPCs
402
+ # @return [Rpcs]
403
+ #
404
+ def rpcs
405
+ @rpcs ||= begin
406
+ parent_rpcs = nil
407
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
408
+ Rpcs.new parent_rpcs
409
+ end
410
+ end
411
+
412
+ ##
413
+ # Configuration RPC class for the Fulfillments API.
414
+ #
415
+ # Includes fields providing the configuration for each RPC in this service.
416
+ # Each configuration object is of type `Gapic::Config::Method` and includes
417
+ # the following configuration fields:
418
+ #
419
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
420
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
421
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
422
+ # include the following keys:
423
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
424
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
425
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
426
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
427
+ # trigger a retry.
428
+ #
429
+ class Rpcs
430
+ ##
431
+ # RPC-specific configuration for `get_fulfillment`
432
+ # @return [::Gapic::Config::Method]
433
+ #
434
+ attr_reader :get_fulfillment
435
+ ##
436
+ # RPC-specific configuration for `update_fulfillment`
437
+ # @return [::Gapic::Config::Method]
438
+ #
439
+ attr_reader :update_fulfillment
440
+
441
+ # @private
442
+ def initialize parent_rpcs = nil
443
+ get_fulfillment_config = parent_rpcs.get_fulfillment if parent_rpcs.respond_to? :get_fulfillment
444
+ @get_fulfillment = ::Gapic::Config::Method.new get_fulfillment_config
445
+ update_fulfillment_config = parent_rpcs.update_fulfillment if parent_rpcs.respond_to? :update_fulfillment
446
+ @update_fulfillment = ::Gapic::Config::Method.new update_fulfillment_config
447
+
448
+ yield self if block_given?
449
+ end
450
+ end
451
+ end
452
+ end
453
+ end
454
+ end
455
+ end
456
+ end
457
+ end