google-cloud-discovery_engine-v1beta 0.a → 0.2.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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +429 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/completion_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +78 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +386 -0
  9. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +114 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/completion_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +1159 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/document_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +768 -0
  15. data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +135 -0
  16. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +960 -0
  17. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +919 -0
  18. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +518 -0
  19. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest.rb +55 -0
  20. data/lib/google/cloud/discovery_engine/v1beta/document_service.rb +58 -0
  21. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +486 -0
  22. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/credentials.rb +47 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/paths.rb +135 -0
  24. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +443 -0
  25. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +116 -0
  26. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest.rb +52 -0
  27. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service.rb +55 -0
  28. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +42 -0
  29. data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +840 -0
  30. data/lib/google/cloud/discovery_engine/v1beta/schema_service/credentials.rb +47 -0
  31. data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +768 -0
  32. data/lib/google/cloud/discovery_engine/v1beta/schema_service/paths.rb +127 -0
  33. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +680 -0
  34. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +919 -0
  35. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +382 -0
  36. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest.rb +53 -0
  37. data/lib/google/cloud/discovery_engine/v1beta/schema_service.rb +56 -0
  38. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +511 -0
  39. data/lib/google/cloud/discovery_engine/v1beta/search_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1beta/search_service/paths.rb +131 -0
  41. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +463 -0
  42. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +116 -0
  43. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest.rb +52 -0
  44. data/lib/google/cloud/discovery_engine/v1beta/search_service.rb +55 -0
  45. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +638 -0
  46. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/credentials.rb +47 -0
  47. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +768 -0
  48. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/paths.rb +131 -0
  49. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +542 -0
  50. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +919 -0
  51. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +250 -0
  52. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest.rb +53 -0
  53. data/lib/google/cloud/discovery_engine/v1beta/user_event_service.rb +56 -0
  54. data/lib/google/cloud/discovery_engine/v1beta/version.rb +7 -2
  55. data/lib/google/cloud/discovery_engine/v1beta.rb +50 -0
  56. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +46 -0
  57. data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +49 -0
  58. data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +45 -0
  59. data/lib/google/cloud/discoveryengine/v1beta/document_pb.rb +48 -0
  60. data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +58 -0
  61. data/lib/google/cloud/discoveryengine/v1beta/document_service_services_pb.rb +81 -0
  62. data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +66 -0
  63. data/lib/google/cloud/discoveryengine/v1beta/purge_config_pb.rb +49 -0
  64. data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_pb.rb +55 -0
  65. data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_services_pb.rb +45 -0
  66. data/lib/google/cloud/discoveryengine/v1beta/schema_pb.rb +47 -0
  67. data/lib/google/cloud/discoveryengine/v1beta/schema_service_pb.rb +61 -0
  68. data/lib/google/cloud/discoveryengine/v1beta/schema_service_services_pb.rb +53 -0
  69. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +71 -0
  70. data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +45 -0
  71. data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +58 -0
  72. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_pb.rb +53 -0
  73. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_services_pb.rb +59 -0
  74. data/lib/google-cloud-discovery_engine-v1beta.rb +21 -0
  75. data/proto_docs/README.md +4 -0
  76. data/proto_docs/google/api/client.rb +381 -0
  77. data/proto_docs/google/api/field_behavior.rb +71 -0
  78. data/proto_docs/google/api/httpbody.rb +80 -0
  79. data/proto_docs/google/api/launch_stage.rb +71 -0
  80. data/proto_docs/google/api/resource.rb +222 -0
  81. data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +107 -0
  82. data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +98 -0
  83. data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +107 -0
  84. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +181 -0
  85. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +340 -0
  86. data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +84 -0
  87. data/proto_docs/google/cloud/discoveryengine/v1beta/recommendation_service.rb +210 -0
  88. data/proto_docs/google/cloud/discoveryengine/v1beta/schema.rb +45 -0
  89. data/proto_docs/google/cloud/discoveryengine/v1beta/schema_service.rb +180 -0
  90. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +603 -0
  91. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +473 -0
  92. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event_service.rb +64 -0
  93. data/proto_docs/google/longrunning/operations.rb +164 -0
  94. data/proto_docs/google/protobuf/any.rb +144 -0
  95. data/proto_docs/google/protobuf/duration.rb +98 -0
  96. data/proto_docs/google/protobuf/empty.rb +34 -0
  97. data/proto_docs/google/protobuf/struct.rb +96 -0
  98. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  99. data/proto_docs/google/rpc/status.rb +48 -0
  100. data/proto_docs/google/type/date.rb +53 -0
  101. metadata +254 -12
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module DiscoveryEngine
23
+ module V1beta
24
+ module UserEventService
25
+ # Path helper methods for the UserEventService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified DataStore resource string.
29
+ #
30
+ # @overload data_store_path(project:, location:, data_store:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/locations/{location}/dataStores/{data_store}`
34
+ #
35
+ # @param project [String]
36
+ # @param location [String]
37
+ # @param data_store [String]
38
+ #
39
+ # @overload data_store_path(project:, location:, collection:, data_store:)
40
+ # The resource will be in the following format:
41
+ #
42
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
43
+ #
44
+ # @param project [String]
45
+ # @param location [String]
46
+ # @param collection [String]
47
+ # @param data_store [String]
48
+ #
49
+ # @return [::String]
50
+ def data_store_path **args
51
+ resources = {
52
+ "data_store:location:project" => (proc do |project:, location:, data_store:|
53
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
54
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
55
+
56
+ "projects/#{project}/locations/#{location}/dataStores/#{data_store}"
57
+ end),
58
+ "collection:data_store:location:project" => (proc do |project:, location:, collection:, data_store:|
59
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
60
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
61
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
62
+
63
+ "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}"
64
+ end)
65
+ }
66
+
67
+ resource = resources[args.keys.sort.join(":")]
68
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
69
+ resource.call(**args)
70
+ end
71
+
72
+ ##
73
+ # Create a fully-qualified Document resource string.
74
+ #
75
+ # @overload document_path(project:, location:, data_store:, branch:, document:)
76
+ # The resource will be in the following format:
77
+ #
78
+ # `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}`
79
+ #
80
+ # @param project [String]
81
+ # @param location [String]
82
+ # @param data_store [String]
83
+ # @param branch [String]
84
+ # @param document [String]
85
+ #
86
+ # @overload document_path(project:, location:, collection:, data_store:, branch:, document:)
87
+ # The resource will be in the following format:
88
+ #
89
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`
90
+ #
91
+ # @param project [String]
92
+ # @param location [String]
93
+ # @param collection [String]
94
+ # @param data_store [String]
95
+ # @param branch [String]
96
+ # @param document [String]
97
+ #
98
+ # @return [::String]
99
+ def document_path **args
100
+ resources = {
101
+ "branch:data_store:document:location:project" => (proc do |project:, location:, data_store:, branch:, document:|
102
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
103
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
104
+ raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
105
+ raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/"
106
+
107
+ "projects/#{project}/locations/#{location}/dataStores/#{data_store}/branches/#{branch}/documents/#{document}"
108
+ end),
109
+ "branch:collection:data_store:document:location:project" => (proc do |project:, location:, collection:, data_store:, branch:, document:|
110
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
111
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
112
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
113
+ raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
114
+ raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/"
115
+
116
+ "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/branches/#{branch}/documents/#{document}"
117
+ end)
118
+ }
119
+
120
+ resource = resources[args.keys.sort.join(":")]
121
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
122
+ resource.call(**args)
123
+ end
124
+
125
+ extend self
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,542 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/discoveryengine/v1beta/user_event_service_pb"
21
+ require "google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1beta
27
+ module UserEventService
28
+ module Rest
29
+ ##
30
+ # REST client for the UserEventService service.
31
+ #
32
+ # Service for ingesting end user actions on a website to Discovery Engine API.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :user_event_service_stub
39
+
40
+ ##
41
+ # Configure the UserEventService Client class.
42
+ #
43
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all UserEventService clients
49
+ # ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.timeout = 30.0
70
+ default_config.retry_policy = {
71
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
72
+ }
73
+
74
+ default_config.rpcs.import_user_events.timeout = 300.0
75
+ default_config.rpcs.import_user_events.retry_policy = {
76
+ initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
77
+ }
78
+
79
+ default_config
80
+ end
81
+ yield @configure if block_given?
82
+ @configure
83
+ end
84
+
85
+ ##
86
+ # Configure the UserEventService Client instance.
87
+ #
88
+ # The configuration is set to the derived mode, meaning that values can be changed,
89
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
90
+ # should be made on {Client.configure}.
91
+ #
92
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client::Configuration}
93
+ # for a description of the configuration fields.
94
+ #
95
+ # @yield [config] Configure the Client client.
96
+ # @yieldparam config [Client::Configuration]
97
+ #
98
+ # @return [Client::Configuration]
99
+ #
100
+ def configure
101
+ yield @config if block_given?
102
+ @config
103
+ end
104
+
105
+ ##
106
+ # Create a new UserEventService REST client object.
107
+ #
108
+ # @example
109
+ #
110
+ # # Create a client using the default configuration
111
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client.new
112
+ #
113
+ # # Create a client using a custom configuration
114
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client.new do |config|
115
+ # config.timeout = 10.0
116
+ # end
117
+ #
118
+ # @yield [config] Configure the UserEventService client.
119
+ # @yieldparam config [Client::Configuration]
120
+ #
121
+ def initialize
122
+ # Create the configuration object
123
+ @config = Configuration.new Client.configure
124
+
125
+ # Yield the configuration if needed
126
+ yield @config if block_given?
127
+
128
+ # Create credentials
129
+ credentials = @config.credentials
130
+ # Use self-signed JWT if the endpoint is unchanged from default,
131
+ # but only if the default endpoint does not have a region prefix.
132
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+
140
+ @quota_project_id = @config.quota_project
141
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
142
+
143
+ @operations_client = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Operations.new do |config|
144
+ config.credentials = credentials
145
+ config.quota_project = @quota_project_id
146
+ config.endpoint = @config.endpoint
147
+ end
148
+
149
+ @user_event_service_stub = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
150
+ end
151
+
152
+ ##
153
+ # Get the associated client for long-running operations.
154
+ #
155
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Operations]
156
+ #
157
+ attr_reader :operations_client
158
+
159
+ # Service calls
160
+
161
+ ##
162
+ # Writes a single user event.
163
+ #
164
+ # @overload write_user_event(request, options = nil)
165
+ # Pass arguments to `write_user_event` via a request object, either of type
166
+ # {::Google::Cloud::DiscoveryEngine::V1beta::WriteUserEventRequest} or an equivalent Hash.
167
+ #
168
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::WriteUserEventRequest, ::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 write_user_event(parent: nil, user_event: nil)
175
+ # Pass arguments to `write_user_event` 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 parent [::String]
180
+ # Required. The parent DataStore resource name, such as
181
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
182
+ # @param user_event [::Google::Cloud::DiscoveryEngine::V1beta::UserEvent, ::Hash]
183
+ # Required. User event to write.
184
+ # @yield [result, operation] Access the result along with the TransportOperation object
185
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::UserEvent]
186
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
187
+ #
188
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::UserEvent]
189
+ #
190
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
191
+ def write_user_event request, options = nil
192
+ raise ::ArgumentError, "request must be provided" if request.nil?
193
+
194
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::WriteUserEventRequest
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
+ call_metadata = @config.rpcs.write_user_event.metadata.to_h
201
+
202
+ # Set x-goog-api-client and x-goog-user-project headers
203
+ call_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::DiscoveryEngine::V1beta::VERSION,
206
+ transports_version_send: [:rest]
207
+
208
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
209
+
210
+ options.apply_defaults timeout: @config.rpcs.write_user_event.timeout,
211
+ metadata: call_metadata,
212
+ retry_policy: @config.rpcs.write_user_event.retry_policy
213
+
214
+ options.apply_defaults timeout: @config.timeout,
215
+ metadata: @config.metadata,
216
+ retry_policy: @config.retry_policy
217
+
218
+ @user_event_service_stub.write_user_event request, options do |result, operation|
219
+ yield result, operation if block_given?
220
+ return result
221
+ end
222
+ rescue ::Gapic::Rest::Error => e
223
+ raise ::Google::Cloud::Error.from_error(e)
224
+ end
225
+
226
+ ##
227
+ # Writes a single user event from the browser. This uses a GET request to
228
+ # due to browser restriction of POST-ing to a 3rd party domain.
229
+ #
230
+ # This method is used only by the Discovery Engine API JavaScript pixel and
231
+ # Google Tag Manager. Users should not call this method directly.
232
+ #
233
+ # @overload collect_user_event(request, options = nil)
234
+ # Pass arguments to `collect_user_event` via a request object, either of type
235
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CollectUserEventRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CollectUserEventRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @overload collect_user_event(parent: nil, user_event: nil, uri: nil, ets: nil)
244
+ # Pass arguments to `collect_user_event` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param parent [::String]
249
+ # Required. The parent DataStore resource name, such as
250
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
251
+ # @param user_event [::String]
252
+ # Required. URL encoded UserEvent proto with a length limit of 2,000,000
253
+ # characters.
254
+ # @param uri [::String]
255
+ # The URL including cgi-parameters but excluding the hash fragment with a
256
+ # length limit of 5,000 characters. This is often more useful than the
257
+ # referer URL, because many browsers only send the domain for 3rd party
258
+ # requests.
259
+ # @param ets [::Integer]
260
+ # The event timestamp in milliseconds. This prevents browser caching of
261
+ # otherwise identical get requests. The name is abbreviated to reduce the
262
+ # payload bytes.
263
+ # @yield [result, operation] Access the result along with the TransportOperation object
264
+ # @yieldparam result [::Google::Api::HttpBody]
265
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
266
+ #
267
+ # @return [::Google::Api::HttpBody]
268
+ #
269
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
270
+ def collect_user_event request, options = nil
271
+ raise ::ArgumentError, "request must be provided" if request.nil?
272
+
273
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CollectUserEventRequest
274
+
275
+ # Converts hash and nil to an options object
276
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
277
+
278
+ # Customize the options with defaults
279
+ call_metadata = @config.rpcs.collect_user_event.metadata.to_h
280
+
281
+ # Set x-goog-api-client and x-goog-user-project headers
282
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
283
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
284
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
285
+ transports_version_send: [:rest]
286
+
287
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
288
+
289
+ options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout,
290
+ metadata: call_metadata,
291
+ retry_policy: @config.rpcs.collect_user_event.retry_policy
292
+
293
+ options.apply_defaults timeout: @config.timeout,
294
+ metadata: @config.metadata,
295
+ retry_policy: @config.retry_policy
296
+
297
+ @user_event_service_stub.collect_user_event request, options do |result, operation|
298
+ yield result, operation if block_given?
299
+ return result
300
+ end
301
+ rescue ::Gapic::Rest::Error => e
302
+ raise ::Google::Cloud::Error.from_error(e)
303
+ end
304
+
305
+ ##
306
+ # Bulk import of User events. Request processing might be
307
+ # synchronous. Events that already exist are skipped.
308
+ # Use this method for backfilling historical user events.
309
+ #
310
+ # Operation.response is of type ImportResponse. Note that it is
311
+ # possible for a subset of the items to be successfully inserted.
312
+ # Operation.metadata is of type ImportMetadata.
313
+ #
314
+ # @overload import_user_events(request, options = nil)
315
+ # Pass arguments to `import_user_events` via a request object, either of type
316
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest} or an equivalent Hash.
317
+ #
318
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest, ::Hash]
319
+ # A request object representing the call parameters. Required. To specify no
320
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
321
+ # @param options [::Gapic::CallOptions, ::Hash]
322
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
323
+ #
324
+ # @overload import_user_events(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil)
325
+ # Pass arguments to `import_user_events` via keyword arguments. Note that at
326
+ # least one keyword argument is required. To specify no parameters, or to keep all
327
+ # the default parameter values, pass an empty Hash as a request object (see above).
328
+ #
329
+ # @param inline_source [::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest::InlineSource, ::Hash]
330
+ # Required. The Inline source for the input content for UserEvents.
331
+ # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1beta::GcsSource, ::Hash]
332
+ # Required. Cloud Storage location for the input content.
333
+ # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource, ::Hash]
334
+ # Required. BigQuery input source.
335
+ # @param parent [::String]
336
+ # Required. Parent DataStore resource name, of the form
337
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
338
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1beta::ImportErrorConfig, ::Hash]
339
+ # The desired location of errors incurred during the Import. Cannot be set
340
+ # for inline user event imports.
341
+ # @yield [result, operation] Access the result along with the TransportOperation object
342
+ # @yieldparam result [::Gapic::Operation]
343
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
344
+ #
345
+ # @return [::Gapic::Operation]
346
+ #
347
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
348
+ def import_user_events request, options = nil
349
+ raise ::ArgumentError, "request must be provided" if request.nil?
350
+
351
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest
352
+
353
+ # Converts hash and nil to an options object
354
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
355
+
356
+ # Customize the options with defaults
357
+ call_metadata = @config.rpcs.import_user_events.metadata.to_h
358
+
359
+ # Set x-goog-api-client and x-goog-user-project headers
360
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
361
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
362
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
363
+ transports_version_send: [:rest]
364
+
365
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
366
+
367
+ options.apply_defaults timeout: @config.rpcs.import_user_events.timeout,
368
+ metadata: call_metadata,
369
+ retry_policy: @config.rpcs.import_user_events.retry_policy
370
+
371
+ options.apply_defaults timeout: @config.timeout,
372
+ metadata: @config.metadata,
373
+ retry_policy: @config.retry_policy
374
+
375
+ @user_event_service_stub.import_user_events request, options do |result, operation|
376
+ result = ::Gapic::Operation.new result, @operations_client, options: options
377
+ yield result, operation if block_given?
378
+ return result
379
+ end
380
+ rescue ::Gapic::Rest::Error => e
381
+ raise ::Google::Cloud::Error.from_error(e)
382
+ end
383
+
384
+ ##
385
+ # Configuration class for the UserEventService REST API.
386
+ #
387
+ # This class represents the configuration for UserEventService REST,
388
+ # providing control over timeouts, retry behavior, logging, transport
389
+ # parameters, and other low-level controls. Certain parameters can also be
390
+ # applied individually to specific RPCs. See
391
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client::Configuration::Rpcs}
392
+ # for a list of RPCs that can be configured independently.
393
+ #
394
+ # Configuration can be applied globally to all clients, or to a single client
395
+ # on construction.
396
+ #
397
+ # @example
398
+ #
399
+ # # Modify the global config, setting the timeout for
400
+ # # write_user_event to 20 seconds,
401
+ # # and all remaining timeouts to 10 seconds.
402
+ # ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client.configure do |config|
403
+ # config.timeout = 10.0
404
+ # config.rpcs.write_user_event.timeout = 20.0
405
+ # end
406
+ #
407
+ # # Apply the above configuration only to a new client.
408
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Rest::Client.new do |config|
409
+ # config.timeout = 10.0
410
+ # config.rpcs.write_user_event.timeout = 20.0
411
+ # end
412
+ #
413
+ # @!attribute [rw] endpoint
414
+ # The hostname or hostname:port of the service endpoint.
415
+ # Defaults to `"discoveryengine.googleapis.com"`.
416
+ # @return [::String]
417
+ # @!attribute [rw] credentials
418
+ # Credentials to send with calls. You may provide any of the following types:
419
+ # * (`String`) The path to a service account key file in JSON format
420
+ # * (`Hash`) A service account key as a Hash
421
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
422
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
423
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
424
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
425
+ # * (`nil`) indicating no credentials
426
+ # @return [::Object]
427
+ # @!attribute [rw] scope
428
+ # The OAuth scopes
429
+ # @return [::Array<::String>]
430
+ # @!attribute [rw] lib_name
431
+ # The library name as recorded in instrumentation and logging
432
+ # @return [::String]
433
+ # @!attribute [rw] lib_version
434
+ # The library version as recorded in instrumentation and logging
435
+ # @return [::String]
436
+ # @!attribute [rw] timeout
437
+ # The call timeout in seconds.
438
+ # @return [::Numeric]
439
+ # @!attribute [rw] metadata
440
+ # Additional headers to be sent with the call.
441
+ # @return [::Hash{::Symbol=>::String}]
442
+ # @!attribute [rw] retry_policy
443
+ # The retry policy. The value is a hash with the following keys:
444
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
445
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
446
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
447
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
448
+ # trigger a retry.
449
+ # @return [::Hash]
450
+ # @!attribute [rw] quota_project
451
+ # A separate project against which to charge quota.
452
+ # @return [::String]
453
+ #
454
+ class Configuration
455
+ extend ::Gapic::Config
456
+
457
+ config_attr :endpoint, "discoveryengine.googleapis.com", ::String
458
+ config_attr :credentials, nil do |value|
459
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
460
+ allowed.any? { |klass| klass === value }
461
+ end
462
+ config_attr :scope, nil, ::String, ::Array, nil
463
+ config_attr :lib_name, nil, ::String, nil
464
+ config_attr :lib_version, nil, ::String, nil
465
+ config_attr :timeout, nil, ::Numeric, nil
466
+ config_attr :metadata, nil, ::Hash, nil
467
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
468
+ config_attr :quota_project, nil, ::String, nil
469
+
470
+ # @private
471
+ def initialize parent_config = nil
472
+ @parent_config = parent_config unless parent_config.nil?
473
+
474
+ yield self if block_given?
475
+ end
476
+
477
+ ##
478
+ # Configurations for individual RPCs
479
+ # @return [Rpcs]
480
+ #
481
+ def rpcs
482
+ @rpcs ||= begin
483
+ parent_rpcs = nil
484
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
485
+ Rpcs.new parent_rpcs
486
+ end
487
+ end
488
+
489
+ ##
490
+ # Configuration RPC class for the UserEventService API.
491
+ #
492
+ # Includes fields providing the configuration for each RPC in this service.
493
+ # Each configuration object is of type `Gapic::Config::Method` and includes
494
+ # the following configuration fields:
495
+ #
496
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
497
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
498
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
499
+ # include the following keys:
500
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
501
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
502
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
503
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
504
+ # trigger a retry.
505
+ #
506
+ class Rpcs
507
+ ##
508
+ # RPC-specific configuration for `write_user_event`
509
+ # @return [::Gapic::Config::Method]
510
+ #
511
+ attr_reader :write_user_event
512
+ ##
513
+ # RPC-specific configuration for `collect_user_event`
514
+ # @return [::Gapic::Config::Method]
515
+ #
516
+ attr_reader :collect_user_event
517
+ ##
518
+ # RPC-specific configuration for `import_user_events`
519
+ # @return [::Gapic::Config::Method]
520
+ #
521
+ attr_reader :import_user_events
522
+
523
+ # @private
524
+ def initialize parent_rpcs = nil
525
+ write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event
526
+ @write_user_event = ::Gapic::Config::Method.new write_user_event_config
527
+ collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event
528
+ @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config
529
+ import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events
530
+ @import_user_events = ::Gapic::Config::Method.new import_user_events_config
531
+
532
+ yield self if block_given?
533
+ end
534
+ end
535
+ end
536
+ end
537
+ end
538
+ end
539
+ end
540
+ end
541
+ end
542
+ end