Skip to content

Commit

Permalink
feat: 修改接口文档
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu committed Nov 24, 2023
1 parent 6472d9d commit 4fa86ca
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 7 deletions.
8 changes: 4 additions & 4 deletions backend/app/api/v1/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (b *BaseApi) LoadDeviceConf(c *gin.Context) {
// @Success 200
// @Security ApiKeyAuth
// @Router /toolbox/device/update/byconf [post]
func (b *BaseApi) UpdateDevicByFile(c *gin.Context) {
func (b *BaseApi) UpdateDeviceByFile(c *gin.Context) {
var req dto.UpdateByNameAndFile
if err := helper.CheckBindAndValidate(&req, c); err != nil {
return
Expand Down Expand Up @@ -138,7 +138,7 @@ func (b *BaseApi) UpdateDeviceHost(c *gin.Context) {
// @Success 200
// @Security ApiKeyAuth
// @Router /toolbox/device/update/passwd [post]
func (b *BaseApi) UpdateDevicPasswd(c *gin.Context) {
func (b *BaseApi) UpdateDevicePasswd(c *gin.Context) {
var req dto.ChangePasswd
if err := helper.CheckBindAndValidate(&req, c); err != nil {
return
Expand Down Expand Up @@ -167,8 +167,8 @@ func (b *BaseApi) UpdateDevicPasswd(c *gin.Context) {
// @Success 200
// @Security ApiKeyAuth
// @Router /toolbox/device/update/swap [post]
// @x-panel-log {"bodyKeys":["opreate","path"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[opreate] 主机 swap [path]","formatEN":"[opreate] device swap [path]"}
func (b *BaseApi) UpdateDevicSwap(c *gin.Context) {
// @x-panel-log {"bodyKeys":["operate","path"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operate] 主机 swap [path]","formatEN":"[operate] device swap [path]"}
func (b *BaseApi) UpdateDeviceSwap(c *gin.Context) {
var req dto.SwapHelper
if err := helper.CheckBindAndValidate(&req, c); err != nil {
return
Expand Down
6 changes: 3 additions & 3 deletions backend/router/ro_toolbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func (s *ToolboxRouter) InitToolboxRouter(Router *gin.RouterGroup) {
toolboxRouter.GET("/device/zone/options", baseApi.LoadTimeOption)
toolboxRouter.POST("/device/update/conf", baseApi.UpdateDeviceConf)
toolboxRouter.POST("/device/update/host", baseApi.UpdateDeviceHost)
toolboxRouter.POST("/device/update/passwd", baseApi.UpdateDevicPasswd)
toolboxRouter.POST("/device/update/swap", baseApi.UpdateDevicSwap)
toolboxRouter.POST("/device/update/byconf", baseApi.UpdateDevicByFile)
toolboxRouter.POST("/device/update/passwd", baseApi.UpdateDevicePasswd)
toolboxRouter.POST("/device/update/swap", baseApi.UpdateDeviceSwap)
toolboxRouter.POST("/device/update/byconf", baseApi.UpdateDeviceByFile)
toolboxRouter.POST("/device/check/dns", baseApi.CheckDNS)
toolboxRouter.POST("/device/conf", baseApi.LoadDeviceConf)

Expand Down
87 changes: 87 additions & 0 deletions cmd/server/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 87 additions & 0 deletions cmd/server/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -10324,6 +10324,49 @@
}
}
},
"/toolbox/device/update/swap": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "修改系统 Swap",
"consumes": [
"application/json"
],
"tags": [
"Device"
],
"summary": "Update device swap",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.SwapHelper"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"operate",
"path"
],
"formatEN": "[operate] device swap [path]",
"formatZH": "[operate] 主机 swap [path]",
"paramKeys": []
}
}
},
"/toolbox/device/zone/options": {
"get": {
"security": [
Expand Down Expand Up @@ -13741,6 +13784,9 @@
"openStdin": {
"type": "boolean"
},
"privileged": {
"type": "boolean"
},
"publishAllPorts": {
"type": "boolean"
},
Expand Down Expand Up @@ -14512,6 +14558,21 @@
"ntp": {
"type": "string"
},
"swapDetails": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SwapHelper"
}
},
"swapMemoryAvailable": {
"type": "integer"
},
"swapMemoryTotal": {
"type": "integer"
},
"swapMemoryUsed": {
"type": "integer"
},
"timeZone": {
"type": "string"
},
Expand Down Expand Up @@ -16646,6 +16707,32 @@
}
}
},
"dto.SwapHelper": {
"type": "object",
"required": [
"operate",
"path"
],
"properties": {
"operate": {
"type": "string",
"enum": [
"create",
"delete",
"update"
]
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
},
"used": {
"type": "string"
}
}
},
"dto.TreeChild": {
"type": "object",
"properties": {
Expand Down
58 changes: 58 additions & 0 deletions cmd/server/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ definitions:
type: string
openStdin:
type: boolean
privileged:
type: boolean
publishAllPorts:
type: boolean
restartPolicy:
Expand Down Expand Up @@ -954,6 +956,16 @@ definitions:
type: string
ntp:
type: string
swapDetails:
items:
$ref: '#/definitions/dto.SwapHelper'
type: array
swapMemoryAvailable:
type: integer
swapMemoryTotal:
type: integer
swapMemoryUsed:
type: integer
timeZone:
type: string
user:
Expand Down Expand Up @@ -2395,6 +2407,24 @@ definitions:
required:
- id
type: object
dto.SwapHelper:
properties:
operate:
enum:
- create
- delete
- update
type: string
path:
type: string
size:
type: integer
used:
type: string
required:
- operate
- path
type: object
dto.TreeChild:
properties:
id:
Expand Down Expand Up @@ -11107,6 +11137,34 @@ paths:
summary: Update device passwd
tags:
- Device
/toolbox/device/update/swap:
post:
consumes:
- application/json
description: 修改系统 Swap
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.SwapHelper'
responses:
"200":
description: OK
security:
- ApiKeyAuth: []
summary: Update device swap
tags:
- Device
x-panel-log:
BeforeFunctions: []
bodyKeys:
- operate
- path
formatEN: '[operate] device swap [path]'
formatZH: '[operate] 主机 swap [path]'
paramKeys: []
/toolbox/device/zone/options:
get:
consumes:
Expand Down

0 comments on commit 4fa86ca

Please sign in to comment.