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