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 GetWorkspace(GetWorkspaceInput) returns (WorkspaceProjection) {} rpc GetCore(GetCoreInput) returns (CoreProjection) {} rpc GetTable(GetTableInput) returns (TableProjection) {} rpc GetCellByColumnAndRowId(GetCellByColumnAndRowIdInput) returns (CellData) {} rpc GetLookupCellByColumnAndRowId(GetLookupCellByColumnAndRowIdInput) returns (LookupCellDataResult) {} rpc GetAllWorkspaces(EmptyInput) returns (WorkspacesResult) {} rpc GetAllCores(GetCoresInput) returns (CoresResult) {} 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 GetLookupCellByColumnAndRowIdInput { string columnId = 1; string rowId = 2; int32 depth = 3; } message GetCellByColumnAndRowIdInput { string columnId = 1; string rowId = 2; } message TableProjection { string id = 3; string name = 4; repeated ViewData views = 5; } message TableData { repeated RowData rows = 1; } message RowData { string id = 1; int32 order = 2; repeated CellData cells = 3; } message LookupCellDataResult { repeated CellData result = 1; } message CellData { string columnId = 1; string type = 2; string text = 3; repeated ForeignRowValue foreignRow = 4; float number = 5; // these 3 needs to be in strings for now string selectedItem = 6; string selectedItems = 7; string attachments = 8; string dateTime = 9; repeated CellData lookup = 10; } message ViewData { string id = 1; // TODO: enums string type = 2; string name = 3; repeated RowData rows = 4; repeated ColumnDefinition columns = 5; } 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; string choices = 9; string dateFormat = 10; bool includeTime = 11; string timeFormat = 12; bool useGMT = 13; } message Choice { string id = 1; string name = 2; string color = 3; } message WorkspaceProjection { string id = 1; string name = 2; } message CoreProjection { string id = 2; string name = 3; string color = 4; string icon = 5; } message ForeignRowVisibleNameValue { string value = 1; } message ForeignRowValue { string id = 1; repeated ForeignRowVisibleNameValue visibleName = 2; } message Attachment { string name = 1; string url = 2; } 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 tableName = 7; CoreCreatedDTO coreCreatedDto = 8; CoreUpdatedDTO coreUpdatedDto = 9; ColumnConfig columnConfig = 10; ViewDefinition view = 11; UpdateCellActionInput action = 12; EventMetadata _metadata = 13; } message CoreCreatedDTO { string workspaceId = 1; string coreId = 2; string coreName = 3; string color = 4; string icon = 5; } message CoreUpdatedDTO { string workspaceId = 1; string coreId = 2; string coreName = 3; string color = 4; string icon = 5; } 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; string dateFormat = 10; bool includeTime = 11; string timeFormat = 12; bool useGMT = 13; } message AddRowInput { string workspaceId = 1; string coreId = 2; string tableId = 3; } message CellValueInput { string type = 1; string text = 2; string foreignRowId = 3; float number = 4; Choice selectedItem = 5; repeated Choice selectedItems = 6; repeated Attachment attachments = 7; string dateTime = 8; } message UpdateCellActionInput { // one of [ADD_VALUE SET_VALUE REMOVE_VALUE] string type = 1; CellValueInput value = 2; } message UpdateCellInput { string workspaceId = 1; string coreId = 2; string tableId = 3; string columnId = 4; string rowId = 5; UpdateCellActionInput action = 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; }