bdledger-apis/docs/openapiv2/bdware/bdledger/api/ledger.swagger.json
2021-02-12 21:12:20 +08:00

229 lines
5.0 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "bdware/bdledger/api/ledger.proto",
"version": "version not set"
},
"tags": [
{
"name": "Ledger"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v0/ledgers": {
"get": {
"summary": "*\nGet all ledgers\n查询所有帐本列表",
"operationId": "Ledger_GetLedgers",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiGetLedgersResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"Ledger"
]
},
"post": {
"summary": "*\nCreate a new ledger\n创建一个新账本",
"operationId": "Ledger_CreateLedger",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiCreateLedgerResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/apiCreateLedgerRequest"
}
}
],
"tags": [
"Ledger"
]
}
},
"/v0/ledgers/{ledger}/transactions": {
"post": {
"summary": "*\nSend a new transaction\n发送一个新事务",
"operationId": "Ledger_SendTransaction",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiSendTransactionResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "ledger",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/apiSendTransactionRequest"
}
}
],
"tags": [
"Ledger"
]
}
}
},
"definitions": {
"apiCreateLedgerRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"apiCreateLedgerResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
},
"apiGetLedgersResponse": {
"type": "object",
"properties": {
"ledgers": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"apiSendTransactionRequest": {
"type": "object",
"properties": {
"ledger": {
"type": "string"
},
"transaction": {
"$ref": "#/definitions/apiSendTransactionRequestTransaction"
}
}
},
"apiSendTransactionRequestTransaction": {
"type": "object",
"properties": {
"type": {
"$ref": "#/definitions/apiTransactionType"
},
"from": {
"type": "string",
"format": "byte"
},
"nonce": {
"type": "string",
"format": "uint64"
},
"to": {
"type": "string",
"format": "byte"
},
"data": {
"type": "string",
"format": "byte"
}
}
},
"apiSendTransactionResponse": {
"type": "object",
"properties": {
"hash": {
"type": "string",
"format": "byte"
}
}
},
"apiTransactionType": {
"type": "string",
"enum": [
"RECORD",
"MESSAGE",
"CONTRACT_CREATION",
"CONTRACT_INVOCATION",
"CONTRACT_STATUS"
],
"default": "RECORD",
"title": "事务类型"
},
"protobufAny": {
"type": "object",
"properties": {
"typeUrl": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}