warehouse.proto 57 KB

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