user_event_service.proto 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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/api/resource.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. // Starts a user-event rejoin operation with latest product catalog. Events
  89. // are not annotated with detailed product information for products that are
  90. // missing from the catalog when the user event is ingested. These
  91. // events are stored as unjoined events with limited usage on training and
  92. // serving. You can use this method to start a join operation on specified
  93. // events with the latest version of product catalog. You can also use this
  94. // method to correct events joined with the wrong product catalog. A rejoin
  95. // operation can take hours or days to complete.
  96. rpc RejoinUserEvents(RejoinUserEventsRequest)
  97. returns (google.longrunning.Operation) {
  98. option (google.api.http) = {
  99. post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin"
  100. body: "*"
  101. };
  102. option (google.longrunning.operation_info) = {
  103. response_type: "RejoinUserEventsResponse"
  104. metadata_type: "RejoinUserEventsMetadata"
  105. };
  106. }
  107. }
  108. // Request message for WriteUserEvent method.
  109. message WriteUserEventRequest {
  110. // Required. The parent catalog resource name, such as
  111. // `projects/1234/locations/global/catalogs/default_catalog`.
  112. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  113. // Required. User event to write.
  114. UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED];
  115. }
  116. // Request message for CollectUserEvent method.
  117. message CollectUserEventRequest {
  118. // Required. The parent catalog name, such as
  119. // `projects/1234/locations/global/catalogs/default_catalog`.
  120. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  121. // Required. URL encoded UserEvent proto with a length limit of 2,000,000
  122. // characters.
  123. string user_event = 2 [(google.api.field_behavior) = REQUIRED];
  124. // The URL including cgi-parameters but excluding the hash fragment with a
  125. // length limit of 5,000 characters. This is often more useful than the
  126. // referer URL, because many browsers only send the domain for 3rd party
  127. // requests.
  128. string uri = 3;
  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. int64 ets = 4;
  133. }
  134. // Request message for RejoinUserEvents method.
  135. message RejoinUserEventsRequest {
  136. // The scope of user events to be rejoined with the latest product catalog.
  137. // If the rejoining aims at reducing number of unjoined events, set
  138. // `UserEventRejoinScope` to `UNJOINED_EVENTS`.
  139. // If the rejoining aims at correcting product catalog information in joined
  140. // events, set `UserEventRejoinScope` to `JOINED_EVENTS`.
  141. // If all events needs to be rejoined, set `UserEventRejoinScope` to
  142. // `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`.
  143. enum UserEventRejoinScope {
  144. // Rejoin all events with the latest product catalog, including both joined
  145. // events and unjoined events.
  146. USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0;
  147. // Only rejoin joined events with the latest product catalog.
  148. JOINED_EVENTS = 1;
  149. // Only rejoin unjoined events with the latest product catalog.
  150. UNJOINED_EVENTS = 2;
  151. }
  152. // Required. The parent catalog resource name, such as
  153. // `projects/1234/locations/global/catalogs/default_catalog`.
  154. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  155. // The type of the user event rejoin to define the scope and range of the user
  156. // events to be rejoined with the latest product catalog. Defaults to
  157. // `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
  158. // an invalid integer value.
  159. UserEventRejoinScope user_event_rejoin_scope = 2;
  160. }
  161. // Response message for `RejoinUserEvents` method.
  162. message RejoinUserEventsResponse {
  163. // Number of user events that were joined with latest product catalog.
  164. int64 rejoined_user_events_count = 1;
  165. }
  166. // Metadata for `RejoinUserEvents` method.
  167. message RejoinUserEventsMetadata {}