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.v1alpha; 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/v1alpha/import_config.proto"; 25import "google/cloud/discoveryengine/v1alpha/purge_config.proto"; 26import "google/cloud/discoveryengine/v1alpha/user_event.proto"; 27import "google/longrunning/operations.proto"; 28 29option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha"; 30option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb"; 31option java_multiple_files = true; 32option java_outer_classname = "UserEventServiceProto"; 33option java_package = "com.google.cloud.discoveryengine.v1alpha"; 34option objc_class_prefix = "DISCOVERYENGINE"; 35option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha"; 36option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha"; 37 38// Service for ingesting end user actions on a website to Discovery Engine API. 39service UserEventService { 40 option (google.api.default_host) = "discoveryengine.googleapis.com"; 41 option (google.api.oauth_scopes) = 42 "https://www.googleapis.com/auth/cloud-platform"; 43 44 // Writes a single user event. 45 rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) { 46 option (google.api.http) = { 47 post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/userEvents:write" 48 body: "user_event" 49 additional_bindings { 50 post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:write" 51 body: "user_event" 52 } 53 }; 54 } 55 56 // Writes a single user event from the browser. This uses a GET request to 57 // due to browser restriction of POST-ing to a third-party domain. 58 // 59 // This method is used only by the Discovery Engine API JavaScript pixel and 60 // Google Tag Manager. Users should not call this method directly. 61 rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) { 62 option (google.api.http) = { 63 get: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/userEvents:collect" 64 additional_bindings { 65 get: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:collect" 66 } 67 }; 68 } 69 70 // Deletes permanently all user events specified by the filter provided. 71 // Depending on the number of events specified by the filter, this operation 72 // could take hours or days to complete. To test a filter, use the list 73 // command first. 74 rpc PurgeUserEvents(PurgeUserEventsRequest) 75 returns (google.longrunning.Operation) { 76 option (google.api.http) = { 77 post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/userEvents:purge" 78 body: "*" 79 additional_bindings { 80 post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:purge" 81 body: "*" 82 } 83 }; 84 option (google.longrunning.operation_info) = { 85 response_type: "google.cloud.discoveryengine.v1alpha.PurgeUserEventsResponse" 86 metadata_type: "google.cloud.discoveryengine.v1alpha.PurgeUserEventsMetadata" 87 }; 88 } 89 90 // Bulk import of User events. Request processing might be 91 // synchronous. Events that already exist are skipped. 92 // Use this method for backfilling historical user events. 93 // 94 // Operation.response is of type ImportResponse. Note that it is 95 // possible for a subset of the items to be successfully inserted. 96 // Operation.metadata is of type ImportMetadata. 97 rpc ImportUserEvents(ImportUserEventsRequest) 98 returns (google.longrunning.Operation) { 99 option (google.api.http) = { 100 post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/userEvents:import" 101 body: "*" 102 additional_bindings { 103 post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:import" 104 body: "*" 105 } 106 }; 107 option (google.longrunning.operation_info) = { 108 response_type: "google.cloud.discoveryengine.v1alpha.ImportUserEventsResponse" 109 metadata_type: "google.cloud.discoveryengine.v1alpha.ImportUserEventsMetadata" 110 }; 111 } 112} 113 114// Request message for WriteUserEvent method. 115message WriteUserEventRequest { 116 // Required. The parent DataStore resource name, such as 117 // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. 118 string parent = 1 [ 119 (google.api.field_behavior) = REQUIRED, 120 (google.api.resource_reference) = { 121 type: "discoveryengine.googleapis.com/DataStore" 122 } 123 ]; 124 125 // Required. User event to write. 126 optional UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; 127} 128 129// Request message for CollectUserEvent method. 130message CollectUserEventRequest { 131 // Required. The parent DataStore resource name, such as 132 // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. 133 string parent = 1 [ 134 (google.api.field_behavior) = REQUIRED, 135 (google.api.resource_reference) = { 136 type: "discoveryengine.googleapis.com/DataStore" 137 } 138 ]; 139 140 // Required. URL encoded UserEvent proto with a length limit of 2,000,000 141 // characters. 142 string user_event = 2 [(google.api.field_behavior) = REQUIRED]; 143 144 // The URL including cgi-parameters but excluding the hash fragment with a 145 // length limit of 5,000 characters. This is often more useful than the 146 // referer URL, because many browsers only send the domain for third-party 147 // requests. 148 optional string uri = 3; 149 150 // The event timestamp in milliseconds. This prevents browser caching of 151 // otherwise identical get requests. The name is abbreviated to reduce the 152 // payload bytes. 153 optional int64 ets = 4; 154} 155