xref: /aosp_15_r20/external/googleapis/google/cloud/visionai/v1alpha1/warehouse.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.visionai.v1alpha1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/longrunning/operations.proto";
24import "google/protobuf/any.proto";
25import "google/protobuf/duration.proto";
26import "google/protobuf/empty.proto";
27import "google/protobuf/field_mask.proto";
28import "google/protobuf/struct.proto";
29import "google/protobuf/timestamp.proto";
30import "google/rpc/status.proto";
31import "google/type/datetime.proto";
32
33option csharp_namespace = "Google.Cloud.VisionAI.V1Alpha1";
34option go_package = "cloud.google.com/go/visionai/apiv1alpha1/visionaipb;visionaipb";
35option java_multiple_files = true;
36option java_outer_classname = "WarehouseProto";
37option java_package = "com.google.cloud.visionai.v1alpha1";
38option php_namespace = "Google\\Cloud\\VisionAI\\V1alpha1";
39option ruby_package = "Google::Cloud::VisionAI::V1alpha1";
40
41// Service that manages media content + metadata for streaming.
42service Warehouse {
43  option (google.api.default_host) = "visionai.googleapis.com";
44  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
45
46  // Creates an asset inside corpus.
47  rpc CreateAsset(CreateAssetRequest) returns (Asset) {
48    option (google.api.http) = {
49      post: "/v1alpha1/{parent=projects/*/locations/*/corpora/*}/assets"
50      body: "asset"
51    };
52    option (google.api.method_signature) = "parent,asset,asset_id";
53  }
54
55  // Updates an asset inside corpus.
56  rpc UpdateAsset(UpdateAssetRequest) returns (Asset) {
57    option (google.api.http) = {
58      patch: "/v1alpha1/{asset.name=projects/*/locations/*/corpora/*/assets/*}"
59      body: "asset"
60    };
61    option (google.api.method_signature) = "asset,update_mask";
62  }
63
64  // Reads an asset inside corpus.
65  rpc GetAsset(GetAssetRequest) returns (Asset) {
66    option (google.api.http) = {
67      get: "/v1alpha1/{name=projects/*/locations/*/corpora/*/assets/*}"
68    };
69    option (google.api.method_signature) = "name";
70  }
71
72  // Lists an list of assets inside corpus.
73  rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) {
74    option (google.api.http) = {
75      get: "/v1alpha1/{parent=projects/*/locations/*/corpora/*}/assets"
76    };
77    option (google.api.method_signature) = "parent";
78  }
79
80  // Deletes asset inside corpus.
81  rpc DeleteAsset(DeleteAssetRequest) returns (google.longrunning.Operation) {
82    option (google.api.http) = {
83      delete: "/v1alpha1/{name=projects/*/locations/*/corpora/*/assets/*}"
84    };
85    option (google.api.method_signature) = "name";
86    option (google.longrunning.operation_info) = {
87      response_type: "google.protobuf.Empty"
88      metadata_type: "DeleteAssetMetadata"
89    };
90  }
91
92  // Creates a corpus inside a project.
93  rpc CreateCorpus(CreateCorpusRequest) returns (google.longrunning.Operation) {
94    option (google.api.http) = {
95      post: "/v1alpha1/{parent=projects/*/locations/*}/corpora"
96      body: "corpus"
97    };
98    option (google.api.method_signature) = "parent,corpus";
99    option (google.longrunning.operation_info) = {
100      response_type: "Corpus"
101      metadata_type: "CreateCorpusMetadata"
102    };
103  }
104
105  // Gets corpus details inside a project.
106  rpc GetCorpus(GetCorpusRequest) returns (Corpus) {
107    option (google.api.http) = {
108      get: "/v1alpha1/{name=projects/*/locations/*/corpora/*}"
109    };
110    option (google.api.method_signature) = "name";
111  }
112
113  // Updates a corpus in a project.
114  rpc UpdateCorpus(UpdateCorpusRequest) returns (Corpus) {
115    option (google.api.http) = {
116      patch: "/v1alpha1/{corpus.name=projects/*/locations/*/corpora/*}"
117      body: "corpus"
118    };
119    option (google.api.method_signature) = "corpus,update_mask";
120  }
121
122  // Lists all corpora in a project.
123  rpc ListCorpora(ListCorporaRequest) returns (ListCorporaResponse) {
124    option (google.api.http) = {
125      get: "/v1alpha1/{parent=projects/*/locations/*}/corpora"
126    };
127    option (google.api.method_signature) = "parent";
128  }
129
130  // Deletes a corpus only if its empty.
131  // Returns empty response.
132  rpc DeleteCorpus(DeleteCorpusRequest) returns (google.protobuf.Empty) {
133    option (google.api.http) = {
134      delete: "/v1alpha1/{name=projects/*/locations/*/corpora/*}"
135    };
136    option (google.api.method_signature) = "name";
137  }
138
139  // Creates data schema inside corpus.
140  rpc CreateDataSchema(CreateDataSchemaRequest) returns (DataSchema) {
141    option (google.api.http) = {
142      post: "/v1alpha1/{parent=projects/*/locations/*/corpora/*}/dataSchemas"
143      body: "data_schema"
144    };
145    option (google.api.method_signature) = "parent,data_schema";
146  }
147
148  // Updates data schema inside corpus.
149  rpc UpdateDataSchema(UpdateDataSchemaRequest) returns (DataSchema) {
150    option (google.api.http) = {
151      patch: "/v1alpha1/{data_schema.name=projects/*/locations/*/corpora/*/dataSchemas/*}"
152      body: "data_schema"
153    };
154    option (google.api.method_signature) = "data_schema,update_mask";
155  }
156
157  // Gets data schema inside corpus.
158  rpc GetDataSchema(GetDataSchemaRequest) returns (DataSchema) {
159    option (google.api.http) = {
160      get: "/v1alpha1/{name=projects/*/locations/*/corpora/*/dataSchemas/*}"
161    };
162    option (google.api.method_signature) = "name";
163  }
164
165  // Deletes data schema inside corpus.
166  rpc DeleteDataSchema(DeleteDataSchemaRequest) returns (google.protobuf.Empty) {
167    option (google.api.http) = {
168      delete: "/v1alpha1/{name=projects/*/locations/*/corpora/*/dataSchemas/*}"
169    };
170    option (google.api.method_signature) = "name";
171  }
172
173  // Lists a list of data schemas inside corpus.
174  rpc ListDataSchemas(ListDataSchemasRequest) returns (ListDataSchemasResponse) {
175    option (google.api.http) = {
176      get: "/v1alpha1/{parent=projects/*/locations/*/corpora/*}/dataSchemas"
177    };
178    option (google.api.method_signature) = "parent";
179  }
180
181  // Creates annotation inside asset.
182  rpc CreateAnnotation(CreateAnnotationRequest) returns (Annotation) {
183    option (google.api.http) = {
184      post: "/v1alpha1/{parent=projects/*/locations/*/corpora/*/assets/*}/annotations"
185      body: "annotation"
186    };
187    option (google.api.method_signature) = "parent,annotation,annotation_id";
188  }
189
190  // Reads annotation inside asset.
191  rpc GetAnnotation(GetAnnotationRequest) returns (Annotation) {
192    option (google.api.http) = {
193      get: "/v1alpha1/{name=projects/*/locations/*/corpora/*/assets/*/annotations/*}"
194    };
195    option (google.api.method_signature) = "name";
196  }
197
198  // Lists a list of annotations inside asset.
199  rpc ListAnnotations(ListAnnotationsRequest) returns (ListAnnotationsResponse) {
200    option (google.api.http) = {
201      get: "/v1alpha1/{parent=projects/*/locations/*/corpora/*/assets/*}/annotations"
202    };
203    option (google.api.method_signature) = "parent";
204  }
205
206  // Updates annotation inside asset.
207  rpc UpdateAnnotation(UpdateAnnotationRequest) returns (Annotation) {
208    option (google.api.http) = {
209      patch: "/v1alpha1/{annotation.name=projects/*/locations/*/corpora/*/assets/*/annotations/*}"
210      body: "annotation"
211    };
212    option (google.api.method_signature) = "annotation,update_mask";
213  }
214
215  // Deletes annotation inside asset.
216  rpc DeleteAnnotation(DeleteAnnotationRequest) returns (google.protobuf.Empty) {
217    option (google.api.http) = {
218      delete: "/v1alpha1/{name=projects/*/locations/*/corpora/*/assets/*/annotations/*}"
219    };
220    option (google.api.method_signature) = "name";
221  }
222
223  // Ingests data for the asset. It is not allowed to ingest a data chunk which
224  // is already expired according to TTL.
225  // This method is only available via the gRPC API (not HTTP since
226  // bi-directional streaming is not supported via HTTP).
227  rpc IngestAsset(stream IngestAssetRequest) returns (stream IngestAssetResponse) {
228  }
229
230  // Generates clips for downloading. The api takes in a time range, and
231  // generates a clip of the first content available after start_time and
232  // before end_time, which may overflow beyond these bounds.
233  // Returned clips are truncated if the total size of the clips are larger
234  // than 100MB.
235  rpc ClipAsset(ClipAssetRequest) returns (ClipAssetResponse) {
236    option (google.api.http) = {
237      post: "/v1alpha1/{name=projects/*/locations/*/corpora/*/assets/*}:clip"
238      body: "*"
239    };
240  }
241
242  // Generates a uri for an HLS manifest. The api takes in a collection of time
243  // ranges, and generates a URI for an HLS manifest that covers all the
244  // requested time ranges.
245  rpc GenerateHlsUri(GenerateHlsUriRequest) returns (GenerateHlsUriResponse) {
246    option (google.api.http) = {
247      post: "/v1alpha1/{name=projects/*/locations/*/corpora/*/assets/*}:generateHlsUri"
248      body: "*"
249    };
250  }
251
252  // Creates a search configuration inside a corpus.
253  //
254  // Please follow the rules below to create a valid CreateSearchConfigRequest.
255  // --- General Rules ---
256  // 1. Request.search_config_id must not be associated with an existing
257  //    SearchConfig.
258  // 2. Request must contain at least one non-empty search_criteria_property or
259  //    facet_property.
260  // 3. mapped_fields must not be empty, and must map to existing UGA keys.
261  // 4. All mapped_fields must be of the same type.
262  // 5. All mapped_fields must share the same granularity.
263  // 6. All mapped_fields must share the same semantic SearchConfig match
264  //    options.
265  // For property-specific rules, please reference the comments for
266  // FacetProperty and SearchCriteriaProperty.
267  rpc CreateSearchConfig(CreateSearchConfigRequest) returns (SearchConfig) {
268    option (google.api.http) = {
269      post: "/v1alpha1/{parent=projects/*/locations/*/corpora/*}/searchConfigs"
270      body: "search_config"
271    };
272    option (google.api.method_signature) = "parent,search_config,search_config_id";
273  }
274
275  // Updates a search configuration inside a corpus.
276  //
277  // Please follow the rules below to create a valid UpdateSearchConfigRequest.
278  // --- General Rules ---
279  // 1. Request.search_configuration.name must already exist.
280  // 2. Request must contain at least one non-empty search_criteria_property or
281  // facet_property.
282  // 3. mapped_fields must not be empty, and must map to existing UGA keys.
283  // 4. All mapped_fields must be of the same type.
284  // 5. All mapped_fields must share the same granularity.
285  // 6. All mapped_fields must share the same semantic SearchConfig match
286  //    options.
287  // For property-specific rules, please reference the comments for
288  // FacetProperty and SearchCriteriaProperty.
289  rpc UpdateSearchConfig(UpdateSearchConfigRequest) returns (SearchConfig) {
290    option (google.api.http) = {
291      patch: "/v1alpha1/{search_config.name=projects/*/locations/*/corpora/*/searchConfigs/*}"
292      body: "search_config"
293    };
294    option (google.api.method_signature) = "search_config,update_mask";
295  }
296
297  // Gets a search configuration inside a corpus.
298  rpc GetSearchConfig(GetSearchConfigRequest) returns (SearchConfig) {
299    option (google.api.http) = {
300      get: "/v1alpha1/{name=projects/*/locations/*/corpora/*/searchConfigs/*}"
301    };
302    option (google.api.method_signature) = "name";
303  }
304
305  // Deletes a search configuration inside a corpus.
306  //
307  // For a DeleteSearchConfigRequest to be valid,
308  // Request.search_configuration.name must already exist.
309  rpc DeleteSearchConfig(DeleteSearchConfigRequest) returns (google.protobuf.Empty) {
310    option (google.api.http) = {
311      delete: "/v1alpha1/{name=projects/*/locations/*/corpora/*/searchConfigs/*}"
312    };
313    option (google.api.method_signature) = "name";
314  }
315
316  // Lists all search configurations inside a corpus.
317  rpc ListSearchConfigs(ListSearchConfigsRequest) returns (ListSearchConfigsResponse) {
318    option (google.api.http) = {
319      get: "/v1alpha1/{parent=projects/*/locations/*/corpora/*}/searchConfigs"
320    };
321    option (google.api.method_signature) = "parent";
322  }
323
324  // Search media asset.
325  rpc SearchAssets(SearchAssetsRequest) returns (SearchAssetsResponse) {
326    option (google.api.http) = {
327      post: "/v1alpha1/{corpus=projects/*/locations/*/corpora/*}:searchAssets"
328      body: "*"
329    };
330  }
331}
332
333// Different types for a facet bucket.
334enum FacetBucketType {
335  // Unspecified type.
336  FACET_BUCKET_TYPE_UNSPECIFIED = 0;
337
338  // Value type.
339  FACET_BUCKET_TYPE_VALUE = 1;
340
341  // Datetime type.
342  FACET_BUCKET_TYPE_DATETIME = 2;
343
344  // Fixed Range type.
345  FACET_BUCKET_TYPE_FIXED_RANGE = 3;
346
347  // Custom Range type.
348  FACET_BUCKET_TYPE_CUSTOM_RANGE = 4;
349}
350
351// Request message for CreateAssetRequest.
352message CreateAssetRequest {
353  // Required. The parent resource where this asset will be created.
354  // Format: projects/*/locations/*/corpora/*
355  string parent = 1 [
356    (google.api.field_behavior) = REQUIRED,
357    (google.api.resource_reference) = {
358      type: "visionai.googleapis.com/Corpus"
359    }
360  ];
361
362  // Required. The asset to create.
363  Asset asset = 2 [(google.api.field_behavior) = REQUIRED];
364
365  // Optional. The ID to use for the asset, which will become the final component of
366  // the asset's resource name if user choose to specify. Otherwise, asset id
367  // will be generated by system.
368  //
369  // This value should be up to 63 characters, and valid characters
370  // are /[a-z][0-9]-/. The first character must be a letter, the last could be
371  // a letter or a number.
372  optional string asset_id = 3 [(google.api.field_behavior) = OPTIONAL];
373}
374
375// Request message for GetAsset.
376message GetAssetRequest {
377  // Required. The name of the asset to retrieve.
378  // Format:
379  // projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
380  string name = 1 [
381    (google.api.field_behavior) = REQUIRED,
382    (google.api.resource_reference) = {
383      type: "visionai.googleapis.com/Asset"
384    }
385  ];
386}
387
388// Request message for ListAssets.
389message ListAssetsRequest {
390  // Required. The parent, which owns this collection of assets.
391  // Format:
392  // projects/{project_number}/locations/{location}/corpora/{corpus}
393  string parent = 1 [
394    (google.api.field_behavior) = REQUIRED,
395    (google.api.resource_reference) = {
396      child_type: "visionai.googleapis.com/Asset"
397    }
398  ];
399
400  // The maximum number of assets to return. The service may return fewer than
401  // this value.
402  // If unspecified, at most 50 assets will be returned.
403  // The maximum value is 1000; values above 1000 will be coerced to 1000.
404  int32 page_size = 2;
405
406  // A page token, received from a previous `ListAssets` call.
407  // Provide this to retrieve the subsequent page.
408  //
409  // When paginating, all other parameters provided to `ListAssets` must match
410  // the call that provided the page token.
411  string page_token = 3;
412}
413
414// Response message for ListAssets.
415message ListAssetsResponse {
416  // The assets from the specified corpus.
417  repeated Asset assets = 1;
418
419  // A token, which can be sent as `page_token` to retrieve the next page.
420  // If this field is omitted, there are no subsequent pages.
421  string next_page_token = 2;
422}
423
424// Response message for UpdateAsset.
425message UpdateAssetRequest {
426  // Required. The asset to update.
427  //
428  // The asset's `name` field is used to identify the asset to be updated.
429  // Format:
430  // projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
431  Asset asset = 1 [(google.api.field_behavior) = REQUIRED];
432
433  // The list of fields to be updated.
434  google.protobuf.FieldMask update_mask = 2;
435}
436
437// Request message for DeleteAsset.
438message DeleteAssetRequest {
439  // Required. The name of the asset to delete.
440  // Format:
441  // projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
442  string name = 1 [
443    (google.api.field_behavior) = REQUIRED,
444    (google.api.resource_reference) = {
445      type: "visionai.googleapis.com/Asset"
446    }
447  ];
448}
449
450// An asset is a resource in corpus. It represents a media object inside corpus,
451// contains metadata and another resource annotation. Different feature could be
452// applied to the asset to generate annotations. User could specified annotation
453// related to the target asset.
454message Asset {
455  option (google.api.resource) = {
456    type: "visionai.googleapis.com/Asset"
457    pattern: "projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}"
458  };
459
460  // Resource name of the asset.
461  // Form:
462  // `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}`
463  string name = 1;
464
465  // The duration for which all media assets, associated metadata, and search
466  // documents can exist. If not set, then it will using the default ttl in the
467  // parent corpus resource.
468  google.protobuf.Duration ttl = 2;
469}
470
471// Request message of CreateCorpus API.
472message CreateCorpusRequest {
473  // Required. Form: `projects/{project_number}/locations/{location_id}`
474  string parent = 1 [(google.api.field_behavior) = REQUIRED];
475
476  // Required. The corpus to be created.
477  Corpus corpus = 2 [(google.api.field_behavior) = REQUIRED];
478}
479
480// Metadata for CreateCorpus API.
481message CreateCorpusMetadata {
482
483}
484
485// Corpus is a set of video contents for management. Within a corpus, videos
486// share the same data schema. Search is also restricted within a single corpus.
487message Corpus {
488  option (google.api.resource) = {
489    type: "visionai.googleapis.com/Corpus"
490    pattern: "projects/{project_number}/locations/{location}/corpora/{corpus}"
491  };
492
493  // Resource name of the corpus.
494  // Form:
495  // `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}`
496  string name = 1;
497
498  // Required. The corpus name to shown in the UI. The name can be up to 32 characters
499  // long.
500  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
501
502  // Optional. Description of the corpus. Can be up to 25000 characters long.
503  string description = 3 [(google.api.field_behavior) = OPTIONAL];
504
505  // Required. The default TTL value for all assets under the corpus without a asset level
506  // user-defined TTL with a maximum of 10 years. This is required for all
507  // corpora.
508  google.protobuf.Duration default_ttl = 5 [(google.api.field_behavior) = REQUIRED];
509}
510
511// Request message for GetCorpus.
512message GetCorpusRequest {
513  // Required. The resource name of the corpus to retrieve.
514  string name = 1 [
515    (google.api.field_behavior) = REQUIRED,
516    (google.api.resource_reference) = {
517      type: "visionai.googleapis.com/Corpus"
518    }
519  ];
520}
521
522// Request message for UpdateCorpus.
523message UpdateCorpusRequest {
524  // Required. The corpus which replaces the resource on the server.
525  Corpus corpus = 1 [(google.api.field_behavior) = REQUIRED];
526
527  // The list of fields to be updated.
528  google.protobuf.FieldMask update_mask = 2;
529}
530
531// Request message for ListCorpora.
532message ListCorporaRequest {
533  // Required. The resource name of the project from which to list corpora.
534  string parent = 1 [(google.api.field_behavior) = REQUIRED];
535
536  // Requested page size. API may return fewer results than requested.
537  // If negative, INVALID_ARGUMENT error will be returned.
538  // If unspecified or 0, API will pick a default size, which is 10.
539  // If the requested page size is larger than the maximum size, API will pick
540  // use the maximum size, which is 20.
541  int32 page_size = 2;
542
543  // A token identifying a page of results for the server to return.
544  // Typically obtained via [ListCorpora.next_page_token][] of the previous
545  // [Warehouse.ListCorpora][google.cloud.visionai.v1alpha1.Warehouse.ListCorpora] call.
546  string page_token = 3;
547}
548
549// Response message for ListCorpora.
550message ListCorporaResponse {
551  // The corpora in the project.
552  repeated Corpus corpora = 1;
553
554  // A token to retrieve next page of results.
555  // Pass to [ListCorporaRequest.page_token][google.cloud.visionai.v1alpha1.ListCorporaRequest.page_token] to obtain that page.
556  string next_page_token = 2;
557}
558
559// Request message for DeleteCorpus.
560message DeleteCorpusRequest {
561  // Required. The resource name of the corpus to delete.
562  string name = 1 [
563    (google.api.field_behavior) = REQUIRED,
564    (google.api.resource_reference) = {
565      type: "visionai.googleapis.com/Corpus"
566    }
567  ];
568}
569
570// Request message for CreateDataSchema.
571message CreateDataSchemaRequest {
572  // Required. The parent resource where this data schema will be created.
573  // Format: projects/*/locations/*/corpora/*
574  string parent = 1 [
575    (google.api.field_behavior) = REQUIRED,
576    (google.api.resource_reference) = {
577      type: "visionai.googleapis.com/Corpus"
578    }
579  ];
580
581  // Required. The data schema to create.
582  DataSchema data_schema = 2 [(google.api.field_behavior) = REQUIRED];
583}
584
585// Data schema indicates how the user specified annotation is interpreted in the
586// system.
587message DataSchema {
588  option (google.api.resource) = {
589    type: "visionai.googleapis.com/DataSchema"
590    pattern: "projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}"
591  };
592
593  // Resource name of the data schema in the form of:
594  // `projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}`
595  // where {data_schema} part should be the same as the `key` field below.
596  string name = 1;
597
598  // Required. The key of this data schema. This key should be matching the key of user
599  // specified annotation and unique inside corpus. This value can be up to
600  // 63 characters, and valid characters are /[a-z][0-9]-/. The first character
601  // must be a letter, the last could be a letter or a number.
602  string key = 2 [(google.api.field_behavior) = REQUIRED];
603
604  // The schema details mapping to the key.
605  DataSchemaDetails schema_details = 3;
606}
607
608// Data schema details indicates the data type and the data struct corresponding
609// to the key of user specified annotation.
610message DataSchemaDetails {
611  // The configuration for `PROTO_ANY` data type.
612  message ProtoAnyConfig {
613    // The type URI of the proto message.
614    string type_uri = 1;
615  }
616
617  // The search strategy for annotations value of the `key`.
618  message SearchStrategy {
619    // The types of search strategies to be applied on the annotation key.
620    enum SearchStrategyType {
621      // Annotatation values of the `key` above will not be searchable.
622      NO_SEARCH = 0;
623
624      // When searching with `key`, the value must be exactly as the annotation
625      // value that has been ingested.
626      EXACT_SEARCH = 1;
627
628      // When searching with `key`, Warehouse will perform broad search based on
629      // semantic of the annotation value.
630      SMART_SEARCH = 2;
631    }
632
633    // The type of search strategy to be applied on the `key` above.
634    // The allowed `search_strategy_type` is different for different data types,
635    // which is documented in the DataSchemaDetails.DataType. Specifying
636    // unsupported `search_strategy_type` for data types will result in
637    // INVALID_ARGUMENT error.
638    SearchStrategyType search_strategy_type = 1;
639  }
640
641  // Data type of the annotation.
642  enum DataType {
643    // Unspecified type.
644    DATA_TYPE_UNSPECIFIED = 0;
645
646    // Integer type.
647    // Allowed search strategies:
648    // - DataSchema.SearchStrategy.NO_SEARCH,
649    // - DataSchema.SearchStrategy.EXACT_SEARCH.
650    //   Supports query by IntRangeArray.
651    INTEGER = 1;
652
653    // Float type.
654    // Allowed search strategies:
655    // - DataSchema.SearchStrategy.NO_SEARCH,
656    // - DataSchema.SearchStrategy.EXACT_SEARCH.
657    //   Supports query by FloatRangeArray.
658    FLOAT = 2;
659
660    // String type.
661    // Allowed search strategies:
662    // - DataSchema.SearchStrategy.NO_SEARCH,
663    // - DataSchema.SearchStrategy.EXACT_SEARCH,
664    // - DataSchema.SearchStrategy.SMART_SEARCH.
665    STRING = 3;
666
667    // Supported formats:
668    // %Y-%m-%dT%H:%M:%E*S%E*z (absl::RFC3339_full)
669    // %Y-%m-%dT%H:%M:%E*S
670    // %Y-%m-%dT%H:%M%E*z
671    // %Y-%m-%dT%H:%M
672    // %Y-%m-%dT%H%E*z
673    // %Y-%m-%dT%H
674    // %Y-%m-%d%E*z
675    // %Y-%m-%d
676    // %Y-%m
677    // %Y
678    // Allowed search strategies:
679    // - DataSchema.SearchStrategy.NO_SEARCH,
680    // - DataSchema.SearchStrategy.EXACT_SEARCH.
681    //   Supports query by DateTimeRangeArray.
682    DATETIME = 5;
683
684    // Geo coordinate type.
685    // Allowed search strategies:
686    // - DataSchema.SearchStrategy.NO_SEARCH,
687    // - DataSchema.SearchStrategy.EXACT_SEARCH.
688    //   Supports query by GeoLocationArray.
689    GEO_COORDINATE = 7;
690
691    // Type to pass any proto as available in annotations.proto. Only use
692    // internally.
693    // Available proto types and its corresponding search behavior:
694    // - ImageObjectDetectionPredictionResult, allows SMART_SEARCH on
695    //   display_names and NO_SEARCH.
696    // - ClassificationPredictionResult, allows SMART_SEARCH on display_names
697    //   and NO_SEARCH.
698    // - ImageSegmentationPredictionResult, allows NO_SEARCH.
699    // - VideoActionRecognitionPredictionResult, allows SMART_SEARCH on
700    //   display_name and NO_SEARCH.
701    // - VideoObjectTrackingPredictionResult, allows SMART_SEARCH on
702    //   display_name and NO_SEARCH.
703    // - VideoClassificationPredictionResult, allows SMART_SEARCH on
704    //   display_name and NO_SEARCH.
705    // - OccupancyCountingPredictionResult, allows EXACT_SEARCH on
706    //   stats.full_frame_count.count and NO_SEARCH.
707    // - ObjectDetectionPredictionResult, allows SMART_SEARCH on
708    //   identified_boxes.entity.label_string and NO_SEARCH.
709    PROTO_ANY = 8;
710
711    // Boolean type.
712    // Allowed search strategies:
713    // - DataSchema.SearchStrategy.NO_SEARCH,
714    // - DataSchema.SearchStrategy.EXACT_SEARCH.
715    BOOLEAN = 9;
716  }
717
718  // The granularity of annotations under this DataSchema.
719  enum Granularity {
720    // Unspecified granularity.
721    GRANULARITY_UNSPECIFIED = 0;
722
723    // Asset-level granularity (annotations must not contain partition info).
724    GRANULARITY_ASSET_LEVEL = 1;
725
726    // Partition-level granularity (annotations must contain partition info).
727    GRANULARITY_PARTITION_LEVEL = 2;
728  }
729
730  // Type of the annotation.
731  DataType type = 1;
732
733  // Config for protobuf any type.
734  ProtoAnyConfig proto_any_config = 6;
735
736  // The granularity associated with this DataSchema.
737  Granularity granularity = 5;
738
739  // The search strategy to be applied on the `key` above.
740  SearchStrategy search_strategy = 7;
741}
742
743// Request message for UpdateDataSchema.
744message UpdateDataSchemaRequest {
745  // Required. The data schema's `name` field is used to identify the data schema to be
746  // updated. Format:
747  // projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}
748  DataSchema data_schema = 1 [(google.api.field_behavior) = REQUIRED];
749
750  // The list of fields to be updated.
751  google.protobuf.FieldMask update_mask = 2;
752}
753
754// Request message for GetDataSchema.
755message GetDataSchemaRequest {
756  // Required. The name of the data schema to retrieve.
757  // Format:
758  // projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}
759  string name = 1 [
760    (google.api.field_behavior) = REQUIRED,
761    (google.api.resource_reference) = {
762      type: "visionai.googleapis.com/DataSchema"
763    }
764  ];
765}
766
767// Request message for DeleteDataSchema.
768message DeleteDataSchemaRequest {
769  // Required. The name of the data schema to delete.
770  // Format:
771  // projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}
772  string name = 1 [
773    (google.api.field_behavior) = REQUIRED,
774    (google.api.resource_reference) = {
775      type: "visionai.googleapis.com/DataSchema"
776    }
777  ];
778}
779
780// Request message for ListDataSchemas.
781message ListDataSchemasRequest {
782  // Required. The parent, which owns this collection of data schemas.
783  // Format:
784  // projects/{project_number}/locations/{location_id}/corpora/{corpus_id}
785  string parent = 1 [
786    (google.api.field_behavior) = REQUIRED,
787    (google.api.resource_reference) = {
788      child_type: "visionai.googleapis.com/DataSchema"
789    }
790  ];
791
792  // The maximum number of data schemas to return. The service may return fewer
793  // than this value. If unspecified, at most 50 data schemas will be returned.
794  // The maximum value is 1000; values above 1000 will be coerced to 1000.
795  int32 page_size = 2;
796
797  // A page token, received from a previous `ListDataSchemas` call.
798  // Provide this to retrieve the subsequent page.
799  //
800  // When paginating, all other parameters provided to `ListDataSchemas` must
801  // match the call that provided the page token.
802  string page_token = 3;
803}
804
805// Response message for ListDataSchemas.
806message ListDataSchemasResponse {
807  // The data schemas from the specified corpus.
808  repeated DataSchema data_schemas = 1;
809
810  // A token, which can be sent as `page_token` to retrieve the next page.
811  // If this field is omitted, there are no subsequent pages.
812  string next_page_token = 2;
813}
814
815// Request message for CreateAnnotation.
816message CreateAnnotationRequest {
817  // Required. The parent resource where this annotation will be created.
818  // Format: projects/*/locations/*/corpora/*/assets/*
819  string parent = 1 [
820    (google.api.field_behavior) = REQUIRED,
821    (google.api.resource_reference) = {
822      type: "visionai.googleapis.com/Asset"
823    }
824  ];
825
826  // Required. The annotation to create.
827  Annotation annotation = 2 [(google.api.field_behavior) = REQUIRED];
828
829  // Optional. The ID to use for the annotation, which will become the final component of
830  // the annotation's resource name if user choose to specify. Otherwise,
831  // annotation id will be generated by system.
832  //
833  // This value should be up to 63 characters, and valid characters
834  // are /[a-z][0-9]-/. The first character must be a letter, the last could be
835  // a letter or a number.
836  optional string annotation_id = 3 [(google.api.field_behavior) = OPTIONAL];
837}
838
839// An annotation is a resource in asset. It represents a key-value mapping of
840// content in asset.
841message Annotation {
842  option (google.api.resource) = {
843    type: "visionai.googleapis.com/Annotation"
844    pattern: "projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}"
845  };
846
847  // Resource name of the annotation.
848  // Form:
849  // `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}`
850  string name = 1;
851
852  // User provided annotation.
853  UserSpecifiedAnnotation user_specified_annotation = 2;
854}
855
856// Annotation provided by users.
857message UserSpecifiedAnnotation {
858  // Required. Key of the annotation. The key must be set with type by CreateDataSchema.
859  string key = 1 [(google.api.field_behavior) = REQUIRED];
860
861  // Value of the annotation. The value must be able to convert
862  // to the type according to the data schema.
863  AnnotationValue value = 2;
864
865  // Partition information in time and space for the sub-asset level annotation.
866  Partition partition = 3;
867}
868
869// Location Coordinate Representation
870message GeoCoordinate {
871  // Latitude Coordinate. Degrees [-90 .. 90]
872  double latitude = 1;
873
874  // Longitude Coordinate. Degrees [-180 .. 180]
875  double longitude = 2;
876}
877
878// Value of annotation, including all types available in data schema.
879message AnnotationValue {
880  oneof value {
881    // Value of int type annotation.
882    int64 int_value = 1;
883
884    // Value of float type annotation.
885    float float_value = 2;
886
887    // Value of string type annotation.
888    string str_value = 3;
889
890    // Value of date time type annotation.
891    string datetime_value = 5;
892
893    // Value of geo coordinate type annotation.
894    GeoCoordinate geo_coordinate = 7;
895
896    // Value of any proto value.
897    google.protobuf.Any proto_any_value = 8;
898
899    // Value of boolean type annotation.
900    bool bool_value = 9;
901
902    // Value of customized struct annotation.
903    google.protobuf.Struct customized_struct_data_value = 10;
904  }
905}
906
907// Request message for GetAnnotation API.
908message ListAnnotationsRequest {
909  // The parent, which owns this collection of annotations.
910  // Format:
911  // projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
912  string parent = 1 [(google.api.resource_reference) = {
913                       type: "visionai.googleapis.com/Asset"
914                     }];
915
916  // The maximum number of annotations to return. The service may return fewer
917  // than this value. If unspecified, at most 50 annotations will be returned.
918  // The maximum value is 1000; values above 1000 will be coerced to 1000.
919  int32 page_size = 2;
920
921  // A page token, received from a previous `ListAnnotations` call.
922  // Provide this to retrieve the subsequent page.
923  //
924  // When paginating, all other parameters provided to `ListAnnotations` must
925  // match the call that provided the page token.
926  string page_token = 3;
927
928  // The filter applied to the returned list.
929  // We only support filtering for the following fields:
930  // `partition.temporal_partition.start_time`,
931  // `partition.temporal_partition.end_time`, and `key`.
932  // Timestamps are specified in the RFC-3339 format, and only one restriction
933  // may be applied per field, joined by conjunctions.
934  // Format:
935  // "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND
936  // partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND
937  // key = "example_key""
938  string filter = 4;
939}
940
941// Request message for ListAnnotations API.
942message ListAnnotationsResponse {
943  // The annotations from the specified asset.
944  repeated Annotation annotations = 1;
945
946  // A token, which can be sent as `page_token` to retrieve the next page.
947  // If this field is omitted, there are no subsequent pages.
948  string next_page_token = 2;
949}
950
951// Request message for GetAnnotation API.
952message GetAnnotationRequest {
953  // Required. The name of the annotation to retrieve.
954  // Format:
955  // projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}
956  string name = 1 [
957    (google.api.field_behavior) = REQUIRED,
958    (google.api.resource_reference) = {
959      type: "visionai.googleapis.com/Annotation"
960    }
961  ];
962}
963
964// Request message for UpdateAnnotation API.
965message UpdateAnnotationRequest {
966  // Required. The annotation to update.
967  // The annotation's `name` field is used to identify the annotation to be
968  // updated. Format:
969  // projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}
970  Annotation annotation = 1 [(google.api.field_behavior) = REQUIRED];
971
972  // The list of fields to be updated.
973  google.protobuf.FieldMask update_mask = 2;
974}
975
976// Request message for DeleteAnnotation API.
977message DeleteAnnotationRequest {
978  // Required. The name of the annotation to delete.
979  // Format:
980  // projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}
981  string name = 1 [
982    (google.api.field_behavior) = REQUIRED,
983    (google.api.resource_reference) = {
984      type: "visionai.googleapis.com/Annotation"
985    }
986  ];
987}
988
989// Request message for CreateSearchConfig.
990message CreateSearchConfigRequest {
991  // Required. The parent resource where this search configuration will be created.
992  // Format: projects/*/locations/*/corpora/*
993  string parent = 1 [
994    (google.api.field_behavior) = REQUIRED,
995    (google.api.resource_reference) = {
996      child_type: "visionai.googleapis.com/SearchConfig"
997    }
998  ];
999
1000  // Required. The search config to create.
1001  SearchConfig search_config = 2 [(google.api.field_behavior) = REQUIRED];
1002
1003  // Required. ID to use for the new search config. Will become the final component of the
1004  // SearchConfig's resource name. This value should be up to 63 characters, and
1005  // valid characters are /[a-z][0-9]-_/. The first character must be a letter,
1006  // the last could be a letter or a number.
1007  string search_config_id = 3 [(google.api.field_behavior) = REQUIRED];
1008}
1009
1010// Request message for UpdateSearchConfig.
1011message UpdateSearchConfigRequest {
1012  // Required. The search configuration to update.
1013  //
1014  // The search configuration's `name` field is used to identify the resource to
1015  // be updated. Format:
1016  // projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}
1017  SearchConfig search_config = 1 [(google.api.field_behavior) = REQUIRED];
1018
1019  // The list of fields to be updated. If left unset, all field paths will be
1020  // updated/overwritten.
1021  google.protobuf.FieldMask update_mask = 2;
1022}
1023
1024// Request message for GetSearchConfig.
1025message GetSearchConfigRequest {
1026  // Required. The name of the search configuration to retrieve.
1027  // Format:
1028  // projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}
1029  string name = 1 [
1030    (google.api.field_behavior) = REQUIRED,
1031    (google.api.resource_reference) = {
1032      type: "visionai.googleapis.com/SearchConfig"
1033    }
1034  ];
1035}
1036
1037// Request message for DeleteSearchConfig.
1038message DeleteSearchConfigRequest {
1039  // Required. The name of the search configuration to delete.
1040  // Format:
1041  // projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}
1042  string name = 1 [
1043    (google.api.field_behavior) = REQUIRED,
1044    (google.api.resource_reference) = {
1045      type: "visionai.googleapis.com/SearchConfig"
1046    }
1047  ];
1048}
1049
1050// Request message for ListSearchConfigs.
1051message ListSearchConfigsRequest {
1052  // Required. The parent, which owns this collection of search configurations.
1053  // Format:
1054  // projects/{project_number}/locations/{location}/corpora/{corpus}
1055  string parent = 1 [
1056    (google.api.field_behavior) = REQUIRED,
1057    (google.api.resource_reference) = {
1058      child_type: "visionai.googleapis.com/SearchConfig"
1059    }
1060  ];
1061
1062  // The maximum number of search configurations to return. The service may
1063  // return fewer than this value. If unspecified, a page size of 50 will be
1064  // used. The maximum value is 1000; values above 1000 will be coerced to 1000.
1065  int32 page_size = 2;
1066
1067  // A page token, received from a previous `ListSearchConfigs` call.
1068  // Provide this to retrieve the subsequent page.
1069  //
1070  // When paginating, all other parameters provided to
1071  // `ListSearchConfigs` must match the call that provided the page
1072  // token.
1073  string page_token = 3;
1074}
1075
1076// Response message for ListSearchConfigs.
1077message ListSearchConfigsResponse {
1078  // The search configurations from the specified corpus.
1079  repeated SearchConfig search_configs = 1;
1080
1081  // A token, which can be sent as `page_token` to retrieve the next page.
1082  // If this field is omitted, there are no subsequent pages.
1083  string next_page_token = 2;
1084}
1085
1086// SearchConfig stores different properties that will affect search
1087// behaviors and search results.
1088message SearchConfig {
1089  option (google.api.resource) = {
1090    type: "visionai.googleapis.com/SearchConfig"
1091    pattern: "projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}"
1092  };
1093
1094  // Resource name of the search configuration.
1095  // For CustomSearchCriteria, search_config would be the search
1096  // operator name. For Facets, search_config would be the facet
1097  // dimension name.
1098  // Form:
1099  // `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}`
1100  string name = 1;
1101
1102  // Establishes a FacetDimension and associated specifications.
1103  FacetProperty facet_property = 2;
1104
1105  // Creates a mapping between a custom SearchCriteria and one or more UGA keys.
1106  SearchCriteriaProperty search_criteria_property = 3;
1107}
1108
1109// Central configuration for a facet.
1110message FacetProperty {
1111  // If bucket type is FIXED_RANGE, specify how values are bucketized. Use
1112  // FixedRangeBucketSpec when you want to create multiple buckets with equal
1113  // granularities. Using integer bucket value as an example, when
1114  // bucket_start = 0, bucket_granularity = 10, bucket_count = 5, this facet
1115  // will be aggregated via the following buckets:
1116  // [-inf, 0), [0, 10), [10, 20), [20, 30), [30, inf).
1117  // Notably, bucket_count <= 1 is an invalid spec.
1118  message FixedRangeBucketSpec {
1119    // Lower bound of the bucket. NOTE: Only integer type is currently supported
1120    // for this field.
1121    FacetValue bucket_start = 1;
1122
1123    // Bucket granularity. NOTE: Only integer type is currently supported for
1124    // this field.
1125    FacetValue bucket_granularity = 2;
1126
1127    // Total number of buckets.
1128    int32 bucket_count = 3;
1129  }
1130
1131  // If bucket type is CUSTOM_RANGE, specify how values are bucketized. Use
1132  // integer bucket value as an example, when the endpoints are 0, 10, 100, and
1133  // 1000, we will generate the following facets:
1134  // [-inf, 0), [0, 10), [10, 100), [100, 1000), [1000, inf).
1135  // Notably:
1136  // - endpoints must be listed in ascending order. Otherwise, the SearchConfig
1137  //   API will reject the facet config.
1138  // - < 1 endpoints is an invalid spec.
1139  message CustomRangeBucketSpec {
1140    // Currently, only integer type is supported for this field.
1141    repeated FacetValue endpoints = 1;
1142  }
1143
1144  // If bucket type is DATE, specify how date values are bucketized.
1145  message DateTimeBucketSpec {
1146    // Granularity enum for the datetime bucket.
1147    enum Granularity {
1148      // Unspecified granularity.
1149      GRANULARITY_UNSPECIFIED = 0;
1150
1151      // Granularity is year.
1152      YEAR = 1;
1153
1154      // Granularity is month.
1155      MONTH = 2;
1156
1157      // Granularity is day.
1158      DAY = 3;
1159    }
1160
1161    // Granularity of date type facet.
1162    Granularity granularity = 1;
1163  }
1164
1165  oneof range_facet_config {
1166    // Fixed range facet bucket config.
1167    FixedRangeBucketSpec fixed_range_bucket_spec = 5;
1168
1169    // Custom range facet bucket config.
1170    CustomRangeBucketSpec custom_range_bucket_spec = 6;
1171
1172    // Datetime range facet bucket config.
1173    DateTimeBucketSpec datetime_bucket_spec = 7;
1174  }
1175
1176  // Name of the facets, which are the dimensions users want to use to refine
1177  // search results. `mapped_fields` will match UserSpecifiedDataSchema keys.
1178  //
1179  // For example, user can add a bunch of UGAs with the same key, such as
1180  // player:adam, player:bob, player:charles. When multiple mapped_fields are
1181  // specified, will merge their value together as final facet value. E.g.
1182  // home_team: a, home_team:b, away_team:a, away_team:c, when facet_field =
1183  // [home_team, away_team], facet_value will be [a, b, c].
1184  //
1185  // UNLESS this is a 1:1 facet dimension (mapped_fields.size() == 1) AND the
1186  // mapped_field equals the parent SearchConfig.name, the parent must
1187  // also contain a SearchCriteriaProperty that maps to the same fields.
1188  // mapped_fields must not be empty.
1189  repeated string mapped_fields = 1;
1190
1191  // Display name of the facet. To be used by UI for facet rendering.
1192  string display_name = 2;
1193
1194  // Maximum number of unique bucket to return for one facet. Bucket number can
1195  // be large for high-cardinality facet such as "player". We only return top-n
1196  // most related ones to user. If it's <= 0, the server will decide the
1197  // appropriate result_size.
1198  int64 result_size = 3;
1199
1200  // Facet bucket type e.g. value, range.
1201  FacetBucketType bucket_type = 4;
1202}
1203
1204// Central configuration for custom search criteria.
1205message SearchCriteriaProperty {
1206  // Each mapped_field corresponds to a UGA key. To understand how this property
1207  // works, take the following example. In the SearchConfig table, the
1208  // user adds this entry:
1209  //   search_config {
1210  //     name: "person"
1211  //     search_criteria_property {
1212  //       mapped_fields: "player"
1213  //       mapped_fields: "coach"
1214  //     }
1215  //   }
1216  //
1217  // Now, when a user issues a query like:
1218  //   criteria {
1219  //     field: "person"
1220  //     text_array {
1221  //       txt_values: "Tom Brady"
1222  //       txt_values: "Bill Belichick"
1223  //     }
1224  //   }
1225  //
1226  // MWH search will return search documents where (player=Tom Brady ||
1227  // coach=Tom Brady || player=Bill Belichick || coach=Bill Belichick).
1228  repeated string mapped_fields = 1;
1229}
1230
1231// Definition of a single value with generic type.
1232message FacetValue {
1233  oneof value {
1234    // String type value.
1235    string string_value = 1;
1236
1237    // Integer type value.
1238    int64 integer_value = 2;
1239
1240    // Datetime type value.
1241    google.type.DateTime datetime_value = 3;
1242  }
1243}
1244
1245// Holds the facet value, selections state, and metadata.
1246message FacetBucket {
1247  // The range of values [start, end) for which faceting is applied.
1248  message Range {
1249    // Start of the range. Non-existence indicates some bound (e.g. -inf).
1250    FacetValue start = 1;
1251
1252    // End of the range. Non-existence indicates some bound (e.g. inf).
1253    FacetValue end = 2;
1254  }
1255
1256  // Bucket associated with a facet. For example, bucket of facet “team”
1257  // can be "49ers", "patriots", etc; bucket of facet "player" can be "tom
1258  // brady", "drew brees", etc.
1259  oneof bucket_value {
1260    // Singular value.
1261    FacetValue value = 2;
1262
1263    // Range value.
1264    Range range = 4;
1265  }
1266
1267  // Whether one facet bucket is selected. This field represents user's facet
1268  // selection. It is set by frontend in SearchVideosRequest.
1269  bool selected = 3;
1270}
1271
1272// A group of facet buckets to be passed back and forth between backend &
1273// frontend.
1274message FacetGroup {
1275  // Unique id of the facet group.
1276  string facet_id = 1;
1277
1278  // Display name of the facet. To be used by UI for facet rendering.
1279  string display_name = 2;
1280
1281  // Buckets associated with the facet. E.g. for "Team" facet, the bucket
1282  // can be 49ers, patriots, etc.
1283  repeated FacetBucket buckets = 3;
1284
1285  // Facet bucket type.
1286  FacetBucketType bucket_type = 4;
1287
1288  // If true, return query matched annotations for this facet group's selection.
1289  // This option is only applicable for facets based on partition level
1290  // annotations. It supports the following facet values:
1291  //  - INTEGER
1292  //  - STRING (DataSchema.SearchStrategy.EXACT_SEARCH only)
1293  bool fetch_matched_annotations = 5;
1294}
1295
1296// Request message for IngestAsset API.
1297message IngestAssetRequest {
1298  // Configuration for the data.
1299  message Config {
1300    // Type information for video data.
1301    message VideoType {
1302      // Container format of the video.
1303      enum ContainerFormat {
1304        // The default type, not supposed to be used.
1305        CONTAINER_FORMAT_UNSPECIFIED = 0;
1306
1307        // Mp4 container format.
1308        CONTAINER_FORMAT_MP4 = 1;
1309      }
1310
1311      // Container format of the video data.
1312      ContainerFormat container_format = 1;
1313    }
1314
1315    oneof data_type {
1316      // Type information for video data.
1317      VideoType video_type = 2;
1318    }
1319
1320    // Required. The resource name of the asset that the ingested data belongs to.
1321    string asset = 1 [
1322      (google.api.field_behavior) = REQUIRED,
1323      (google.api.resource_reference) = {
1324        type: "visionai.googleapis.com/Asset"
1325      }
1326    ];
1327  }
1328
1329  // Contains the data and the corresponding time range this data is for.
1330  message TimeIndexedData {
1331    // Data to be ingested.
1332    bytes data = 1;
1333
1334    // Time range of the data.
1335    Partition.TemporalPartition temporal_partition = 2;
1336  }
1337
1338  oneof streaming_request {
1339    // Provides information for the data and the asset resource name that the
1340    // data belongs to. The first `IngestAssetRequest` message must only contain
1341    // a `Config` message.
1342    Config config = 1;
1343
1344    // Data to be ingested.
1345    TimeIndexedData time_indexed_data = 2;
1346  }
1347}
1348
1349// Response message for IngestAsset API.
1350message IngestAssetResponse {
1351  // Time range of the data that has been successfully ingested.
1352  Partition.TemporalPartition successfully_ingested_partition = 1;
1353}
1354
1355// Request message for ClipAsset API.
1356message ClipAssetRequest {
1357  // Required. The resource name of the asset to request clips for.
1358  // Form:
1359  // 'projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}'
1360  string name = 1 [
1361    (google.api.field_behavior) = REQUIRED,
1362    (google.api.resource_reference) = {
1363      type: "visionai.googleapis.com/Asset"
1364    }
1365  ];
1366
1367  // Required. The time range to request clips for.
1368  Partition.TemporalPartition temporal_partition = 2 [(google.api.field_behavior) = REQUIRED];
1369}
1370
1371// Response message for ClipAsset API.
1372message ClipAssetResponse {
1373  // Signed uri with corresponding time range.
1374  message TimeIndexedUri {
1375    // Time range of the video that the uri is for.
1376    Partition.TemporalPartition temporal_partition = 1;
1377
1378    // Signed uri to download the video clip.
1379    string uri = 2;
1380  }
1381
1382  // A list of signed uris to download the video clips that cover the requested
1383  // time range ordered by time.
1384  repeated TimeIndexedUri time_indexed_uris = 1;
1385}
1386
1387// Request message for GenerateHlsUri API.
1388message GenerateHlsUriRequest {
1389  // Required. The resource name of the asset to request clips for.
1390  // Form:
1391  // 'projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}'
1392  string name = 1 [
1393    (google.api.field_behavior) = REQUIRED,
1394    (google.api.resource_reference) = {
1395      type: "visionai.googleapis.com/Asset"
1396    }
1397  ];
1398
1399  // Required. The time range to request clips for.
1400  repeated Partition.TemporalPartition temporal_partitions = 2 [(google.api.field_behavior) = REQUIRED];
1401}
1402
1403// Response message for GenerateHlsUri API.
1404message GenerateHlsUriResponse {
1405  // A signed uri to download the HLS manifest corresponding to the requested
1406  // times.
1407  string uri = 1;
1408
1409  // A list of temporal partitions of the content returned in the order they
1410  // appear in the stream.
1411  repeated Partition.TemporalPartition temporal_partitions = 2;
1412}
1413
1414// Request message for SearchAssets.
1415message SearchAssetsRequest {
1416  // Required. The parent corpus to search.
1417  // Form: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}'
1418  string corpus = 1 [
1419    (google.api.field_behavior) = REQUIRED,
1420    (google.api.resource_reference) = {
1421      type: "visionai.googleapis.com/Corpus"
1422    }
1423  ];
1424
1425  // The number of results to be returned in this page. If it's 0, the server
1426  // will decide the appropriate page_size.
1427  int32 page_size = 2;
1428
1429  // The continuation token to fetch the next page. If empty, it means it is
1430  // fetching the first page.
1431  string page_token = 3;
1432
1433  // Time ranges that matching video content must fall within. If no ranges are
1434  // provided, there will be no time restriction. This field is treated just
1435  // like the criteria below, but defined separately for convenience as it is
1436  // used frequently. Note that if the end_time is in the future, it will be
1437  // clamped to the time the request was received.
1438  DateTimeRangeArray content_time_ranges = 5;
1439
1440  // Criteria applied to search results.
1441  repeated Criteria criteria = 4;
1442
1443  // Stores most recent facet selection state. Only facet groups with user's
1444  // selection will be presented here. Selection state is either selected or
1445  // unselected. Only selected facet buckets will be used as search criteria.
1446  repeated FacetGroup facet_selections = 6;
1447
1448  // A list of annotation keys to specify the annotations to be retrieved and
1449  // returned with each search result.
1450  // Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search
1451  // strategy must not be NO_SEARCH.
1452  repeated string result_annotation_keys = 8;
1453}
1454
1455// The metadata for DeleteAsset API that embeds in
1456// [metadata][google.longrunning.Operation.metadata] field.
1457message DeleteAssetMetadata {
1458
1459}
1460
1461// Stores the criteria-annotation matching results for each search result item.
1462message AnnotationMatchingResult {
1463  // The criteria used for matching. It can be an input search criteria or a
1464  // criteria converted from a facet selection.
1465  Criteria criteria = 1;
1466
1467  // Matched annotations for the criteria.
1468  repeated Annotation matched_annotations = 2;
1469
1470  // Status of the match result. Possible values:
1471  // FAILED_PRECONDITION - the criteria is not eligible for match.
1472  // OK - matching is performed.
1473  google.rpc.Status status = 3;
1474}
1475
1476// Search result contains asset name and corresponding time ranges.
1477message SearchResultItem {
1478  // The resource name of the asset.
1479  // Form:
1480  // 'projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}'
1481  string asset = 1;
1482
1483  // The matched asset segments.
1484  // Deprecated: please use singular `segment` field.
1485  repeated Partition.TemporalPartition segments = 2 [deprecated = true];
1486
1487  // The matched asset segment.
1488  Partition.TemporalPartition segment = 5;
1489
1490  // Search result annotations specified by result_annotation_keys in search
1491  // request.
1492  repeated Annotation requested_annotations = 3;
1493
1494  // Criteria or facet-selection based annotation matching results associated to
1495  // this search result item. Only contains results for criteria or
1496  // facet_selections with fetch_matched_annotations=true.
1497  repeated AnnotationMatchingResult annotation_matching_results = 4;
1498}
1499
1500// Response message for SearchAssets.
1501message SearchAssetsResponse {
1502  // Returned search results.
1503  repeated SearchResultItem search_result_items = 1;
1504
1505  // The next-page continuation token.
1506  string next_page_token = 2;
1507
1508  // Facet search results of a given query, which contains user's
1509  // already-selected facet values and updated facet search results.
1510  repeated FacetGroup facet_results = 3;
1511}
1512
1513// Integer range type.
1514message IntRange {
1515  // Start of the int range.
1516  optional int64 start = 1;
1517
1518  // End of the int range.
1519  optional int64 end = 2;
1520}
1521
1522// Float range type.
1523message FloatRange {
1524  // Start of the float range.
1525  optional float start = 1;
1526
1527  // End of the float range.
1528  optional float end = 2;
1529}
1530
1531// A list of string-type values.
1532message StringArray {
1533  // String type values.
1534  repeated string txt_values = 1;
1535}
1536
1537// A list of integer range values.
1538message IntRangeArray {
1539  // Int range values.
1540  repeated IntRange int_ranges = 1;
1541}
1542
1543// A list of float range values.
1544message FloatRangeArray {
1545  // Float range values.
1546  repeated FloatRange float_ranges = 1;
1547}
1548
1549// Datetime range type.
1550message DateTimeRange {
1551  // Start date time.
1552  google.type.DateTime start = 1;
1553
1554  // End data time.
1555  google.type.DateTime end = 2;
1556}
1557
1558// A list of datetime range values.
1559message DateTimeRangeArray {
1560  // Date time ranges.
1561  repeated DateTimeRange date_time_ranges = 1;
1562}
1563
1564// Representation of a circle area.
1565message CircleArea {
1566  // Latitude of circle area's center. Degrees [-90 .. 90]
1567  double latitude = 1;
1568
1569  // Longitude of circle area's center. Degrees [-180 .. 180]
1570  double longitude = 2;
1571
1572  // Radius of the circle area in meters.
1573  double radius_meter = 3;
1574}
1575
1576// A list of locations.
1577message GeoLocationArray {
1578  // A list of circle areas.
1579  repeated CircleArea circle_areas = 1;
1580}
1581
1582message BoolValue {
1583  bool value = 1;
1584}
1585
1586// Filter criteria applied to current search results.
1587message Criteria {
1588  oneof value {
1589    // The text values associated with the field.
1590    StringArray text_array = 2;
1591
1592    // The integer ranges associated with the field.
1593    IntRangeArray int_range_array = 3;
1594
1595    // The float ranges associated with the field.
1596    FloatRangeArray float_range_array = 4;
1597
1598    // The datetime ranges associated with the field.
1599    DateTimeRangeArray date_time_range_array = 5;
1600
1601    // Geo Location array.
1602    GeoLocationArray geo_location_array = 6;
1603
1604    // A Boolean value.
1605    BoolValue bool_value = 7;
1606  }
1607
1608  // The UGA field or ML field to apply filtering criteria.
1609  string field = 1;
1610
1611  // If true, return query matched annotations for this criteria.
1612  // This option is only applicable for partition level annotations and supports
1613  // the following data types:
1614  //  - INTEGER
1615  //  - FLOAT
1616  //  - STRING (DataSchema.SearchStrategy.EXACT_SEARCH only)
1617  //  - BOOLEAN
1618  bool fetch_matched_annotations = 8;
1619}
1620
1621// Partition to specify the partition in time and space for sub-asset level
1622// annotation.
1623message Partition {
1624  // Partition of asset in UTC Epoch time.
1625  message TemporalPartition {
1626    // Start time of the partition.
1627    google.protobuf.Timestamp start_time = 1;
1628
1629    // End time of the partition.
1630    google.protobuf.Timestamp end_time = 2;
1631  }
1632
1633  // Partition of asset in space.
1634  message SpatialPartition {
1635    // The minimum x coordinate value.
1636    optional int64 x_min = 1;
1637
1638    // The minimum y coordinate value.
1639    optional int64 y_min = 2;
1640
1641    // The maximum x coordinate value.
1642    optional int64 x_max = 3;
1643
1644    // The maximum y coordinate value.
1645    optional int64 y_max = 4;
1646  }
1647
1648  // Partition of asset in time.
1649  TemporalPartition temporal_partition = 1;
1650
1651  // Partition of asset in space.
1652  SpatialPartition spatial_partition = 2;
1653}
1654