mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 18:20:33 +09:00
2307 lines
69 KiB
Protocol Buffer
2307 lines
69 KiB
Protocol Buffer
syntax = "proto3";
|
||
package anytype;
|
||
option go_package = "pb";
|
||
|
||
import "vendor/github.com/anytypeio/go-anytype-library/pb/model/protos/models.proto";
|
||
import "vendor/github.com/anytypeio/go-anytype-library/pb/model/protos/localstore.proto";
|
||
|
||
import "pb/protos/events.proto";
|
||
import "google/protobuf/struct.proto";
|
||
|
||
/*
|
||
* Rpc is a namespace, that agregates all of the service commands between client and middleware.
|
||
* Structure: Topic > Subtopic > Subsub... > Action > (Request, Response).
|
||
* Request – message from a client.
|
||
* Response – message from a middleware.
|
||
*/
|
||
message Rpc {
|
||
|
||
message ExternalDrop {
|
||
message Files {
|
||
message Request {
|
||
string contextId = 1;
|
||
string dropTargetId = 2;
|
||
anytype.model.Block.Position position = 3;
|
||
repeated string localFilePaths = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Content {
|
||
message Request {
|
||
string contextId = 1;
|
||
string focusedBlockId = 2; // can be null
|
||
bytes content = 3; // TODO
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message BlockList {
|
||
|
||
message ConvertChildrenToPages {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
repeated string linkIds = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Move {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
string targetContextId = 3;
|
||
string dropTargetId = 4;
|
||
anytype.model.Block.Position position = 5;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message MoveToNewPage {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
google.protobuf.Struct details = 3; // page details
|
||
string dropTargetId = 4;
|
||
anytype.model.Block.Position position = 5;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string linkId = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Makes blocks copy by given ids and paste it to shown place
|
||
*/
|
||
message Duplicate {
|
||
message Request {
|
||
string contextId = 1; // id of the context block
|
||
string targetId = 2; // id of the closest block
|
||
repeated string blockIds = 3; // id of block for duplicate
|
||
anytype.model.Block.Position position = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
repeated string blockIds = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Set {
|
||
message Page {
|
||
message IsArchived {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
bool isArchived = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// commands acceptable only for text blocks, others will be ignored
|
||
message Text {
|
||
message Style {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
anytype.model.Block.Content.Text.Style style = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
message Color {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
string color = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
message Mark {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
anytype.model.Block.Content.Text.Mark mark = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message BackgroundColor {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
string color = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
message Align {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
anytype.model.Block.Align align = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
message Fields {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated BlockField blockFields = 2;
|
||
|
||
message BlockField {
|
||
string blockId = 1;
|
||
google.protobuf.Struct fields = 2;
|
||
}
|
||
}
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
message Div {
|
||
message Style {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated string blockIds = 2;
|
||
anytype.model.Block.Content.Div.Style style = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
message Delete {
|
||
// Deletes the page, keys and all records from the local store and unsubscribe from remote changes
|
||
message Page {
|
||
message Request {
|
||
repeated string blockIds = 1; // pages to remove
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Namespace, that agregates subtopics and actions, that relates to blocks.
|
||
*/
|
||
message Block {
|
||
message Replace {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
anytype.model.Block block = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string blockId = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Split {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
anytype.model.Range range = 3;
|
||
anytype.model.Block.Content.Text.Style style = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string blockId = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Merge {
|
||
message Request {
|
||
string contextId = 1;
|
||
string firstBlockId = 2;
|
||
string secondBlockId = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Copy {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated anytype.model.Block blocks = 2;
|
||
anytype.model.Range selectedTextRange = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string textSlot = 2;
|
||
string htmlSlot = 3;
|
||
repeated anytype.model.Block anySlot = 4;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Paste {
|
||
message Request {
|
||
string contextId = 1;
|
||
string focusedBlockId = 2;
|
||
anytype.model.Range selectedTextRange = 3;
|
||
repeated string selectedBlockIds = 4;
|
||
bool isPartOfBlock = 5;
|
||
|
||
string textSlot = 6;
|
||
string htmlSlot = 7;
|
||
repeated anytype.model.Block anySlot = 8;
|
||
repeated File fileSlot = 9;
|
||
|
||
message File {
|
||
string name = 1;
|
||
bytes data = 2;
|
||
}
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
repeated string blockIds = 2;
|
||
int32 caretPosition = 3;
|
||
bool isSameBlockCaret = 4;
|
||
ResponseEvent event = 5;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Cut {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated anytype.model.Block blocks = 2;
|
||
anytype.model.Range selectedTextRange = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string textSlot = 2;
|
||
string htmlSlot = 3;
|
||
repeated anytype.model.Block anySlot = 4;
|
||
ResponseEvent event = 5;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message ImportMarkdown {
|
||
message Request {
|
||
string contextId = 1;
|
||
string importPath = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
repeated string rootLinkIds = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Export {
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated anytype.model.Block blocks = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string path = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Upload {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string filePath = 3;
|
||
string url = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Download {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Set {
|
||
message Fields {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
google.protobuf.Struct fields = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
message Details {
|
||
message Detail {
|
||
string key = 1;
|
||
google.protobuf.Value value = 2; // NUll - removes key
|
||
}
|
||
message Request {
|
||
string contextId = 1;
|
||
repeated Detail details = 2;
|
||
}
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
message Restrictions {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
anytype.model.Block.Restrictions restrictions = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Page {
|
||
message IsArchived {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
bool isArchived = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Text {
|
||
message Text {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string text = 3;
|
||
anytype.model.Block.Content.Text.Marks marks = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Color {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string color = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
message Style {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
anytype.model.Block.Content.Text.Style style = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Checked {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
bool checked = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message File {
|
||
message Name {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string name = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Image {
|
||
message Name {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string name = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Width {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
int32 width = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Video {
|
||
message Name {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string name = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Width {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
int32 width = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Link {
|
||
message TargetBlockId {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string targetBlockId = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Dataview {
|
||
message View {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2; // id of dataview block to update
|
||
string viewId = 3; // id of view to update
|
||
anytype.model.Block.Content.Dataview.View view = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// set the current active view (persisted only within a session)
|
||
message ActiveView {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2; // id of dataview block
|
||
string viewId = 3; // id of active view
|
||
uint32 offset = 4;
|
||
uint32 limit = 5;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
message Bookmark {
|
||
message Fetch {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string url = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message CreateAndFetch {
|
||
message Request {
|
||
string contextId = 1;
|
||
string targetId = 2;
|
||
anytype.model.Block.Position position = 3;
|
||
string url = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string blockId = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message File {
|
||
message CreateAndUpload {
|
||
message Request {
|
||
string contextId = 1;
|
||
string targetId = 2;
|
||
anytype.model.Block.Position position = 3;
|
||
string url = 4;
|
||
string localPath = 5;
|
||
anytype.model.Block.Content.File.Type fileType = 6;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string blockId = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Get {
|
||
/*
|
||
* Get marks list in the selected range in text block.
|
||
*/
|
||
message Marks {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
anytype.model.Range range = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Undo {
|
||
message Request {
|
||
string contextId = 1; // id of the context block
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
CAN_NOT_MOVE = 3;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Redo {
|
||
message Request {
|
||
string contextId = 1; // id of the context block
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
CAN_NOT_MOVE = 3;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Works with a smart blocks (block-organizers, like page, dashboard etc)
|
||
* **Example scenario**
|
||
* 1A. On front-end start.
|
||
* 1. Front -> MW: Rpc.Block.Open.Request(dashboard.id)
|
||
* 2. MW -> Front: BlockShow(dashboard)
|
||
* 3. MW -> Front: Rpc.Block.Open.Response(err)
|
||
* 1B. User clicks on a page icon on the dashboard.
|
||
* 1. Front -> MW: Rpc.Block.Close.Request(dashboard.id)
|
||
* Get close response first, then open request:
|
||
* 2. MW -> Front: Rpc.Block.Close.Response(err)
|
||
* 3. Front -> MW: Rpc.Block.Open.Request(page.id)
|
||
* 4. MW -> Front: BlockShow(<page, blocks>)
|
||
* 5. MW -> Front: Rpc.Block.Open.Response(err)
|
||
* Image/Video/File blocks then:
|
||
* 6. MW -> Front: BlockShow(<blocks>)
|
||
*/
|
||
message Open {
|
||
message Request {
|
||
string contextId = 1; // id of the context blo1k
|
||
string blockId = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
ANYTYPE_NEEDS_UPGRADE = 10; // failed to read unknown data format – need to upgrade anytype
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message GetPublicWebURL {
|
||
message Request {
|
||
string blockId = 1;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
string url = 2;
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message OpenBreadcrumbs {
|
||
message Request {
|
||
string contextId = 1; // id of the context blo1k
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string blockId = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message SetBreadcrumbs {
|
||
message Request {
|
||
string breadcrumbsId = 1;
|
||
repeated string ids = 2; // page ids
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Create a Smart/Internal block. Request can contain a block with a content, or it can be an empty block with a specific block.content.
|
||
* **Example scenario**
|
||
* 1A. Create Page on a dashboard
|
||
* 1. Front -> MW: Rpc.Block.Create.Request(blockId:dashboard.id, position:bottom, block: emtpy block with page content and id = "")
|
||
* 2. Front -> MW: Rpc.Block.Close.Request(block: dashboard.id)
|
||
* 3. Front <- MW: Rpc.Block.Close.Response(err)
|
||
* 4. Front <- MW: Rpc.Block.Create.Response(page.id)
|
||
* 5. Front <- MW: Rpc.Block.Open.Response(err)
|
||
* 6. Front <- MW: Event.Block.Show(page)
|
||
* 1B. Create Page on a Page
|
||
* 1. Front -> MW: Rpc.Block.Create.Request(blockId:dashboard.id, position:bottom, block: emtpy block with page content and id = "")
|
||
* 2. Front <- MW: Rpc.Block.Create.Response(newPage.id)
|
||
* 3. Front <- MW: Event.Block.Show(newPage)
|
||
*/
|
||
message Create {
|
||
message Dataview {
|
||
message View {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2; // id of dataview block to insert the new block
|
||
anytype.model.Block.Content.Dataview.View view = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
string viewId = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Record {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
google.protobuf.Struct record = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
google.protobuf.Struct record = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// common simple block command
|
||
message Request {
|
||
string contextId = 1; // id of the context block
|
||
string targetId = 2; // id of the closest block
|
||
anytype.model.Block block = 3;
|
||
anytype.model.Block.Position position = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string blockId = 2;
|
||
ResponseEvent event = 3;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message CreatePage {
|
||
message Request {
|
||
string contextId = 1; // id of the context block
|
||
string targetId = 2; // id of the closest block
|
||
google.protobuf.Struct details = 3; // page details
|
||
anytype.model.Block.Position position = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string blockId = 2;
|
||
string targetId = 3;
|
||
ResponseEvent event = 4;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Remove blocks from the childrenIds of its parents
|
||
*/
|
||
message Unlink {
|
||
message Request {
|
||
string contextId = 1; // id of the context block
|
||
repeated string blockIds = 2; // targets to remove
|
||
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Update {
|
||
message Dataview{
|
||
message Record {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string recordId = 3;
|
||
google.protobuf.Struct record = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Delete {
|
||
message Dataview {
|
||
message View {
|
||
message Request {
|
||
string contextId = 1; // id of the context block
|
||
string blockId = 2; // id of the dataview
|
||
string viewId = 4; // id of the view to remove
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Record {
|
||
message Request {
|
||
string contextId = 1;
|
||
string blockId = 2;
|
||
string recordId = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
ResponseEvent event = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Block.Close – it means unsubscribe from a block.
|
||
* Precondition: block should be opened.
|
||
*/
|
||
message Close {
|
||
message Request {
|
||
string contextId = 1; // id of the context blo1k
|
||
string blockId = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Namespace, that agregates subtopics and actions, that relates to wallet.
|
||
*/
|
||
message Wallet {
|
||
message Create {
|
||
/**
|
||
* Front-end-to-middleware request to create a new wallet
|
||
*/
|
||
message Request {
|
||
string rootPath = 1; // Path to a wallet directory
|
||
}
|
||
|
||
/**
|
||
* Middleware-to-front-end response, that can contain mnemonic of a created account and a NULL error or an empty mnemonic and a non-NULL error
|
||
*/
|
||
message Response {
|
||
Error error = 1;
|
||
string mnemonic = 2; // Mnemonic of a new account (sequence of words, divided by spaces)
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0; // No error; mnemonic should be non-empty
|
||
UNKNOWN_ERROR = 1; // Any other errors
|
||
BAD_INPUT = 2; // Root path is wrong
|
||
|
||
FAILED_TO_CREATE_LOCAL_REPO = 101;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Recover {
|
||
/**
|
||
* Front end to middleware request-to-recover-a wallet with this mnemonic and a rootPath
|
||
*/
|
||
message Request {
|
||
string rootPath = 1; // Path to a wallet directory
|
||
string mnemonic = 2; // Mnemonic of a wallet to recover
|
||
}
|
||
|
||
/**
|
||
* Middleware-to-front-end response, that can contain a NULL error or a non-NULL error
|
||
*/
|
||
message Response {
|
||
Error error = 1; // Error while trying to recover a wallet
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0; // No error; wallet successfully recovered
|
||
UNKNOWN_ERROR = 1; // Any other errors
|
||
BAD_INPUT = 2; // Root path or mnemonic is wrong
|
||
|
||
FAILED_TO_CREATE_LOCAL_REPO = 101;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Namespace, that agregates subtopics and actions, that relates to account.
|
||
*/
|
||
message Account {
|
||
message Create {
|
||
/**
|
||
* Front end to middleware request-to-create-an account
|
||
*/
|
||
message Request {
|
||
string name = 1; // Account name
|
||
oneof avatar {
|
||
string avatarLocalPath = 2; // Path to an image, that will be used as an avatar of this account
|
||
string avatarColor = 3; // Avatar color as an alternative for avatar image
|
||
}
|
||
|
||
|
||
string alphaInviteCode = 20;
|
||
}
|
||
|
||
/**
|
||
* Middleware-to-front-end response for an account creation request, that can contain a NULL error and created account or a non-NULL error and an empty account
|
||
*/
|
||
message Response {
|
||
Error error = 1; // Error while trying to create an account
|
||
anytype.model.Account account = 2; // A newly created account; In case of a failure, i.e. error is non-NULL, the account model should contain empty/default-value fields
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0; // No error; Account should be non-empty
|
||
UNKNOWN_ERROR = 1; // Any other errors
|
||
BAD_INPUT = 2; // Avatar or name is not correct
|
||
|
||
ACCOUNT_CREATED_BUT_FAILED_TO_START_NODE = 101;
|
||
ACCOUNT_CREATED_BUT_FAILED_TO_SET_NAME = 102;
|
||
ACCOUNT_CREATED_BUT_FAILED_TO_SET_AVATAR = 103;
|
||
FAILED_TO_STOP_RUNNING_NODE = 104;
|
||
|
||
BAD_INVITE_CODE = 900;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Recover {
|
||
/**
|
||
* Front end to middleware request-to-start-search of an accounts for a recovered mnemonic.
|
||
* Each of an account that would be found will come with an AccountAdd event
|
||
*/
|
||
message Request {
|
||
}
|
||
|
||
/**
|
||
* Middleware-to-front-end response to an account recover request, that can contain a NULL error and created account or a non-NULL error and an empty account
|
||
*/
|
||
message Response {
|
||
Error error = 1; // Error while trying to recover an account
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0; // No error;
|
||
UNKNOWN_ERROR = 1; // Any other errors
|
||
BAD_INPUT = 2;
|
||
|
||
NO_ACCOUNTS_FOUND = 101;
|
||
NEED_TO_RECOVER_WALLET_FIRST = 102;
|
||
FAILED_TO_CREATE_LOCAL_REPO = 103;
|
||
LOCAL_REPO_EXISTS_BUT_CORRUPTED = 104;
|
||
FAILED_TO_RUN_NODE = 105;
|
||
WALLET_RECOVER_NOT_PERFORMED = 106;
|
||
FAILED_TO_STOP_RUNNING_NODE = 107;
|
||
ANOTHER_ANYTYPE_PROCESS_IS_RUNNING = 108;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Select {
|
||
/**
|
||
* Front end to middleware request-to-launch-a specific account using account id and a root path
|
||
* User can select an account from those, that came with an AccountAdd events
|
||
*/
|
||
message Request {
|
||
string id = 1; // Id of a selected account
|
||
string rootPath = 2; // Root path is optional, set if this is a first request
|
||
}
|
||
|
||
/**
|
||
* Middleware-to-front-end response for an account select request, that can contain a NULL error and selected account or a non-NULL error and an empty account
|
||
*/
|
||
message Response {
|
||
Error error = 1; // Error while trying to launch/select an account
|
||
anytype.model.Account account = 2; // Selected account
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0; // No error
|
||
UNKNOWN_ERROR = 1; // Any other errors
|
||
BAD_INPUT = 2; // Id or root path is wrong
|
||
|
||
FAILED_TO_CREATE_LOCAL_REPO = 101;
|
||
LOCAL_REPO_EXISTS_BUT_CORRUPTED = 102;
|
||
FAILED_TO_RUN_NODE = 103;
|
||
FAILED_TO_FIND_ACCOUNT_INFO = 104;
|
||
LOCAL_REPO_NOT_EXISTS_AND_MNEMONIC_NOT_SET = 105;
|
||
FAILED_TO_STOP_SEARCHER_NODE = 106;
|
||
FAILED_TO_RECOVER_PREDEFINED_BLOCKS = 107;
|
||
ANOTHER_ANYTYPE_PROCESS_IS_RUNNING = 108;
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Stop {
|
||
/**
|
||
* Front end to middleware request to stop currently running account node and optionally remove the locally stored data
|
||
*/
|
||
message Request {
|
||
bool removeData = 1;
|
||
}
|
||
|
||
/**
|
||
* Middleware-to-front-end response for an account stop request
|
||
*/
|
||
message Response {
|
||
Error error = 1; // Error while trying to launch/select an account
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0; // No error
|
||
UNKNOWN_ERROR = 1; // Any other errors
|
||
BAD_INPUT = 2; // Id or root path is wrong
|
||
|
||
ACCOUNT_IS_NOT_RUNNING = 101;
|
||
FAILED_TO_STOP_NODE = 102;
|
||
FAILED_TO_REMOVE_ACCOUNT_DATA = 103;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Namespace, that agregates log subtopics and actions.
|
||
* Usage: send request with topic (Level) and description (message) from client to middleware to log.
|
||
*/
|
||
message Log {
|
||
message Send {
|
||
message Request {
|
||
string message = 1;
|
||
Level level = 2;
|
||
|
||
enum Level {
|
||
DEBUG = 0;
|
||
ERROR = 1;
|
||
FATAL = 2;
|
||
INFO = 3;
|
||
PANIC = 4;
|
||
WARNING = 5;
|
||
}
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
|
||
NOT_FOUND = 101;
|
||
TIMEOUT = 102;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Get info about a version of a middleware.
|
||
* Info is a string, that contains: BuildDate, GitCommit, GitBranch, GitState
|
||
*/
|
||
message Version {
|
||
message Get {
|
||
message Request {
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string version = 2;
|
||
string details = 3; // build date, branch and commit
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
VERSION_IS_EMPTY = 3;
|
||
|
||
NOT_FOUND = 101;
|
||
TIMEOUT = 102;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Namespace, that agregates subtopics and actions to work with IPFS directly (get files, blobs, images, etc)
|
||
*/
|
||
message Ipfs {
|
||
message File {
|
||
message Get {
|
||
message Request {
|
||
string id = 1;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
bytes data = 2;
|
||
string media = 3;
|
||
string name = 4;
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
|
||
NOT_FOUND = 101;
|
||
TIMEOUT = 102;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Image {
|
||
message Get {
|
||
message Blob {
|
||
message Request {
|
||
string hash = 1;
|
||
int32 wantWidth = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
bytes blob = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
|
||
NOT_FOUND = 101;
|
||
TIMEOUT = 102;
|
||
NODE_NOT_STARTED = 103;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message File {
|
||
message Request {
|
||
string hash = 1;
|
||
int32 wantWidth = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string localPath = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
|
||
NOT_FOUND = 101;
|
||
TIMEOUT = 102;
|
||
NODE_NOT_STARTED = 103;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Shutdown {
|
||
message Request {
|
||
}
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
|
||
NODE_NOT_STARTED = 101;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
message Config {
|
||
message Get {
|
||
message Request {
|
||
}
|
||
message Response {
|
||
Error error = 1;
|
||
string homeBlockId = 2; // home dashboard block id
|
||
string archiveBlockId = 3; // archive block id
|
||
string profileBlockId = 4; // profile block id
|
||
string gatewayUrl = 101; // gateway url for fetching static files
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
|
||
NODE_NOT_STARTED = 101;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Ping {
|
||
message Request {
|
||
int32 index = 1;
|
||
int32 numberOfEventsToSend = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
int32 index = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Process {
|
||
message Cancel {
|
||
message Request {
|
||
string id = 1;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
message LinkPreview {
|
||
message Request {
|
||
string url = 1;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
anytype.model.LinkPreview linkPreview = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message UploadFile {
|
||
message Request {
|
||
string url = 1;
|
||
string localPath = 2;
|
||
anytype.model.Block.Content.File.Type type = 3;
|
||
bool disableEncryption = 4;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
string hash = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Navigation {
|
||
message ListPages {
|
||
message Request {
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
repeated anytype.model.PageInfo pages = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Get the info for page alongside with info for all inbound and outbound links from/to this page
|
||
*/
|
||
message GetPageInfoWithLinks {
|
||
message Request {
|
||
string pageId = 1;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
anytype.model.PageInfoWithLinks page = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message History {
|
||
// returns list of versions (changes)
|
||
message Versions {
|
||
message Version {
|
||
string id = 1;
|
||
repeated string previousIds = 2;
|
||
string authorId = 3;
|
||
string authorName = 4;
|
||
int64 time = 5;
|
||
}
|
||
|
||
message Request {
|
||
string pageId = 1;
|
||
// when indicated, results will include versions before given id
|
||
string lastVersionId = 2;
|
||
// desired count of versions
|
||
int32 limit = 3;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
repeated Version versions = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// returns blockShow event for given version
|
||
message Show {
|
||
message Request {
|
||
string pageId = 1;
|
||
string versionId = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
Event.Block.Show blockShow = 2;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message SetVersion {
|
||
message Request {
|
||
string pageId = 1;
|
||
string versionId = 2;
|
||
}
|
||
|
||
message Response {
|
||
Error error = 1;
|
||
|
||
message Error {
|
||
Code code = 1;
|
||
string description = 2;
|
||
|
||
enum Code {
|
||
NULL = 0;
|
||
UNKNOWN_ERROR = 1;
|
||
BAD_INPUT = 2;
|
||
// ...
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
message Empty {
|
||
|
||
}
|