google-cloud-dataqna-v1alpha 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +139 -0
- data/lib/google-cloud-dataqna-v1alpha.rb +21 -0
- data/lib/google/cloud/dataqna/v1alpha.rb +39 -0
- data/lib/google/cloud/dataqna/v1alpha/annotated_string_pb.rb +40 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +114 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/client.rb +459 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/credentials.rb +51 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/paths.rb +50 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service_pb.rb +56 -0
- data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service_services_pb.rb +111 -0
- data/lib/google/cloud/dataqna/v1alpha/question_pb.rb +155 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service.rb +63 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service/client.rb +712 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service/credentials.rb +51 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service/paths.rb +88 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service_pb.rb +49 -0
- data/lib/google/cloud/dataqna/v1alpha/question_service_services_pb.rb +68 -0
- data/lib/google/cloud/dataqna/v1alpha/user_feedback_pb.rb +32 -0
- data/lib/google/cloud/dataqna/v1alpha/version.rb +28 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +65 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb +110 -0
- data/proto_docs/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +140 -0
- data/proto_docs/google/cloud/dataqna/v1alpha/question.rb +418 -0
- data/proto_docs/google/cloud/dataqna/v1alpha/question_service.rb +91 -0
- data/proto_docs/google/cloud/dataqna/v1alpha/user_feedback.rb +55 -0
- data/proto_docs/google/protobuf/any.rb +141 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +129 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +219 -0
@@ -0,0 +1,21 @@
|
|
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
|
+
# This gem does not autoload during Bundler.require. To load this gem,
|
20
|
+
# issue explicit require statements for the packages desired, e.g.:
|
21
|
+
# require "google/cloud/dataqna/v1alpha"
|
@@ -0,0 +1,39 @@
|
|
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/dataqna/v1alpha/auto_suggestion_service"
|
20
|
+
require "google/cloud/dataqna/v1alpha/question_service"
|
21
|
+
require "google/cloud/dataqna/v1alpha/version"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module DataQnA
|
26
|
+
##
|
27
|
+
# To load this package, including all its services, and instantiate a client:
|
28
|
+
#
|
29
|
+
# require "google/cloud/dataqna/v1alpha"
|
30
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client.new
|
31
|
+
#
|
32
|
+
module V1alpha
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
helper_path = ::File.join __dir__, "v1alpha", "_helpers.rb"
|
39
|
+
require "google/cloud/dataqna/v1alpha/_helpers" if ::File.file? helper_path
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/dataqna/v1alpha/annotated_string.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("google/cloud/dataqna/v1alpha/annotated_string.proto", :syntax => :proto3) do
|
8
|
+
add_message "google.cloud.dataqna.v1alpha.AnnotatedString" do
|
9
|
+
optional :text_formatted, :string, 1
|
10
|
+
optional :html_formatted, :string, 2
|
11
|
+
repeated :markups, :message, 3, "google.cloud.dataqna.v1alpha.AnnotatedString.SemanticMarkup"
|
12
|
+
end
|
13
|
+
add_message "google.cloud.dataqna.v1alpha.AnnotatedString.SemanticMarkup" do
|
14
|
+
optional :type, :enum, 1, "google.cloud.dataqna.v1alpha.AnnotatedString.SemanticMarkupType"
|
15
|
+
optional :start_char_index, :int32, 2
|
16
|
+
optional :length, :int32, 3
|
17
|
+
end
|
18
|
+
add_enum "google.cloud.dataqna.v1alpha.AnnotatedString.SemanticMarkupType" do
|
19
|
+
value :MARKUP_TYPE_UNSPECIFIED, 0
|
20
|
+
value :METRIC, 1
|
21
|
+
value :DIMENSION, 2
|
22
|
+
value :FILTER, 3
|
23
|
+
value :UNUSED, 4
|
24
|
+
value :BLOCKED, 5
|
25
|
+
value :ROW, 6
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module DataQnA
|
33
|
+
module V1alpha
|
34
|
+
AnnotatedString = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataqna.v1alpha.AnnotatedString").msgclass
|
35
|
+
AnnotatedString::SemanticMarkup = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataqna.v1alpha.AnnotatedString.SemanticMarkup").msgclass
|
36
|
+
AnnotatedString::SemanticMarkupType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataqna.v1alpha.AnnotatedString.SemanticMarkupType").enummodule
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,114 @@
|
|
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/dataqna/v1alpha/version"
|
24
|
+
|
25
|
+
require "google/cloud/dataqna/v1alpha/auto_suggestion_service/credentials"
|
26
|
+
require "google/cloud/dataqna/v1alpha/auto_suggestion_service/paths"
|
27
|
+
require "google/cloud/dataqna/v1alpha/auto_suggestion_service/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module DataQnA
|
32
|
+
module V1alpha
|
33
|
+
##
|
34
|
+
# This stateless API provides automatic suggestions for natural language
|
35
|
+
# queries for the data sources in the provided project and location.
|
36
|
+
#
|
37
|
+
# The service provides a resourceless operation `suggestQueries` that can be
|
38
|
+
# called to get a list of suggestions for a given incomplete query and scope
|
39
|
+
# (or list of scopes) under which the query is to be interpreted.
|
40
|
+
#
|
41
|
+
# There are two types of suggestions, ENTITY for single entity suggestions
|
42
|
+
# and TEMPLATE for full sentences. By default, both types are returned.
|
43
|
+
#
|
44
|
+
# Example Request:
|
45
|
+
# ```
|
46
|
+
# GetSuggestions({
|
47
|
+
# parent: "locations/us/projects/my-project"
|
48
|
+
# scopes:
|
49
|
+
# "//bigquery.googleapis.com/projects/my-project/datasets/my-dataset/tables/my-table"
|
50
|
+
# query: "top it"
|
51
|
+
# })
|
52
|
+
# ```
|
53
|
+
#
|
54
|
+
# The service will retrieve information based on the given scope(s) and give
|
55
|
+
# suggestions based on that (e.g. "top item" for "top it" if "item" is a known
|
56
|
+
# dimension for the provided scope).
|
57
|
+
# ```
|
58
|
+
# suggestions {
|
59
|
+
# suggestion_info {
|
60
|
+
# annotated_suggestion {
|
61
|
+
# text_formatted: "top item by sum of usd_revenue_net"
|
62
|
+
# markups {
|
63
|
+
# type: DIMENSION
|
64
|
+
# start_char_index: 4
|
65
|
+
# length: 4
|
66
|
+
# }
|
67
|
+
# markups {
|
68
|
+
# type: METRIC
|
69
|
+
# start_char_index: 19
|
70
|
+
# length: 15
|
71
|
+
# }
|
72
|
+
# }
|
73
|
+
# query_matches {
|
74
|
+
# start_char_index: 0
|
75
|
+
# length: 6
|
76
|
+
# }
|
77
|
+
# }
|
78
|
+
# suggestion_type: TEMPLATE
|
79
|
+
# ranking_score: 0.9
|
80
|
+
# }
|
81
|
+
# suggestions {
|
82
|
+
# suggestion_info {
|
83
|
+
# annotated_suggestion {
|
84
|
+
# text_formatted: "item"
|
85
|
+
# markups {
|
86
|
+
# type: DIMENSION
|
87
|
+
# start_char_index: 4
|
88
|
+
# length: 2
|
89
|
+
# }
|
90
|
+
# }
|
91
|
+
# query_matches {
|
92
|
+
# start_char_index: 0
|
93
|
+
# length: 6
|
94
|
+
# }
|
95
|
+
# }
|
96
|
+
# suggestion_type: ENTITY
|
97
|
+
# ranking_score: 0.8
|
98
|
+
# }
|
99
|
+
# ```
|
100
|
+
#
|
101
|
+
# To load this service and instantiate a client:
|
102
|
+
#
|
103
|
+
# require "google/cloud/dataqna/v1alpha/auto_suggestion_service"
|
104
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client.new
|
105
|
+
#
|
106
|
+
module AutoSuggestionService
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
helper_path = ::File.join __dir__, "auto_suggestion_service", "helpers.rb"
|
114
|
+
require "google/cloud/dataqna/v1alpha/auto_suggestion_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,459 @@
|
|
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/dataqna/v1alpha/auto_suggestion_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module DataQnA
|
25
|
+
module V1alpha
|
26
|
+
module AutoSuggestionService
|
27
|
+
##
|
28
|
+
# Client for the AutoSuggestionService service.
|
29
|
+
#
|
30
|
+
# This stateless API provides automatic suggestions for natural language
|
31
|
+
# queries for the data sources in the provided project and location.
|
32
|
+
#
|
33
|
+
# The service provides a resourceless operation `suggestQueries` that can be
|
34
|
+
# called to get a list of suggestions for a given incomplete query and scope
|
35
|
+
# (or list of scopes) under which the query is to be interpreted.
|
36
|
+
#
|
37
|
+
# There are two types of suggestions, ENTITY for single entity suggestions
|
38
|
+
# and TEMPLATE for full sentences. By default, both types are returned.
|
39
|
+
#
|
40
|
+
# Example Request:
|
41
|
+
# ```
|
42
|
+
# GetSuggestions({
|
43
|
+
# parent: "locations/us/projects/my-project"
|
44
|
+
# scopes:
|
45
|
+
# "//bigquery.googleapis.com/projects/my-project/datasets/my-dataset/tables/my-table"
|
46
|
+
# query: "top it"
|
47
|
+
# })
|
48
|
+
# ```
|
49
|
+
#
|
50
|
+
# The service will retrieve information based on the given scope(s) and give
|
51
|
+
# suggestions based on that (e.g. "top item" for "top it" if "item" is a known
|
52
|
+
# dimension for the provided scope).
|
53
|
+
# ```
|
54
|
+
# suggestions {
|
55
|
+
# suggestion_info {
|
56
|
+
# annotated_suggestion {
|
57
|
+
# text_formatted: "top item by sum of usd_revenue_net"
|
58
|
+
# markups {
|
59
|
+
# type: DIMENSION
|
60
|
+
# start_char_index: 4
|
61
|
+
# length: 4
|
62
|
+
# }
|
63
|
+
# markups {
|
64
|
+
# type: METRIC
|
65
|
+
# start_char_index: 19
|
66
|
+
# length: 15
|
67
|
+
# }
|
68
|
+
# }
|
69
|
+
# query_matches {
|
70
|
+
# start_char_index: 0
|
71
|
+
# length: 6
|
72
|
+
# }
|
73
|
+
# }
|
74
|
+
# suggestion_type: TEMPLATE
|
75
|
+
# ranking_score: 0.9
|
76
|
+
# }
|
77
|
+
# suggestions {
|
78
|
+
# suggestion_info {
|
79
|
+
# annotated_suggestion {
|
80
|
+
# text_formatted: "item"
|
81
|
+
# markups {
|
82
|
+
# type: DIMENSION
|
83
|
+
# start_char_index: 4
|
84
|
+
# length: 2
|
85
|
+
# }
|
86
|
+
# }
|
87
|
+
# query_matches {
|
88
|
+
# start_char_index: 0
|
89
|
+
# length: 6
|
90
|
+
# }
|
91
|
+
# }
|
92
|
+
# suggestion_type: ENTITY
|
93
|
+
# ranking_score: 0.8
|
94
|
+
# }
|
95
|
+
# ```
|
96
|
+
#
|
97
|
+
class Client
|
98
|
+
include Paths
|
99
|
+
|
100
|
+
# @private
|
101
|
+
attr_reader :auto_suggestion_service_stub
|
102
|
+
|
103
|
+
##
|
104
|
+
# Configure the AutoSuggestionService Client class.
|
105
|
+
#
|
106
|
+
# See {::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client::Configuration}
|
107
|
+
# for a description of the configuration fields.
|
108
|
+
#
|
109
|
+
# ## Example
|
110
|
+
#
|
111
|
+
# To modify the configuration for all AutoSuggestionService clients:
|
112
|
+
#
|
113
|
+
# ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client.configure do |config|
|
114
|
+
# config.timeout = 10.0
|
115
|
+
# end
|
116
|
+
#
|
117
|
+
# @yield [config] Configure the Client client.
|
118
|
+
# @yieldparam config [Client::Configuration]
|
119
|
+
#
|
120
|
+
# @return [Client::Configuration]
|
121
|
+
#
|
122
|
+
def self.configure
|
123
|
+
@configure ||= begin
|
124
|
+
namespace = ["Google", "Cloud", "DataQnA", "V1alpha"]
|
125
|
+
parent_config = while namespace.any?
|
126
|
+
parent_name = namespace.join "::"
|
127
|
+
parent_const = const_get parent_name
|
128
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
129
|
+
namespace.pop
|
130
|
+
end
|
131
|
+
default_config = Client::Configuration.new parent_config
|
132
|
+
|
133
|
+
default_config.timeout = 2.0
|
134
|
+
|
135
|
+
default_config
|
136
|
+
end
|
137
|
+
yield @configure if block_given?
|
138
|
+
@configure
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# Configure the AutoSuggestionService Client instance.
|
143
|
+
#
|
144
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
145
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
146
|
+
# should be made on {Client.configure}.
|
147
|
+
#
|
148
|
+
# See {::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client::Configuration}
|
149
|
+
# for a description of the configuration fields.
|
150
|
+
#
|
151
|
+
# @yield [config] Configure the Client client.
|
152
|
+
# @yieldparam config [Client::Configuration]
|
153
|
+
#
|
154
|
+
# @return [Client::Configuration]
|
155
|
+
#
|
156
|
+
def configure
|
157
|
+
yield @config if block_given?
|
158
|
+
@config
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# Create a new AutoSuggestionService client object.
|
163
|
+
#
|
164
|
+
# ## Examples
|
165
|
+
#
|
166
|
+
# To create a new AutoSuggestionService client with the default
|
167
|
+
# configuration:
|
168
|
+
#
|
169
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client.new
|
170
|
+
#
|
171
|
+
# To create a new AutoSuggestionService client with a custom
|
172
|
+
# configuration:
|
173
|
+
#
|
174
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client.new do |config|
|
175
|
+
# config.timeout = 10.0
|
176
|
+
# end
|
177
|
+
#
|
178
|
+
# @yield [config] Configure the AutoSuggestionService client.
|
179
|
+
# @yieldparam config [Client::Configuration]
|
180
|
+
#
|
181
|
+
def initialize
|
182
|
+
# These require statements are intentionally placed here to initialize
|
183
|
+
# the gRPC module only when it's required.
|
184
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
185
|
+
require "gapic/grpc"
|
186
|
+
require "google/cloud/dataqna/v1alpha/auto_suggestion_service_services_pb"
|
187
|
+
|
188
|
+
# Create the configuration object
|
189
|
+
@config = Configuration.new Client.configure
|
190
|
+
|
191
|
+
# Yield the configuration if needed
|
192
|
+
yield @config if block_given?
|
193
|
+
|
194
|
+
# Create credentials
|
195
|
+
credentials = @config.credentials
|
196
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
197
|
+
# but only if the default endpoint does not have a region prefix.
|
198
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
199
|
+
@config.endpoint == Client.configure.endpoint &&
|
200
|
+
!@config.endpoint.split(".").first.include?("-")
|
201
|
+
credentials ||= Credentials.default scope: @config.scope,
|
202
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
203
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
204
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
205
|
+
end
|
206
|
+
@quota_project_id = @config.quota_project
|
207
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
208
|
+
|
209
|
+
@auto_suggestion_service_stub = ::Gapic::ServiceStub.new(
|
210
|
+
::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Stub,
|
211
|
+
credentials: credentials,
|
212
|
+
endpoint: @config.endpoint,
|
213
|
+
channel_args: @config.channel_args,
|
214
|
+
interceptors: @config.interceptors
|
215
|
+
)
|
216
|
+
end
|
217
|
+
|
218
|
+
# Service calls
|
219
|
+
|
220
|
+
##
|
221
|
+
# Gets a list of suggestions based on a prefix string.
|
222
|
+
# AutoSuggestion tolerance should be less than 1 second.
|
223
|
+
#
|
224
|
+
# @overload suggest_queries(request, options = nil)
|
225
|
+
# Pass arguments to `suggest_queries` via a request object, either of type
|
226
|
+
# {::Google::Cloud::DataQnA::V1alpha::SuggestQueriesRequest} or an equivalent Hash.
|
227
|
+
#
|
228
|
+
# @param request [::Google::Cloud::DataQnA::V1alpha::SuggestQueriesRequest, ::Hash]
|
229
|
+
# A request object representing the call parameters. Required. To specify no
|
230
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
231
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
232
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
233
|
+
#
|
234
|
+
# @overload suggest_queries(parent: nil, scopes: nil, query: nil, suggestion_types: nil)
|
235
|
+
# Pass arguments to `suggest_queries` via keyword arguments. Note that at
|
236
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
237
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
238
|
+
#
|
239
|
+
# @param parent [::String]
|
240
|
+
# Required. The parent of the suggestion query is the resource denoting the project and
|
241
|
+
# location.
|
242
|
+
# @param scopes [::Array<::String>]
|
243
|
+
# The scopes to which this search is restricted. The only supported scope
|
244
|
+
# pattern is
|
245
|
+
# `//bigquery.googleapis.com/projects/{GCP-PROJECT-ID}/datasets/{DATASET-ID}/tables/{TABLE-ID}`.
|
246
|
+
# @param query [::String]
|
247
|
+
# User query for which to generate suggestions. If the query is empty, zero
|
248
|
+
# state suggestions are returned. This allows UIs to display suggestions
|
249
|
+
# right away, helping the user to get a sense of what a query might look
|
250
|
+
# like.
|
251
|
+
# @param suggestion_types [::Array<::Google::Cloud::DataQnA::V1alpha::SuggestionType>]
|
252
|
+
# The requested suggestion type. Multiple suggestion types can be
|
253
|
+
# requested, but there is no guarantee that the service will return
|
254
|
+
# suggestions for each type. Suggestions for a requested type might rank
|
255
|
+
# lower than suggestions for other types and the service may decide to cut
|
256
|
+
# these suggestions off.
|
257
|
+
#
|
258
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
259
|
+
# @yieldparam response [::Google::Cloud::DataQnA::V1alpha::SuggestQueriesResponse]
|
260
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
261
|
+
#
|
262
|
+
# @return [::Google::Cloud::DataQnA::V1alpha::SuggestQueriesResponse]
|
263
|
+
#
|
264
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
265
|
+
#
|
266
|
+
def suggest_queries request, options = nil
|
267
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
268
|
+
|
269
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::SuggestQueriesRequest
|
270
|
+
|
271
|
+
# Converts hash and nil to an options object
|
272
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
273
|
+
|
274
|
+
# Customize the options with defaults
|
275
|
+
metadata = @config.rpcs.suggest_queries.metadata.to_h
|
276
|
+
|
277
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
278
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
279
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
280
|
+
gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION
|
281
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
282
|
+
|
283
|
+
header_params = {
|
284
|
+
"parent" => request.parent
|
285
|
+
}
|
286
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
287
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
288
|
+
|
289
|
+
options.apply_defaults timeout: @config.rpcs.suggest_queries.timeout,
|
290
|
+
metadata: metadata,
|
291
|
+
retry_policy: @config.rpcs.suggest_queries.retry_policy
|
292
|
+
options.apply_defaults metadata: @config.metadata,
|
293
|
+
retry_policy: @config.retry_policy
|
294
|
+
|
295
|
+
@auto_suggestion_service_stub.call_rpc :suggest_queries, request, options: options do |response, operation|
|
296
|
+
yield response, operation if block_given?
|
297
|
+
return response
|
298
|
+
end
|
299
|
+
rescue ::GRPC::BadStatus => e
|
300
|
+
raise ::Google::Cloud::Error.from_error(e)
|
301
|
+
end
|
302
|
+
|
303
|
+
##
|
304
|
+
# Configuration class for the AutoSuggestionService API.
|
305
|
+
#
|
306
|
+
# This class represents the configuration for AutoSuggestionService,
|
307
|
+
# providing control over timeouts, retry behavior, logging, transport
|
308
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
309
|
+
# applied individually to specific RPCs. See
|
310
|
+
# {::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client::Configuration::Rpcs}
|
311
|
+
# for a list of RPCs that can be configured independently.
|
312
|
+
#
|
313
|
+
# Configuration can be applied globally to all clients, or to a single client
|
314
|
+
# on construction.
|
315
|
+
#
|
316
|
+
# # Examples
|
317
|
+
#
|
318
|
+
# To modify the global config, setting the timeout for suggest_queries
|
319
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
320
|
+
#
|
321
|
+
# ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client.configure do |config|
|
322
|
+
# config.timeout = 10.0
|
323
|
+
# config.rpcs.suggest_queries.timeout = 20.0
|
324
|
+
# end
|
325
|
+
#
|
326
|
+
# To apply the above configuration only to a new client:
|
327
|
+
#
|
328
|
+
# client = ::Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client.new do |config|
|
329
|
+
# config.timeout = 10.0
|
330
|
+
# config.rpcs.suggest_queries.timeout = 20.0
|
331
|
+
# end
|
332
|
+
#
|
333
|
+
# @!attribute [rw] endpoint
|
334
|
+
# The hostname or hostname:port of the service endpoint.
|
335
|
+
# Defaults to `"dataqna.googleapis.com"`.
|
336
|
+
# @return [::String]
|
337
|
+
# @!attribute [rw] credentials
|
338
|
+
# Credentials to send with calls. You may provide any of the following types:
|
339
|
+
# * (`String`) The path to a service account key file in JSON format
|
340
|
+
# * (`Hash`) A service account key as a Hash
|
341
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
342
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
343
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
344
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
345
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
346
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
347
|
+
# * (`nil`) indicating no credentials
|
348
|
+
# @return [::Object]
|
349
|
+
# @!attribute [rw] scope
|
350
|
+
# The OAuth scopes
|
351
|
+
# @return [::Array<::String>]
|
352
|
+
# @!attribute [rw] lib_name
|
353
|
+
# The library name as recorded in instrumentation and logging
|
354
|
+
# @return [::String]
|
355
|
+
# @!attribute [rw] lib_version
|
356
|
+
# The library version as recorded in instrumentation and logging
|
357
|
+
# @return [::String]
|
358
|
+
# @!attribute [rw] channel_args
|
359
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
360
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
361
|
+
# @return [::Hash]
|
362
|
+
# @!attribute [rw] interceptors
|
363
|
+
# An array of interceptors that are run before calls are executed.
|
364
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
365
|
+
# @!attribute [rw] timeout
|
366
|
+
# The call timeout in seconds.
|
367
|
+
# @return [::Numeric]
|
368
|
+
# @!attribute [rw] metadata
|
369
|
+
# Additional gRPC headers to be sent with the call.
|
370
|
+
# @return [::Hash{::Symbol=>::String}]
|
371
|
+
# @!attribute [rw] retry_policy
|
372
|
+
# The retry policy. The value is a hash with the following keys:
|
373
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
374
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
375
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
376
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
377
|
+
# trigger a retry.
|
378
|
+
# @return [::Hash]
|
379
|
+
# @!attribute [rw] quota_project
|
380
|
+
# A separate project against which to charge quota.
|
381
|
+
# @return [::String]
|
382
|
+
#
|
383
|
+
class Configuration
|
384
|
+
extend ::Gapic::Config
|
385
|
+
|
386
|
+
config_attr :endpoint, "dataqna.googleapis.com", ::String
|
387
|
+
config_attr :credentials, nil do |value|
|
388
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
389
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
390
|
+
allowed.any? { |klass| klass === value }
|
391
|
+
end
|
392
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
393
|
+
config_attr :lib_name, nil, ::String, nil
|
394
|
+
config_attr :lib_version, nil, ::String, nil
|
395
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
396
|
+
config_attr :interceptors, nil, ::Array, nil
|
397
|
+
config_attr :timeout, nil, ::Numeric, nil
|
398
|
+
config_attr :metadata, nil, ::Hash, nil
|
399
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
400
|
+
config_attr :quota_project, nil, ::String, nil
|
401
|
+
|
402
|
+
# @private
|
403
|
+
def initialize parent_config = nil
|
404
|
+
@parent_config = parent_config unless parent_config.nil?
|
405
|
+
|
406
|
+
yield self if block_given?
|
407
|
+
end
|
408
|
+
|
409
|
+
##
|
410
|
+
# Configurations for individual RPCs
|
411
|
+
# @return [Rpcs]
|
412
|
+
#
|
413
|
+
def rpcs
|
414
|
+
@rpcs ||= begin
|
415
|
+
parent_rpcs = nil
|
416
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
417
|
+
Rpcs.new parent_rpcs
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
##
|
422
|
+
# Configuration RPC class for the AutoSuggestionService API.
|
423
|
+
#
|
424
|
+
# Includes fields providing the configuration for each RPC in this service.
|
425
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
426
|
+
# the following configuration fields:
|
427
|
+
#
|
428
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
429
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
430
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
431
|
+
# include the following keys:
|
432
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
433
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
434
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
435
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
436
|
+
# trigger a retry.
|
437
|
+
#
|
438
|
+
class Rpcs
|
439
|
+
##
|
440
|
+
# RPC-specific configuration for `suggest_queries`
|
441
|
+
# @return [::Gapic::Config::Method]
|
442
|
+
#
|
443
|
+
attr_reader :suggest_queries
|
444
|
+
|
445
|
+
# @private
|
446
|
+
def initialize parent_rpcs = nil
|
447
|
+
suggest_queries_config = parent_rpcs&.suggest_queries if parent_rpcs&.respond_to? :suggest_queries
|
448
|
+
@suggest_queries = ::Gapic::Config::Method.new suggest_queries_config
|
449
|
+
|
450
|
+
yield self if block_given?
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
end
|