tables.proto 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. // Copyright 2021 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.area120.tables.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/protobuf/empty.proto";
  21. import "google/protobuf/field_mask.proto";
  22. import "google/protobuf/struct.proto";
  23. option go_package = "google.golang.org/genproto/googleapis/area120/tables/v1alpha1;tables";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "TablesProto";
  26. option java_package = "com.google.area120.tables.v1alpha1";
  27. // The Tables Service provides an API for reading and updating tables.
  28. // It defines the following resource model:
  29. //
  30. // - The API has a collection of [Table][google.area120.tables.v1alpha1.Table]
  31. // resources, named `tables/*`
  32. //
  33. // - Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row]
  34. // resources, named `tables/*/rows/*`
  35. //
  36. // - The API has a collection of
  37. // [Workspace][google.area120.tables.v1alpha1.Workspace]
  38. // resources, named `workspaces/*`.
  39. service TablesService {
  40. option (google.api.default_host) = "area120tables.googleapis.com";
  41. option (google.api.oauth_scopes) =
  42. "https://www.googleapis.com/auth/drive,"
  43. "https://www.googleapis.com/auth/drive.file,"
  44. "https://www.googleapis.com/auth/drive.readonly,"
  45. "https://www.googleapis.com/auth/spreadsheets,"
  46. "https://www.googleapis.com/auth/spreadsheets.readonly,"
  47. "https://www.googleapis.com/auth/tables";
  48. // Gets a table. Returns NOT_FOUND if the table does not exist.
  49. rpc GetTable(GetTableRequest) returns (Table) {
  50. option (google.api.http) = {
  51. get: "/v1alpha1/{name=tables/*}"
  52. };
  53. option (google.api.method_signature) = "name";
  54. }
  55. // Lists tables for the user.
  56. rpc ListTables(ListTablesRequest) returns (ListTablesResponse) {
  57. option (google.api.http) = {
  58. get: "/v1alpha1/tables"
  59. };
  60. }
  61. // Gets a workspace. Returns NOT_FOUND if the workspace does not exist.
  62. rpc GetWorkspace(GetWorkspaceRequest) returns (Workspace) {
  63. option (google.api.http) = {
  64. get: "/v1alpha1/{name=workspaces/*}"
  65. };
  66. option (google.api.method_signature) = "name";
  67. }
  68. // Lists workspaces for the user.
  69. rpc ListWorkspaces(ListWorkspacesRequest) returns (ListWorkspacesResponse) {
  70. option (google.api.http) = {
  71. get: "/v1alpha1/workspaces"
  72. };
  73. }
  74. // Gets a row. Returns NOT_FOUND if the row does not exist in the table.
  75. rpc GetRow(GetRowRequest) returns (Row) {
  76. option (google.api.http) = {
  77. get: "/v1alpha1/{name=tables/*/rows/*}"
  78. };
  79. option (google.api.method_signature) = "name";
  80. }
  81. // Lists rows in a table. Returns NOT_FOUND if the table does not exist.
  82. rpc ListRows(ListRowsRequest) returns (ListRowsResponse) {
  83. option (google.api.http) = {
  84. get: "/v1alpha1/{parent=tables/*}/rows"
  85. };
  86. option (google.api.method_signature) = "parent";
  87. }
  88. // Creates a row.
  89. rpc CreateRow(CreateRowRequest) returns (Row) {
  90. option (google.api.http) = {
  91. post: "/v1alpha1/{parent=tables/*}/rows"
  92. body: "row"
  93. };
  94. option (google.api.method_signature) = "parent,row";
  95. }
  96. // Creates multiple rows.
  97. rpc BatchCreateRows(BatchCreateRowsRequest) returns (BatchCreateRowsResponse) {
  98. option (google.api.http) = {
  99. post: "/v1alpha1/{parent=tables/*}/rows:batchCreate"
  100. body: "*"
  101. };
  102. }
  103. // Updates a row.
  104. rpc UpdateRow(UpdateRowRequest) returns (Row) {
  105. option (google.api.http) = {
  106. patch: "/v1alpha1/{row.name=tables/*/rows/*}"
  107. body: "row"
  108. };
  109. option (google.api.method_signature) = "row,update_mask";
  110. }
  111. // Updates multiple rows.
  112. rpc BatchUpdateRows(BatchUpdateRowsRequest) returns (BatchUpdateRowsResponse) {
  113. option (google.api.http) = {
  114. post: "/v1alpha1/{parent=tables/*}/rows:batchUpdate"
  115. body: "*"
  116. };
  117. }
  118. // Deletes a row.
  119. rpc DeleteRow(DeleteRowRequest) returns (google.protobuf.Empty) {
  120. option (google.api.http) = {
  121. delete: "/v1alpha1/{name=tables/*/rows/*}"
  122. };
  123. option (google.api.method_signature) = "name";
  124. }
  125. // Deletes multiple rows.
  126. rpc BatchDeleteRows(BatchDeleteRowsRequest) returns (google.protobuf.Empty) {
  127. option (google.api.http) = {
  128. post: "/v1alpha1/{parent=tables/*}/rows:batchDelete"
  129. body: "*"
  130. };
  131. }
  132. }
  133. // Request message for TablesService.GetTable.
  134. message GetTableRequest {
  135. // Required. The name of the table to retrieve.
  136. // Format: tables/{table}
  137. string name = 1 [
  138. (google.api.field_behavior) = REQUIRED,
  139. (google.api.resource_reference) = {
  140. type: "area120tables.googleapis.com/Table"
  141. }
  142. ];
  143. }
  144. // Request message for TablesService.ListTables.
  145. message ListTablesRequest {
  146. // The maximum number of tables to return. The service may return fewer than
  147. // this value.
  148. //
  149. // If unspecified, at most 20 tables are returned. The maximum value is 100;
  150. // values above 100 are coerced to 100.
  151. int32 page_size = 1;
  152. // A page token, received from a previous `ListTables` call.
  153. // Provide this to retrieve the subsequent page.
  154. //
  155. // When paginating, all other parameters provided to `ListTables` must match
  156. // the call that provided the page token.
  157. string page_token = 2;
  158. }
  159. // Response message for TablesService.ListTables.
  160. message ListTablesResponse {
  161. // The list of tables.
  162. repeated Table tables = 1;
  163. // A token, which can be sent as `page_token` to retrieve the next page.
  164. // If this field is empty, there are no subsequent pages.
  165. string next_page_token = 2;
  166. }
  167. // Request message for TablesService.GetWorkspace.
  168. message GetWorkspaceRequest {
  169. // Required. The name of the workspace to retrieve.
  170. // Format: workspaces/{workspace}
  171. string name = 1 [
  172. (google.api.field_behavior) = REQUIRED,
  173. (google.api.resource_reference) = {
  174. type: "area120tables.googleapis.com/Workspace"
  175. }
  176. ];
  177. }
  178. // Request message for TablesService.ListWorkspaces.
  179. message ListWorkspacesRequest {
  180. // The maximum number of workspaces to return. The service may return fewer
  181. // than this value.
  182. //
  183. // If unspecified, at most 10 workspaces are returned. The maximum value is
  184. // 25; values above 25 are coerced to 25.
  185. int32 page_size = 1;
  186. // A page token, received from a previous `ListWorkspaces` call.
  187. // Provide this to retrieve the subsequent page.
  188. //
  189. // When paginating, all other parameters provided to `ListWorkspaces` must
  190. // match the call that provided the page token.
  191. string page_token = 2;
  192. }
  193. // Response message for TablesService.ListWorkspaces.
  194. message ListWorkspacesResponse {
  195. // The list of workspaces.
  196. repeated Workspace workspaces = 1;
  197. // A token, which can be sent as `page_token` to retrieve the next page.
  198. // If this field is empty, there are no subsequent pages.
  199. string next_page_token = 2;
  200. }
  201. // Request message for TablesService.GetRow.
  202. message GetRowRequest {
  203. // Required. The name of the row to retrieve.
  204. // Format: tables/{table}/rows/{row}
  205. string name = 1 [
  206. (google.api.field_behavior) = REQUIRED,
  207. (google.api.resource_reference) = {
  208. type: "area120tables.googleapis.com/Row"
  209. }
  210. ];
  211. // Optional. Column key to use for values in the row.
  212. // Defaults to user entered name.
  213. View view = 2 [(google.api.field_behavior) = OPTIONAL];
  214. }
  215. // Request message for TablesService.ListRows.
  216. message ListRowsRequest {
  217. // Required. The parent table.
  218. // Format: tables/{table}
  219. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  220. // The maximum number of rows to return. The service may return fewer than
  221. // this value.
  222. //
  223. // If unspecified, at most 50 rows are returned. The maximum value is 1,000;
  224. // values above 1,000 are coerced to 1,000.
  225. int32 page_size = 2;
  226. // A page token, received from a previous `ListRows` call.
  227. // Provide this to retrieve the subsequent page.
  228. //
  229. // When paginating, all other parameters provided to `ListRows` must match
  230. // the call that provided the page token.
  231. string page_token = 3;
  232. // Optional. Column key to use for values in the row.
  233. // Defaults to user entered name.
  234. View view = 4 [(google.api.field_behavior) = OPTIONAL];
  235. // Optional. Raw text query to search for in rows of the table.
  236. // Special characters must be escaped. Logical operators and field specific
  237. // filtering not supported.
  238. string filter = 5 [(google.api.field_behavior) = OPTIONAL];
  239. }
  240. // Response message for TablesService.ListRows.
  241. message ListRowsResponse {
  242. // The rows from the specified table.
  243. repeated Row rows = 1;
  244. // A token, which can be sent as `page_token` to retrieve the next page.
  245. // If this field is empty, there are no subsequent pages.
  246. string next_page_token = 2;
  247. }
  248. // Request message for TablesService.CreateRow.
  249. message CreateRowRequest {
  250. // Required. The parent table where this row will be created.
  251. // Format: tables/{table}
  252. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  253. // Required. The row to create.
  254. Row row = 2 [(google.api.field_behavior) = REQUIRED];
  255. // Optional. Column key to use for values in the row.
  256. // Defaults to user entered name.
  257. View view = 3 [(google.api.field_behavior) = OPTIONAL];
  258. }
  259. // Request message for TablesService.BatchCreateRows.
  260. message BatchCreateRowsRequest {
  261. // Required. The parent table where the rows will be created.
  262. // Format: tables/{table}
  263. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  264. // Required. The request message specifying the rows to create.
  265. //
  266. // A maximum of 500 rows can be created in a single batch.
  267. repeated CreateRowRequest requests = 2 [(google.api.field_behavior) = REQUIRED];
  268. }
  269. // Response message for TablesService.BatchCreateRows.
  270. message BatchCreateRowsResponse {
  271. // The created rows.
  272. repeated Row rows = 1;
  273. }
  274. // Request message for TablesService.UpdateRow.
  275. message UpdateRowRequest {
  276. // Required. The row to update.
  277. Row row = 1 [(google.api.field_behavior) = REQUIRED];
  278. // The list of fields to update.
  279. google.protobuf.FieldMask update_mask = 2;
  280. // Optional. Column key to use for values in the row.
  281. // Defaults to user entered name.
  282. View view = 3 [(google.api.field_behavior) = OPTIONAL];
  283. }
  284. // Request message for TablesService.BatchUpdateRows.
  285. message BatchUpdateRowsRequest {
  286. // Required. The parent table shared by all rows being updated.
  287. // Format: tables/{table}
  288. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  289. // Required. The request messages specifying the rows to update.
  290. //
  291. // A maximum of 500 rows can be modified in a single batch.
  292. repeated UpdateRowRequest requests = 2 [(google.api.field_behavior) = REQUIRED];
  293. }
  294. // Response message for TablesService.BatchUpdateRows.
  295. message BatchUpdateRowsResponse {
  296. // The updated rows.
  297. repeated Row rows = 1;
  298. }
  299. // Request message for TablesService.DeleteRow
  300. message DeleteRowRequest {
  301. // Required. The name of the row to delete.
  302. // Format: tables/{table}/rows/{row}
  303. string name = 1 [
  304. (google.api.field_behavior) = REQUIRED,
  305. (google.api.resource_reference) = {
  306. type: "area120tables.googleapis.com/Row"
  307. }
  308. ];
  309. }
  310. // Request message for TablesService.BatchDeleteRows
  311. message BatchDeleteRowsRequest {
  312. // Required. The parent table shared by all rows being deleted.
  313. // Format: tables/{table}
  314. string parent = 1 [
  315. (google.api.field_behavior) = REQUIRED,
  316. (google.api.resource_reference) = {
  317. type: "area120tables.googleapis.com/Table"
  318. }
  319. ];
  320. // Required. The names of the rows to delete. All rows must belong to the parent table
  321. // or else the entire batch will fail. A maximum of 500 rows can be deleted
  322. // in a batch.
  323. // Format: tables/{table}/rows/{row}
  324. repeated string names = 2 [
  325. (google.api.field_behavior) = REQUIRED,
  326. (google.api.resource_reference) = {
  327. type: "area120tables.googleapis.com/Row"
  328. }
  329. ];
  330. }
  331. // A single table.
  332. message Table {
  333. option (google.api.resource) = {
  334. type: "area120tables.googleapis.com/Table"
  335. pattern: "tables/{table}"
  336. };
  337. // The resource name of the table.
  338. // Table names have the form `tables/{table}`.
  339. string name = 1;
  340. // The human readable title of the table.
  341. string display_name = 2;
  342. // List of columns in this table.
  343. // Order of columns matches the display order.
  344. repeated ColumnDescription columns = 3;
  345. }
  346. // Details on a column in the table.
  347. message ColumnDescription {
  348. // column name
  349. string name = 1;
  350. // Data type of the column
  351. // Supported types are auto_id, boolean, boolean_list, creator,
  352. // create_timestamp, date, dropdown, location, integer,
  353. // integer_list, number, number_list, person, person_list, tags, check_list,
  354. // text, text_list, update_timestamp, updater, relationship,
  355. // file_attachment_list.
  356. // These types directly map to the column types supported on Tables website.
  357. string data_type = 2;
  358. // Internal id for a column.
  359. string id = 3;
  360. // Optional. Range of labeled values for the column.
  361. // Some columns like tags and drop-downs limit the values to a set of
  362. // possible values. We return the range of values in such cases to help
  363. // clients implement better user data validation.
  364. repeated LabeledItem labels = 4 [(google.api.field_behavior) = OPTIONAL];
  365. // Optional. Additional details about a relationship column. Specified when data_type
  366. // is relationship.
  367. RelationshipDetails relationship_details = 5 [(google.api.field_behavior) = OPTIONAL];
  368. // Optional. Indicates that this is a lookup column whose value is derived from the
  369. // relationship column specified in the details. Lookup columns can not be
  370. // updated directly. To change the value you must update the associated
  371. // relationship column.
  372. LookupDetails lookup_details = 6 [(google.api.field_behavior) = OPTIONAL];
  373. }
  374. // A single item in a labeled column.
  375. message LabeledItem {
  376. // Display string as entered by user.
  377. string name = 1;
  378. // Internal id associated with the item.
  379. string id = 2;
  380. }
  381. // Details about a relationship column.
  382. message RelationshipDetails {
  383. // The name of the table this relationship is linked to.
  384. string linked_table = 1;
  385. }
  386. // Details about a lookup column whose value comes from the associated
  387. // relationship.
  388. message LookupDetails {
  389. // The name of the relationship column associated with the lookup.
  390. string relationship_column = 1;
  391. // The id of the relationship column.
  392. string relationship_column_id = 2;
  393. }
  394. // A single row in a table.
  395. message Row {
  396. option (google.api.resource) = {
  397. type: "area120tables.googleapis.com/Row"
  398. pattern: "tables/{table}/rows/{row}"
  399. };
  400. // The resource name of the row.
  401. // Row names have the form `tables/{table}/rows/{row}`.
  402. // The name is ignored when creating a row.
  403. string name = 1;
  404. // The values of the row. This is a map of column key to value.
  405. // Key is user entered name(default) or the internal column id based on
  406. // the view in the request.
  407. map<string, google.protobuf.Value> values = 2;
  408. }
  409. // A single workspace.
  410. message Workspace {
  411. option (google.api.resource) = {
  412. type: "area120tables.googleapis.com/Workspace"
  413. pattern: "workspaces/{workspace}"
  414. };
  415. // The resource name of the workspace.
  416. // Workspace names have the form `workspaces/{workspace}`.
  417. string name = 1;
  418. // The human readable title of the workspace.
  419. string display_name = 2;
  420. // The list of tables in the workspace.
  421. repeated Table tables = 3;
  422. }
  423. // Column identifier used for the values in the row.
  424. enum View {
  425. // Defaults to user entered text.
  426. VIEW_UNSPECIFIED = 0;
  427. // Uses internally generated column id to identify values.
  428. COLUMN_ID_VIEW = 1;
  429. }