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/resource.proto"; 23import "google/cloud/discoveryengine/v1alpha/document.proto"; 24import "google/cloud/discoveryengine/v1alpha/import_config.proto"; 25import "google/cloud/discoveryengine/v1alpha/purge_config.proto"; 26import "google/longrunning/operations.proto"; 27import "google/protobuf/empty.proto"; 28import "google/protobuf/field_mask.proto"; 29 30option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha"; 31option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb"; 32option java_multiple_files = true; 33option java_outer_classname = "DocumentServiceProto"; 34option java_package = "com.google.cloud.discoveryengine.v1alpha"; 35option objc_class_prefix = "DISCOVERYENGINE"; 36option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha"; 37option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha"; 38 39// Service for ingesting 40// [Document][google.cloud.discoveryengine.v1alpha.Document] information of the 41// customer's website. 42service DocumentService { 43 option (google.api.default_host) = "discoveryengine.googleapis.com"; 44 option (google.api.oauth_scopes) = 45 "https://www.googleapis.com/auth/cloud-platform"; 46 47 // Gets a [Document][google.cloud.discoveryengine.v1alpha.Document]. 48 rpc GetDocument(GetDocumentRequest) returns (Document) { 49 option (google.api.http) = { 50 get: "/v1alpha/{name=projects/*/locations/*/dataStores/*/branches/*/documents/*}" 51 additional_bindings { 52 get: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*}" 53 } 54 }; 55 option (google.api.method_signature) = "name"; 56 } 57 58 // Gets a list of [Document][google.cloud.discoveryengine.v1alpha.Document]s. 59 rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { 60 option (google.api.http) = { 61 get: "/v1alpha/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents" 62 additional_bindings { 63 get: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents" 64 } 65 }; 66 option (google.api.method_signature) = "parent"; 67 } 68 69 // Creates a [Document][google.cloud.discoveryengine.v1alpha.Document]. 70 rpc CreateDocument(CreateDocumentRequest) returns (Document) { 71 option (google.api.http) = { 72 post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents" 73 body: "document" 74 additional_bindings { 75 post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents" 76 body: "document" 77 } 78 }; 79 option (google.api.method_signature) = "parent,document,document_id"; 80 } 81 82 // Updates a [Document][google.cloud.discoveryengine.v1alpha.Document]. 83 rpc UpdateDocument(UpdateDocumentRequest) returns (Document) { 84 option (google.api.http) = { 85 patch: "/v1alpha/{document.name=projects/*/locations/*/dataStores/*/branches/*/documents/*}" 86 body: "document" 87 additional_bindings { 88 patch: "/v1alpha/{document.name=projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*}" 89 body: "document" 90 } 91 }; 92 option (google.api.method_signature) = "document,update_mask"; 93 } 94 95 // Deletes a [Document][google.cloud.discoveryengine.v1alpha.Document]. 96 rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) { 97 option (google.api.http) = { 98 delete: "/v1alpha/{name=projects/*/locations/*/dataStores/*/branches/*/documents/*}" 99 additional_bindings { 100 delete: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*}" 101 } 102 }; 103 option (google.api.method_signature) = "name"; 104 } 105 106 // Bulk import of multiple 107 // [Document][google.cloud.discoveryengine.v1alpha.Document]s. Request 108 // processing may be synchronous. Non-existing items will be created. 109 // 110 // Note: It is possible for a subset of the 111 // [Document][google.cloud.discoveryengine.v1alpha.Document]s to be 112 // successfully updated. 113 rpc ImportDocuments(ImportDocumentsRequest) 114 returns (google.longrunning.Operation) { 115 option (google.api.http) = { 116 post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents:import" 117 body: "*" 118 additional_bindings { 119 post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents:import" 120 body: "*" 121 } 122 }; 123 option (google.longrunning.operation_info) = { 124 response_type: "google.cloud.discoveryengine.v1alpha.ImportDocumentsResponse" 125 metadata_type: "google.cloud.discoveryengine.v1alpha.ImportDocumentsMetadata" 126 }; 127 } 128 129 // Permanently deletes all selected 130 // [Document][google.cloud.discoveryengine.v1alpha.Document]s in a branch. 131 // 132 // This process is asynchronous. Depending on the number of 133 // [Document][google.cloud.discoveryengine.v1alpha.Document]s to be deleted, 134 // this operation can take hours to complete. Before the delete operation 135 // completes, some [Document][google.cloud.discoveryengine.v1alpha.Document]s 136 // might still be returned by 137 // [DocumentService.GetDocument][google.cloud.discoveryengine.v1alpha.DocumentService.GetDocument] 138 // or 139 // [DocumentService.ListDocuments][google.cloud.discoveryengine.v1alpha.DocumentService.ListDocuments]. 140 // 141 // To get a list of the 142 // [Document][google.cloud.discoveryengine.v1alpha.Document]s to be deleted, 143 // set 144 // [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1alpha.PurgeDocumentsRequest.force] 145 // to false. 146 rpc PurgeDocuments(PurgeDocumentsRequest) 147 returns (google.longrunning.Operation) { 148 option (google.api.http) = { 149 post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents:purge" 150 body: "*" 151 additional_bindings { 152 post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents:purge" 153 body: "*" 154 } 155 }; 156 option (google.longrunning.operation_info) = { 157 response_type: "google.cloud.discoveryengine.v1alpha.PurgeDocumentsResponse" 158 metadata_type: "google.cloud.discoveryengine.v1alpha.PurgeDocumentsMetadata" 159 }; 160 } 161 162 // Gets the parsed layout information for a 163 // [Document][google.cloud.discoveryengine.v1alpha.Document]. 164 rpc GetProcessedDocument(GetProcessedDocumentRequest) 165 returns (ProcessedDocument) { 166 option (google.api.http) = { 167 get: "/v1alpha/{name=projects/*/locations/*/dataStores/*/branches/*/documents/*}:getProcessedDocument" 168 additional_bindings { 169 get: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*}:getProcessedDocument" 170 } 171 }; 172 option (google.api.method_signature) = "name"; 173 } 174} 175 176// Request message for 177// [DocumentService.GetDocument][google.cloud.discoveryengine.v1alpha.DocumentService.GetDocument] 178// method. 179message GetDocumentRequest { 180 // Required. Full resource name of 181 // [Document][google.cloud.discoveryengine.v1alpha.Document], such as 182 // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. 183 // 184 // If the caller does not have permission to access the 185 // [Document][google.cloud.discoveryengine.v1alpha.Document], regardless of 186 // whether or not it exists, a `PERMISSION_DENIED` error is returned. 187 // 188 // If the requested [Document][google.cloud.discoveryengine.v1alpha.Document] 189 // does not exist, a `NOT_FOUND` error is returned. 190 string name = 1 [ 191 (google.api.field_behavior) = REQUIRED, 192 (google.api.resource_reference) = { 193 type: "discoveryengine.googleapis.com/Document" 194 } 195 ]; 196} 197 198// Request message for 199// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1alpha.DocumentService.ListDocuments] 200// method. 201message ListDocumentsRequest { 202 // Required. The parent branch resource name, such as 203 // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`. 204 // Use `default_branch` as the branch ID, to list documents under the default 205 // branch. 206 // 207 // If the caller does not have permission to list 208 // [Document][google.cloud.discoveryengine.v1alpha.Document]s under this 209 // branch, regardless of whether or not this branch exists, a 210 // `PERMISSION_DENIED` error is returned. 211 string parent = 1 [ 212 (google.api.field_behavior) = REQUIRED, 213 (google.api.resource_reference) = { 214 type: "discoveryengine.googleapis.com/Branch" 215 } 216 ]; 217 218 // Maximum number of 219 // [Document][google.cloud.discoveryengine.v1alpha.Document]s to return. If 220 // unspecified, defaults to 100. The maximum allowed value is 1000. Values 221 // above 1000 will be coerced to 1000. 222 // 223 // If this field is negative, an `INVALID_ARGUMENT` error is returned. 224 int32 page_size = 2; 225 226 // A page token 227 // [ListDocumentsResponse.next_page_token][google.cloud.discoveryengine.v1alpha.ListDocumentsResponse.next_page_token], 228 // received from a previous 229 // [DocumentService.ListDocuments][google.cloud.discoveryengine.v1alpha.DocumentService.ListDocuments] 230 // call. Provide this to retrieve the subsequent page. 231 // 232 // When paginating, all other parameters provided to 233 // [DocumentService.ListDocuments][google.cloud.discoveryengine.v1alpha.DocumentService.ListDocuments] 234 // must match the call that provided the page token. Otherwise, an 235 // `INVALID_ARGUMENT` error is returned. 236 string page_token = 3; 237} 238 239// Response message for 240// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1alpha.DocumentService.ListDocuments] 241// method. 242message ListDocumentsResponse { 243 // The [Document][google.cloud.discoveryengine.v1alpha.Document]s. 244 repeated Document documents = 1; 245 246 // A token that can be sent as 247 // [ListDocumentsRequest.page_token][google.cloud.discoveryengine.v1alpha.ListDocumentsRequest.page_token] 248 // to retrieve the next page. If this field is omitted, there are no 249 // subsequent pages. 250 string next_page_token = 2; 251} 252 253// Request message for 254// [DocumentService.CreateDocument][google.cloud.discoveryengine.v1alpha.DocumentService.CreateDocument] 255// method. 256message CreateDocumentRequest { 257 // Required. The parent resource name, such as 258 // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`. 259 string parent = 1 [ 260 (google.api.field_behavior) = REQUIRED, 261 (google.api.resource_reference) = { 262 type: "discoveryengine.googleapis.com/Branch" 263 } 264 ]; 265 266 // Required. The [Document][google.cloud.discoveryengine.v1alpha.Document] to 267 // create. 268 Document document = 2 [(google.api.field_behavior) = REQUIRED]; 269 270 // Required. The ID to use for the 271 // [Document][google.cloud.discoveryengine.v1alpha.Document], which will 272 // become the final component of the 273 // [Document.name][google.cloud.discoveryengine.v1alpha.Document.name]. 274 // 275 // If the caller does not have permission to create the 276 // [Document][google.cloud.discoveryengine.v1alpha.Document], regardless of 277 // whether or not it exists, a `PERMISSION_DENIED` error is returned. 278 // 279 // This field must be unique among all 280 // [Document][google.cloud.discoveryengine.v1alpha.Document]s with the same 281 // [parent][google.cloud.discoveryengine.v1alpha.CreateDocumentRequest.parent]. 282 // Otherwise, an `ALREADY_EXISTS` error is returned. 283 // 284 // This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) 285 // standard with a length limit of 63 characters. Otherwise, an 286 // `INVALID_ARGUMENT` error is returned. 287 string document_id = 3 [(google.api.field_behavior) = REQUIRED]; 288} 289 290// Request message for 291// [DocumentService.UpdateDocument][google.cloud.discoveryengine.v1alpha.DocumentService.UpdateDocument] 292// method. 293message UpdateDocumentRequest { 294 // Required. The document to update/create. 295 // 296 // If the caller does not have permission to update the 297 // [Document][google.cloud.discoveryengine.v1alpha.Document], regardless of 298 // whether or not it exists, a `PERMISSION_DENIED` error is returned. 299 // 300 // If the [Document][google.cloud.discoveryengine.v1alpha.Document] to update 301 // does not exist and 302 // [allow_missing][google.cloud.discoveryengine.v1alpha.UpdateDocumentRequest.allow_missing] 303 // is not set, a `NOT_FOUND` error is returned. 304 Document document = 1 [(google.api.field_behavior) = REQUIRED]; 305 306 // If set to true, and the 307 // [Document][google.cloud.discoveryengine.v1alpha.Document] is not found, a 308 // new [Document][google.cloud.discoveryengine.v1alpha.Document] will be 309 // created. 310 bool allow_missing = 2; 311 312 // Indicates which fields in the provided imported 'document' to update. If 313 // not set, will by default update all fields. 314 google.protobuf.FieldMask update_mask = 3; 315} 316 317// Request message for 318// [DocumentService.DeleteDocument][google.cloud.discoveryengine.v1alpha.DocumentService.DeleteDocument] 319// method. 320message DeleteDocumentRequest { 321 // Required. Full resource name of 322 // [Document][google.cloud.discoveryengine.v1alpha.Document], such as 323 // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. 324 // 325 // If the caller does not have permission to delete the 326 // [Document][google.cloud.discoveryengine.v1alpha.Document], regardless of 327 // whether or not it exists, a `PERMISSION_DENIED` error is returned. 328 // 329 // If the [Document][google.cloud.discoveryengine.v1alpha.Document] to delete 330 // does not exist, a `NOT_FOUND` error is returned. 331 string name = 1 [ 332 (google.api.field_behavior) = REQUIRED, 333 (google.api.resource_reference) = { 334 type: "discoveryengine.googleapis.com/Document" 335 } 336 ]; 337} 338 339// Request message for 340// [DocumentService.GetDocument][google.cloud.discoveryengine.v1alpha.DocumentService.GetDocument] 341// method. 342message GetProcessedDocumentRequest { 343 // The type of processing to return in the response. 344 enum ProcessedDocumentType { 345 // Default value. 346 PROCESSED_DOCUMENT_TYPE_UNSPECIFIED = 0; 347 348 // Available for all data store parsing configs. 349 PARSED_DOCUMENT = 1; 350 351 // Only available if ChunkingConfig is enabeld on the data store. 352 CHUNKED_DOCUMENT = 2; 353 } 354 355 // The format of the returned processed document. If unspecified, defaults to 356 // JSON. 357 enum ProcessedDocumentFormat { 358 // Default value. 359 PROCESSED_DOCUMENT_FORMAT_UNSPECIFIED = 0; 360 361 // output format will be a JSON string representation of processed document. 362 JSON = 1; 363 } 364 365 // Required. Full resource name of 366 // [Document][google.cloud.discoveryengine.v1alpha.Document], such as 367 // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. 368 // 369 // If the caller does not have permission to access the 370 // [Document][google.cloud.discoveryengine.v1alpha.Document], regardless of 371 // whether or not it exists, a `PERMISSION_DENIED` error is returned. 372 // 373 // If the requested [Document][google.cloud.discoveryengine.v1alpha.Document] 374 // does not exist, a `NOT_FOUND` error is returned. 375 string name = 1 [ 376 (google.api.field_behavior) = REQUIRED, 377 (google.api.resource_reference) = { 378 type: "discoveryengine.googleapis.com/Document" 379 } 380 ]; 381 382 // Required. What type of processing to return. 383 ProcessedDocumentType processed_document_type = 2 384 [(google.api.field_behavior) = REQUIRED]; 385 386 // What format output should be. If unspecified, defaults to JSON. 387 ProcessedDocumentFormat processed_document_format = 3; 388} 389