@google-cloud/discoveryengine 0.1.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 (32) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +202 -0
  3. package/README.md +209 -0
  4. package/build/protos/google/cloud/discoveryengine/v1beta/common.proto +93 -0
  5. package/build/protos/google/cloud/discoveryengine/v1beta/document.proto +77 -0
  6. package/build/protos/google/cloud/discoveryengine/v1beta/document_service.proto +261 -0
  7. package/build/protos/google/cloud/discoveryengine/v1beta/import_config.proto +265 -0
  8. package/build/protos/google/cloud/discoveryengine/v1beta/recommendation_service.proto +182 -0
  9. package/build/protos/google/cloud/discoveryengine/v1beta/user_event.proto +453 -0
  10. package/build/protos/google/cloud/discoveryengine/v1beta/user_event_service.proto +122 -0
  11. package/build/protos/protos.d.ts +10120 -0
  12. package/build/protos/protos.js +26118 -0
  13. package/build/protos/protos.json +2682 -0
  14. package/build/src/index.d.ts +17 -0
  15. package/build/src/index.js +37 -0
  16. package/build/src/index.js.map +1 -0
  17. package/build/src/v1beta/document_service_client.d.ts +684 -0
  18. package/build/src/v1beta/document_service_client.js +830 -0
  19. package/build/src/v1beta/document_service_client.js.map +1 -0
  20. package/build/src/v1beta/document_service_client_config.json +77 -0
  21. package/build/src/v1beta/index.d.ts +3 -0
  22. package/build/src/v1beta/index.js +27 -0
  23. package/build/src/v1beta/index.js.map +1 -0
  24. package/build/src/v1beta/recommendation_service_client.d.ts +307 -0
  25. package/build/src/v1beta/recommendation_service_client.js +407 -0
  26. package/build/src/v1beta/recommendation_service_client.js.map +1 -0
  27. package/build/src/v1beta/recommendation_service_client_config.json +43 -0
  28. package/build/src/v1beta/user_event_service_client.d.ts +445 -0
  29. package/build/src/v1beta/user_event_service_client.js +628 -0
  30. package/build/src/v1beta/user_event_service_client.js.map +1 -0
  31. package/build/src/v1beta/user_event_service_client_config.json +62 -0
  32. package/package.json +66 -0
@@ -0,0 +1,182 @@
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.v1beta;
18
+
19
+ import "google/api/annotations.proto";
20
+ import "google/api/client.proto";
21
+ import "google/api/field_behavior.proto";
22
+ import "google/api/resource.proto";
23
+ import "google/cloud/discoveryengine/v1beta/document.proto";
24
+ import "google/cloud/discoveryengine/v1beta/user_event.proto";
25
+ import "google/protobuf/struct.proto";
26
+
27
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
28
+ option go_package = "google.golang.org/genproto/googleapis/cloud/discoveryengine/v1beta;discoveryengine";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "RecommendationServiceProto";
31
+ option java_package = "com.google.cloud.discoveryengine.v1beta";
32
+ option objc_class_prefix = "DISCOVERYENGINE";
33
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
34
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
35
+
36
+ // Service for making recommendations.
37
+ service RecommendationService {
38
+ option (google.api.default_host) = "discoveryengine.googleapis.com";
39
+ option (google.api.oauth_scopes) =
40
+ "https://www.googleapis.com/auth/cloud-platform";
41
+
42
+ // Makes a recommendation, which requires a contextual user event.
43
+ rpc Recommend(RecommendRequest) returns (RecommendResponse) {
44
+ option (google.api.http) = {
45
+ post: "/v1beta/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:recommend"
46
+ body: "*"
47
+ };
48
+ }
49
+ }
50
+
51
+ // Request message for Recommend method.
52
+ message RecommendRequest {
53
+ // Required. Full resource name of the format:
54
+ // projects/*/locations/global/dataStores/*/servingConfigs/*
55
+ //
56
+ // Before you can request recommendations from your model, you must create at
57
+ // least one serving config for it.
58
+ string serving_config = 1 [
59
+ (google.api.field_behavior) = REQUIRED,
60
+ (google.api.resource_reference) = {
61
+ type: "discoveryengine.googleapis.com/ServingConfig"
62
+ }
63
+ ];
64
+
65
+ // Required. Context about the user, what they are looking at and what action
66
+ // they took to trigger the Recommend request. Note that this user event
67
+ // detail won't be ingested to userEvent logs. Thus, a separate userEvent
68
+ // write request is required for event logging.
69
+ //
70
+ // Don't set
71
+ // [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
72
+ // or
73
+ // [UserEvent.user_info.user_id][google.cloud.discoveryengine.v1beta.UserInfo.user_id]
74
+ // to the same fixed ID for different users. If you are trying to receive
75
+ // non-personalized recommendations (not recommended; this can negatively
76
+ // impact model performance), instead set
77
+ // [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
78
+ // to a random unique ID and leave
79
+ // [UserEvent.user_info.user_id][google.cloud.discoveryengine.v1beta.UserInfo.user_id]
80
+ // unset.
81
+ UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED];
82
+
83
+ // Maximum number of results to return. Set this property
84
+ // to the number of recommendation results needed. If zero, the service will
85
+ // choose a reasonable default. The maximum allowed value is 100. Values
86
+ // above 100 will be coerced to 100.
87
+ int32 page_size = 3;
88
+
89
+ // Filter for restricting recommendation results with a length limit of 5,000
90
+ // characters. Currently, only filter expressions on the `filter_tags`
91
+ // attribute is supported.
92
+ //
93
+ //
94
+ // Examples:
95
+ //
96
+ // * (filter_tags: ANY("Red", "Blue") OR filter_tags: ANY("Hot", "Cold"))
97
+ // * (filter_tags: ANY("Red", "Blue")) AND NOT (filter_tags: ANY("Green"))
98
+ //
99
+ // If your filter blocks all results, the API will return generic
100
+ // (unfiltered) popular Documents. If you only want results strictly matching
101
+ // the filters, set `strictFiltering` to True in
102
+ // [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params]
103
+ // to receive empty results instead.
104
+ //
105
+ // Note that the API will never return Documents with storageStatus of
106
+ // "EXPIRED" or "DELETED" regardless of filter choices.
107
+ string filter = 4;
108
+
109
+ // Use validate only mode for this recommendation query. If set to true, a
110
+ // fake model will be used that returns arbitrary Document IDs.
111
+ // Note that the validate only mode should only be used for testing the API,
112
+ // or if the model is not ready.
113
+ bool validate_only = 5;
114
+
115
+ // Additional domain specific parameters for the recommendations.
116
+ //
117
+ // Allowed values:
118
+ //
119
+ // * `returnDocument`: Boolean. If set to true, the associated Document
120
+ // object will be returned in
121
+ // [RecommendResponse.results.document][RecommendationResult.document].
122
+ // * `returnScore`: Boolean. If set to true, the recommendation 'score'
123
+ // corresponding to each returned Document will be set in
124
+ // [RecommendResponse.results.metadata][RecommendationResult.metadata]. The
125
+ // given 'score' indicates the probability of a Document conversion given
126
+ // the user's context and history.
127
+ // * `strictFiltering`: Boolean. True by default. If set to false, the service
128
+ // will return generic (unfiltered) popular Documents instead of empty if
129
+ // your filter blocks all recommendation results.
130
+ // * `diversityLevel`: String. Default empty. If set to be non-empty, then
131
+ // it needs to be one of:
132
+ // * 'no-diversity'
133
+ // * 'low-diversity'
134
+ // * 'medium-diversity'
135
+ // * 'high-diversity'
136
+ // * 'auto-diversity'
137
+ // This gives request-level control and adjusts recommendation results
138
+ // based on Document category.
139
+ map<string, google.protobuf.Value> params = 6;
140
+ }
141
+
142
+ // Response message for Recommend method.
143
+ message RecommendResponse {
144
+ // RecommendationResult represents a generic recommendation result with
145
+ // associated metadata.
146
+ message RecommendationResult {
147
+ // Resource ID of the recommended Document.
148
+ string id = 1;
149
+
150
+ // Set if `returnDocument` is set to true in
151
+ // [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params].
152
+ Document document = 2;
153
+
154
+ // Additional Document metadata / annotations.
155
+ //
156
+ // Possible values:
157
+ //
158
+ // * `score`: Recommendation score in double value. Is set if
159
+ // `returnScore` is set to true in
160
+ // [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params].
161
+ map<string, google.protobuf.Value> metadata = 3;
162
+ }
163
+
164
+ // A list of recommended Documents. The order represents the ranking (from the
165
+ // most relevant Document to the least).
166
+ repeated RecommendationResult results = 1;
167
+
168
+ // A unique attribution token. This should be included in the
169
+ // [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] logs resulting
170
+ // from this recommendation, which enables accurate attribution of
171
+ // recommendation model performance.
172
+ string attribution_token = 2;
173
+
174
+ // IDs of documents in the request that were missing from the default Branch
175
+ // associated with the requested ServingConfig.
176
+ repeated string missing_ids = 3;
177
+
178
+ // True if
179
+ // [RecommendRequest.validate_only][google.cloud.discoveryengine.v1beta.RecommendRequest.validate_only]
180
+ // was set.
181
+ bool validate_only = 4;
182
+ }
@@ -0,0 +1,453 @@
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.v1beta;
18
+
19
+ import "google/api/field_behavior.proto";
20
+ import "google/api/resource.proto";
21
+ import "google/cloud/discoveryengine/v1beta/common.proto";
22
+ import "google/protobuf/duration.proto";
23
+ import "google/protobuf/timestamp.proto";
24
+
25
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
26
+ option go_package = "google.golang.org/genproto/googleapis/cloud/discoveryengine/v1beta;discoveryengine";
27
+ option java_multiple_files = true;
28
+ option java_outer_classname = "UserEventProto";
29
+ option java_package = "com.google.cloud.discoveryengine.v1beta";
30
+ option objc_class_prefix = "DISCOVERYENGINE";
31
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
32
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
33
+
34
+ // UserEvent captures all metadata information DiscoveryEngine API needs to know
35
+ // about how end users interact with customers' website.
36
+ message UserEvent {
37
+ // Required. User event type. Allowed values are:
38
+ //
39
+ // Generic values:
40
+ // * `search`: Search for Documents.
41
+ // * `view-item`: Detailed page view of a Document.
42
+ // * `view-item-list`: View of a panel or ordered list of Documents.
43
+ // * `view-home-page`: View of the home page.
44
+ // * `view-category-page`: View of a category page, e.g. Home > Men > Jeans
45
+ //
46
+ // Retail-related values:
47
+ // * `add-to-cart`: Add an item(s) to cart, e.g. in Retail online shopping
48
+ // * `purchase`: Purchase an item(s)
49
+ //
50
+ // Media-related values:
51
+ // * `media-play`: Start/resume watching a video, playing a song, etc.
52
+ // * `media-complete`: Finished or stopped midway through a video, song, etc.
53
+ string event_type = 1 [(google.api.field_behavior) = REQUIRED];
54
+
55
+ // Required. A unique identifier for tracking visitors.
56
+ //
57
+ // For example, this could be implemented with an HTTP cookie, which should be
58
+ // able to uniquely identify a visitor on a single device. This unique
59
+ // identifier should not change if the visitor log in/out of the website.
60
+ //
61
+ // Do not set the field to the same fixed ID for different users. This mixes
62
+ // the event history of those users together, which results in degraded model
63
+ // quality.
64
+ //
65
+ // The field must be a UTF-8 encoded string with a length limit of 128
66
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
67
+ //
68
+ // The field should not contain PII or user-data. We recommend to use Google
69
+ // Analytics [Client
70
+ // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
71
+ // for this field.
72
+ string user_pseudo_id = 2 [(google.api.field_behavior) = REQUIRED];
73
+
74
+ // Only required for
75
+ // [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1beta.UserEventService.ImportUserEvents]
76
+ // method. Timestamp of when the user event happened.
77
+ google.protobuf.Timestamp event_time = 3;
78
+
79
+ // Information about the end user.
80
+ UserInfo user_info = 4;
81
+
82
+ // Should set to true if the request is made directly from the end user, in
83
+ // which case the
84
+ // [UserEvent.user_info.user_agent][google.cloud.discoveryengine.v1beta.UserInfo.user_agent]
85
+ // can be populated from the HTTP request.
86
+ //
87
+ // This flag should be set only if the API request is made directly from the
88
+ // end user such as a mobile app (and not if a gateway or a server is
89
+ // processing and pushing the user events).
90
+ //
91
+ // This should not be set when using the JavaScript tag in
92
+ // [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1beta.UserEventService.CollectUserEvent].
93
+ bool direct_user_request = 5;
94
+
95
+ // A unique identifier for tracking a visitor session with a length limit of
96
+ // 128 bytes. A session is an aggregation of an end user behavior in a time
97
+ // span.
98
+ //
99
+ // A general guideline to populate the sesion_id:
100
+ // 1. If user has no activity for 30 min, a new session_id should be assigned.
101
+ // 2. The session_id should be unique across users, suggest use uuid or add
102
+ // [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
103
+ // as prefix.
104
+ string session_id = 6;
105
+
106
+ // Page metadata such as categories and other critical information for certain
107
+ // event types such as `view-category-page`.
108
+ PageInfo page_info = 7;
109
+
110
+ // Token to attribute an API response to user action(s) to trigger the event.
111
+ //
112
+ // Highly recommended for user events that are the result of
113
+ // [PredictionService.Predict][]. This field enables accurate attribution of
114
+ // recommendation model performance.
115
+ //
116
+ // The value must be one of:
117
+ //
118
+ // * [PredictResponse.attribution_token][] for events that are the result of
119
+ // [PredictionService.Predict][].
120
+ // * [SearchResponse.attribution_token][google.cloud.discoveryengine.v1beta.SearchResponse.attribution_token] for events that are the result of
121
+ // [SearchService.Search][].
122
+ // * [CompleteQueryResponse.attribution_token][] for events that are the
123
+ // result of [SearchService.CompleteQuery][].
124
+ //
125
+ // This token enables us to accurately attribute page view or conversion
126
+ // completion back to the event and the particular predict response containing
127
+ // this clicked/purchased product. If user clicks on product K in the
128
+ // recommendation results, pass [PredictResponse.attribution_token][] as a URL
129
+ // parameter to product K's page. When recording events on product K's page,
130
+ // log the [PredictResponse.attribution_token][] to this field.
131
+ string attribution_token = 8;
132
+
133
+ // The filter syntax consists of an expression language for constructing a
134
+ // predicate from one or more fields of the documents being filtered.
135
+ //
136
+ // One example is for `search` events, the associated
137
+ // [SearchService.SearchRequest][] may contain a filter expression in
138
+ // [SearchService.SearchRequest.filter][] conforming to
139
+ // https://google.aip.dev/160#filtering.
140
+ //
141
+ // Similarly, for `view-item-list` events that are generated from a
142
+ // [PredictionService.PredictRequest][], this field may be populated directly
143
+ // from [PredictionService.PredictRequest.filter][] conforming to
144
+ // https://google.aip.dev/160#filtering.
145
+ //
146
+ // The value must be a UTF-8 encoded string with a length limit of 1,000
147
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
148
+ string filter = 9;
149
+
150
+ // List of Documents associated with this user event.
151
+ //
152
+ // This field is optional except for the following event types:
153
+ //
154
+ // * `view-item`
155
+ // * `add-to-cart`
156
+ // * `purchase`
157
+ // * `media-play`
158
+ // * `media-complete`
159
+ //
160
+ // In a `search` event, this field represents the documents returned to the
161
+ // end user on the current page (the end user may have not finished browsing
162
+ // the whole page yet). When a new page is returned to the end user, after
163
+ // pagination/filtering/ordering even for the same query, a new `search` event
164
+ // with different
165
+ // [UserEvent.documents][google.cloud.discoveryengine.v1beta.UserEvent.documents]
166
+ // is desired.
167
+ repeated DocumentInfo documents = 10;
168
+
169
+ // Panel metadata associated with this user event.
170
+ PanelInfo panel = 11;
171
+
172
+ // Search API details related to the event.
173
+ //
174
+ // This field should be set for `search` event.
175
+ SearchInfo search_info = 12;
176
+
177
+ // CompleteQuery API details related to the event.
178
+ //
179
+ // This field should be set for `search` event when autocomplete function is
180
+ // enabled and the user clicks a suggestion for search.
181
+ CompletionInfo completion_info = 13;
182
+
183
+ // The transaction metadata (if any) associated with this user event.
184
+ TransactionInfo transaction_info = 14;
185
+
186
+ // A list of identifiers for the independent experiment groups this user event
187
+ // belongs to. This is used to distinguish between user events associated with
188
+ // different experiment setups on the customer end.
189
+ repeated string tag_ids = 15;
190
+
191
+ // The promotion IDs if this is an event associated with promotions.
192
+ // Currently, this field is restricted to at most one ID.
193
+ repeated string promotion_ids = 16;
194
+
195
+ // Extra user event features to include in the recommendation model.
196
+ // These attributes must NOT contain data that needs to be parsed or processed
197
+ // further, e.g. JSON or other encodings.
198
+ //
199
+ // If you provide custom attributes for ingested user events, also include
200
+ // them in the user events that you associate with prediction requests. Custom
201
+ // attribute formatting must be consistent between imported events and events
202
+ // provided with prediction requests. This lets the DiscoveryEngine API use
203
+ // those custom attributes when training models and serving predictions, which
204
+ // helps improve recommendation quality.
205
+ //
206
+ // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
207
+ // error is returned:
208
+ //
209
+ // * The key must be a UTF-8 encoded string with a length limit of 5,000
210
+ // characters.
211
+ // * For text attributes, at most 400 values are allowed. Empty values are not
212
+ // allowed. Each value must be a UTF-8 encoded string with a length limit of
213
+ // 256 characters.
214
+ // * For number attributes, at most 400 values are allowed.
215
+ //
216
+ // For product recommendations, an example of extra user information is
217
+ // traffic_channel, which is how a user arrives at the site. Users can arrive
218
+ // at the site by coming to the site directly, coming through Google
219
+ // search, or in other ways.
220
+ map<string, CustomAttribute> attributes = 17;
221
+
222
+ // Media-specific info.
223
+ MediaInfo media_info = 18;
224
+ }
225
+
226
+ // Detailed page information.
227
+ message PageInfo {
228
+ // A unique ID of a web page view.
229
+ //
230
+ // This should be kept the same for all user events triggered from the same
231
+ // pageview. For example, an item detail page view could trigger multiple
232
+ // events as the user is browsing the page. The `pageViewId` property should
233
+ // be kept the same for all these events so that they can be grouped together
234
+ // properly.
235
+ //
236
+ // When using the client side event reporting with JavaScript pixel and Google
237
+ // Tag Manager, this value is filled in automatically.
238
+ string pageview_id = 1;
239
+
240
+ // The most specific category associated with a category page.
241
+ //
242
+ // To represent full path of category, use '>' sign to separate different
243
+ // hierarchies. If '>' is part of the category name, please replace it with
244
+ // other character(s).
245
+ //
246
+ // Category pages include special pages such as sales or promotions. For
247
+ // instance, a special sale page may have the category hierarchy:
248
+ // "pageCategory" : "Sales > 2017 Black Friday Deals".
249
+ //
250
+ // Required for `view-category-page` events. Other event types should not set
251
+ // this field. Otherwise, an INVALID_ARGUMENT error is returned.
252
+ string page_category = 2;
253
+
254
+ // Complete URL (window.location.href) of the user's current page.
255
+ //
256
+ // When using the client side event reporting with JavaScript pixel and Google
257
+ // Tag Manager, this value is filled in automatically. Maximum length 5,000
258
+ // characters.
259
+ string uri = 3;
260
+
261
+ // The referrer URL of the current page.
262
+ //
263
+ // When using the client side event reporting with JavaScript pixel and Google
264
+ // Tag Manager, this value is filled in automatically. However, some browser
265
+ // privacy restrictions may cause this field to be empty.
266
+ string referrer_uri = 4;
267
+ }
268
+
269
+ // Detailed search information.
270
+ message SearchInfo {
271
+ // The user's search query.
272
+ //
273
+ // See
274
+ // [SearchRequest.query][google.cloud.discoveryengine.v1beta.SearchRequest.query]
275
+ // for definition.
276
+ //
277
+ // The value must be a UTF-8 encoded string with a length limit of 5,000
278
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
279
+ //
280
+ // At least one of
281
+ // [search_query][google.cloud.discoveryengine.v1beta.SearchInfo.search_query]
282
+ // or [page_categories][] is required for `search` events. Other event types
283
+ // should not set this field. Otherwise, an INVALID_ARGUMENT error is
284
+ // returned.
285
+ string search_query = 1;
286
+
287
+ // The order in which products are returned, if applicable.
288
+ //
289
+ // See
290
+ // [SearchRequest.order_by][google.cloud.discoveryengine.v1beta.SearchRequest.order_by]
291
+ // for definition and syntax.
292
+ //
293
+ // The value must be a UTF-8 encoded string with a length limit of 1,000
294
+ // characters. Otherwise, an INVALID_ARGUMENT error is returned.
295
+ //
296
+ // This can only be set for `search` events. Other event types should not set
297
+ // this field. Otherwise, an INVALID_ARGUMENT error is returned.
298
+ string order_by = 2;
299
+
300
+ // An integer that specifies the current offset for pagination (the 0-indexed
301
+ // starting location, amongst the products deemed by the API as relevant).
302
+ //
303
+ // See
304
+ // [SearchRequest.offset][google.cloud.discoveryengine.v1beta.SearchRequest.offset]
305
+ // for definition.
306
+ //
307
+ // If this field is negative, an INVALID_ARGUMENT is returned.
308
+ //
309
+ // This can only be set for `search` events. Other event types should not set
310
+ // this field. Otherwise, an INVALID_ARGUMENT error is returned.
311
+ optional int32 offset = 3;
312
+ }
313
+
314
+ // Detailed completion information including completion attribution token and
315
+ // clicked completion info.
316
+ message CompletionInfo {
317
+ // End user selected [CompleteQueryResponse.CompletionResult.suggestion][].
318
+ string selected_suggestion = 1;
319
+
320
+ // End user selected [CompleteQueryResponse.CompletionResult.suggestion][]
321
+ // position, starting from 0.
322
+ int32 selected_position = 2;
323
+ }
324
+
325
+ // A transaction represents the entire purchase transaction.
326
+ message TransactionInfo {
327
+ // Required. Total non-zero value associated with the transaction. This value
328
+ // may include shipping, tax, or other adjustments to the total value that you
329
+ // want to include.
330
+ optional float value = 1 [(google.api.field_behavior) = REQUIRED];
331
+
332
+ // Required. Currency code. Use three-character ISO-4217 code.
333
+ string currency = 2 [(google.api.field_behavior) = REQUIRED];
334
+
335
+ // The transaction ID with a length limit of 128 characters.
336
+ string transaction_id = 3;
337
+
338
+ // All the taxes associated with the transaction.
339
+ optional float tax = 4;
340
+
341
+ // All the costs associated with the products. These can be manufacturing
342
+ // costs, shipping expenses not borne by the end user, or any other costs,
343
+ // such that:
344
+ //
345
+ // * Profit =
346
+ // [value][google.cloud.discoveryengine.v1beta.TransactionInfo.value] -
347
+ // [tax][google.cloud.discoveryengine.v1beta.TransactionInfo.tax] -
348
+ // [cost][google.cloud.discoveryengine.v1beta.TransactionInfo.cost]
349
+ optional float cost = 5;
350
+
351
+ // The total discount(s) value applied to this transaction.
352
+ // This figure should be excluded from
353
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1beta.TransactionInfo.value]
354
+ //
355
+ // For example, if a user paid
356
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1beta.TransactionInfo.value]
357
+ // amount, then nominal (pre-discount) value of the transaction is the sum of
358
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1beta.TransactionInfo.value]
359
+ // and
360
+ // [TransactionInfo.discount_value][google.cloud.discoveryengine.v1beta.TransactionInfo.discount_value]
361
+ //
362
+ // This means that profit is calculated the same way, regardless of the
363
+ // discount value, and that
364
+ // [TransactionInfo.discount_value][google.cloud.discoveryengine.v1beta.TransactionInfo.discount_value]
365
+ // can be larger than
366
+ // [TransactionInfo.value][google.cloud.discoveryengine.v1beta.TransactionInfo.value]:
367
+ //
368
+ // * Profit =
369
+ // [value][google.cloud.discoveryengine.v1beta.TransactionInfo.value] -
370
+ // [tax][google.cloud.discoveryengine.v1beta.TransactionInfo.tax] -
371
+ // [cost][google.cloud.discoveryengine.v1beta.TransactionInfo.cost]
372
+ optional float discount_value = 6;
373
+ }
374
+
375
+ // Detailed document information associated with a user event.
376
+ message DocumentInfo {
377
+ // A required descriptor of the associated Document.
378
+ //
379
+ // * If [id][google.cloud.discoveryengine.v1beta.DocumentInfo.id] is
380
+ // specified, then the default values for <location>, <data_store_id>, and
381
+ // <branch_id> are used when annotating with the stored Document.
382
+ //
383
+ // * If [name][google.cloud.discoveryengine.v1beta.DocumentInfo.name] is
384
+ // specified, then the provided values (default values allowed) for
385
+ // <location>, <data_store_id>, and <branch_id> are used when annotating with
386
+ // the stored Document.
387
+ oneof document_descriptor {
388
+ // Required. The Document resource ID.
389
+ string id = 1 [(google.api.field_behavior) = REQUIRED];
390
+
391
+ // Required. The Document resource full name, of the form:
392
+ // projects/<project_id>/locations/<location>/dataStores/<data_store_id>/branches/<branch_id>/documents/<document_id>
393
+ string name = 2 [
394
+ (google.api.field_behavior) = REQUIRED,
395
+ (google.api.resource_reference) = {
396
+ type: "discoveryengine.googleapis.com/Document"
397
+ }
398
+ ];
399
+ }
400
+
401
+ // Quantity of the Document associated with the user event. Defaults to 1.
402
+ //
403
+ // For example, this field will be 2 if two quantities of the same Document
404
+ // are involved in a `add-to-cart` event.
405
+ //
406
+ // Required for events of the following event types:
407
+ // * `add-to-cart`
408
+ // * `purchase`
409
+ optional int32 quantity = 3;
410
+
411
+ // The promotion IDs associated with this Document.
412
+ // Currently, this field is restricted to at most one ID.
413
+ repeated string promotion_ids = 4;
414
+ }
415
+
416
+ // Detailed panel information associated with a user event.
417
+ message PanelInfo {
418
+ // Required. The panel ID.
419
+ string panel_id = 2 [(google.api.field_behavior) = REQUIRED];
420
+
421
+ // The display name of the panel.
422
+ string display_name = 3;
423
+
424
+ // The ordered position of the panel, if shown to the user with other panels.
425
+ // If set, then
426
+ // [total_panels][google.cloud.discoveryengine.v1beta.PanelInfo.total_panels]
427
+ // must also be set.
428
+ optional int32 panel_position = 4;
429
+
430
+ // The total number of panels, including this one, shown to the user.
431
+ // Must be set if
432
+ // [panel_position][google.cloud.discoveryengine.v1beta.PanelInfo.panel_position]
433
+ // is set.
434
+ optional int32 total_panels = 5;
435
+ }
436
+
437
+ // Media-specific user event information.
438
+ message MediaInfo {
439
+ // The media progress time in seconds, if applicable.
440
+ // For example, if the end user has finished 90 seconds of a playback video,
441
+ // then [MediaInfo.media_progress_duration.seconds][Duration.seconds] should
442
+ // be set to 90.
443
+ google.protobuf.Duration media_progress_duration = 1;
444
+
445
+ // Media progress should be computed using only the media_progress_duration
446
+ // relative to the media total length.
447
+ //
448
+ // This value must be between [0, 1.0] inclusive.
449
+ //
450
+ // If this is not a playback or the progress cannot be computed (e.g. ongoing
451
+ // livestream), this field should be unset.
452
+ optional float media_progress_percentage = 2;
453
+ }