Commit 0a1c83e5 authored by metacertain's avatar metacertain Committed by GitHub

Added base api and debugapi yamls, common types (#289)

* Added base api and debugapi yamls, common types
* version 0.1.0
parent cfb17e33
openapi: 3.0.0
info:
version: 0.1.0
title: Swarm API
description: 'A list of the currently provided Interfaces to interact with the swarm, implementing file operations'
security:
- {}
externalDocs:
description: Browse the documentation @ the Swarm Docs
url: 'https://docs.swarm.eth'
servers:
- url: 'http://{apiRoot}:{port}/v1'
variables:
apiRoot:
default: 'localhost'
description: Base address of the local bee node main API
port:
default: 8080
description: Service port provided in bee node config
- url: 'http://{apiRoot}:{port}'
variables:
apiRoot:
default: 'localhost'
description: Base address of the local bee node main API
port:
default: 8080
description: Service port provided in bee node config
paths:
'/bytes':
post:
summary: 'Upload data'
tags:
- 'Endpoints on local bee node'
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/ReferenceResponse'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/bytes/{reference}':
get:
summary: 'Get referenced data'
tags:
- 'Endpoints on local bee node'
parameters:
- in: path
name: reference
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmReference'
required: true
description: Swarm address reference to content
responses:
'200':
description: Retrieved content specified by reference
content:
application/octet-stream:
schema:
type: string
format: binary
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'404':
$ref: 'SwarmCommon.yaml#/components/responses/404'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/chunks/{reference}':
get:
summary: 'Get Chunk'
tags:
- 'Endpoints on local bee node'
parameters:
- in: path
name: reference
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmReference'
required: true
description: Swarm address of chunk
responses:
'200':
description: Retrieved chunk content
content:
application/octet-stream:
schema:
type: string
format: binary
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'404':
$ref: 'SwarmCommon.yaml#/components/responses/404'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
post:
summary: 'Upload Chunk'
tags:
- 'Endpoints on local bee node'
parameters:
- in: header
name: swarm-tag-uid
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Uid'
required: false
description: Uid of chunk
- in: header
name: swarm-pin
schema:
type: boolean
required: false
description: Represents the pinning state of the chunk
- in: path
name: reference
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmReference'
required: true
description: Swarm address of chunk
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Status'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/files':
post:
summary: 'Upload file'
tags:
- 'Endpoints on local bee node'
parameters:
- in: query
name: name
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/FileName'
required: false
description: Filename
requestBody:
content:
multipart/form-data:
schema:
properties:
file:
type: array
items:
type: string
format: binary
application/octet-stream:
schema:
type: string
format: binary
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/ReferenceResponse'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/files/{reference}':
get:
summary: 'Get referenced file'
tags:
- 'Endpoints on local bee node'
parameters:
- in: path
name: reference
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmReference'
required: true
description: Swarm address of content
responses:
'200':
description: Ok
content:
application/octet-stream:
schema:
type: string
format: binary
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'404':
$ref: 'SwarmCommon.yaml#/components/responses/404'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
openapi: 3.0.0
info:
version: '0.1.0'
title: 'Common Data Types'
description: |
\*****bzzz*****
externalDocs:
description: Browse the documentation @ the Swarm Docs
url: 'https://docs.swarm.eth'
paths: {}
components:
schemas:
Address:
type: object
properties:
Address:
$ref: '#/components/schemas/SwarmAddress'
Addresses:
type: object
properties:
overlay:
$ref: '#/components/schemas/SwarmAddress'
underlay:
type: array
items:
$ref: '#/components/schemas/P2PUnderlay'
BzzChunksPinned:
type: object
properties:
chunks:
type: array
items:
type: object
properties:
address:
type: string
pinCounter:
type: integer
BzzTopology:
type: object
properties:
baseAddr:
$ref: '#/components/schemas/SwarmAddress'
population:
type: integer
connected:
type: integer
timestamp:
type: string
nnLowWatermark:
type: integer
depth:
type: integer
bins:
type: object
additionalProperties:
type: object
properties:
population:
type: integer
connected:
type: integer
disconnectedPeers:
type: object
connectedPeers:
type: object
DateTime:
type: string
format: date-time
pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{7}\+\d{2}:\d{2})$'
example: "2020-06-11T11:26:42.6969797+02:00"
Duration:
description: Go time.Duration format
type: string
example: "5.0018ms"
FileName:
type: string
Hash:
type: object
properties:
hash:
$ref: '#/components/schemas/SwarmAddress'
MultiAddress:
type: string
NewTagResponse:
type: object
properties:
total:
type: integer
split:
type: integer
seen:
type: integer
stored:
type: integer
sent:
type: integer
synced:
type: integer
uid:
$ref: '#/components/schemas/Uid'
anonymous:
type: boolean
name:
type: string
address:
type: string
startedAt:
$ref: '#/components/schemas/DateTime'
P2PUnderlay:
type: string
example: "/ip4/127.0.0.1/tcp/7070/p2p/16Uiu2HAmTm17toLDaPYzRyjKn27iCB76yjKnJ5DjQXneFmifFvaX"
Peers:
type: object
properties:
peers:
type: array
items:
$ref: '#/components/schemas/Address'
PinningState:
type: object
properties:
address:
$ref: '#/components/schemas/SwarmAddress'
pinCounter:
type: integer
ProblemDetails:
type: string
ReferenceResponse:
type: object
properties:
reference:
$ref: '#/components/schemas/SwarmReference'
Response:
type: object
properties:
message:
type: string
code:
type: integer
RttMs:
type: object
properties:
rtt:
$ref: '#/components/schemas/Duration'
Status:
type: object
properties:
status:
type: string
SwarmAddress:
type: string
pattern: '^[A-Fa-f0-9]{64}$'
example: "36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f"
SwarmEncryptedReference:
type: string
pattern: '^[A-Fa-f0-9]{128}$'
example: "36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f2d2810619d29b5dbefd5d74abce25d58b81b251baddb9c3871cf0d6967deaae2"
SwarmReference:
oneOf:
- $ref: '#/components/schemas/SwarmAddress'
- $ref: '#/components/schemas/SwarmEncryptedReference'
TagName:
type: string
Uid:
type: integer
responses:
'400':
description: Bad request
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'404':
description: Not Found
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'500':
description: Internal Server Error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
openapi: 3.0.0
info:
version: 0.1.0
title: Bee Debug API
description: >-
A list of the currently provided debug interfaces to interact with the bee
node
security:
- {}
externalDocs:
description: Browse the documentation @ the Swarm Docs
url: 'https://docs.swarm.eth'
servers:
- url: 'http://{apiRoot}:{port}'
variables:
apiRoot:
default: 'localhost'
description: Base address of the local bee node debug API
port:
default: 6060
description: Service port provided in bee node config
paths:
'/addresses':
get:
summary: Get overlay and underlay addresses of the node
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Own node underlay and overlay addresses
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Addresses'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/chunks/{address}':
get:
summary: Check if chunk at address exists locally
tags:
- Swarm Debug Endpoints
parameters:
- in: path
name: address
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmAddress'
required: true
description: Swarm address of chunk
responses:
'200':
description: Chunk exists
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Response'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'404':
$ref: 'SwarmCommon.yaml#/components/responses/404'
default:
description: Default response
'/chunks-pin/{address}':
parameters:
- in: path
name: address
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmAddress'
required: true
description: Swarm address of chunk
post:
summary: Pin chunk with given address
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Pinning chunk with address
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Response'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'404':
$ref: 'SwarmCommon.yaml#/components/responses/404'
default:
description: Default response
delete:
summary: Unpin chunk with given address
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Unpinning chunk with address
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Response'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'404':
$ref: 'SwarmCommon.yaml#/components/responses/404'
default:
description: Default response
get:
summary: Get pinning status of chunk with given address
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Pinning state of chunk with address
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/PinningState'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/chunks-pin/':
get:
summary: Get list of pinned chunks
tags:
- Swarm Debug Endpoints
responses:
'200':
description: List of pinned chunks
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/BzzChunksPinned'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/connect/{multiAddress}':
post:
summary: Connect to address
tags:
- Swarm Debug Endpoints
parameters:
- in: path
allowReserved: true
name: multiAddress
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/MultiAddress'
required: true
description: Underlay address of peer
responses:
'200':
description: Returns overlay address of connected peer
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Address'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/health':
get:
summary: Get health of node
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Health State of node
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Status'
default:
description: Default response
'/peers':
get:
summary: Get a list of peers
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Returns overlay addresses of connected peers
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Peers'
default:
description: Default response
'/peers/{address}':
delete:
summary: Remove peer
tags:
- Swarm Debug Endpoints
parameters:
- in: path
name: address
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmAddress'
required: true
description: Swarm address of peer
responses:
'200':
description: Disconnected peer
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Response'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/pingpong/{peer-id}':
post:
summary: Try connection to node
tags:
- Swarm Debug Endpoints
parameters:
- in: path
name: peer-id
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/SwarmAddress'
required: true
description: Swarm address of peer
responses:
'200':
description: Returns round trip time for given peer
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/RttMs'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'404':
$ref: 'SwarmCommon.yaml#/components/responses/404'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/readiness':
get:
summary: Get readiness state of node
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Health State of node
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Status'
default:
description: Default response
'/tags':
post:
summary: 'Create Tag'
tags:
- Swarm Debug Endpoints
parameters:
- in: query
name: name
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/TagName'
required: true
description: Tagname
responses:
'200':
description: New Tag Info
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/NewTagResponse'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/tags/{uid}':
get:
summary: 'Get Tag information using Uid'
tags:
- Swarm Debug Endpoints
parameters:
- in: path
name: uid
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/Uid'
required: true
description: Uid
responses:
'200':
description: Tag info
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/NewTagResponse'
'400':
$ref: 'SwarmCommon.yaml#/components/responses/400'
'500':
$ref: 'SwarmCommon.yaml#/components/responses/500'
default:
description: Default response
'/topology':
get:
description: Get topology of known network
tags:
- Swarm Debug Endpoints
responses:
'200':
description: Swarm topology of the bee node
content:
application/json:
schema:
$ref: 'SwarmCommon.yaml#/components/schemas/BzzTopology'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment