1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00
anytype-heart/pb/protos/block.proto
Sergey Cherepanov 342afa6e6a
merge
2019-10-29 14:51:04 +03:00

349 lines
No EOL
5.8 KiB
Protocol Buffer

syntax="proto3";
package anytype;
option go_package = "pb";
import "struct.proto";
// commands
//
message BlockOpenRequest {
string id = 1;
}
message BlockOpenResponse {
Error error = 1;
BlockHeader blockHeader = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
message BlockCreateRequest {
BlockType type = 1;
}
message BlockCreateResponse {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
message BlockUpdateRequest {
BlockChanges changes = 1;
}
message BlockUpdateResponse {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
// events
//
// call
message BlockShow {
Block block = 1;
}
message BlockUpdate {
BlockChanges changes = 1;
}
message BlockCreate {
Block block = 1;
}
message BlockContentTextChange {
oneof change {
string text = 1;
BlockContentText.Style style = 2;
BlockContentText.Marks marks = 3;
bool toggleable = 4;
BlockContentText.MarkerType markerType = 5;
bool checkable = 6;
bool checked = 7;
}
}
message BlockContentPageChange {
oneof change {
BlockContentPage.Style style = 1;
BlockConnectionsList structure = 2;
BlocksList blocks = 3;
}
}
message BlockHeaderChange {
oneof change {
string id = 1;
BlockType type = 2;
string name = 3;
string icon = 4;
BlockPermissions permissions = 5;
}
}
message BlockContentDashboardChange {
oneof change {
BlockContentDashboard.Style style = 1;
BlockConnectionsList structure = 2;
BlockHeadersList headers = 3;
}
}
message BlockAtomicChange {
string id = 1;
oneof change {
BlockContentTextChange text = 2;
BlockHeaderChange blockHeader = 3;
BlockContentPageChange page = 4;
BlockContentDashboardChange dashboard = 5;
}
}
message BlockChanges {
repeated BlockAtomicChange changes = 1;
}
// models
//
message Block {
BlockHeader header = 1;
oneof content {
BlockContentDashboard dashboard = 11;
BlockContentPage page = 12;
BlockContentDataview dataview = 13;
BlockContentText text = 14;
BlockContentMedia media = 15;
}
}
message BlockHeader {
string id = 1;
BlockType type = 2;
Struct fields = 3;
BlockPermissions permissions = 4;
}
message BlockPermissions {
bool read = 1;
bool edit = 2;
bool remove = 3;
bool drag = 4;
bool dropOn = 5;
}
enum BlockType {
DASHBOARD = 0;
PAGE = 1;
DATAVIEW = 2;
TEXT = 3;
FILE = 4;
PICTURE = 5;
VIDEO = 6;
}
message BlockConnections {
string id = 1;
string next = 2;
string columnBottom = 3;
string rowRight = 4;
string inner = 5;
}
message BlockConnectionsList {
repeated BlockConnections structure = 1;
}
message BlockHeadersList {
repeated BlockHeader headers = 1;
}
message BlocksList {
repeated Block blocks = 1;
}
message BlockContentPage {
enum Style {
EMPTY = 0;
TASK = 1;
BOOKMARK = 2;
SET = 3;
// ...
}
Style style = 1;
BlockConnectionsList structure = 2;
BlocksList blocks = 3;
}
message BlockContentDashboard {
enum Style {
MAIN_SCREEN = 0;
// ...
}
Style style = 1;
BlockConnectionsList structure = 2;
BlockHeadersList headers = 3;
}
message BlockContentDataview {
// ...
}
message BlockContentText {
enum Style {
p = 0;
h1 = 1;
h2 = 2;
h3 = 3;
h4 = 4;
quote = 5;
}
enum MarkerType {
none = 0;
number = 1;
bullet = 2;
}
message Marks {
repeated Mark marks = 1;
}
message Mark {
enum Type {
STRIKETHROUGH = 0;
KEYBOARD = 1;
ITALIC = 2;
BOLD = 3;
LINK = 4;
}
Range range = 1;
Type type = 2;
string param = 3; // link, color, etc
}
string text = 1;
Style style = 2;
Marks marksList = 3;
bool toggleable = 4;
MarkerType markerType = 5;
bool checkable = 6;
bool checked = 7;
}
message BlockContentMedia {
string link = 1;
}
message Range {
int32 from = 1;
int32 to = 2;
}
/*
message Scheme {
oneof scheme {
PageScheme pageScheme = 1;
DataviewScheme dataviewScheme = 2;
}
}
message DataviewScheme {
// ...
}
message PageScheme {
BlockHeader header = 1;
BlockConnectionsList structure = 2;
BlockHeadersList headers = 3;
}
message BlockContentPreview {
oneof preview {
bool noPreview = 1;
ImagePreview imagePreview = 2;
VideoPreview videoPreview = 3;
FilePreview filePreview = 4;
TextPreview textPreview = 5;
EmptyPagePreview emptyPagePreview = 6;
TaskPagePreview taskPagePreview = 7;
}
}
message ImagePreview {
string name = 1;
int32 height = 2;
int32 width = 3;
}
message VideoPreview {
string name = 1;
int32 height = 2;
int32 width = 3;
}
message FilePreview {
string name = 1;
string icon = 2;
}
message TextPreview {
int32 symblos = 1;
BlockContentText.Style style = 2;
}
message EmptyPagePreview {
string name = 1;
string icon = 2;
}
message TaskPagePreview {
string header = 1;
string assignee = 2;
// ...
}
*/