1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-11 18:20:33 +09:00
anytype-heart/pb/protos/commands.proto
2019-11-06 21:45:06 +01:00

423 lines
13 KiB
Protocol Buffer

syntax="proto3";
package anytype;
option go_package = "pb";
import "models.proto";
import "changes.proto";
message Rpc {
message Block {
message History {
message Move {
message Request {
string blockId = 1;
bool moveForward = 2;
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
CAN_NOT_MOVE = 3;
// ...
}
}
}
}
}
message Open {
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 Create {
message Request {
Model.Block block = 1;
string targetId = 2;
Model.Block.Position position = 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 Update {
message Request {
Change.Multiple.BlocksList changes = 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 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;
}
}
}
}
}
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
}
}
/**
* 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
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;
}
}
}
}
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;
}
}
}
}
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
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;
}
}
}
}
}
message Version {
message Get {
message Request {}
message Response {
Error error = 1;
string version = 2;
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;
}
}
}
}
}
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;
}
}
}
}
}
message Ipfs {
message Get {
message File {
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 id = 1;
Model.Image.Size size = 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;
}
}
}
}
message File {
message Request {
string id = 1;
Model.Image.Size size = 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;
}
}
}
}
}
}
}