Skip to content

Commit

Permalink
added swagger spec
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnguyen22 committed Jun 17, 2019
1 parent a874ca3 commit 12429a2
Show file tree
Hide file tree
Showing 5 changed files with 208 additions and 61 deletions.
28 changes: 13 additions & 15 deletions doc/config/chains.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
[
{
"blockchain": {
"name": "ethereum",
"netid": "1"
},
"port": "8545",
"medium": "rpc"
{
"blockchain": {
"name": "ethereum",
"netid": "1"
},
{
"blockchain": {
"name": "bitcoin",
"netid": "1"
},
"port": "8333",
"medium": "rpc"
}
"url": "localhost:8545"
},
{
"blockchain": {
"name": "bitcoin",
"netid": "1"
},
"url": "localhost:8333"
}
]
8 changes: 4 additions & 4 deletions doc/config/developer_whitelist.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
"DEVID1",
"DEVID2",
"DEVID3",
"DEVID4"
"DEVID1",
"DEVID2",
"DEVID3",
"DEVID4"
]
38 changes: 0 additions & 38 deletions doc/config/peers.json

This file was deleted.

8 changes: 4 additions & 4 deletions doc/config/service_whitelist.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
"GID1",
"GID2",
"GID3",
"GID4"
"GID1",
"GID2",
"GID3",
"GID4"
]
187 changes: 187 additions & 0 deletions doc/swagger_mvp-1.7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
swagger: "2.0"
info:
description: "This simple API guide is an easy to use reference for Pocket Core (MVP). Pocket Core's API may be designed differently then API's you have seen before. It is a blend between a RESTful and a JSON RPC architecture. Using the guide below, it should be very apparent how to access the API from each endpoint"
version: "MVP 1.7"
title: "Pocket Network MVP"
contact:
email: "[email protected]"
license:
name: "MIT"
url: "https://opensource.org/licenses/MIT"
host: "service.pokt.network"
basePath: "/v1"
tags:
- name: "relay"
description: "Read and write request to a non-native blockchain"
- name: "dispatch"
description: "Retrieve a list of service nodes from the dispatcher"
schemes:
- "https"
- "http"
paths:
/relay:
post:
tags:
- "relay"
summary: "Read or write request to a non-native blockchain"
description: ""
operationId: "Relay()"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Relay object to be executed"
required: true
schema:
$ref: "#/definitions/Relay"
responses:
400:
description: "Request not properly formatted (couldn't be decoded)"
401:
description: "Invalid credentials"
500:
description: "Internal error"

/dispatch:
post:
tags:
- "dispatch"
summary: "Retrieve a list of service nodes from the dispatcher"
description: "Retrieve a list of avaliable service nodes for a particullar non-native blockchain"
operationId: "Dispatch()"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Dispatch query"
required: true
schema:
$ref: "#/definitions/Dispatch"
responses:
400:
description: "Request not properly formatted (couldn't be decoded)"
401:
description: "Invalid credentials"
500:
description: "Internal error"

/report:
post:
tags:
- "report"
summary: "Report a service node"
description: "Make a report about a particular service node"
operationId: "Report()"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Dispatch query"
required: true
schema:
$ref: "#/definitions/Report"
responses:
400:
description: "Request not properly formatted (couldn't be decoded)"


definitions:
Header:
type: "object"
properties:
header-key:
type: "string"
example: "header-value"
description: "can be any http header key value pair"
Headers:
type: "array"
items:
$ref: "#/definitions/Header"

Relay:
type: "object"
required:
- "blockchain"
- "netid"
- "DevID"
properties:
blockchain:
type: "string"
example: "XTZ"
netid:
type: "integer"
example: "1"
method:
type: "string"
example: "DELETE"
path:
type: "string"
example: "/network/connections/<peer_id>?[wait]"
headers:
$ref: "#/definitions/Headers"
data:
type: "string"
example: "<payload if needed for api call>"
devid:
type: "string"
example: "devid1"
description: "https://pocketnetwork.typeform.com/to/ZX6PLl"

Blockchain:
type: "object"
required:
- "name"
- "netid"
properties:
name:
type: "string"
example: "ETH"
description: "Official ticker name"
netid:
type: "string"
example: "4"
description: "Network identifier"

Dispatch:
type: "object"
required:
- "blockchains"
- "DevID"
properties:
blockchains:
type: "array"
items:
$ref: "#/definitions/Blockchain"
devid:
type: "string"
example: "devid1"
description: "https://pocketnetwork.typeform.com/to/ZX6PLl"

Report:
type: "object"
required:
- "ip"
- "message"
properties:
ip:
type: "string"
example: "8.8.8.8"
description: "the ip address of the service node"
message:
type: "string"
example: "this service node is unavailable"
description: "the message payload included in the report"


externalDocs:
description: "Find out more about Pocket Network"
url: "https://pokt.network"

0 comments on commit 12429a2

Please sign in to comment.