Add API documentation

This commit is contained in:
Nex
2020-04-07 21:56:57 +08:00
parent 935d130a98
commit 6ce31075db
6 changed files with 4345 additions and 1 deletions

View File

@@ -9,8 +9,20 @@ option go_package = "bdware.org/bdledger/api/grpc/pb";
option java_package = "org.bdware.bdledger.api.grpc.pb";
service Ledger {
/**
* Create a new ledger
* 创建一个新账本
*/
rpc CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse);
/**
* Get all ledgers
* 查询所有帐本列表
*/
rpc GetLedgers (google.protobuf.Empty) returns (GetLedgersResponse);
/**
* Send a new transaction
* 发送一个新事务
*/
rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse);
}

View File

@@ -8,6 +8,10 @@ option go_package = "bdware.org/bdledger/api/grpc/pb";
option java_package = "org.bdware.bdledger.api.grpc.pb";
service Node {
/**
* Get BDLedger node version
* 查询BDLedger节点版本
*/
rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse);
}

View File

@@ -8,12 +8,42 @@ option go_package = "bdware.org/bdledger/api/grpc/pb";
option java_package = "org.bdware.bdledger.api.grpc.pb";
service Query {
/**
* Get a block identified by its hash
* 查询哈希所指定的区块
*/
rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse);
rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse); // start_timestamp is required
/**
* Get blocks in a timestamp range
* 查询时间范围内的区块
* start_timestamp is required
*/
rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse);
/**
* Count all blocks in a ledger, or blocks in a timestamp range
* 查询帐本中的所有区块数量,或时间范围内的区块数量
*/
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
/**
* Get a transaction identified by its hash
* 查询哈希所指定的事务
*/
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (GetTransactionByHashResponse);
/**
* Get a transaction identified by hash of the block it belongs to and its index inside the block
* 查询所在区块的哈希与其在区块中的index所指定的事务
*/
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (GetTransactionByBlockHashAndIndexResponse);
/**
* Get transactions in a timestamp range
* 查询时间范围内的事务
*/
rpc GetTransactions (TransactionsRequest) returns (GetTransactionsResponse);
/**
* Count all transactions in a ledger, or transactions in a timestamp range
* 查询帐本中的所有事务数量,或时间范围内的事务数量
* start_timestamp is required
*/
rpc CountTransactions (TransactionsRequest) returns (CountTransactionsResponse);
}