1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-18 15:59:16 +08:00

feat: Update swagger docs (#7710)

This commit is contained in:
2025-01-13 23:10:04 +08:00 committed by GitHub
parent 99f62b7230
commit 999e5a779a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 381 additions and 123 deletions

View File

@ -166,7 +166,7 @@ func (b *BaseApi) SearchBackupRecords(c *gin.Context) {
// @Summary Load backup records size // @Summary Load backup records size
// @Accept json // @Accept json
// @Param request body dto.RecordSearch true "request" // @Param request body dto.RecordSearch true "request"
// @Success 200 {array} dto.dto.BackupFile // @Success 200 {array} dto.BackupFile
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Security Timestamp // @Security Timestamp
// @Router /settings/backup/record/size [post] // @Router /settings/backup/record/size [post]
@ -215,7 +215,7 @@ func (b *BaseApi) SearchBackupRecordsByCronjob(c *gin.Context) {
// @Summary Load backup records size for cronjob // @Summary Load backup records size for cronjob
// @Accept json // @Accept json
// @Param request body dto.RecordSearchByCronjob true "request" // @Param request body dto.RecordSearchByCronjob true "request"
// @Success 200 {array} dto.dto.BackupFile // @Success 200 {array} dto.BackupFile
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Security Timestamp // @Security Timestamp
// @Router /settings/backup/record/size/bycronjob [post] // @Router /settings/backup/record/size/bycronjob [post]

View File

@ -10624,6 +10624,88 @@ const docTemplate = `{
} }
} }
}, },
"/settings/backup/record/size": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"Backup Account"
],
"summary": "Load backup records size",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.RecordSearch"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.BackupFile"
}
}
}
}
}
},
"/settings/backup/record/size/bycronjob": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"Backup Account"
],
"summary": "Load backup records size for cronjob",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.RecordSearchByCronjob"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.BackupFile"
}
}
}
}
}
},
"/settings/backup/recover": { "/settings/backup/recover": {
"post": { "post": {
"security": [ "security": [
@ -16684,6 +16766,20 @@ const docTemplate = `{
} }
} }
}, },
"dto.BackupFile": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"dto.BackupInfo": { "dto.BackupInfo": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -19448,7 +19544,10 @@ const docTemplate = `{
"zh", "zh",
"en", "en",
"tw", "tw",
"ru" "ja",
"ru",
"ms",
"pt-BR"
] ]
}, },
"name": { "name": {
@ -24834,7 +24933,48 @@ const docTemplate = `{
} }
} }
}, },
"response.AppDto": { "response.AppInstalledCheck": {
"type": "object",
"properties": {
"app": {
"type": "string"
},
"appInstallId": {
"type": "integer"
},
"containerName": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"httpPort": {
"type": "integer"
},
"httpsPort": {
"type": "integer"
},
"installPath": {
"type": "string"
},
"isExist": {
"type": "boolean"
},
"lastBackupAt": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"response.AppItem": {
"type": "object", "type": "object",
"properties": { "properties": {
"icon": { "icon": {
@ -24884,47 +25024,6 @@ const docTemplate = `{
} }
} }
}, },
"response.AppInstalledCheck": {
"type": "object",
"properties": {
"app": {
"type": "string"
},
"appInstallId": {
"type": "integer"
},
"containerName": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"httpPort": {
"type": "integer"
},
"httpsPort": {
"type": "integer"
},
"installPath": {
"type": "string"
},
"isExist": {
"type": "boolean"
},
"lastBackupAt": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"response.AppParam": { "response.AppParam": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -24965,7 +25064,7 @@ const docTemplate = `{
"items": { "items": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/response.AppDto" "$ref": "#/definitions/response.AppItem"
} }
}, },
"total": { "total": {
@ -25965,7 +26064,7 @@ const docTemplate = `{
}, },
"securityDefinitions": { "securityDefinitions": {
"ApiKeyAuth": { "ApiKeyAuth": {
"description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n` + "`" + `` + "`" + `` + "`" + `\neg:\ncurl -X GET \"http://localhost:4004/api/v1/resource\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n` + "`" + `` + "`" + `` + "`" + `\n- ` + "`" + `1Panel-Token` + "`" + ` is the key for the panel API Key.", "description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n` + "`" + `` + "`" + `` + "`" + `\neg:\ncurl -X GET \"http://localhost:4004/api/v1/dashboard/current\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n` + "`" + `` + "`" + `` + "`" + `\n- ` + "`" + `1Panel-Token` + "`" + ` is the key for the panel API Key.",
"type": "apiKey", "type": "apiKey",
"name": "1Panel-Token", "name": "1Panel-Token",
"in": "header" "in": "header"

View File

@ -10621,6 +10621,88 @@
} }
} }
}, },
"/settings/backup/record/size": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"Backup Account"
],
"summary": "Load backup records size",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.RecordSearch"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.BackupFile"
}
}
}
}
}
},
"/settings/backup/record/size/bycronjob": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"Backup Account"
],
"summary": "Load backup records size for cronjob",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.RecordSearchByCronjob"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.BackupFile"
}
}
}
}
}
},
"/settings/backup/recover": { "/settings/backup/recover": {
"post": { "post": {
"security": [ "security": [
@ -16681,6 +16763,20 @@
} }
} }
}, },
"dto.BackupFile": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"dto.BackupInfo": { "dto.BackupInfo": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -19445,7 +19541,10 @@
"zh", "zh",
"en", "en",
"tw", "tw",
"ru" "ja",
"ru",
"ms",
"pt-BR"
] ]
}, },
"name": { "name": {
@ -24831,7 +24930,48 @@
} }
} }
}, },
"response.AppDto": { "response.AppInstalledCheck": {
"type": "object",
"properties": {
"app": {
"type": "string"
},
"appInstallId": {
"type": "integer"
},
"containerName": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"httpPort": {
"type": "integer"
},
"httpsPort": {
"type": "integer"
},
"installPath": {
"type": "string"
},
"isExist": {
"type": "boolean"
},
"lastBackupAt": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"response.AppItem": {
"type": "object", "type": "object",
"properties": { "properties": {
"icon": { "icon": {
@ -24881,47 +25021,6 @@
} }
} }
}, },
"response.AppInstalledCheck": {
"type": "object",
"properties": {
"app": {
"type": "string"
},
"appInstallId": {
"type": "integer"
},
"containerName": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"httpPort": {
"type": "integer"
},
"httpsPort": {
"type": "integer"
},
"installPath": {
"type": "string"
},
"isExist": {
"type": "boolean"
},
"lastBackupAt": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"response.AppParam": { "response.AppParam": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -24962,7 +25061,7 @@
"items": { "items": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/response.AppDto" "$ref": "#/definitions/response.AppItem"
} }
}, },
"total": { "total": {
@ -25962,7 +26061,7 @@
}, },
"securityDefinitions": { "securityDefinitions": {
"ApiKeyAuth": { "ApiKeyAuth": {
"description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n```\neg:\ncurl -X GET \"http://localhost:4004/api/v1/resource\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n```\n- `1Panel-Token` is the key for the panel API Key.", "description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n```\neg:\ncurl -X GET \"http://localhost:4004/api/v1/dashboard/current\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n```\n- `1Panel-Token` is the key for the panel API Key.",
"type": "apiKey", "type": "apiKey",
"name": "1Panel-Token", "name": "1Panel-Token",
"in": "header" "in": "header"

View File

@ -145,6 +145,15 @@ definitions:
version: version:
type: string type: string
type: object type: object
dto.BackupFile:
properties:
id:
type: integer
name:
type: string
size:
type: integer
type: object
dto.BackupInfo: dto.BackupInfo:
properties: properties:
backupPath: backupPath:
@ -1999,7 +2008,10 @@ definitions:
- zh - zh
- en - en
- tw - tw
- ja
- ru - ru
- ms
- pt-BR
type: string type: string
name: name:
type: string type: string
@ -5627,7 +5639,34 @@ definitions:
version: version:
type: string type: string
type: object type: object
response.AppDto: response.AppInstalledCheck:
properties:
app:
type: string
appInstallId:
type: integer
containerName:
type: string
createdAt:
type: string
httpPort:
type: integer
httpsPort:
type: integer
installPath:
type: string
isExist:
type: boolean
lastBackupAt:
type: string
name:
type: string
status:
type: string
version:
type: string
type: object
response.AppItem:
properties: properties:
icon: icon:
type: string type: string
@ -5660,33 +5699,6 @@ definitions:
type: string type: string
type: array type: array
type: object type: object
response.AppInstalledCheck:
properties:
app:
type: string
appInstallId:
type: integer
containerName:
type: string
createdAt:
type: string
httpPort:
type: integer
httpsPort:
type: integer
installPath:
type: string
isExist:
type: boolean
lastBackupAt:
type: string
name:
type: string
status:
type: string
version:
type: string
type: object
response.AppParam: response.AppParam:
properties: properties:
edit: edit:
@ -5714,7 +5726,7 @@ definitions:
properties: properties:
items: items:
items: items:
$ref: '#/definitions/response.AppDto' $ref: '#/definitions/response.AppItem'
type: array type: array
total: total:
type: integer type: integer
@ -12765,6 +12777,54 @@ paths:
summary: Page backup records by cronjob summary: Page backup records by cronjob
tags: tags:
- Backup Account - Backup Account
/settings/backup/record/size:
post:
consumes:
- application/json
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.RecordSearch'
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.BackupFile'
type: array
security:
- ApiKeyAuth: []
- Timestamp: []
summary: Load backup records size
tags:
- Backup Account
/settings/backup/record/size/bycronjob:
post:
consumes:
- application/json
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.RecordSearchByCronjob'
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.BackupFile'
type: array
security:
- ApiKeyAuth: []
- Timestamp: []
summary: Load backup records size for cronjob
tags:
- Backup Account
/settings/backup/recover: /settings/backup/recover:
post: post:
consumes: consumes:
@ -16303,7 +16363,7 @@ securityDefinitions:
Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp). Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).
``` ```
eg: eg:
curl -X GET "http://localhost:4004/api/v1/resource" \ curl -X GET "http://localhost:4004/api/v1/dashboard/current" \
-H "1Panel-Token: <1panel_token>" \ -H "1Panel-Token: <1panel_token>" \
-H "1Panel-Timestamp: <current_unix_timestamp>" -H "1Panel-Timestamp: <current_unix_timestamp>"
``` ```

View File

@ -23,7 +23,7 @@ import (
// @description Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp). // @description Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).
// @description ``` // @description ```
// @description eg: // @description eg:
// @description curl -X GET "http://localhost:4004/api/v1/resource" \ // @description curl -X GET "http://localhost:4004/api/v1/dashboard/current" \
// @description -H "1Panel-Token: <1panel_token>" \ // @description -H "1Panel-Token: <1panel_token>" \
// @description -H "1Panel-Timestamp: <current_unix_timestamp>" // @description -H "1Panel-Timestamp: <current_unix_timestamp>"
// @description ``` // @description ```