user_event_service.proto 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. // Copyright 2020 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. // Triggers 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 API can be used to trigger a 'join' operation on specified
  92. // events with latest version of product catalog. It can also be used to
  93. // correct events joined with wrong product catalog.
  94. rpc RejoinUserEvents(RejoinUserEventsRequest)
  95. returns (google.longrunning.Operation) {
  96. option (google.api.http) = {
  97. post: "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin"
  98. body: "*"
  99. };
  100. option (google.longrunning.operation_info) = {
  101. response_type: "RejoinUserEventsResponse"
  102. metadata_type: "RejoinUserEventsMetadata"
  103. };
  104. }
  105. }
  106. // Request message for WriteUserEvent method.
  107. message WriteUserEventRequest {
  108. // Required. The parent catalog resource name, such as
  109. // `projects/1234/locations/global/catalogs/default_catalog`.
  110. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  111. // Required. User event to write.
  112. UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED];
  113. }
  114. // Request message for CollectUserEvent method.
  115. message CollectUserEventRequest {
  116. // Required. The parent catalog name, such as
  117. // `projects/1234/locations/global/catalogs/default_catalog`.
  118. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  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. // The URL including cgi-parameters but excluding the hash fragment with a
  123. // length limit of 5,000 characters. This is often more useful than the
  124. // referer URL, because many browsers only send the domain for 3rd party
  125. // requests.
  126. string uri = 3;
  127. // The event timestamp in milliseconds. This prevents browser caching of
  128. // otherwise identical get requests. The name is abbreviated to reduce the
  129. // payload bytes.
  130. int64 ets = 4;
  131. }
  132. // Request message for RejoinUserEvents method.
  133. message RejoinUserEventsRequest {
  134. // The scope of user events to be rejoined with the latest product catalog.
  135. // If the rejoining aims at reducing number of unjoined events, set
  136. // UserEventRejoinScope to UNJOINED_EVENTS.
  137. // If the rejoining aims at correcting product catalog information in joined
  138. // events, set UserEventRejoinScope to JOINED_EVENTS.
  139. // If all events needs to be rejoined, set UserEventRejoinScope to
  140. // USER_EVENT_REJOIN_SCOPE_UNSPECIFIED.
  141. enum UserEventRejoinScope {
  142. // Rejoin all events with the latest product catalog, including both joined
  143. // events and unjoined events.
  144. USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0;
  145. // Only rejoin joined events with the latest product catalog.
  146. JOINED_EVENTS = 1;
  147. // Only rejoin unjoined events with the latest product catalog.
  148. UNJOINED_EVENTS = 2;
  149. }
  150. // Required. The parent catalog resource name, such as
  151. // `projects/1234/locations/global/catalogs/default_catalog`.
  152. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  153. // The type of the user event rejoin to define the scope and range of the user
  154. // events to be rejoined with the latest product catalog. Defaults to
  155. // USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
  156. // invalid integer value.
  157. UserEventRejoinScope user_event_rejoin_scope = 2;
  158. }
  159. // Response message for RejoinUserEvents method.
  160. message RejoinUserEventsResponse {
  161. // Number of user events that were joined with latest product catalog.
  162. int64 rejoined_user_events_count = 1;
  163. }
  164. // Metadata for RejoinUserEvents method.
  165. message RejoinUserEventsMetadata {}