user_event_service.proto 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. // Copyright 2021 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. syntax = "proto3";
  15. package google.cloud.retail.v2beta;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/httpbody.proto";
  20. import "google/cloud/retail/v2beta/export_config.proto";
  21. import "google/cloud/retail/v2beta/import_config.proto";
  22. import "google/cloud/retail/v2beta/purge_config.proto";
  23. import "google/cloud/retail/v2beta/user_event.proto";
  24. import "google/longrunning/operations.proto";
  25. option csharp_namespace = "Google.Cloud.Retail.V2Beta";
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "UserEventServiceProto";
  29. option java_package = "com.google.cloud.retail.v2beta";
  30. option objc_class_prefix = "RETAIL";
  31. option php_namespace = "Google\\Cloud\\Retail\\V2beta";
  32. option ruby_package = "Google::Cloud::Retail::V2beta";
  33. // Service for ingesting end user actions on the customer website.
  34. service UserEventService {
  35. option (google.api.default_host) = "retail.googleapis.com";
  36. option (google.api.oauth_scopes) =
  37. "https://www.googleapis.com/auth/cloud-platform";
  38. // Writes a single user event.
  39. rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) {
  40. option (google.api.http) = {
  41. post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:write"
  42. body: "user_event"
  43. };
  44. }
  45. // Writes a single user event from the browser. This uses a GET request to
  46. // due to browser restriction of POST-ing to a 3rd party domain.
  47. //
  48. // This method is used only by the Retail API JavaScript pixel and Google Tag
  49. // Manager. Users should not call this method directly.
  50. rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) {
  51. option (google.api.http) = {
  52. get: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect"
  53. };
  54. }
  55. // Deletes permanently all user events specified by the filter provided.
  56. // Depending on the number of events specified by the filter, this operation
  57. // could take hours or days to complete. To test a filter, use the list
  58. // command first.
  59. rpc PurgeUserEvents(PurgeUserEventsRequest)
  60. returns (google.longrunning.Operation) {
  61. option (google.api.http) = {
  62. post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge"
  63. body: "*"
  64. };
  65. option (google.longrunning.operation_info) = {
  66. response_type: "google.cloud.retail.v2beta.PurgeUserEventsResponse"
  67. metadata_type: "google.cloud.retail.v2beta.PurgeMetadata"
  68. };
  69. }
  70. // Bulk import of User events. Request processing might be
  71. // synchronous. Events that already exist are skipped.
  72. // Use this method for backfilling historical user events.
  73. //
  74. // Operation.response is of type ImportResponse. Note that it is
  75. // possible for a subset of the items to be successfully inserted.
  76. // Operation.metadata is of type ImportMetadata.
  77. rpc ImportUserEvents(ImportUserEventsRequest)
  78. returns (google.longrunning.Operation) {
  79. option (google.api.http) = {
  80. post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:import"
  81. body: "*"
  82. };
  83. option (google.longrunning.operation_info) = {
  84. response_type: "google.cloud.retail.v2beta.ImportUserEventsResponse"
  85. metadata_type: "google.cloud.retail.v2beta.ImportMetadata"
  86. };
  87. }
  88. // Triggers a user event rejoin operation with latest product catalog. Events
  89. // will not be annotated with detailed product information if product is
  90. // missing from the catalog at the time the user event is ingested, and these
  91. // events are stored as unjoined events with a limited usage on training and
  92. // serving. This API can be used to trigger a 'join' operation on specified
  93. // events with latest version of product catalog. It can also be used to
  94. // correct events joined with wrong product catalog.
  95. rpc RejoinUserEvents(RejoinUserEventsRequest)
  96. returns (google.longrunning.Operation) {
  97. option (google.api.http) = {
  98. post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin"
  99. body: "*"
  100. };
  101. option (google.longrunning.operation_info) = {
  102. response_type: "RejoinUserEventsResponse"
  103. metadata_type: "RejoinUserEventsMetadata"
  104. };
  105. }
  106. }
  107. // Request message for WriteUserEvent method.
  108. message WriteUserEventRequest {
  109. // Required. The parent catalog resource name, such as
  110. // `projects/1234/locations/global/catalogs/default_catalog`.
  111. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  112. // Required. User event to write.
  113. UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED];
  114. }
  115. // Request message for CollectUserEvent method.
  116. message CollectUserEventRequest {
  117. // Required. The parent catalog name, such as
  118. // `projects/1234/locations/global/catalogs/default_catalog`.
  119. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  120. // Required. URL encoded UserEvent proto with a length limit of 2,000,000
  121. // characters.
  122. string user_event = 2 [(google.api.field_behavior) = REQUIRED];
  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. string uri = 3;
  128. // The event timestamp in milliseconds. This prevents browser caching of
  129. // otherwise identical get requests. The name is abbreviated to reduce the
  130. // payload bytes.
  131. int64 ets = 4;
  132. }
  133. // Request message for RejoinUserEvents method.
  134. message RejoinUserEventsRequest {
  135. // The scope of user events to be rejoined with the latest product catalog.
  136. // If the rejoining aims at reducing number of unjoined events, set
  137. // UserEventRejoinScope to UNJOINED_EVENTS.
  138. // If the rejoining aims at correcting product catalog information in joined
  139. // events, set UserEventRejoinScope to JOINED_EVENTS.
  140. // If all events needs to be rejoined, set UserEventRejoinScope to
  141. // USER_EVENT_REJOIN_SCOPE_UNSPECIFIED.
  142. enum UserEventRejoinScope {
  143. // Rejoin all events with the latest product catalog, including both joined
  144. // events and unjoined events.
  145. USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0;
  146. // Only rejoin joined events with the latest product catalog.
  147. JOINED_EVENTS = 1;
  148. // Only rejoin unjoined events with the latest product catalog.
  149. UNJOINED_EVENTS = 2;
  150. }
  151. // Required. The parent catalog resource name, such as
  152. // `projects/1234/locations/global/catalogs/default_catalog`.
  153. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  154. // The type of the user event rejoin to define the scope and range of the user
  155. // events to be rejoined with the latest product catalog. Defaults to
  156. // USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
  157. // invalid integer value.
  158. UserEventRejoinScope user_event_rejoin_scope = 2;
  159. }
  160. // Response message for RejoinUserEvents method.
  161. message RejoinUserEventsResponse {
  162. // Number of user events that were joined with latest product catalog.
  163. int64 rejoined_user_events_count = 1;
  164. }
  165. // Metadata for RejoinUserEvents method.
  166. message RejoinUserEventsMetadata {}