xref: /aosp_15_r20/external/googleapis/google/cloud/discoveryengine/v1beta/user_event_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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
15syntax = "proto3";
16
17package google.cloud.discoveryengine.v1beta;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/httpbody.proto";
23import "google/api/resource.proto";
24import "google/cloud/discoveryengine/v1beta/import_config.proto";
25import "google/cloud/discoveryengine/v1beta/user_event.proto";
26import "google/longrunning/operations.proto";
27
28option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
29option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb";
30option java_multiple_files = true;
31option java_outer_classname = "UserEventServiceProto";
32option java_package = "com.google.cloud.discoveryengine.v1beta";
33option objc_class_prefix = "DISCOVERYENGINE";
34option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
35option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
36
37// Service for ingesting end user actions on a website to Discovery Engine API.
38service UserEventService {
39  option (google.api.default_host) = "discoveryengine.googleapis.com";
40  option (google.api.oauth_scopes) =
41      "https://www.googleapis.com/auth/cloud-platform";
42
43  // Writes a single user event.
44  rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) {
45    option (google.api.http) = {
46      post: "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:write"
47      body: "user_event"
48      additional_bindings {
49        post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:write"
50        body: "user_event"
51      }
52    };
53  }
54
55  // Writes a single user event from the browser. This uses a GET request to
56  // due to browser restriction of POST-ing to a third-party domain.
57  //
58  // This method is used only by the Discovery Engine API JavaScript pixel and
59  // Google Tag Manager. Users should not call this method directly.
60  rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) {
61    option (google.api.http) = {
62      get: "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:collect"
63      additional_bindings {
64        get: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:collect"
65      }
66    };
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: "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:import"
80      body: "*"
81      additional_bindings {
82        post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:import"
83        body: "*"
84      }
85    };
86    option (google.longrunning.operation_info) = {
87      response_type: "google.cloud.discoveryengine.v1beta.ImportUserEventsResponse"
88      metadata_type: "google.cloud.discoveryengine.v1beta.ImportUserEventsMetadata"
89    };
90  }
91}
92
93// Request message for WriteUserEvent method.
94message WriteUserEventRequest {
95  // Required. The parent DataStore resource name, such as
96  // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
97  string parent = 1 [
98    (google.api.field_behavior) = REQUIRED,
99    (google.api.resource_reference) = {
100      type: "discoveryengine.googleapis.com/DataStore"
101    }
102  ];
103
104  // Required. User event to write.
105  optional UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED];
106}
107
108// Request message for CollectUserEvent method.
109message CollectUserEventRequest {
110  // Required. The parent DataStore resource name, such as
111  // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
112  string parent = 1 [
113    (google.api.field_behavior) = REQUIRED,
114    (google.api.resource_reference) = {
115      type: "discoveryengine.googleapis.com/DataStore"
116    }
117  ];
118
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
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 third-party
126  // requests.
127  optional string uri = 3;
128
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  optional int64 ets = 4;
133}
134