tamar-file-hub-client 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- file_hub_client/__init__.py +39 -0
- file_hub_client/client.py +43 -6
- file_hub_client/rpc/async_client.py +91 -11
- file_hub_client/rpc/gen/taple_service_pb2.py +225 -0
- file_hub_client/rpc/gen/taple_service_pb2_grpc.py +1626 -0
- file_hub_client/rpc/generate_grpc.py +2 -2
- file_hub_client/rpc/interceptors.py +550 -0
- file_hub_client/rpc/protos/taple_service.proto +874 -0
- file_hub_client/rpc/sync_client.py +91 -9
- file_hub_client/schemas/__init__.py +60 -0
- file_hub_client/schemas/taple.py +413 -0
- file_hub_client/services/__init__.py +5 -0
- file_hub_client/services/file/async_blob_service.py +558 -482
- file_hub_client/services/file/async_file_service.py +18 -9
- file_hub_client/services/file/base_file_service.py +19 -6
- file_hub_client/services/file/sync_blob_service.py +556 -478
- file_hub_client/services/file/sync_file_service.py +18 -9
- file_hub_client/services/folder/async_folder_service.py +20 -11
- file_hub_client/services/folder/sync_folder_service.py +20 -11
- file_hub_client/services/taple/__init__.py +10 -0
- file_hub_client/services/taple/async_taple_service.py +2281 -0
- file_hub_client/services/taple/base_taple_service.py +353 -0
- file_hub_client/services/taple/idempotent_taple_mixin.py +142 -0
- file_hub_client/services/taple/sync_taple_service.py +2256 -0
- file_hub_client/utils/__init__.py +43 -1
- file_hub_client/utils/file_utils.py +59 -11
- file_hub_client/utils/idempotency.py +196 -0
- file_hub_client/utils/logging.py +315 -0
- file_hub_client/utils/retry.py +241 -2
- file_hub_client/utils/smart_retry.py +403 -0
- tamar_file_hub_client-0.0.3.dist-info/METADATA +2050 -0
- tamar_file_hub_client-0.0.3.dist-info/RECORD +57 -0
- tamar_file_hub_client-0.0.1.dist-info/METADATA +0 -874
- tamar_file_hub_client-0.0.1.dist-info/RECORD +0 -44
- {tamar_file_hub_client-0.0.1.dist-info → tamar_file_hub_client-0.0.3.dist-info}/WHEEL +0 -0
- {tamar_file_hub_client-0.0.1.dist-info → tamar_file_hub_client-0.0.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,874 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
package filehub.taple;
|
4
|
+
|
5
|
+
import "google/protobuf/timestamp.proto";
|
6
|
+
import "google/protobuf/struct.proto";
|
7
|
+
|
8
|
+
option go_package = "github.com/your-org/file-hub-server/rpc/gen/taple";
|
9
|
+
|
10
|
+
// Taple service for spreadsheet operations
|
11
|
+
service TapleService {
|
12
|
+
// Table operations
|
13
|
+
rpc CreateTable (CreateTableRequest) returns (TableResponse);
|
14
|
+
rpc GetTable (GetTableRequest) returns (TableResponse);
|
15
|
+
rpc UpdateTable (UpdateTableRequest) returns (TableResponse);
|
16
|
+
rpc DeleteTable (DeleteTableRequest) returns (Empty);
|
17
|
+
|
18
|
+
// Sheet operations
|
19
|
+
rpc CreateSheet (CreateSheetRequest) returns (SheetResponse);
|
20
|
+
rpc GetSheet (GetSheetRequest) returns (SheetResponse);
|
21
|
+
rpc ListSheets (ListSheetsRequest) returns (ListSheetsResponse);
|
22
|
+
rpc UpdateSheet (UpdateSheetRequest) returns (SheetResponse);
|
23
|
+
rpc DeleteSheet (DeleteSheetRequest) returns (Empty);
|
24
|
+
|
25
|
+
// Column operations
|
26
|
+
rpc CreateColumn (CreateColumnRequest) returns (ColumnResponse);
|
27
|
+
rpc UpdateColumn (UpdateColumnRequest) returns (ColumnResponse);
|
28
|
+
rpc DeleteColumn (DeleteColumnRequest) returns (Empty);
|
29
|
+
rpc BatchEditColumns (BatchEditColumnsRequest) returns (BatchEditColumnsResponse);
|
30
|
+
|
31
|
+
// Row operations
|
32
|
+
rpc CreateRow (CreateRowRequest) returns (RowResponse);
|
33
|
+
rpc UpdateRow (UpdateRowRequest) returns (RowResponse);
|
34
|
+
rpc DeleteRow (DeleteRowRequest) returns (Empty);
|
35
|
+
rpc BatchEditRows (BatchEditRowsRequest) returns (BatchEditRowsResponse);
|
36
|
+
|
37
|
+
// Cell operations
|
38
|
+
rpc EditCell (EditCellRequest) returns (CellResponse);
|
39
|
+
rpc DeleteCell (DeleteCellRequest) returns (Empty);
|
40
|
+
rpc BatchEditCells (BatchEditCellsRequest) returns (BatchEditCellsResponse);
|
41
|
+
|
42
|
+
// Mixed batch operations for column/row/cell
|
43
|
+
rpc BatchEditSheet (BatchEditSheetRequest) returns (BatchEditSheetResponse);
|
44
|
+
|
45
|
+
// Data retrieval
|
46
|
+
rpc GetSheetVersion (GetSheetVersionRequest) returns (GetSheetVersionResponse); // 仅获取版本号
|
47
|
+
rpc GetSheetData (GetSheetDataRequest) returns (GetSheetDataResponse); // 获取完整数据
|
48
|
+
rpc GetColumnData (GetColumnDataRequest) returns (ColumnDataResponse);
|
49
|
+
rpc GetRowData (GetRowDataRequest) returns (RowDataResponse);
|
50
|
+
rpc GetCellData (GetCellDataRequest) returns (CellDataResponse);
|
51
|
+
|
52
|
+
// Table data operations
|
53
|
+
rpc CloneTableData (CloneTableDataRequest) returns (CloneTableDataResponse); // 克隆表格数据到另一个组织
|
54
|
+
rpc ExportTableData (ExportTableDataRequest) returns (ExportTableDataResponse); // 导出表格数据到文件
|
55
|
+
rpc ImportTableData (ImportTableDataRequest) returns (ImportTableDataResponse); // 导入文件数据到表格
|
56
|
+
|
57
|
+
// Table view operations
|
58
|
+
rpc CreateTableView (CreateTableViewRequest) returns (TableViewResponse); // 创建表格视图
|
59
|
+
rpc BatchCreateTableViews (BatchCreateTableViewsRequest) returns (BatchCreateTableViewsResponse); // 批量创建表格视图
|
60
|
+
rpc GetTableView (GetTableViewRequest) returns (TableViewResponse); // 获取表格视图
|
61
|
+
rpc ListTableViews (ListTableViewsRequest) returns (ListTableViewsResponse); // 列出表格视图
|
62
|
+
rpc UpdateTableView (UpdateTableViewRequest) returns (TableViewResponse); // 更新表格视图
|
63
|
+
rpc DeleteTableView (DeleteTableViewRequest) returns (Empty); // 删除表格视图
|
64
|
+
rpc UpdateTableViewConfig (UpdateTableViewConfigRequest) returns (TableViewResponse); // 更新视图配置
|
65
|
+
}
|
66
|
+
|
67
|
+
// Core data models
|
68
|
+
message Table {
|
69
|
+
string id = 1;
|
70
|
+
string file_id = 2;
|
71
|
+
string org_id = 3;
|
72
|
+
string user_id = 4;
|
73
|
+
optional string name = 5;
|
74
|
+
optional string description = 6;
|
75
|
+
string created_by_role = 7;
|
76
|
+
string created_by = 8;
|
77
|
+
google.protobuf.Timestamp created_at = 9;
|
78
|
+
google.protobuf.Timestamp updated_at = 10;
|
79
|
+
optional google.protobuf.Timestamp deleted_at = 11;
|
80
|
+
}
|
81
|
+
|
82
|
+
message Sheet {
|
83
|
+
string id = 1;
|
84
|
+
string table_id = 2;
|
85
|
+
string org_id = 3;
|
86
|
+
string user_id = 4;
|
87
|
+
string name = 5;
|
88
|
+
optional string description = 6;
|
89
|
+
int32 position = 7;
|
90
|
+
int64 version = 8;
|
91
|
+
string created_by_role = 9;
|
92
|
+
string created_by = 10;
|
93
|
+
google.protobuf.Timestamp created_at = 11;
|
94
|
+
google.protobuf.Timestamp updated_at = 12;
|
95
|
+
optional google.protobuf.Timestamp deleted_at = 13;
|
96
|
+
}
|
97
|
+
|
98
|
+
message Column {
|
99
|
+
string id = 1;
|
100
|
+
string sheet_id = 2;
|
101
|
+
string org_id = 3;
|
102
|
+
string user_id = 4;
|
103
|
+
string column_key = 5;
|
104
|
+
string name = 6;
|
105
|
+
string column_type = 7;
|
106
|
+
optional string description = 8; // 列描述信息
|
107
|
+
int32 position = 9;
|
108
|
+
optional int32 width = 10;
|
109
|
+
optional bool hidden = 11;
|
110
|
+
optional google.protobuf.Struct properties = 12;
|
111
|
+
int64 version = 13;
|
112
|
+
string created_by_role = 14;
|
113
|
+
string created_by = 15;
|
114
|
+
google.protobuf.Timestamp created_at = 16;
|
115
|
+
google.protobuf.Timestamp updated_at = 17;
|
116
|
+
optional google.protobuf.Timestamp deleted_at = 18;
|
117
|
+
}
|
118
|
+
|
119
|
+
message Row {
|
120
|
+
string id = 1;
|
121
|
+
string sheet_id = 2;
|
122
|
+
string org_id = 3;
|
123
|
+
string user_id = 4;
|
124
|
+
string row_key = 5;
|
125
|
+
int32 position = 6;
|
126
|
+
optional int32 height = 7;
|
127
|
+
optional bool hidden = 8;
|
128
|
+
int64 version = 9;
|
129
|
+
string created_by_role = 10;
|
130
|
+
string created_by = 11;
|
131
|
+
google.protobuf.Timestamp created_at = 12;
|
132
|
+
google.protobuf.Timestamp updated_at = 13;
|
133
|
+
optional google.protobuf.Timestamp deleted_at = 14;
|
134
|
+
}
|
135
|
+
|
136
|
+
message Cell {
|
137
|
+
string id = 1;
|
138
|
+
string sheet_id = 2;
|
139
|
+
string column_id = 3;
|
140
|
+
string row_id = 4;
|
141
|
+
string org_id = 5;
|
142
|
+
string user_id = 6;
|
143
|
+
string column_key = 7;
|
144
|
+
string row_key = 8;
|
145
|
+
optional string raw_value = 9;
|
146
|
+
optional string formatted_value = 10;
|
147
|
+
optional string formula = 11;
|
148
|
+
optional google.protobuf.Struct styles = 12;
|
149
|
+
optional string data_type = 13;
|
150
|
+
int64 version = 14;
|
151
|
+
string created_by_role = 15;
|
152
|
+
string created_by = 16;
|
153
|
+
google.protobuf.Timestamp created_at = 17;
|
154
|
+
google.protobuf.Timestamp updated_at = 18;
|
155
|
+
optional google.protobuf.Timestamp deleted_at = 19;
|
156
|
+
}
|
157
|
+
|
158
|
+
message MergedCell {
|
159
|
+
string id = 1;
|
160
|
+
string sheet_id = 2;
|
161
|
+
string org_id = 3;
|
162
|
+
string user_id = 4;
|
163
|
+
string start_column_id = 5;
|
164
|
+
string end_column_id = 6;
|
165
|
+
string start_row_id = 7;
|
166
|
+
string end_row_id = 8;
|
167
|
+
google.protobuf.Timestamp created_at = 9;
|
168
|
+
google.protobuf.Timestamp updated_at = 10;
|
169
|
+
optional google.protobuf.Timestamp deleted_at = 11;
|
170
|
+
}
|
171
|
+
|
172
|
+
message TableView {
|
173
|
+
string id = 1;
|
174
|
+
string table_id = 2;
|
175
|
+
string sheet_id = 3;
|
176
|
+
string org_id = 4;
|
177
|
+
string user_id = 5;
|
178
|
+
string file_id = 6; // 关联文件ID
|
179
|
+
|
180
|
+
// 视图配置字段
|
181
|
+
google.protobuf.Struct filter_criteria = 7; // 过滤条件(JSON)
|
182
|
+
google.protobuf.Struct sort_criteria = 8; // 排序条件(JSON)
|
183
|
+
google.protobuf.ListValue visible_columns = 9; // 可见列(JSON数组)
|
184
|
+
google.protobuf.Struct group_criteria = 10; // 分组条件(JSON)
|
185
|
+
|
186
|
+
// 创建者信息
|
187
|
+
string created_by_role = 11; // 创建者角色:user-用户;agent-智能体
|
188
|
+
string created_by = 12; // 创建者
|
189
|
+
|
190
|
+
// 视图基本信息
|
191
|
+
string view_name = 13; // 视图名称
|
192
|
+
string view_type = 14; // 视图类型:table-表格视图; gantt-甘特图; calendar-日历视图; etc
|
193
|
+
|
194
|
+
// 视图状态
|
195
|
+
bool is_hidden = 15; // 是否隐藏
|
196
|
+
bool is_default = 16; // 是否默认视图
|
197
|
+
|
198
|
+
// 扩展配置
|
199
|
+
google.protobuf.Struct config = 17; // 视图配置(JSON)
|
200
|
+
|
201
|
+
// 时间戳
|
202
|
+
google.protobuf.Timestamp created_at = 18;
|
203
|
+
google.protobuf.Timestamp updated_at = 19;
|
204
|
+
optional google.protobuf.Timestamp deleted_at = 20;
|
205
|
+
}
|
206
|
+
|
207
|
+
// Request/Response messages
|
208
|
+
|
209
|
+
// Table operations
|
210
|
+
message CreateTableRequest {
|
211
|
+
optional string folder_id = 1; // Parent folder ID where the table file will be created (optional, defaults to "My Folder")
|
212
|
+
string name = 2; // Table name (also used as filename)
|
213
|
+
optional string description = 3;
|
214
|
+
optional string idempotency_key = 4; // 幂等性键
|
215
|
+
}
|
216
|
+
|
217
|
+
message GetTableRequest {
|
218
|
+
optional string table_id = 1;
|
219
|
+
optional string file_id = 2; // Can get table by either table_id or file_id
|
220
|
+
}
|
221
|
+
|
222
|
+
message UpdateTableRequest {
|
223
|
+
string table_id = 1;
|
224
|
+
optional string name = 2;
|
225
|
+
optional string description = 3;
|
226
|
+
optional string idempotency_key = 4; // 幂等性键
|
227
|
+
}
|
228
|
+
|
229
|
+
message DeleteTableRequest {
|
230
|
+
string table_id = 1;
|
231
|
+
optional string idempotency_key = 2; // 幂等性键
|
232
|
+
}
|
233
|
+
|
234
|
+
message TableResponse {
|
235
|
+
Table table = 1;
|
236
|
+
}
|
237
|
+
|
238
|
+
// Sheet operations
|
239
|
+
message CreateSheetRequest {
|
240
|
+
string table_id = 1;
|
241
|
+
string name = 2;
|
242
|
+
optional string description = 3;
|
243
|
+
optional int32 position = 4;
|
244
|
+
optional string idempotency_key = 5; // 幂等性键
|
245
|
+
}
|
246
|
+
|
247
|
+
message GetSheetRequest {
|
248
|
+
string sheet_id = 1;
|
249
|
+
}
|
250
|
+
|
251
|
+
message ListSheetsRequest {
|
252
|
+
string table_id = 1;
|
253
|
+
}
|
254
|
+
|
255
|
+
message ListSheetsResponse {
|
256
|
+
repeated Sheet sheets = 1;
|
257
|
+
}
|
258
|
+
|
259
|
+
message UpdateSheetRequest {
|
260
|
+
string sheet_id = 1;
|
261
|
+
optional string name = 2;
|
262
|
+
optional string description = 3;
|
263
|
+
optional int32 position = 4;
|
264
|
+
optional string idempotency_key = 5; // 幂等性键
|
265
|
+
}
|
266
|
+
|
267
|
+
message DeleteSheetRequest {
|
268
|
+
string sheet_id = 1;
|
269
|
+
optional string idempotency_key = 2; // 幂等性键
|
270
|
+
}
|
271
|
+
|
272
|
+
message SheetResponse {
|
273
|
+
Sheet sheet = 1;
|
274
|
+
}
|
275
|
+
|
276
|
+
// Column operations
|
277
|
+
message CreateColumnRequest {
|
278
|
+
string sheet_id = 1;
|
279
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
280
|
+
string client_id = 3; // 客户端ID
|
281
|
+
string name = 4;
|
282
|
+
optional string column_type = 5;
|
283
|
+
optional string description = 6; // 列描述信息
|
284
|
+
optional int32 position = 7;
|
285
|
+
optional int32 width = 8;
|
286
|
+
optional google.protobuf.Struct properties = 9;
|
287
|
+
optional string idempotency_key = 10; // 幂等性键
|
288
|
+
}
|
289
|
+
|
290
|
+
message UpdateColumnRequest {
|
291
|
+
string sheet_id = 1;
|
292
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
293
|
+
string client_id = 3; // 客户端ID
|
294
|
+
string column_key = 4;
|
295
|
+
optional string name = 5;
|
296
|
+
optional string column_type = 6;
|
297
|
+
optional string description = 7; // 列描述信息
|
298
|
+
optional int32 width = 8;
|
299
|
+
optional bool hidden = 9;
|
300
|
+
optional google.protobuf.Struct properties = 10;
|
301
|
+
optional string idempotency_key = 11; // 幂等性键
|
302
|
+
}
|
303
|
+
|
304
|
+
message DeleteColumnRequest {
|
305
|
+
string sheet_id = 1;
|
306
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
307
|
+
string client_id = 3; // 客户端ID
|
308
|
+
string column_key = 4;
|
309
|
+
optional string idempotency_key = 5; // 幂等性键
|
310
|
+
}
|
311
|
+
|
312
|
+
// Batch edit operations support create/update/delete in one request
|
313
|
+
message BatchEditColumnsRequest {
|
314
|
+
string sheet_id = 1;
|
315
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
316
|
+
string client_id = 3; // 客户端ID
|
317
|
+
repeated ColumnOperation operations = 4;
|
318
|
+
optional string idempotency_key = 5; // 幂等性键
|
319
|
+
}
|
320
|
+
|
321
|
+
message ColumnOperation {
|
322
|
+
oneof operation {
|
323
|
+
CreateColumnData create = 1;
|
324
|
+
UpdateColumnData update = 2;
|
325
|
+
DeleteColumnData delete = 3;
|
326
|
+
}
|
327
|
+
}
|
328
|
+
|
329
|
+
message CreateColumnData {
|
330
|
+
string name = 1;
|
331
|
+
optional string column_type = 2;
|
332
|
+
optional string description = 3; // 列描述信息
|
333
|
+
optional int32 position = 4; // If not specified, append to end
|
334
|
+
optional int32 width = 5;
|
335
|
+
optional google.protobuf.Struct properties = 6;
|
336
|
+
}
|
337
|
+
|
338
|
+
message UpdateColumnData {
|
339
|
+
string column_key = 1;
|
340
|
+
optional string name = 2;
|
341
|
+
optional string column_type = 3;
|
342
|
+
optional string description = 4; // 列描述信息
|
343
|
+
optional int32 position = 5; // Moving to new position
|
344
|
+
optional int32 width = 6;
|
345
|
+
optional bool hidden = 7;
|
346
|
+
optional google.protobuf.Struct properties = 8;
|
347
|
+
}
|
348
|
+
|
349
|
+
message DeleteColumnData {
|
350
|
+
string column_key = 1;
|
351
|
+
}
|
352
|
+
|
353
|
+
message ColumnResponse {
|
354
|
+
Column column = 1;
|
355
|
+
int64 current_version = 2; // 返回当前版本号
|
356
|
+
bool applied_immediately = 3; // 是否立即应用
|
357
|
+
}
|
358
|
+
|
359
|
+
message BatchEditColumnsResponse {
|
360
|
+
bool success = 1;
|
361
|
+
int64 current_version = 2; // 返回当前版本号
|
362
|
+
repeated ColumnOperationResult results = 3;
|
363
|
+
optional string error_message = 4;
|
364
|
+
optional ConflictInfo conflict_info = 5; // 冲突信息
|
365
|
+
}
|
366
|
+
|
367
|
+
message ColumnOperationResult {
|
368
|
+
bool success = 1;
|
369
|
+
optional Column column = 2; // For create/update operations
|
370
|
+
optional string error_message = 3;
|
371
|
+
optional string operation_type = 4; // "create", "update", "delete"
|
372
|
+
}
|
373
|
+
|
374
|
+
message ConflictInfo {
|
375
|
+
bool has_conflict = 1;
|
376
|
+
int64 server_version = 2;
|
377
|
+
string conflict_type = 3; // "version_mismatch", "concurrent_edit"
|
378
|
+
repeated string conflicted_columns = 4;
|
379
|
+
optional string resolution_suggestion = 5;
|
380
|
+
}
|
381
|
+
|
382
|
+
|
383
|
+
// Row operations
|
384
|
+
message CreateRowRequest {
|
385
|
+
string sheet_id = 1;
|
386
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
387
|
+
string client_id = 3; // 客户端ID
|
388
|
+
optional int32 position = 4;
|
389
|
+
optional int32 height = 5;
|
390
|
+
optional bool hidden = 6;
|
391
|
+
optional string idempotency_key = 7; // 幂等性键
|
392
|
+
}
|
393
|
+
|
394
|
+
message UpdateRowRequest {
|
395
|
+
string sheet_id = 1;
|
396
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
397
|
+
string client_id = 3; // 客户端ID
|
398
|
+
string row_key = 4;
|
399
|
+
optional int32 position = 5;
|
400
|
+
optional int32 height = 6;
|
401
|
+
optional bool hidden = 7;
|
402
|
+
optional string idempotency_key = 8; // 幂等性键
|
403
|
+
}
|
404
|
+
|
405
|
+
message DeleteRowRequest {
|
406
|
+
string sheet_id = 1;
|
407
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
408
|
+
string client_id = 3; // 客户端ID
|
409
|
+
string row_key = 4;
|
410
|
+
optional string idempotency_key = 5; // 幂等性键
|
411
|
+
}
|
412
|
+
|
413
|
+
message BatchEditRowsRequest {
|
414
|
+
string sheet_id = 1;
|
415
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
416
|
+
string client_id = 3; // 客户端ID
|
417
|
+
repeated RowOperation operations = 4;
|
418
|
+
optional string idempotency_key = 5; // 幂等性键
|
419
|
+
}
|
420
|
+
|
421
|
+
message RowOperation {
|
422
|
+
oneof operation {
|
423
|
+
CreateRowData create = 1;
|
424
|
+
UpdateRowData update = 2;
|
425
|
+
DeleteRowData delete = 3;
|
426
|
+
}
|
427
|
+
}
|
428
|
+
|
429
|
+
message CreateRowData {
|
430
|
+
optional int32 position = 1; // If not specified, append to end
|
431
|
+
optional int32 height = 2;
|
432
|
+
}
|
433
|
+
|
434
|
+
message UpdateRowData {
|
435
|
+
string row_key = 1;
|
436
|
+
optional int32 position = 2; // Moving to new position
|
437
|
+
optional int32 height = 3;
|
438
|
+
optional bool hidden = 4;
|
439
|
+
}
|
440
|
+
|
441
|
+
message DeleteRowData {
|
442
|
+
string row_key = 1;
|
443
|
+
}
|
444
|
+
|
445
|
+
message RowResponse {
|
446
|
+
Row row = 1;
|
447
|
+
int64 current_version = 2; // 返回当前版本号
|
448
|
+
bool applied_immediately = 3; // 是否立即应用
|
449
|
+
bool success = 4; // 操作是否成功
|
450
|
+
optional string error_message = 5; // 错误信息
|
451
|
+
optional ConflictInfo conflict_info = 6; // 冲突信息
|
452
|
+
}
|
453
|
+
|
454
|
+
message BatchEditRowsResponse {
|
455
|
+
bool success = 1;
|
456
|
+
int64 current_version = 2; // 返回当前版本号
|
457
|
+
repeated RowOperationResult results = 3;
|
458
|
+
optional string error_message = 4;
|
459
|
+
optional ConflictInfo conflict_info = 5; // 冲突信息
|
460
|
+
}
|
461
|
+
|
462
|
+
message RowOperationResult {
|
463
|
+
bool success = 1;
|
464
|
+
optional Row row = 2; // For create/update operations
|
465
|
+
optional string error_message = 3;
|
466
|
+
optional string operation_type = 4; // "create", "update", "delete"
|
467
|
+
}
|
468
|
+
|
469
|
+
// Cell operations
|
470
|
+
message EditCellRequest {
|
471
|
+
string sheet_id = 1;
|
472
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
473
|
+
string client_id = 3; // 客户端ID
|
474
|
+
string column_key = 4;
|
475
|
+
string row_key = 5;
|
476
|
+
optional string raw_value = 6;
|
477
|
+
optional string formatted_value = 7;
|
478
|
+
optional string formula = 8;
|
479
|
+
optional google.protobuf.Struct styles = 9;
|
480
|
+
optional string data_type = 10;
|
481
|
+
optional string idempotency_key = 11; // 幂等性键
|
482
|
+
}
|
483
|
+
|
484
|
+
message DeleteCellRequest {
|
485
|
+
string sheet_id = 1;
|
486
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
487
|
+
string client_id = 3; // 客户端ID
|
488
|
+
string column_key = 4;
|
489
|
+
string row_key = 5;
|
490
|
+
optional string idempotency_key = 6; // 幂等性键
|
491
|
+
}
|
492
|
+
|
493
|
+
message BatchEditCellsRequest {
|
494
|
+
string sheet_id = 1;
|
495
|
+
int64 sheet_version = 2; // 乐观锁版本号
|
496
|
+
string client_id = 3; // 客户端ID
|
497
|
+
repeated CellOperation operations = 4;
|
498
|
+
optional string idempotency_key = 5; // 幂等性键
|
499
|
+
}
|
500
|
+
|
501
|
+
message CellOperation {
|
502
|
+
oneof operation {
|
503
|
+
EditCellData edit = 1; // 编辑单元格(新增或更新)
|
504
|
+
ClearCellData clear = 2; // 清空单元格内容
|
505
|
+
DeleteCellData delete = 3; // 删除单元格记录
|
506
|
+
}
|
507
|
+
}
|
508
|
+
|
509
|
+
message EditCellData {
|
510
|
+
string column_key = 1;
|
511
|
+
string row_key = 2;
|
512
|
+
optional string raw_value = 3;
|
513
|
+
optional string formatted_value = 4;
|
514
|
+
optional string formula = 5;
|
515
|
+
optional google.protobuf.Struct styles = 6;
|
516
|
+
optional string data_type = 7;
|
517
|
+
}
|
518
|
+
|
519
|
+
message ClearCellData {
|
520
|
+
string column_key = 1;
|
521
|
+
string row_key = 2;
|
522
|
+
}
|
523
|
+
|
524
|
+
message DeleteCellData {
|
525
|
+
string column_key = 1;
|
526
|
+
string row_key = 2;
|
527
|
+
}
|
528
|
+
|
529
|
+
message CellResponse {
|
530
|
+
Cell cell = 1;
|
531
|
+
int64 current_version = 2; // 返回当前版本号
|
532
|
+
bool applied_immediately = 3; // 是否立即应用
|
533
|
+
bool success = 4; // 操作是否成功
|
534
|
+
optional string error_message = 5; // 错误信息
|
535
|
+
optional ConflictInfo conflict_info = 6; // 冲突信息
|
536
|
+
}
|
537
|
+
|
538
|
+
message BatchEditCellsResponse {
|
539
|
+
bool success = 1;
|
540
|
+
int64 current_version = 2; // 返回当前版本号
|
541
|
+
repeated CellOperationResult results = 3;
|
542
|
+
optional string error_message = 4;
|
543
|
+
optional ConflictInfo conflict_info = 5; // 冲突信息
|
544
|
+
}
|
545
|
+
|
546
|
+
message CellOperationResult {
|
547
|
+
bool success = 1;
|
548
|
+
optional Cell cell = 2; // For update operations
|
549
|
+
optional string error_message = 3;
|
550
|
+
optional string operation_type = 4; // "update", "clear"
|
551
|
+
}
|
552
|
+
|
553
|
+
// Mixed batch operations for column/row/cell
|
554
|
+
message BatchEditSheetRequest {
|
555
|
+
string sheet_id = 1;
|
556
|
+
repeated SheetOperation operations = 2;
|
557
|
+
int64 sheet_version = 3; // 乐观锁版本号
|
558
|
+
string client_id = 4; // 客户端ID
|
559
|
+
optional string idempotency_key = 5; // 幂等性键
|
560
|
+
}
|
561
|
+
|
562
|
+
message SheetOperation {
|
563
|
+
oneof operation {
|
564
|
+
ColumnOperation column_op = 1;
|
565
|
+
RowOperation row_op = 2;
|
566
|
+
CellOperation cell_op = 3;
|
567
|
+
}
|
568
|
+
}
|
569
|
+
|
570
|
+
message BatchEditSheetResponse {
|
571
|
+
bool success = 1;
|
572
|
+
string batch_id = 2;
|
573
|
+
int64 current_version = 3;
|
574
|
+
repeated SheetOperationResult results = 4;
|
575
|
+
optional string error_message = 5;
|
576
|
+
optional ConflictInfo conflict_info = 6; // 冲突信息
|
577
|
+
}
|
578
|
+
|
579
|
+
message SheetOperationResult {
|
580
|
+
bool success = 1;
|
581
|
+
optional string error_message = 2;
|
582
|
+
optional string column_key = 3; // 返回的列key(如果适用)
|
583
|
+
optional string row_key = 4; // 返回的行key(如果适用)
|
584
|
+
optional string cell_key = 5; // 返回的单元格key(如果适用)
|
585
|
+
oneof result {
|
586
|
+
ColumnOperationResult column_result = 6;
|
587
|
+
RowOperationResult row_result = 7;
|
588
|
+
CellOperationResult cell_result = 8;
|
589
|
+
}
|
590
|
+
}
|
591
|
+
|
592
|
+
// Data retrieval operations
|
593
|
+
message GetColumnDataRequest {
|
594
|
+
string sheet_id = 1;
|
595
|
+
string column_key = 2;
|
596
|
+
}
|
597
|
+
|
598
|
+
message ColumnDataResponse {
|
599
|
+
Column column = 1;
|
600
|
+
repeated Cell cells = 2;
|
601
|
+
}
|
602
|
+
|
603
|
+
message GetRowDataRequest {
|
604
|
+
string sheet_id = 1;
|
605
|
+
string row_key = 2;
|
606
|
+
}
|
607
|
+
|
608
|
+
message RowDataResponse {
|
609
|
+
Row row = 1;
|
610
|
+
repeated Cell cells = 2;
|
611
|
+
}
|
612
|
+
|
613
|
+
message GetCellDataRequest {
|
614
|
+
string sheet_id = 1;
|
615
|
+
string column_key = 2;
|
616
|
+
string row_key = 3;
|
617
|
+
}
|
618
|
+
|
619
|
+
message CellDataResponse {
|
620
|
+
Cell cell = 1;
|
621
|
+
}
|
622
|
+
|
623
|
+
message GetSheetVersionRequest {
|
624
|
+
string sheet_id = 1;
|
625
|
+
}
|
626
|
+
|
627
|
+
message GetSheetVersionResponse {
|
628
|
+
string sheet_id = 1;
|
629
|
+
int64 version = 2; // 当前版本号
|
630
|
+
Sheet metadata = 3; // Sheet基本信息(不包含详细数据)
|
631
|
+
}
|
632
|
+
|
633
|
+
message GetSheetDataRequest {
|
634
|
+
string sheet_id = 1;
|
635
|
+
optional int64 version = 2; // If provided, return changes since this version
|
636
|
+
}
|
637
|
+
|
638
|
+
message GetSheetDataResponse {
|
639
|
+
string sheet_id = 1;
|
640
|
+
int64 version = 2; // 当前版本号
|
641
|
+
Sheet metadata = 3; // Sheet元数据
|
642
|
+
repeated Column columns = 4; // 所有列
|
643
|
+
repeated Row rows = 5; // 所有行
|
644
|
+
repeated Cell cells = 6; // 所有单元格
|
645
|
+
google.protobuf.Timestamp last_updated = 7; // 最后更新时间
|
646
|
+
}
|
647
|
+
|
648
|
+
// Empty response
|
649
|
+
message Empty {}
|
650
|
+
|
651
|
+
// Table clone operations
|
652
|
+
message CloneTableDataRequest {
|
653
|
+
string source_table_id = 1; // 源表格ID
|
654
|
+
string target_org_id = 2; // 目标组织ID
|
655
|
+
string target_user_id = 3; // 目标用户ID
|
656
|
+
optional string target_folder_id = 4; // 目标文件夹ID(可选)
|
657
|
+
optional string new_table_name = 5; // 新表格名称(可选,不提供则使用原名称+Copy)
|
658
|
+
optional bool include_views = 6; // 是否包含视图数据,默认 false - 否
|
659
|
+
optional string idempotency_key = 7; // 幂等性键
|
660
|
+
}
|
661
|
+
|
662
|
+
message CloneTableDataResponse {
|
663
|
+
bool success = 1;
|
664
|
+
string new_table_id = 2; // 新创建的表格ID
|
665
|
+
string new_file_id = 3; // 新创建的文件ID
|
666
|
+
int32 sheets_cloned = 4; // 克隆的工作表数量
|
667
|
+
int32 cells_cloned = 5; // 克隆的单元格数量
|
668
|
+
string error_message = 6; // 错误信息(如果失败)
|
669
|
+
google.protobuf.Timestamp created_at = 7; // 创建时间
|
670
|
+
}
|
671
|
+
|
672
|
+
// Table export operations
|
673
|
+
message ExportTableDataRequest {
|
674
|
+
string table_id = 1; // 要导出的表格ID
|
675
|
+
ExportFormat format = 2; // 导出格式
|
676
|
+
repeated string sheet_ids = 3; // 要导出的工作表ID列表(空则导出全部)
|
677
|
+
ExportOptions options = 4; // 导出选项
|
678
|
+
optional string idempotency_key = 5; // 幂等性键
|
679
|
+
}
|
680
|
+
|
681
|
+
enum ExportFormat {
|
682
|
+
EXPORT_FORMAT_UNSPECIFIED = 0;
|
683
|
+
EXPORT_FORMAT_EXCEL = 1; // .xlsx
|
684
|
+
EXPORT_FORMAT_CSV = 2; // .csv (每个sheet一个文件,打包成zip)
|
685
|
+
EXPORT_FORMAT_JSON = 3; // .json
|
686
|
+
}
|
687
|
+
|
688
|
+
message ExportOptions {
|
689
|
+
bool include_formulas = 1; // 是否包含公式
|
690
|
+
bool include_styles = 2; // 是否包含样式(仅Excel)
|
691
|
+
bool include_hidden_sheets = 3; // 是否包含隐藏的工作表
|
692
|
+
bool include_hidden_rows_cols = 4; // 是否包含隐藏的行列
|
693
|
+
string date_format = 5; // 日期格式(默认:YYYY-MM-DD)
|
694
|
+
string csv_delimiter = 6; // CSV分隔符(默认:逗号)
|
695
|
+
string csv_encoding = 7; // CSV编码(默认:UTF-8)
|
696
|
+
}
|
697
|
+
|
698
|
+
message ExportTableDataResponse {
|
699
|
+
bool success = 1;
|
700
|
+
string export_id = 2; // 导出记录ID
|
701
|
+
string file_url = 3; // GCS文件URL(内部使用)
|
702
|
+
string download_url = 4; // 下载链接(带签名的临时链接)
|
703
|
+
int64 file_size = 5; // 文件大小(字节)
|
704
|
+
string file_name = 6; // 导出的文件名
|
705
|
+
ExportFormat format = 7; // 导出格式
|
706
|
+
int32 sheets_exported = 8; // 导出的工作表数量
|
707
|
+
string error_message = 9; // 错误信息(如果失败)
|
708
|
+
google.protobuf.Timestamp created_at = 10; // 导出时间
|
709
|
+
google.protobuf.Timestamp expires_at = 11; // 下载链接过期时间
|
710
|
+
}
|
711
|
+
|
712
|
+
// Table import operations
|
713
|
+
message ImportTableDataRequest {
|
714
|
+
string file_id = 1; // 要导入的文件ID
|
715
|
+
optional string target_table_id = 2; // 目标表格ID(可选,不提供则创建新表格)
|
716
|
+
ImportOptions options = 3; // 导入选项
|
717
|
+
optional string folder_id = 4; // 文件夹ID(仅在创建新表格时使用)
|
718
|
+
optional string table_name = 5; // 表格名称(仅在创建新表格时使用)
|
719
|
+
optional string idempotency_key = 6; // 幂等性键
|
720
|
+
}
|
721
|
+
|
722
|
+
message ImportOptions {
|
723
|
+
ImportMode import_mode = 1; // 导入模式
|
724
|
+
bool skip_first_row = 2; // 是否跳过第一行(标题行)
|
725
|
+
bool auto_detect_types = 3; // 是否自动检测列类型
|
726
|
+
bool clear_existing_data = 4; // 是否清空现有数据(仅在导入到现有表格时)
|
727
|
+
map<string, string> column_mapping = 5; // 列映射(源列名 -> 目标列名)
|
728
|
+
string date_format = 6; // 日期格式(默认:YYYY-MM-DD)
|
729
|
+
string csv_delimiter = 7; // CSV分隔符(默认:逗号)
|
730
|
+
string csv_encoding = 8; // CSV编码(默认:UTF-8)
|
731
|
+
int32 max_rows = 9; // 最大导入行数限制(0表示无限制)
|
732
|
+
}
|
733
|
+
|
734
|
+
enum ImportMode {
|
735
|
+
IMPORT_MODE_UNSPECIFIED = 0;
|
736
|
+
IMPORT_MODE_APPEND = 1; // 追加到现有数据
|
737
|
+
IMPORT_MODE_REPLACE = 2; // 替换现有数据
|
738
|
+
IMPORT_MODE_MERGE = 3; // 合并数据(基于主键)
|
739
|
+
}
|
740
|
+
|
741
|
+
message ImportTableDataResponse {
|
742
|
+
bool success = 1;
|
743
|
+
string table_id = 2; // 导入的表格ID(新建或现有)
|
744
|
+
string file_id = 3; // 创建的文件ID(如果创建了新表格)
|
745
|
+
int32 sheets_imported = 4; // 导入的工作表数量
|
746
|
+
int32 rows_imported = 5; // 导入的行数
|
747
|
+
int32 cells_imported = 6; // 导入的单元格数量
|
748
|
+
repeated ImportSheetResult sheet_results = 7; // 每个工作表的导入结果
|
749
|
+
string error_message = 8; // 错误信息(如果失败)
|
750
|
+
repeated ImportWarning warnings = 9; // 警告信息
|
751
|
+
google.protobuf.Timestamp created_at = 10; // 导入时间
|
752
|
+
int64 processing_time_ms = 11; // 处理时间(毫秒)
|
753
|
+
}
|
754
|
+
|
755
|
+
message ImportSheetResult {
|
756
|
+
string sheet_name = 1; // 工作表名称
|
757
|
+
string sheet_id = 2; // 工作表ID
|
758
|
+
int32 rows_imported = 3; // 导入的行数
|
759
|
+
int32 cells_imported = 4; // 导入的单元格数量
|
760
|
+
bool success = 5; // 是否成功
|
761
|
+
optional string error_message = 6; // 错误信息
|
762
|
+
}
|
763
|
+
|
764
|
+
message ImportWarning {
|
765
|
+
string type = 1; // 警告类型(type_conversion, data_truncation, invalid_value等)
|
766
|
+
string message = 2; // 警告消息
|
767
|
+
optional string sheet_name = 3; // 相关工作表
|
768
|
+
optional int32 row_number = 4; // 相关行号
|
769
|
+
optional string column_name = 5; // 相关列名
|
770
|
+
}
|
771
|
+
|
772
|
+
// Table view operations
|
773
|
+
message CreateTableViewRequest {
|
774
|
+
string sheet_id = 1; // 所属工作表ID
|
775
|
+
string view_name = 2; // 视图名称
|
776
|
+
string view_type = 3; // 视图类型
|
777
|
+
|
778
|
+
// 视图配置字段
|
779
|
+
optional google.protobuf.Struct filter_criteria = 4; // 过滤条件
|
780
|
+
optional google.protobuf.Struct sort_criteria = 5; // 排序条件
|
781
|
+
repeated string visible_columns = 6; // 可见列
|
782
|
+
optional google.protobuf.Struct group_criteria = 7; // 分组条件
|
783
|
+
|
784
|
+
// 视图状态
|
785
|
+
bool is_hidden = 8; // 是否隐藏
|
786
|
+
bool is_default = 9; // 是否默认视图
|
787
|
+
|
788
|
+
// 扩展配置
|
789
|
+
optional google.protobuf.Struct config = 10; // 视图配置
|
790
|
+
}
|
791
|
+
|
792
|
+
message BatchCreateTableViewsRequest {
|
793
|
+
string sheet_id = 1; // 所属工作表ID(所有视图共享)
|
794
|
+
repeated CreateTableViewData views = 2; // 要创建的视图列表
|
795
|
+
}
|
796
|
+
|
797
|
+
message CreateTableViewData {
|
798
|
+
string view_name = 1; // 视图名称
|
799
|
+
string view_type = 2; // 视图类型
|
800
|
+
|
801
|
+
// 视图配置字段
|
802
|
+
optional google.protobuf.Struct filter_criteria = 3; // 过滤条件
|
803
|
+
optional google.protobuf.Struct sort_criteria = 4; // 排序条件
|
804
|
+
repeated string visible_columns = 5; // 可见列
|
805
|
+
optional google.protobuf.Struct group_criteria = 6; // 分组条件
|
806
|
+
|
807
|
+
// 视图状态
|
808
|
+
bool is_hidden = 7; // 是否隐藏
|
809
|
+
bool is_default = 8; // 是否默认视图
|
810
|
+
|
811
|
+
// 扩展配置
|
812
|
+
optional google.protobuf.Struct config = 9; // 视图配置
|
813
|
+
}
|
814
|
+
|
815
|
+
message BatchCreateTableViewsResponse {
|
816
|
+
repeated BatchCreateTableViewResult results = 1; // 批量创建结果
|
817
|
+
int32 success_count = 2; // 成功创建的数量
|
818
|
+
int32 failed_count = 3; // 失败的数量
|
819
|
+
}
|
820
|
+
|
821
|
+
message BatchCreateTableViewResult {
|
822
|
+
bool success = 1; // 是否成功
|
823
|
+
optional TableView view = 2; // 成功时返回创建的视图
|
824
|
+
optional string error_message = 3; // 失败时的错误信息
|
825
|
+
optional string view_name = 4; // 视图名称(用于标识是哪个视图)
|
826
|
+
}
|
827
|
+
|
828
|
+
message GetTableViewRequest {
|
829
|
+
string view_id = 1;
|
830
|
+
}
|
831
|
+
|
832
|
+
message ListTableViewsRequest {
|
833
|
+
oneof scope {
|
834
|
+
string table_id = 1; // 按表格ID查询
|
835
|
+
string sheet_id = 2; // 按工作表ID查询
|
836
|
+
}
|
837
|
+
optional string view_type = 3; // 筛选视图类型
|
838
|
+
}
|
839
|
+
|
840
|
+
message UpdateTableViewRequest {
|
841
|
+
string view_id = 1;
|
842
|
+
optional string view_name = 2; // 新名称
|
843
|
+
|
844
|
+
// 视图配置字段(可选更新)
|
845
|
+
optional google.protobuf.Struct filter_criteria = 3; // 过滤条件
|
846
|
+
optional google.protobuf.Struct sort_criteria = 4; // 排序条件
|
847
|
+
google.protobuf.ListValue visible_columns = 5; // 可见列(使用ListValue以支持null值)
|
848
|
+
optional google.protobuf.Struct group_criteria = 6; // 分组条件
|
849
|
+
|
850
|
+
// 视图状态(可选更新)
|
851
|
+
optional bool is_hidden = 7; // 是否隐藏
|
852
|
+
optional bool is_default = 8; // 是否默认视图
|
853
|
+
|
854
|
+
// 扩展配置
|
855
|
+
optional google.protobuf.Struct config = 9; // 视图配置
|
856
|
+
}
|
857
|
+
|
858
|
+
message UpdateTableViewConfigRequest {
|
859
|
+
string view_id = 1;
|
860
|
+
google.protobuf.Struct config = 2; // 新配置
|
861
|
+
}
|
862
|
+
|
863
|
+
message DeleteTableViewRequest {
|
864
|
+
string view_id = 1;
|
865
|
+
}
|
866
|
+
|
867
|
+
message TableViewResponse {
|
868
|
+
TableView view = 1;
|
869
|
+
}
|
870
|
+
|
871
|
+
message ListTableViewsResponse {
|
872
|
+
repeated TableView views = 1;
|
873
|
+
int32 total_count = 2; // 总数量
|
874
|
+
}
|