1// Copyright 2023 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.contentwarehouse.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/cloud/contentwarehouse/v1/common.proto"; 22import "google/cloud/contentwarehouse/v1/document.proto"; 23import "google/cloud/contentwarehouse/v1/filters.proto"; 24import "google/cloud/contentwarehouse/v1/histogram.proto"; 25import "google/iam/v1/policy.proto"; 26import "google/protobuf/field_mask.proto"; 27 28option csharp_namespace = "Google.Cloud.ContentWarehouse.V1"; 29option go_package = "cloud.google.com/go/contentwarehouse/apiv1/contentwarehousepb;contentwarehousepb"; 30option java_multiple_files = true; 31option java_outer_classname = "DocumentServiceRequestProto"; 32option java_package = "com.google.cloud.contentwarehouse.v1"; 33option php_namespace = "Google\\Cloud\\ContentWarehouse\\V1"; 34option ruby_package = "Google::Cloud::ContentWarehouse::V1"; 35 36// Request Option for processing Cloud AI Document in CW Document. 37message CloudAIDocumentOption { 38 // Whether to convert all the entities to properties. 39 bool enable_entities_conversions = 1; 40 41 // If set, only selected entities will be converted to properties. 42 map<string, string> customized_entities_properties_conversions = 2; 43} 44 45// Request message for DocumentService.CreateDocument. 46message CreateDocumentRequest { 47 // Required. The parent name. 48 // Format: projects/{project_number}/locations/{location}. 49 string parent = 1 [ 50 (google.api.field_behavior) = REQUIRED, 51 (google.api.resource_reference) = { 52 type: "contentwarehouse.googleapis.com/Location" 53 } 54 ]; 55 56 // Required. The document to create. 57 Document document = 2 [(google.api.field_behavior) = REQUIRED]; 58 59 // The meta information collected about the end user, used to enforce access 60 // control for the service. 61 RequestMetadata request_metadata = 3; 62 63 // Default document policy during creation. 64 // This refers to an Identity and Access (IAM) policy, which specifies access 65 // controls for the Document. 66 // Conditions defined in the policy will be ignored. 67 google.iam.v1.Policy policy = 4; 68 69 // Request Option for processing Cloud AI Document in Document Warehouse. 70 // This field offers limited support for mapping entities from Cloud AI 71 // Document to Warehouse Document. Please consult with product team before 72 // using this field and other available options. 73 CloudAIDocumentOption cloud_ai_document_option = 5; 74 75 // Field mask for creating Document fields. If mask path is empty, 76 // it means all fields are masked. 77 // For the `FieldMask` definition, 78 // see 79 // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. 80 google.protobuf.FieldMask create_mask = 6; 81} 82 83// Request message for DocumentService.GetDocument. 84message GetDocumentRequest { 85 // Required. The name of the document to retrieve. 86 // Format: 87 // projects/{project_number}/locations/{location}/documents/{document_id} or 88 // projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}. 89 string name = 1 [ 90 (google.api.field_behavior) = REQUIRED, 91 (google.api.resource_reference) = { 92 type: "contentwarehouse.googleapis.com/Document" 93 } 94 ]; 95 96 // The meta information collected about the end user, used to enforce access 97 // control for the service. 98 RequestMetadata request_metadata = 2; 99} 100 101// Request message for DocumentService.UpdateDocument. 102message UpdateDocumentRequest { 103 // Required. The name of the document to update. 104 // Format: 105 // projects/{project_number}/locations/{location}/documents/{document_id} 106 // or 107 // projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}. 108 string name = 1 [ 109 (google.api.field_behavior) = REQUIRED, 110 (google.api.resource_reference) = { 111 type: "contentwarehouse.googleapis.com/Document" 112 } 113 ]; 114 115 // Required. The document to update. 116 Document document = 2 [(google.api.field_behavior) = REQUIRED]; 117 118 // The meta information collected about the end user, used to enforce access 119 // control for the service. 120 RequestMetadata request_metadata = 3; 121 122 // Request Option for processing Cloud AI Document in Document Warehouse. 123 // This field offers limited support for mapping entities from Cloud AI 124 // Document to Warehouse Document. Please consult with product team before 125 // using this field and other available options. 126 CloudAIDocumentOption cloud_ai_document_option = 5; 127 128 // Options for the update operation. 129 UpdateOptions update_options = 6; 130} 131 132// Request message for DocumentService.DeleteDocument. 133message DeleteDocumentRequest { 134 // Required. The name of the document to delete. 135 // Format: 136 // projects/{project_number}/locations/{location}/documents/{document_id} 137 // or 138 // projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}. 139 string name = 1 [ 140 (google.api.field_behavior) = REQUIRED, 141 (google.api.resource_reference) = { 142 type: "contentwarehouse.googleapis.com/Document" 143 } 144 ]; 145 146 // The meta information collected about the end user, used to enforce access 147 // control for the service. 148 RequestMetadata request_metadata = 2; 149} 150 151// Request message for DocumentService.SearchDocuments. 152message SearchDocumentsRequest { 153 // The total number of matching documents. 154 enum TotalResultSize { 155 // Total number calculation will be skipped. 156 TOTAL_RESULT_SIZE_UNSPECIFIED = 0; 157 158 // Estimate total number. The total result size will be accurated up to 159 // 10,000. This option will add cost and latency to your request. 160 ESTIMATED_SIZE = 1; 161 162 // It may adversely impact performance. The limit is 1000,000. 163 ACTUAL_SIZE = 2; 164 } 165 166 // Required. The parent, which owns this collection of documents. 167 // Format: projects/{project_number}/locations/{location}. 168 string parent = 1 [ 169 (google.api.field_behavior) = REQUIRED, 170 (google.api.resource_reference) = { 171 type: "contentwarehouse.googleapis.com/Location" 172 } 173 ]; 174 175 // The meta information collected about the end user, used to enforce access 176 // control and improve the search quality of the service. 177 RequestMetadata request_metadata = 3; 178 179 // Query used to search against documents (keyword, filters, etc.). 180 DocumentQuery document_query = 4; 181 182 // An integer that specifies the current offset (that is, starting result 183 // location, amongst the documents deemed by the API as relevant) in search 184 // results. This field is only considered if 185 // [page_token][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.page_token] 186 // is unset. 187 // 188 // The maximum allowed value is 5000. Otherwise an error is thrown. 189 // 190 // For example, 0 means to return results starting from the first matching 191 // document, and 10 means to return from the 11th document. This can be used 192 // for pagination, (for example, pageSize = 10 and offset = 10 means to return 193 // from the second page). 194 int32 offset = 5; 195 196 // A limit on the number of documents returned in the search results. 197 // Increasing this value above the default value of 10 can increase search 198 // response time. The value can be between 1 and 100. 199 int32 page_size = 6; 200 201 // The token specifying the current offset within search results. 202 // See 203 // [SearchDocumentsResponse.next_page_token][google.cloud.contentwarehouse.v1.SearchDocumentsResponse.next_page_token] 204 // for an explanation of how to obtain the next set of query results. 205 string page_token = 7; 206 207 // The criteria determining how search results are sorted. For non-empty 208 // query, default is `"relevance desc"`. For empty query, default is 209 // `"upload_date desc"`. 210 // 211 // Supported options are: 212 // 213 // * `"relevance desc"`: By relevance descending, as determined by the API 214 // algorithms. 215 // * `"upload_date desc"`: By upload date descending. 216 // * `"upload_date"`: By upload date ascending. 217 // * `"update_date desc"`: By last updated date descending. 218 // * `"update_date"`: By last updated date ascending. 219 // * `"retrieval_importance desc"`: By retrieval importance of properties 220 // descending. This feature is still under development, please do not use 221 // unless otherwise instructed to do so. 222 string order_by = 8; 223 224 // An expression specifying a histogram request against matching 225 // documents. Expression syntax is an aggregation function call with 226 // histogram facets and other options. 227 // 228 // The following aggregation functions are supported: 229 // 230 // * `count(string_histogram_facet)`: Count the number of matching entities 231 // for each distinct attribute value. 232 // 233 // Data types: 234 // 235 // * Histogram facet (aka filterable properties): Facet names with format 236 // <schema id>.<facet>. Facets will have the 237 // format of: `[a-zA-Z][a-zA-Z0-9_:/-.]`. If the facet is a child 238 // facet, then the parent hierarchy needs to be specified separated by 239 // dots in the prefix after the schema id. Thus, the format for a multi- 240 // level facet is: <schema id>.<parent facet name>. 241 // <child facet name>. Example: 242 // schema123.root_parent_facet.middle_facet.child_facet 243 // * DocumentSchemaId: (with no schema id prefix) to get 244 // histograms for each document type (returns the schema id path, e.g. 245 // projects/12345/locations/us-west/documentSchemas/abc123). 246 // 247 // Example expression: 248 // 249 // * Document type counts: 250 // count('DocumentSchemaId') 251 // 252 // * For schema id, abc123, get the counts for MORTGAGE_TYPE: 253 // count('abc123.MORTGAGE_TYPE') 254 repeated HistogramQuery histogram_queries = 9; 255 256 // Controls if the search document request requires the return of a total size 257 // of matched documents. See 258 // [SearchDocumentsResponse.total_size][google.cloud.contentwarehouse.v1.SearchDocumentsResponse.total_size]. 259 // 260 // Enabling this flag may adversely impact performance. Hint: If this is 261 // used with pagination, set this flag on the initial query but set this 262 // to false on subsequent page calls (keep the total count locally). 263 // 264 // Defaults to false. 265 bool require_total_size = 10; 266 267 // Controls if the search document request requires the return of a total size 268 // of matched documents. See 269 // [SearchDocumentsResponse.total_size][google.cloud.contentwarehouse.v1.SearchDocumentsResponse.total_size]. 270 TotalResultSize total_result_size = 12; 271 272 // Experimental, do not use. 273 // The limit on the number of documents returned for the question-answering 274 // feature. To enable the question-answering feature, set 275 // [DocumentQuery].[is_nl_query][] to true. 276 int32 qa_size_limit = 11; 277} 278 279// Request message for DocumentService.LockDocument. 280message LockDocumentRequest { 281 // Required. The name of the document to lock. 282 // Format: 283 // projects/{project_number}/locations/{location}/documents/{document}. 284 string name = 1 [ 285 (google.api.field_behavior) = REQUIRED, 286 (google.api.resource_reference) = { 287 type: "contentwarehouse.googleapis.com/Document" 288 } 289 ]; 290 291 // The collection the document connects to. 292 string collection_id = 2; 293 294 // The user information who locks the document. 295 UserInfo locking_user = 3; 296} 297 298// Request message for DocumentService.FetchAcl 299message FetchAclRequest { 300 // Required. REQUIRED: The resource for which the policy is being requested. 301 // Format for document: 302 // projects/{project_number}/locations/{location}/documents/{document_id}. 303 // Format for collection: 304 // projects/{project_number}/locations/{location}/collections/{collection_id}. 305 // Format for project: projects/{project_number}. 306 string resource = 1 [(google.api.field_behavior) = REQUIRED]; 307 308 // The meta information collected about the end user, used to enforce access 309 // control for the service. 310 RequestMetadata request_metadata = 2; 311 312 // For Get Project ACL only. Authorization check for end user will be ignored 313 // when project_owner=true. 314 bool project_owner = 3; 315} 316 317// Request message for DocumentService.SetAcl. 318message SetAclRequest { 319 // Required. REQUIRED: The resource for which the policy is being requested. 320 // Format for document: 321 // projects/{project_number}/locations/{location}/documents/{document_id}. 322 // Format for collection: 323 // projects/{project_number}/locations/{location}/collections/{collection_id}. 324 // Format for project: projects/{project_number}. 325 string resource = 1 [(google.api.field_behavior) = REQUIRED]; 326 327 // Required. REQUIRED: The complete policy to be applied to the `resource`. 328 // The size of the policy is limited to a few 10s of KB. This refers to an 329 // Identity and Access (IAM) policy, which specifies access controls for the 330 // Document. 331 // 332 // You can set ACL with condition for projects only. 333 // 334 // Supported operators are: `=`, `!=`, `<`, `<=`, `>`, and `>=` where 335 // the left of the operator is `DocumentSchemaId` or property name and the 336 // right of the operator is a number or a quoted string. You must escape 337 // backslash (\\) and quote (\") characters. 338 // 339 // Boolean expressions (AND/OR) are supported up to 3 levels of nesting (for 340 // example, "((A AND B AND C) OR D) AND E"), a maximum of 10 comparisons are 341 // allowed in the expression. The expression must be < 6000 bytes in length. 342 // 343 // Sample condition: 344 // `"DocumentSchemaId = \"some schema id\" OR SchemaId.floatPropertyName 345 // >= 10"` 346 google.iam.v1.Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; 347 348 // The meta information collected about the end user, used to enforce access 349 // control for the service. 350 RequestMetadata request_metadata = 3; 351 352 // For Set Project ACL only. Authorization check for end user will be ignored 353 // when project_owner=true. 354 bool project_owner = 4; 355} 356