update api docs

This commit is contained in:
nikk gitanes
2024-04-14 03:52:41 +03:00
parent 3cd9f5ef90
commit 3a037c88d8
8 changed files with 44 additions and 41 deletions

View File

@@ -143,7 +143,7 @@ const docTemplate = `{
"summary": "Get HTML of magnet links", "summary": "Get HTML of magnet links",
"responses": { "responses": {
"200": { "200": {
"description": "Magnet links" "description": "HTML with Magnet links"
} }
} }
} }
@@ -352,7 +352,7 @@ const docTemplate = `{
"summary": "Get / Set server settings", "summary": "Get / Set server settings",
"parameters": [ "parameters": [
{ {
"description": "Settings request", "description": "Settings request. Available params for action: get, set, def",
"name": "request", "name": "request",
"in": "body", "in": "body",
"required": true, "required": true,
@@ -363,7 +363,7 @@ const docTemplate = `{
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Depends on what action has been asked", "description": "Settings JSON or nothing. Depends on what action has been asked.",
"schema": { "schema": {
"$ref": "#/definitions/settings.BTSets" "$ref": "#/definitions/settings.BTSets"
} }
@@ -387,17 +387,17 @@ const docTemplate = `{
}, },
"/stat": { "/stat": {
"get": { "get": {
"description": "Stat server.", "description": "Show server and torrents statistics.",
"produces": [ "produces": [
"text/plain" "text/plain"
], ],
"tags": [ "tags": [
"Pages" "Pages"
], ],
"summary": "Stat server", "summary": "TorrServer Statistics",
"responses": { "responses": {
"200": { "200": {
"description": "Stats" "description": "TorrServer statistics"
} }
} }
} }
@@ -500,7 +500,7 @@ const docTemplate = `{
"tags": [ "tags": [
"API" "API"
], ],
"summary": "Only one file support", "summary": "Add .torrent file",
"parameters": [ "parameters": [
{ {
"type": "file", "type": "file",
@@ -552,7 +552,7 @@ const docTemplate = `{
}, },
"/torrents": { "/torrents": {
"post": { "post": {
"description": "Allow to add, get or set torrents to server. The action depends of what has been asked.", "description": "Allow to list, add, remove, get, set, drop, wipe torrents on server. The action depends of what has been asked.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@@ -565,7 +565,7 @@ const docTemplate = `{
"summary": "Handle torrents informations", "summary": "Handle torrents informations",
"parameters": [ "parameters": [
{ {
"description": "Torrent request", "description": "Torrent request. Available params for action: add, get, set, rem, list, drop, wipe. link required for add, hash required for get, set, rem, drop.",
"name": "request", "name": "request",
"in": "body", "in": "body",
"required": true, "required": true,
@@ -596,7 +596,7 @@ const docTemplate = `{
"summary": "Set / List / Remove viewed torrents", "summary": "Set / List / Remove viewed torrents",
"parameters": [ "parameters": [
{ {
"description": "Viewed torrent request", "description": "Viewed torrent request. Available params for action: set, rem, list",
"name": "request", "name": "request",
"in": "body", "in": "body",
"required": true, "required": true,

View File

@@ -136,7 +136,7 @@
"summary": "Get HTML of magnet links", "summary": "Get HTML of magnet links",
"responses": { "responses": {
"200": { "200": {
"description": "Magnet links" "description": "HTML with Magnet links"
} }
} }
} }
@@ -345,7 +345,7 @@
"summary": "Get / Set server settings", "summary": "Get / Set server settings",
"parameters": [ "parameters": [
{ {
"description": "Settings request", "description": "Settings request. Available params for action: get, set, def",
"name": "request", "name": "request",
"in": "body", "in": "body",
"required": true, "required": true,
@@ -356,7 +356,7 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Depends on what action has been asked", "description": "Settings JSON or nothing. Depends on what action has been asked.",
"schema": { "schema": {
"$ref": "#/definitions/settings.BTSets" "$ref": "#/definitions/settings.BTSets"
} }
@@ -380,17 +380,17 @@
}, },
"/stat": { "/stat": {
"get": { "get": {
"description": "Stat server.", "description": "Show server and torrents statistics.",
"produces": [ "produces": [
"text/plain" "text/plain"
], ],
"tags": [ "tags": [
"Pages" "Pages"
], ],
"summary": "Stat server", "summary": "TorrServer Statistics",
"responses": { "responses": {
"200": { "200": {
"description": "Stats" "description": "TorrServer statistics"
} }
} }
} }
@@ -493,7 +493,7 @@
"tags": [ "tags": [
"API" "API"
], ],
"summary": "Only one file support", "summary": "Add .torrent file",
"parameters": [ "parameters": [
{ {
"type": "file", "type": "file",
@@ -545,7 +545,7 @@
}, },
"/torrents": { "/torrents": {
"post": { "post": {
"description": "Allow to add, get or set torrents to server. The action depends of what has been asked.", "description": "Allow to list, add, remove, get, set, drop, wipe torrents on server. The action depends of what has been asked.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@@ -558,7 +558,7 @@
"summary": "Handle torrents informations", "summary": "Handle torrents informations",
"parameters": [ "parameters": [
{ {
"description": "Torrent request", "description": "Torrent request. Available params for action: add, get, set, rem, list, drop, wipe. link required for add, hash required for get, set, rem, drop.",
"name": "request", "name": "request",
"in": "body", "in": "body",
"required": true, "required": true,
@@ -589,7 +589,7 @@
"summary": "Set / List / Remove viewed torrents", "summary": "Set / List / Remove viewed torrents",
"parameters": [ "parameters": [
{ {
"description": "Viewed torrent request", "description": "Viewed torrent request. Available params for action: set, rem, list",
"name": "request", "name": "request",
"in": "body", "in": "body",
"required": true, "required": true,

View File

@@ -393,7 +393,7 @@ paths:
- text/html - text/html
responses: responses:
"200": "200":
description: Magnet links description: HTML with Magnet links
summary: Get HTML of magnet links summary: Get HTML of magnet links
tags: tags:
- Pages - Pages
@@ -527,7 +527,7 @@ paths:
- application/json - application/json
description: Allow to get or set server settings. description: Allow to get or set server settings.
parameters: parameters:
- description: Settings request - description: 'Settings request. Available params for action: get, set, def'
in: body in: body
name: request name: request
required: true required: true
@@ -537,7 +537,7 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: Depends on what action has been asked description: Settings JSON or nothing. Depends on what action has been asked.
schema: schema:
$ref: '#/definitions/settings.BTSets' $ref: '#/definitions/settings.BTSets'
summary: Get / Set server settings summary: Get / Set server settings
@@ -554,13 +554,13 @@ paths:
- API - API
/stat: /stat:
get: get:
description: Stat server. description: Show server and torrents statistics.
produces: produces:
- text/plain - text/plain
responses: responses:
"200": "200":
description: Stats description: TorrServer statistics
summary: Stat server summary: TorrServer Statistics
tags: tags:
- Pages - Pages
/stream: /stream:
@@ -658,17 +658,19 @@ paths:
description: Torrent status description: Torrent status
schema: schema:
$ref: '#/definitions/state.TorrentStatus' $ref: '#/definitions/state.TorrentStatus'
summary: Only one file support summary: Add .torrent file
tags: tags:
- API - API
/torrents: /torrents:
post: post:
consumes: consumes:
- application/json - application/json
description: Allow to add, get or set torrents to server. The action depends description: Allow to list, add, remove, get, set, drop, wipe torrents on server.
of what has been asked. The action depends of what has been asked.
parameters: parameters:
- description: Torrent request - description: 'Torrent request. Available params for action: add, get, set,
rem, list, drop, wipe. link required for add, hash required for get, set,
rem, drop.'
in: body in: body
name: request name: request
required: true required: true
@@ -688,7 +690,8 @@ paths:
- application/json - application/json
description: Allow to set, list or remove viewed torrents from server. description: Allow to set, list or remove viewed torrents from server.
parameters: parameters:
- description: Viewed torrent request - description: 'Viewed torrent request. Available params for action: set, rem,
list'
in: body in: body
name: request name: request
required: true required: true

View File

@@ -27,11 +27,11 @@ type setsReqJS struct {
// //
// @Tags API // @Tags API
// //
// @Param request body setsReqJS true "Settings request" // @Param request body setsReqJS true "Settings request. Available params for action: get, set, def"
// //
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} sets.BTSets "Depends on what action has been asked" // @Success 200 {object} sets.BTSets "Settings JSON or nothing. Depends on what action has been asked."
// @Router /settings [post] // @Router /settings [post]
func settings(c *gin.Context) { func settings(c *gin.Context) {
var req setsReqJS var req setsReqJS

View File

@@ -30,11 +30,11 @@ type torrReqJS struct {
// torrents godoc // torrents godoc
// //
// @Summary Handle torrents informations // @Summary Handle torrents informations
// @Description Allow to add, get or set torrents to server. The action depends of what has been asked. // @Description Allow to list, add, remove, get, set, drop, wipe torrents on server. The action depends of what has been asked.
// //
// @Tags API // @Tags API
// //
// @Param request body torrReqJS true "Torrent request" // @Param request body torrReqJS true "Torrent request. Available params for action: add, get, set, rem, list, drop, wipe. link required for add, hash required for get, set, rem, drop."
// //
// @Accept json // @Accept json
// @Produce json // @Produce json

View File

@@ -12,7 +12,7 @@ import (
// torrentUpload godoc // torrentUpload godoc
// //
// @Summary Only one file support // @Summary Add .torrent file
// @Description Only one file support. // @Description Only one file support.
// //
// @Tags API // @Tags API

View File

@@ -25,7 +25,7 @@ type viewedReqJS struct {
// //
// @Tags API // @Tags API
// //
// @Param request body viewedReqJS true "Viewed torrent request" // @Param request body viewedReqJS true "Viewed torrent request. Available params for action: set, rem, list"
// //
// @Accept json // @Accept json
// @Produce json // @Produce json

View File

@@ -31,13 +31,13 @@ func SetupRoute(route gin.IRouter) {
// stat godoc // stat godoc
// //
// @Summary Stat server // @Summary TorrServer Statistics
// @Description Stat server. // @Description Show server and torrents statistics.
// //
// @Tags Pages // @Tags Pages
// //
// @Produce text/plain // @Produce text/plain
// @Success 200 "Stats" // @Success 200 "TorrServer statistics"
// @Router /stat [get] // @Router /stat [get]
func statPage(c *gin.Context) { func statPage(c *gin.Context) {
torr.WriteStatus(c.Writer) torr.WriteStatus(c.Writer)
@@ -52,7 +52,7 @@ func statPage(c *gin.Context) {
// @Tags Pages // @Tags Pages
// //
// @Produce text/html // @Produce text/html
// @Success 200 "Magnet links" // @Success 200 "HTML with Magnet links"
// @Router /magnets [get] // @Router /magnets [get]
func getTorrents(c *gin.Context) { func getTorrents(c *gin.Context) {
list := settings.ListTorrent() list := settings.ListTorrent()