mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-09 07:56:03 +01:00
Started describing v0 API
This commit is contained in:
370
doc/swagger/v0/cyphernode-api.yaml
Normal file
370
doc/swagger/v0/cyphernode-api.yaml
Normal file
@@ -0,0 +1,370 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
description: "Cyphernode API v0"
|
||||
version: "0.1.0"
|
||||
title: "Cyphernode API"
|
||||
externalDocs:
|
||||
description: "Find out more about Swagger"
|
||||
url: "http://swagger.io"
|
||||
servers:
|
||||
- url: /
|
||||
description: authoring
|
||||
- url: http://localhost:8888/
|
||||
description: local cyphernode
|
||||
tags:
|
||||
- name: "cyphernode"
|
||||
description: "Everything bitcoin"
|
||||
externalDocs:
|
||||
description: "Find out more"
|
||||
url: "http://cyphernode.io"
|
||||
- name: "openapi generator"
|
||||
externalDocs:
|
||||
description: "Find out more"
|
||||
url: "https://github.com/OpenAPITools/openapi-generator"
|
||||
- name: "watching addresses"
|
||||
- name: "block"
|
||||
- name: "core features"
|
||||
- name: "lightning"
|
||||
- name: "open timestamps client"
|
||||
paths:
|
||||
/watch:
|
||||
post:
|
||||
tags:
|
||||
- "watching addresses"
|
||||
- "core features"
|
||||
summary: "Add a new address to ne watched"
|
||||
description: "Inserts the address and callbacks in the DB and imports the address to the Watching wallet."
|
||||
operationId: "addWatchedAddress"
|
||||
requestBody:
|
||||
description: "Address that needs to be watched"
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: "object"
|
||||
required:
|
||||
- "address"
|
||||
- "confirmedCallbackURL"
|
||||
- "unconfirmedCallbackURL"
|
||||
properties:
|
||||
address:
|
||||
$ref: '#/components/schemas/TypeAddressString'
|
||||
unconfirmedCallbackURL:
|
||||
type: "string"
|
||||
format: "url"
|
||||
confirmedCallbackURL:
|
||||
type: "string"
|
||||
format: "url"
|
||||
responses:
|
||||
200:
|
||||
description: "successfully created"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/WatchedAddress'
|
||||
401:
|
||||
$ref: '#/components/schemas/ApiResponseNotAllowed'
|
||||
405:
|
||||
$ref: '#/components/schemas/ApiResponseInvalidInput'
|
||||
503:
|
||||
description: "Resource temporarily unavailable"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
/getactivewatches:
|
||||
get:
|
||||
tags:
|
||||
- "watching addresses"
|
||||
- "core features"
|
||||
summary: "Get list of watched addresses"
|
||||
description: "Returns the list of currently watched addresses and callback information."
|
||||
operationId: "listWatchedAddress"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: "object"
|
||||
required:
|
||||
- "watched"
|
||||
properties:
|
||||
watches:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: '#/components/schemas/WatchedAddress'
|
||||
401:
|
||||
$ref: '#/components/schemas/ApiResponseNotAllowed'
|
||||
503:
|
||||
description: "Resource temporarily unavailable"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
/unwatch/{address}:
|
||||
get:
|
||||
parameters:
|
||||
- in: "path"
|
||||
name: "address"
|
||||
description: "Address"
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/components/schemas/TypeAddressString'
|
||||
tags:
|
||||
- "watching addresses"
|
||||
- "core features"
|
||||
summary: "Delete watched address"
|
||||
description: "Updates the watched address row in DB so that callbacks won't be called on tx confirmations for that address."
|
||||
operationId: "deleteWatchedAddress"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
content:
|
||||
application:json:
|
||||
schema:
|
||||
type: "object"
|
||||
properties:
|
||||
event:
|
||||
type: "string"
|
||||
address:
|
||||
$ref: '#/components/schemas/TypeAddressString'
|
||||
401:
|
||||
$ref: '#/components/schemas/ApiResponseNotAllowed'
|
||||
404:
|
||||
$ref: '#/components/schemas/ApiResponseNotFound'
|
||||
503:
|
||||
description: "Resource temporarily unavailable"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
/getbestblockhash:
|
||||
get:
|
||||
tags:
|
||||
- "block"
|
||||
- "core features"
|
||||
summary: "Get the best block hash."
|
||||
description: "Returns the best block hash of the watching Bitcoin node."
|
||||
operationId: "getBestBlockHash"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: "object"
|
||||
required:
|
||||
- "result"
|
||||
properties:
|
||||
result:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
error:
|
||||
type: "string"
|
||||
id:
|
||||
type: "string"
|
||||
401:
|
||||
$ref: '#/components/schemas/ApiResponseNotAllowed'
|
||||
503:
|
||||
description: "Resource temporarily unavailable"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
/getblockinfo/{blockHash}:
|
||||
get:
|
||||
parameters:
|
||||
- in: "path"
|
||||
name: "blockHash"
|
||||
description: "Blockhash"
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
tags:
|
||||
- "block"
|
||||
- "core features"
|
||||
summary: "Show block info"
|
||||
description: ""
|
||||
operationId: "getBlockInfo"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: "object"
|
||||
properties:
|
||||
result:
|
||||
$ref: '#/components/schemas/Block'
|
||||
error:
|
||||
type: "string"
|
||||
id:
|
||||
type: "string"
|
||||
401:
|
||||
$ref: '#/components/schemas/ApiResponseNotAllowed'
|
||||
404:
|
||||
$ref: '#/components/schemas/ApiResponseNotFound'
|
||||
503:
|
||||
description: "Resource temporarily unavailable"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
/getbestblockinfo:
|
||||
get:
|
||||
tags:
|
||||
- "block"
|
||||
- "core features"
|
||||
summary: "Get the best block info"
|
||||
description: ""
|
||||
operationId: "getBestBlockInfo"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: "object"
|
||||
properties:
|
||||
result:
|
||||
$ref: '#/components/schemas/Block'
|
||||
error:
|
||||
type: "string"
|
||||
id:
|
||||
type: "string"
|
||||
401:
|
||||
$ref: '#/components/schemas/ApiResponseNotAllowed'
|
||||
503:
|
||||
description: "Resource temporarily unavailable"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
|
||||
components:
|
||||
schemas:
|
||||
WatchedAddress:
|
||||
type: "object"
|
||||
required:
|
||||
- "address"
|
||||
- "unconfirmedCallbackURL"
|
||||
- "confirmedCallbackURL"
|
||||
properties:
|
||||
id:
|
||||
type: "string"
|
||||
event:
|
||||
type: "string"
|
||||
imported:
|
||||
type: "string"
|
||||
enum: ["0","1"]
|
||||
inserted:
|
||||
type: "string"
|
||||
enum: ["0","1"]
|
||||
address:
|
||||
$ref: '#/components/schemas/TypeAddressString'
|
||||
unconfirmedCallbackURL:
|
||||
description: "Async callback in case of activity on address"
|
||||
type: "string"
|
||||
format: "url"
|
||||
confirmedCallbackURL:
|
||||
description: "Async callback in case of activity on address"
|
||||
type: "string"
|
||||
format: "url"
|
||||
estimatesmartfee2blocks:
|
||||
type: "string"
|
||||
estimatesmartfee6blocks:
|
||||
type: "string"
|
||||
estimatesmartfee36blocks:
|
||||
type: "string"
|
||||
estimatesmartfee144blocks:
|
||||
type: "string"
|
||||
watching_since:
|
||||
type: "string"
|
||||
Block:
|
||||
type: "object"
|
||||
required:
|
||||
- "address"
|
||||
- "callback"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
hash:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
confirmations:
|
||||
type: "integer"
|
||||
strippedsize:
|
||||
type: "integer"
|
||||
size:
|
||||
type: "integer"
|
||||
weight:
|
||||
type: "integer"
|
||||
height:
|
||||
type: "integer"
|
||||
version:
|
||||
type: "integer"
|
||||
versionHex:
|
||||
$ref: '#/components/schemas/TypeInt32HexString'
|
||||
merkleroot:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
tx:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
time:
|
||||
type: "integer"
|
||||
mediantime:
|
||||
type: "integer"
|
||||
nonce:
|
||||
type: "integer"
|
||||
bits:
|
||||
$ref: '#/components/schemas/TypeInt32HexString'
|
||||
difficulty:
|
||||
type: 'integer'
|
||||
chainwork:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
nTx:
|
||||
type: 'integer'
|
||||
previousblockhash:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
nextblockhash:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
TypeAddressString:
|
||||
description: "base58 check encoded address"
|
||||
type: "string"
|
||||
pattern: "^[a-km-zA-HJ-NP-Z1-9]{26,35}$"
|
||||
TypeHashString:
|
||||
description: "64 character hex string"
|
||||
type: "string"
|
||||
pattern: "^[a-fA-F0-9]{64}$"
|
||||
TypeInt32HexString:
|
||||
description: "8 character hex string"
|
||||
type: "string"
|
||||
pattern: "^[a-fA-F0-9]{8}$"
|
||||
ApiResponseTemporarilyUnavailable:
|
||||
type: "object"
|
||||
properties:
|
||||
reason:
|
||||
type: "string"
|
||||
ApiResponseNotAllowed:
|
||||
description: Access token is missing or invalid
|
||||
ApiResponseNotFound:
|
||||
description: Not found
|
||||
ApiResponseInvalidInput:
|
||||
description: Invalid Input
|
||||
securitySchemes:
|
||||
BearerAuth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
Reference in New Issue
Block a user