syntax = "proto3"; package co.treelab.api; service TreeLabApiService { rpc CreateWorkspace(CreateWorkspaceInput) returns (WorkspaceId) {} rpc AddCore(AddCoreInput) returns (CoreId) {} rpc UpdateCore(UpdateCoreInput) returns (CoreId) {} rpc RemoveCore(RemoveCoreInput) returns (CoreId) {} rpc AddTable(AddTableInput) returns (TableId) {} rpc AddColumn(AddColumnInput) returns (ColumnId) {} rpc AddRow(AddRowInput) returns (RowId) {} rpc UpdateCell(UpdateCellInput) returns (TableId) {} rpc AddView(AddViewInput) returns (ViewId) {} rpc SubscribeToWorkspace(WorkspaceSubscriptionInput) returns (stream EventPayload) {} rpc GetAllWorkspaces(EmptyInput) returns (WorkspacesResult) {} rpc GetWorkspace(GetWorkspaceInput) returns (WorkspaceProjection) {} rpc GetCore(GetCoreInput) returns (CoreProjection) {} rpc GetAllCores(GetCoresInput) returns (CoresResult) {} rpc GetTable(GetTableInput) returns (TableProjection) {} rpc GetAllTables(GetTablesInput) returns (TablesResult) {} } message EmptyInput {} message WorkspacesResult { repeated WorkspaceProjection result = 1; } message CoresResult { repeated CoreProjection result = 1; } message TablesResult { repeated TableProjection result = 1; } message TableProjection { string workspaceId = 1; string coreId = 2; string id = 3; string name = 4; TableData tableData = 5; repeated ViewData viewDatas = 6; } message TableData { repeated RowData rows = 1; } message RowData { string id = 1; repeated CellData cells = 2; } message CellData { string id = 1; string columnId = 2; CellValue value = 3; } message ViewData { string id = 1; // TODO: enums string type = 2; string name = 3; repeated ColumnDefinition columns = 4; } message ColumnDefinition { string id = 1; string type = 2; string name = 3; int32 order = 4; bool visibility = 5; string foreignTableId = 6; float defaultNumber = 7; int32 precision = 8; repeated Choice choices = 9; } message Choice { string id = 1; string name = 2; string color = 3; } message WorkspaceProjection { string id = 1; string name = 2; } message CoreProjection { string workspaceId = 1; string id = 2; string name = 3; string color = 4; string icon = 5; } message CellValue { // TODO: find out why the enums don't get passed in gRPC string type = 1; string text = 2; string recordReference = 3; float number = 4; repeated string selectedItems = 5; string selectedItem = 6; } message ColumnConfig { string name = 1; string type = 2; int32 order = 3; } message ViewDefinition { string id = 1; string name = 2; string type = 3; } message EventMetadata { string source = 1; } message EventPayload { string eventName = 1; string workspaceId = 2; string coreId = 3; string tableId = 4; string columnId = 5; string rowId = 6; string coreName = 7; string color = 8; string icon = 9; string tableName = 10; ColumnConfig columnConfig = 11; ViewDefinition view = 12; CellValue value = 13; EventMetadata _metadata = 14; } message WorkspaceSubscriptionInput { string workspaceId = 1; string topic = 2; } message ViewDefinitionInput { string name = 1; // TODO: find out why the enums don't get passed in gRPC string type = 2; } message AddViewInput { string workspaceId = 1; string coreId = 2; string tableId = 3; ViewDefinitionInput view = 4; } message AddColumnInput { string workspaceId = 1; string coreId = 2; string tableId = 3; ColumnConfigInput columnConfig = 4; } message ColumnConfigInput { // TODO: find out why the enums don't get passed in gRPC string type = 1; string name = 2; int32 order = 3; string foreignTableId = 4; float defaultNumber = 5; int32 precision = 6; repeated Choice choices = 9; } message AddRowInput { string workspaceId = 1; string coreId = 2; string tableId = 3; } message UpdateCellInput { string workspaceId = 1; string coreId = 2; string tableId = 3; string columnId = 4; string rowId = 5; CellValue value = 6; } message CreateWorkspaceInput { string name = 1; } message AddCoreInput { string workspaceId = 1; string coreName = 2; string color = 3; string icon = 4; } message UpdateCoreInput { string workspaceId = 1; string coreId = 2; string coreName = 3; string color = 4; string icon = 5; } message RemoveCoreInput { string workspaceId = 1; string coreId = 2; } message AddTableInput { string workspaceId = 1; string coreId = 2; string tableName = 3; } message GetTableInput { string workspaceId = 1; string coreId = 2; string tableId = 3; } message GetWorkspaceInput { string id = 1; } message GetCoreInput { string workspaceId = 1; string coreId = 2; } message GetCoresInput { string workspaceId = 1; } message GetTablesInput { string workspaceId = 1; string coreId = 2; } message WorkspaceId { string id = 1; } message CoreId { string id = 1; } message TableId { string id = 1; } message ColumnId { string id = 1; } message RowId { string id = 1; } message ViewId { string id = 1; }