@google-cloud/discoveryengine 0.6.0 → 0.7.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 (44) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +38 -22
  3. package/build/protos/google/cloud/discoveryengine/v1/common.proto +100 -0
  4. package/build/protos/google/cloud/discoveryengine/v1/completion_service.proto +116 -0
  5. package/build/protos/google/cloud/discoveryengine/v1/document.proto +118 -0
  6. package/build/protos/google/cloud/discoveryengine/v1/document_service.proto +313 -0
  7. package/build/protos/google/cloud/discoveryengine/v1/import_config.proto +334 -0
  8. package/build/protos/google/cloud/discoveryengine/v1/purge_config.proto +86 -0
  9. package/build/protos/google/cloud/discoveryengine/v1/schema.proto +58 -0
  10. package/build/protos/google/cloud/discoveryengine/v1/schema_service.proto +256 -0
  11. package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +289 -0
  12. package/build/protos/google/cloud/discoveryengine/v1/user_event.proto +458 -0
  13. package/build/protos/google/cloud/discoveryengine/v1/user_event_service.proto +133 -0
  14. package/build/protos/google/cloud/discoveryengine/v1beta/import_config.proto +54 -0
  15. package/build/protos/google/cloud/discoveryengine/v1beta/search_service.proto +29 -4
  16. package/build/protos/protos.d.ts +6589 -0
  17. package/build/protos/protos.js +16050 -1
  18. package/build/protos/protos.json +1807 -0
  19. package/build/src/index.d.ts +18 -19
  20. package/build/src/index.js +9 -9
  21. package/build/src/v1/completion_service_client.d.ts +455 -0
  22. package/build/src/v1/completion_service_client.js +659 -0
  23. package/build/src/v1/completion_service_client_config.json +43 -0
  24. package/build/src/v1/document_service_client.d.ts +995 -0
  25. package/build/src/v1/document_service_client.js +1191 -0
  26. package/build/src/v1/document_service_client_config.json +82 -0
  27. package/build/src/v1/index.d.ts +5 -0
  28. package/build/src/v1/index.js +31 -0
  29. package/build/src/v1/schema_service_client.d.ts +795 -0
  30. package/build/src/v1/schema_service_client.js +1129 -0
  31. package/build/src/v1/schema_service_client_config.json +63 -0
  32. package/build/src/v1/search_service_client.d.ts +857 -0
  33. package/build/src/v1/search_service_client.js +1073 -0
  34. package/build/src/v1/search_service_client_config.json +43 -0
  35. package/build/src/v1/user_event_service_client.d.ts +638 -0
  36. package/build/src/v1/user_event_service_client.js +933 -0
  37. package/build/src/v1/user_event_service_client_config.json +62 -0
  38. package/build/src/v1beta/document_service_client.d.ts +52 -0
  39. package/build/src/v1beta/document_service_client.js +6 -0
  40. package/build/src/v1beta/schema_service_client.js +6 -0
  41. package/build/src/v1beta/search_service_client.d.ts +78 -12
  42. package/build/src/v1beta/search_service_client.js +52 -8
  43. package/build/src/v1beta/user_event_service_client.js +6 -0
  44. package/package.json +2 -2
@@ -0,0 +1,458 @@
1
+ // Copyright 2022 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package google.cloud.discoveryengine.v1;
18
+
19
+ import "google/api/field_behavior.proto";
20
+ import "google/api/resource.proto";
21
+ import "google/cloud/discoveryengine/v1/common.proto";
22
+ import "google/protobuf/duration.proto";
23
+ import "google/protobuf/timestamp.proto";
24
+
25
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
26
+ option go_package = "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb";
27
+ option java_multiple_files = true;
28
+ option java_outer_classname = "UserEventProto";
29
+ option java_package = "com.google.cloud.discoveryengine.v1";
30
+ option objc_class_prefix = "DISCOVERYENGINE";
31
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1";
32
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1";
33
+
34
+ // UserEvent captures all metadata information Discovery Engine API needs to
35
+ // know about how end users interact with customers' website.
36
+ message UserEvent {
37
+ // Required. User event type. Allowed values are:
38
+ //
39
+ // Generic values:
40
+ //
41
+ // * `search`: Search for Documents.
42
+ // * `view-item`: Detailed page view of a Document.
43
+ // * `view-item-list`: View of a panel or ordered list of Documents.
44
+ // * `view-home-page`: View of the home page.
45
+ // * `view-category-page`: View of a category page, e.g. Home > Men > Jeans
46
+ //
47
+ // Retail-related values:
48
+ //
49
+ // * `add-to-cart`: Add an item(s) to cart, e.g. in Retail online shopping
50
+ // * `purchase`: Purchase an item(s)
51
+ //
52
+ // Media-related values:
53
+ //
54
+ // * `media-play`: Start/resume watching a video, playing a song, etc.
55
+ // * `media-complete`: Finished or stopped midway through a video, song, etc.
56
+ string event_type = 1 [(google.api.field_behavior) = REQUIRED];
57
+
58
+ // Required. A unique identifier for tracking visitors.
59
+ //
60
+ // For example, this could be implemented with an HTTP cookie, which should be
61
+ // able to uniquely identify a visitor on a single device. This unique
62
+ // identifier should not change if the visitor log in/out of the website.
63
+ //
64
+ // Do not set the field to the same fixed ID for different users. This mixes
65
+ // the event history of those users together, which results in degraded model
66
+ // quality.
67
+ //
68
+ // The field must be a UTF-8 encoded string with a length limit of 128
69
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
70
+ //
71
+ // The field should not contain PII or user-data. We recommend to use Google
72
+ // Analytics [Client
73
+ // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
74
+ // for this field.
75
+ string user_pseudo_id = 2 [(google.api.field_behavior) = REQUIRED];
76
+
77
+ // Only required for
78
+ // [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1.UserEventService.ImportUserEvents]
79
+ // method. Timestamp of when the user event happened.
80
+ google.protobuf.Timestamp event_time = 3;
81
+
82
+ // Information about the end user.
83
+ UserInfo user_info = 4;
84
+
85
+ // Should set to true if the request is made directly from the end user, in
86
+ // which case the
87
+ // [UserEvent.user_info.user_agent][google.cloud.discoveryengine.v1.UserInfo.user_agent]
88
+ // can be populated from the HTTP request.
89
+ //
90
+ // This flag should be set only if the API request is made directly from the
91
+ // end user such as a mobile app (and not if a gateway or a server is
92
+ // processing and pushing the user events).
93
+ //
94
+ // This should not be set when using the JavaScript tag in
95
+ // [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent].
96
+ bool direct_user_request = 5;
97
+
98
+ // A unique identifier for tracking a visitor session with a length limit of
99
+ // 128 bytes. A session is an aggregation of an end user behavior in a time
100
+ // span.
101
+ //
102
+ // A general guideline to populate the session_id:
103
+ //
104
+ // 1. If user has no activity for 30 min, a new session_id should be assigned.
105
+ // 2. The session_id should be unique across users, suggest use uuid or add
106
+ // [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1.UserEvent.user_pseudo_id]
107
+ // as prefix.
108
+ string session_id = 6;
109
+
110
+ // Page metadata such as categories and other critical information for certain
111
+ // event types such as `view-category-page`.
112
+ PageInfo page_info = 7;
113
+
114
+ // Token to attribute an API response to user action(s) to trigger the event.
115
+ //
116
+ // Highly recommended for user events that are the result of
117
+ // [RecommendationService.Recommend][]. This field enables accurate
118
+ // attribution of recommendation model performance.
119
+ //
120
+ // The value must be one of:
121
+ //
122
+ // * [PredictResponse.attribution_token][] for events that are the result of
123
+ // [RecommendationService.Recommend][].
124
+ // * [SearchResponse.attribution_token][google.cloud.discoveryengine.v1.SearchResponse.attribution_token] for events that are the result of
125
+ // [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search].
126
+ // * [CompleteQueryResponse.attribution_token][] for events that are the
127
+ // result of
128
+ // [CompletionService.CompleteQuery][google.cloud.discoveryengine.v1.CompletionService.CompleteQuery].
129
+ //
130
+ // This token enables us to accurately attribute page view or conversion
131
+ // completion back to the event and the particular predict response containing
132
+ // this clicked/purchased product. If user clicks on product K in the
133
+ // recommendation results, pass [PredictResponse.attribution_token][] as a URL
134
+ // parameter to product K's page. When recording events on product K's page,
135
+ // log the [PredictResponse.attribution_token][] to this field.
136
+ string attribution_token = 8;
137
+
138
+ // The filter syntax consists of an expression language for constructing a
139
+ // predicate from one or more fields of the documents being filtered.
140
+ //
141
+ // One example is for `search` events, the associated
142
+ // [SearchRequest][google.cloud.discoveryengine.v1.SearchRequest] may contain
143
+ // a filter expression in [SearchRequest.filter][] conforming to
144
+ // https://google.aip.dev/160#filtering.
145
+ //
146
+ // Similarly, for `view-item-list` events that are generated from a
147
+ // [RecommendationService.RecommendRequest][], this field may be populated
148
+ // directly from [RecommendationService.RecommendRequest.filter][] conforming
149
+ // to https://google.aip.dev/160#filtering.
150
+ //
151
+ // The value must be a UTF-8 encoded string with a length limit of 1,000
152
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
153
+ string filter = 9;
154
+
155
+ // List of Documents associated with this user event.
156
+ //
157
+ // This field is optional except for the following event types:
158
+ //
159
+ // * `view-item`
160
+ // * `add-to-cart`
161
+ // * `purchase`
162
+ // * `media-play`
163
+ // * `media-complete`
164
+ //
165
+ // In a `search` event, this field represents the documents returned to the
166
+ // end user on the current page (the end user may have not finished browsing
167
+ // the whole page yet). When a new page is returned to the end user, after
168
+ // pagination/filtering/ordering even for the same query, a new `search` event
169
+ // with different
170
+ // [UserEvent.documents][google.cloud.discoveryengine.v1.UserEvent.documents]
171
+ // is desired.
172
+ repeated DocumentInfo documents = 10;
173
+
174
+ // Panel metadata associated with this user event.
175
+ PanelInfo panel = 11;
176
+
177
+ // Search API details related to the event.
178
+ //
179
+ // This field should be set for `search` event.
180
+ SearchInfo search_info = 12;
181
+
182
+ // CompleteQuery API details related to the event.
183
+ //
184
+ // This field should be set for `search` event when autocomplete function is
185
+ // enabled and the user clicks a suggestion for search.
186
+ CompletionInfo completion_info = 13;
187
+
188
+ // The transaction metadata (if any) associated with this user event.
189
+ TransactionInfo transaction_info = 14;
190
+
191
+ // A list of identifiers for the independent experiment groups this user event
192
+ // belongs to. This is used to distinguish between user events associated with
193
+ // different experiment setups on the customer end.
194
+ repeated string tag_ids = 15;
195
+
196
+ // The promotion IDs if this is an event associated with promotions.
197
+ // Currently, this field is restricted to at most one ID.
198
+ repeated string promotion_ids = 16;
199
+
200
+ // Extra user event features to include in the recommendation model.
201
+ // These attributes must NOT contain data that needs to be parsed or processed
202
+ // further, e.g. JSON or other encodings.
203
+ //
204
+ // If you provide custom attributes for ingested user events, also include
205
+ // them in the user events that you associate with prediction requests. Custom
206
+ // attribute formatting must be consistent between imported events and events
207
+ // provided with prediction requests. This lets the Discovery Engine API use
208
+ // those custom attributes when training models and serving predictions, which
209
+ // helps improve recommendation quality.
210
+ //
211
+ // This field needs to pass all below criteria, otherwise an
212
+ // `INVALID_ARGUMENT` error is returned:
213
+ //
214
+ // * The key must be a UTF-8 encoded string with a length limit of 5,000
215
+ // characters.
216
+ // * For text attributes, at most 400 values are allowed. Empty values are not
217
+ // allowed. Each value must be a UTF-8 encoded string with a length limit of
218
+ // 256 characters.
219
+ // * For number attributes, at most 400 values are allowed.
220
+ //
221
+ // For product recommendations, an example of extra user information is
222
+ // ` traffic_channel`, which is how a user arrives at the site. Users can
223
+ // arrive
224
+ // at the site by coming to the site directly, coming through Google
225
+ // search, or in other ways.
226
+ map<string, CustomAttribute> attributes = 17;
227
+
228
+ // Media-specific info.
229
+ MediaInfo media_info = 18;
230
+ }
231
+
232
+ // Detailed page information.
233
+ message PageInfo {
234
+ // A unique ID of a web page view.
235
+ //
236
+ // This should be kept the same for all user events triggered from the same
237
+ // pageview. For example, an item detail page view could trigger multiple
238
+ // events as the user is browsing the page. The `pageViewId` property should
239
+ // be kept the same for all these events so that they can be grouped together
240
+ // properly.
241
+ //
242
+ // When using the client side event reporting with JavaScript pixel and Google
243
+ // Tag Manager, this value is filled in automatically.
244
+ string pageview_id = 1;
245
+
246
+ // The most specific category associated with a category page.
247
+ //
248
+ // To represent full path of category, use '>' sign to separate different
249
+ // hierarchies. If '>' is part of the category name, please replace it with
250
+ // other character(s).
251
+ //
252
+ // Category pages include special pages such as sales or promotions. For
253
+ // instance, a special sale page may have the category hierarchy:
254
+ // "pageCategory" : "Sales > 2017 Black Friday Deals".
255
+ //
256
+ // Required for `view-category-page` events. Other event types should not set
257
+ // this field. Otherwise, an INVALID_ARGUMENT error is returned.
258
+ string page_category = 2;
259
+
260
+ // Complete URL (window.location.href) of the user's current page.
261
+ //
262
+ // When using the client side event reporting with JavaScript pixel and Google
263
+ // Tag Manager, this value is filled in automatically. Maximum length 5,000
264
+ // characters.
265
+ string uri = 3;
266
+
267
+ // The referrer URL of the current page.
268
+ //
269
+ // When using the client side event reporting with JavaScript pixel and Google
270
+ // Tag Manager, this value is filled in automatically. However, some browser
271
+ // privacy restrictions may cause this field to be empty.
272
+ string referrer_uri = 4;
273
+ }
274
+
275
+ // Detailed search information.
276
+ message SearchInfo {
277
+ // The user's search query.
278
+ //
279
+ // See
280
+ // [SearchRequest.query][google.cloud.discoveryengine.v1.SearchRequest.query]
281
+ // for definition.
282
+ //
283
+ // The value must be a UTF-8 encoded string with a length limit of 5,000
284
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
285
+ //
286
+ // At least one of
287
+ // [search_query][google.cloud.discoveryengine.v1.SearchInfo.search_query] or
288
+ // [PageInfo.page_category][google.cloud.discoveryengine.v1.PageInfo.page_category]
289
+ // is required for `search` events. Other event types should not set this
290
+ // field. Otherwise, an INVALID_ARGUMENT error is returned.
291
+ string search_query = 1;
292
+
293
+ // The order in which products are returned, if applicable.
294
+ //
295
+ // See [SearchRequest.order_by][] for definition and syntax.
296
+ //
297
+ // The value must be a UTF-8 encoded string with a length limit of 1,000
298
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
299
+ //
300
+ // This can only be set for `search` events. Other event types should not set
301
+ // this field. Otherwise, an INVALID_ARGUMENT error is returned.
302
+ string order_by = 2;
303
+
304
+ // An integer that specifies the current offset for pagination (the 0-indexed
305
+ // starting location, amongst the products deemed by the API as relevant).
306
+ //
307
+ // See
308
+ // [SearchRequest.offset][google.cloud.discoveryengine.v1.SearchRequest.offset]
309
+ // for definition.
310
+ //
311
+ // If this field is negative, an INVALID_ARGUMENT is returned.
312
+ //
313
+ // This can only be set for `search` events. Other event types should not set
314
+ // this field. Otherwise, an INVALID_ARGUMENT error is returned.
315
+ optional int32 offset = 3;
316
+ }
317
+
318
+ // Detailed completion information including completion attribution token and
319
+ // clicked completion info.
320
+ message CompletionInfo {
321
+ // End user selected [CompleteQueryResponse.CompletionResult.suggestion][].
322
+ string selected_suggestion = 1;
323
+
324
+ // End user selected [CompleteQueryResponse.CompletionResult.suggestion][]
325
+ // position, starting from 0.
326
+ int32 selected_position = 2;
327
+ }
328
+
329
+ // A transaction represents the entire purchase transaction.
330
+ message TransactionInfo {
331
+ // Required. Total non-zero value associated with the transaction. This value
332
+ // may include shipping, tax, or other adjustments to the total value that you
333
+ // want to include.
334
+ optional float value = 1 [(google.api.field_behavior) = REQUIRED];
335
+
336
+ // Required. Currency code. Use three-character ISO-4217 code.
337
+ string currency = 2 [(google.api.field_behavior) = REQUIRED];
338
+
339
+ // The transaction ID with a length limit of 128 characters.
340
+ string transaction_id = 3;
341
+
342
+ // All the taxes associated with the transaction.
343
+ optional float tax = 4;
344
+
345
+ // All the costs associated with the products. These can be manufacturing
346
+ // costs, shipping expenses not borne by the end user, or any other costs,
347
+ // such that:
348
+ //
349
+ // * Profit = [value][google.cloud.discoveryengine.v1.TransactionInfo.value] -
350
+ // [tax][google.cloud.discoveryengine.v1.TransactionInfo.tax] -
351
+ // [cost][google.cloud.discoveryengine.v1.TransactionInfo.cost]
352
+ optional float cost = 5;
353
+
354
+ // The total discount(s) value applied to this transaction.
355
+ // This figure should be excluded from
356
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1.TransactionInfo.value]
357
+ //
358
+ // For example, if a user paid
359
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1.TransactionInfo.value]
360
+ // amount, then nominal (pre-discount) value of the transaction is the sum of
361
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1.TransactionInfo.value]
362
+ // and
363
+ // [TransactionInfo.discount_value][google.cloud.discoveryengine.v1.TransactionInfo.discount_value]
364
+ //
365
+ // This means that profit is calculated the same way, regardless of the
366
+ // discount value, and that
367
+ // [TransactionInfo.discount_value][google.cloud.discoveryengine.v1.TransactionInfo.discount_value]
368
+ // can be larger than
369
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1.TransactionInfo.value]:
370
+ //
371
+ // * Profit = [value][google.cloud.discoveryengine.v1.TransactionInfo.value] -
372
+ // [tax][google.cloud.discoveryengine.v1.TransactionInfo.tax] -
373
+ // [cost][google.cloud.discoveryengine.v1.TransactionInfo.cost]
374
+ optional float discount_value = 6;
375
+ }
376
+
377
+ // Detailed document information associated with a user event.
378
+ message DocumentInfo {
379
+ // A required descriptor of the associated
380
+ // [Document][google.cloud.discoveryengine.v1.Document].
381
+ //
382
+ // * If [id][google.cloud.discoveryengine.v1.DocumentInfo.id] is specified,
383
+ // then the default values for
384
+ // `{location}`, `{collection_id}`, `{data_store_id}`, and `{branch_id}` are
385
+ // used when annotating with the stored Document.
386
+ //
387
+ // * If [name][google.cloud.discoveryengine.v1.DocumentInfo.name] is
388
+ // specified, then the provided values (default values allowed) for
389
+ // `{location}`, `{collection_id}`, `{data_store_id}`, and
390
+ // `{branch_id}` are used when annotating with the stored Document.
391
+ oneof document_descriptor {
392
+ // Required. The Document resource ID.
393
+ string id = 1 [(google.api.field_behavior) = REQUIRED];
394
+
395
+ // Required. The Document resource full name, of the form:
396
+ // `projects/{project_id}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/branches/{branch_id}/documents/{document_id}`
397
+ string name = 2 [
398
+ (google.api.field_behavior) = REQUIRED,
399
+ (google.api.resource_reference) = {
400
+ type: "discoveryengine.googleapis.com/Document"
401
+ }
402
+ ];
403
+ }
404
+
405
+ // Quantity of the Document associated with the user event. Defaults to 1.
406
+ //
407
+ // For example, this field will be 2 if two quantities of the same Document
408
+ // are involved in a `add-to-cart` event.
409
+ //
410
+ // Required for events of the following event types:
411
+ //
412
+ // * `add-to-cart`
413
+ // * `purchase`
414
+ optional int32 quantity = 3;
415
+
416
+ // The promotion IDs associated with this Document.
417
+ // Currently, this field is restricted to at most one ID.
418
+ repeated string promotion_ids = 4;
419
+ }
420
+
421
+ // Detailed panel information associated with a user event.
422
+ message PanelInfo {
423
+ // Required. The panel ID.
424
+ string panel_id = 2 [(google.api.field_behavior) = REQUIRED];
425
+
426
+ // The display name of the panel.
427
+ string display_name = 3;
428
+
429
+ // The ordered position of the panel, if shown to the user with other panels.
430
+ // If set, then
431
+ // [total_panels][google.cloud.discoveryengine.v1.PanelInfo.total_panels] must
432
+ // also be set.
433
+ optional int32 panel_position = 4;
434
+
435
+ // The total number of panels, including this one, shown to the user.
436
+ // Must be set if
437
+ // [panel_position][google.cloud.discoveryengine.v1.PanelInfo.panel_position]
438
+ // is set.
439
+ optional int32 total_panels = 5;
440
+ }
441
+
442
+ // Media-specific user event information.
443
+ message MediaInfo {
444
+ // The media progress time in seconds, if applicable.
445
+ // For example, if the end user has finished 90 seconds of a playback video,
446
+ // then [MediaInfo.media_progress_duration.seconds][Duration.seconds] should
447
+ // be set to 90.
448
+ google.protobuf.Duration media_progress_duration = 1;
449
+
450
+ // Media progress should be computed using only the media_progress_duration
451
+ // relative to the media total length.
452
+ //
453
+ // This value must be between `[0, 1.0]` inclusive.
454
+ //
455
+ // If this is not a playback or the progress cannot be computed (e.g. ongoing
456
+ // livestream), this field should be unset.
457
+ optional float media_progress_percentage = 2;
458
+ }
@@ -0,0 +1,133 @@
1
+ // Copyright 2022 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package google.cloud.discoveryengine.v1;
18
+
19
+ import "google/api/annotations.proto";
20
+ import "google/api/client.proto";
21
+ import "google/api/field_behavior.proto";
22
+ import "google/api/httpbody.proto";
23
+ import "google/api/resource.proto";
24
+ import "google/cloud/discoveryengine/v1/import_config.proto";
25
+ import "google/cloud/discoveryengine/v1/user_event.proto";
26
+ import "google/longrunning/operations.proto";
27
+
28
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
29
+ option go_package = "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb";
30
+ option java_multiple_files = true;
31
+ option java_outer_classname = "UserEventServiceProto";
32
+ option java_package = "com.google.cloud.discoveryengine.v1";
33
+ option objc_class_prefix = "DISCOVERYENGINE";
34
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1";
35
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1";
36
+
37
+ // Service for ingesting end user actions on a website to Discovery Engine API.
38
+ service UserEventService {
39
+ option (google.api.default_host) = "discoveryengine.googleapis.com";
40
+ option (google.api.oauth_scopes) =
41
+ "https://www.googleapis.com/auth/cloud-platform";
42
+
43
+ // Writes a single user event.
44
+ rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) {
45
+ option (google.api.http) = {
46
+ post: "/v1/{parent=projects/*/locations/*/dataStores/*}/userEvents:write"
47
+ body: "user_event"
48
+ additional_bindings {
49
+ post: "/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:write"
50
+ body: "user_event"
51
+ }
52
+ };
53
+ }
54
+
55
+ // Writes a single user event from the browser. This uses a GET request to
56
+ // due to browser restriction of POST-ing to a 3rd party domain.
57
+ //
58
+ // This method is used only by the Discovery Engine API JavaScript pixel and
59
+ // Google Tag Manager. Users should not call this method directly.
60
+ rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) {
61
+ option (google.api.http) = {
62
+ get: "/v1/{parent=projects/*/locations/*/dataStores/*}/userEvents:collect"
63
+ additional_bindings {
64
+ get: "/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:collect"
65
+ }
66
+ };
67
+ }
68
+
69
+ // Bulk import of User events. Request processing might be
70
+ // synchronous. Events that already exist are skipped.
71
+ // Use this method for backfilling historical user events.
72
+ //
73
+ // Operation.response is of type ImportResponse. Note that it is
74
+ // possible for a subset of the items to be successfully inserted.
75
+ // Operation.metadata is of type ImportMetadata.
76
+ rpc ImportUserEvents(ImportUserEventsRequest)
77
+ returns (google.longrunning.Operation) {
78
+ option (google.api.http) = {
79
+ post: "/v1/{parent=projects/*/locations/*/dataStores/*}/userEvents:import"
80
+ body: "*"
81
+ additional_bindings {
82
+ post: "/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:import"
83
+ body: "*"
84
+ }
85
+ };
86
+ option (google.longrunning.operation_info) = {
87
+ response_type: "google.cloud.discoveryengine.v1.ImportUserEventsResponse"
88
+ metadata_type: "google.cloud.discoveryengine.v1.ImportUserEventsMetadata"
89
+ };
90
+ }
91
+ }
92
+
93
+ // Request message for WriteUserEvent method.
94
+ message WriteUserEventRequest {
95
+ // Required. The parent DataStore resource name, such as
96
+ // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
97
+ string parent = 1 [
98
+ (google.api.field_behavior) = REQUIRED,
99
+ (google.api.resource_reference) = {
100
+ type: "discoveryengine.googleapis.com/DataStore"
101
+ }
102
+ ];
103
+
104
+ // Required. User event to write.
105
+ optional UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED];
106
+ }
107
+
108
+ // Request message for CollectUserEvent method.
109
+ message CollectUserEventRequest {
110
+ // Required. The parent DataStore resource name, such as
111
+ // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
112
+ string parent = 1 [
113
+ (google.api.field_behavior) = REQUIRED,
114
+ (google.api.resource_reference) = {
115
+ type: "discoveryengine.googleapis.com/DataStore"
116
+ }
117
+ ];
118
+
119
+ // Required. URL encoded UserEvent proto with a length limit of 2,000,000
120
+ // characters.
121
+ string user_event = 2 [(google.api.field_behavior) = REQUIRED];
122
+
123
+ // The URL including cgi-parameters but excluding the hash fragment with a
124
+ // length limit of 5,000 characters. This is often more useful than the
125
+ // referer URL, because many browsers only send the domain for 3rd party
126
+ // requests.
127
+ optional string uri = 3;
128
+
129
+ // The event timestamp in milliseconds. This prevents browser caching of
130
+ // otherwise identical get requests. The name is abbreviated to reduce the
131
+ // payload bytes.
132
+ optional int64 ets = 4;
133
+ }
@@ -269,6 +269,60 @@ message ImportDocumentsRequest {
269
269
  // be imported. Defaults to
270
270
  // [ReconciliationMode.INCREMENTAL][google.cloud.discoveryengine.v1beta.ImportDocumentsRequest.ReconciliationMode.INCREMENTAL].
271
271
  ReconciliationMode reconciliation_mode = 6;
272
+
273
+ // Whether to automatically generate IDs for the documents if absent.
274
+ //
275
+ // If set to `true`,
276
+ // [Document.id][google.cloud.discoveryengine.v1beta.Document.id]s are
277
+ // automatically generated based on the hash of the payload, where IDs may not
278
+ // be consistent during multiple imports. In which case
279
+ // [ReconciliationMode.FULL][google.cloud.discoveryengine.v1beta.ImportDocumentsRequest.ReconciliationMode.FULL]
280
+ // is highly recommended to avoid duplicate contents. If unset or set to
281
+ // `false`, [Document.id][google.cloud.discoveryengine.v1beta.Document.id]s
282
+ // have to be specified using
283
+ // [id_field][google.cloud.discoveryengine.v1beta.ImportDocumentsRequest.id_field],
284
+ // otherwises, documents without IDs will fail to be imported.
285
+ //
286
+ // Only set this field when using
287
+ // [GcsSource][google.cloud.discoveryengine.v1beta.GcsSource] or
288
+ // [BigQuerySource][google.cloud.discoveryengine.v1beta.BigQuerySource], and
289
+ // when
290
+ // [GcsSource.data_schema][google.cloud.discoveryengine.v1beta.GcsSource.data_schema]
291
+ // or
292
+ // [BigQuerySource.data_schema][google.cloud.discoveryengine.v1beta.BigQuerySource.data_schema]
293
+ // is `custom`. Otherwise, an INVALID_ARGUMENT error is thrown.
294
+ bool auto_generate_ids = 8;
295
+
296
+ // The field in the Cloud Storage and BigQuery sources that indicates the
297
+ // unique IDs of the documents.
298
+ //
299
+ // For [GcsSource][google.cloud.discoveryengine.v1beta.GcsSource] it is the
300
+ // key of the JSON field. For instance, `my_id` for JSON `{"my_id":
301
+ // "some_uuid"}`. For
302
+ // [BigQuerySource][google.cloud.discoveryengine.v1beta.BigQuerySource] it is
303
+ // the column name of the BigQuery table where the unique ids are stored.
304
+ //
305
+ // The values of the JSON field or the BigQuery column will be used as the
306
+ // [Document.id][google.cloud.discoveryengine.v1beta.Document.id]s. The JSON
307
+ // field or the BigQuery column must be of string type, and the values must be
308
+ // set as valid strings conform to
309
+ // [RFC-1034](https://tools.ietf.org/html/rfc1034) with 1-63 characters.
310
+ // Otherwise, documents without valid IDs will fail to be imported.
311
+ //
312
+ // Only set this field when using
313
+ // [GcsSource][google.cloud.discoveryengine.v1beta.GcsSource] or
314
+ // [BigQuerySource][google.cloud.discoveryengine.v1beta.BigQuerySource], and
315
+ // when
316
+ // [GcsSource.data_schema][google.cloud.discoveryengine.v1beta.GcsSource.data_schema]
317
+ // or
318
+ // [BigQuerySource.data_schema][google.cloud.discoveryengine.v1beta.BigQuerySource.data_schema]
319
+ // is `custom`. And only set this field when
320
+ // [auto_generate_ids][google.cloud.discoveryengine.v1beta.ImportDocumentsRequest.auto_generate_ids]
321
+ // is unset or set as `false`. Otherwise, an INVALID_ARGUMENT error is thrown.
322
+ //
323
+ // If it is unset, a default value `_id` is used when importing from the
324
+ // allowed data sources.
325
+ string id_field = 9;
272
326
  }
273
327
 
274
328
  // Response of the