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.v2;
  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/v2/import_config.proto";
  21. import "google/cloud/retail/v2/purge_config.proto";
  22. import "google/cloud/retail/v2/user_event.proto";
  23. import "google/longrunning/operations.proto";
  24. option csharp_namespace = "Google.Cloud.Retail.V2";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "UserEventServiceProto";
  28. option java_package = "com.google.cloud.retail.v2";
  29. option objc_class_prefix = "RETAIL";
  30. option php_namespace = "Google\\Cloud\\Retail\\V2";
  31. option ruby_package = "Google::Cloud::Retail::V2";
  32. // Service for ingesting end user actions on the customer website.
  33. service UserEventService {
  34. option (google.api.default_host) = "retail.googleapis.com";
  35. option (google.api.oauth_scopes) =
  36. "https://www.googleapis.com/auth/cloud-platform";
  37. // Writes a single user event.
  38. rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) {
  39. option (google.api.http) = {
  40. post: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write"
  41. body: "user_event"
  42. };
  43. }
  44. // Writes a single user event from the browser. This uses a GET request to
  45. // due to browser restriction of POST-ing to a 3rd party domain.
  46. //
  47. // This method is used only by the Retail API JavaScript pixel and Google Tag
  48. // Manager. Users should not call this method directly.
  49. rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) {
  50. option (google.api.http) = {
  51. get: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect"
  52. };
  53. }
  54. // Deletes permanently all user events specified by the filter provided.
  55. // Depending on the number of events specified by the filter, this operation
  56. // could take hours or days to complete. To test a filter, use the list
  57. // command first.
  58. rpc PurgeUserEvents(PurgeUserEventsRequest)
  59. returns (google.longrunning.Operation) {
  60. option (google.api.http) = {
  61. post: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge"
  62. body: "*"
  63. };
  64. option (google.longrunning.operation_info) = {
  65. response_type: "google.cloud.retail.v2.PurgeUserEventsResponse"
  66. metadata_type: "google.cloud.retail.v2.PurgeMetadata"
  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: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import"
  80. body: "*"
  81. };
  82. option (google.longrunning.operation_info) = {
  83. response_type: "google.cloud.retail.v2.ImportUserEventsResponse"
  84. metadata_type: "google.cloud.retail.v2.ImportMetadata"
  85. };
  86. }
  87. // Starts a user event rejoin operation with latest product catalog. Events
  88. // will not be annotated with detailed product information if product is
  89. // missing from the catalog at the time the user event is ingested, and these
  90. // events are stored as unjoined events with a limited usage on training and
  91. // serving. This method can be used to start a join operation on specified
  92. // events with latest version of product catalog. It can also be used to
  93. // correct events joined with the wrong product catalog. A rejoin operation
  94. // can take hours or days to complete.
  95. rpc RejoinUserEvents(RejoinUserEventsRequest)
  96. returns (google.longrunning.Operation) {
  97. option (google.api.http) = {
  98. post: "/v2/{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 {}