mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2026-05-20 11:01:11 +02:00
docs: add godocs comments to all routes
* disable serving docs by default
This commit is contained in:
190
docs/docs.go
190
docs/docs.go
@@ -25,7 +25,7 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/": {
|
||||
"/account/create": {
|
||||
"post": {
|
||||
"description": "Create a new custodial account.",
|
||||
"consumes": [
|
||||
@@ -34,17 +34,201 @@ const docTemplate = `{
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"summary": "Create a new custodial account.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/account/status/{address}": {
|
||||
"get": {
|
||||
"description": "Return network balance and nonce.",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"network"
|
||||
],
|
||||
"summary": "Get an address's network balance and nonce.",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Account Public Key",
|
||||
"name": "address",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sign/transfer": {
|
||||
"post": {
|
||||
"description": "Sign and dispatch a transfer request.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"network"
|
||||
],
|
||||
"summary": "Sign and dispatch transfer request.",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Sign Transfer Request",
|
||||
"name": "signTransferRequest",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "integer"
|
||||
},
|
||||
"from": {
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"type": "string"
|
||||
},
|
||||
"voucherAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/track/{trackingId}": {
|
||||
"get": {
|
||||
"description": "Track an OTX (Origin transaction) status.",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"track"
|
||||
],
|
||||
"summary": "Track an OTX (Origin transaction) status.",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tracking Id",
|
||||
"name": "trackingId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"api.ErrResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"ok": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api.H": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"api.OkResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"result": {
|
||||
"$ref": "#/definitions/api.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
"basePath": "/api",
|
||||
"paths": {
|
||||
"/": {
|
||||
"/account/create": {
|
||||
"post": {
|
||||
"description": "Create a new custodial account.",
|
||||
"consumes": [
|
||||
@@ -26,17 +26,201 @@
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"summary": "Create a new custodial account.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/account/status/{address}": {
|
||||
"get": {
|
||||
"description": "Return network balance and nonce.",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"network"
|
||||
],
|
||||
"summary": "Get an address's network balance and nonce.",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Account Public Key",
|
||||
"name": "address",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sign/transfer": {
|
||||
"post": {
|
||||
"description": "Sign and dispatch a transfer request.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"network"
|
||||
],
|
||||
"summary": "Sign and dispatch transfer request.",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Sign Transfer Request",
|
||||
"name": "signTransferRequest",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "integer"
|
||||
},
|
||||
"from": {
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"type": "string"
|
||||
},
|
||||
"voucherAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/track/{trackingId}": {
|
||||
"get": {
|
||||
"description": "Track an OTX (Origin transaction) status.",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"track"
|
||||
],
|
||||
"summary": "Track an OTX (Origin transaction) status.",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tracking Id",
|
||||
"name": "trackingId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.OkResp"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/api.ErrResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"api.ErrResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"ok": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api.H": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"api.OkResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"result": {
|
||||
"$ref": "#/definitions/api.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,22 @@
|
||||
basePath: /api
|
||||
definitions:
|
||||
api.ErrResp:
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
ok:
|
||||
type: boolean
|
||||
type: object
|
||||
api.H:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
api.OkResp:
|
||||
properties:
|
||||
ok:
|
||||
type: boolean
|
||||
result:
|
||||
$ref: '#/definitions/api.H'
|
||||
type: object
|
||||
info:
|
||||
contact:
|
||||
email: devops@grassecon.org
|
||||
@@ -12,7 +30,7 @@ info:
|
||||
title: CIC Custodial API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/:
|
||||
/account/create:
|
||||
post:
|
||||
consumes:
|
||||
- '*/*'
|
||||
@@ -23,7 +41,109 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
$ref: '#/definitions/api.OkResp'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api.ErrResp'
|
||||
summary: Create a new custodial account.
|
||||
tags:
|
||||
- account
|
||||
/account/status/{address}:
|
||||
get:
|
||||
consumes:
|
||||
- '*/*'
|
||||
description: Return network balance and nonce.
|
||||
parameters:
|
||||
- description: Account Public Key
|
||||
in: path
|
||||
name: address
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/api.OkResp'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api.ErrResp'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api.ErrResp'
|
||||
summary: Get an address's network balance and nonce.
|
||||
tags:
|
||||
- network
|
||||
/sign/transfer:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Sign and dispatch a transfer request.
|
||||
parameters:
|
||||
- description: Sign Transfer Request
|
||||
in: body
|
||||
name: signTransferRequest
|
||||
required: true
|
||||
schema:
|
||||
properties:
|
||||
amount:
|
||||
type: integer
|
||||
from:
|
||||
type: string
|
||||
to:
|
||||
type: string
|
||||
voucherAddress:
|
||||
type: string
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/api.OkResp'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api.ErrResp'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api.ErrResp'
|
||||
summary: Sign and dispatch transfer request.
|
||||
tags:
|
||||
- network
|
||||
/track/{trackingId}:
|
||||
get:
|
||||
consumes:
|
||||
- '*/*'
|
||||
description: Track an OTX (Origin transaction) status.
|
||||
parameters:
|
||||
- description: Tracking Id
|
||||
in: path
|
||||
name: trackingId
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/api.OkResp'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api.ErrResp'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api.ErrResp'
|
||||
summary: Track an OTX (Origin transaction) status.
|
||||
tags:
|
||||
- track
|
||||
swagger: "2.0"
|
||||
|
||||
Reference in New Issue
Block a user