Update system info API swagger

This commit is contained in:
Yang Luo
2023-03-26 10:18:44 +08:00
parent 117ee509cf
commit 32b05047dc
3 changed files with 128 additions and 43 deletions

View File

@ -21,9 +21,8 @@ import (
// GetSystemInfo // GetSystemInfo
// @Title GetSystemInfo // @Title GetSystemInfo
// @Tag System API // @Tag System API
// @Description get user's system info // @Description get system info like CPU and memory usage
// @Param id query string true "The id ( owner/name ) of the user" // @Success 200 {object} util.SystemInfo The Response object
// @Success 200 {object} object.SystemInfo The Response object
// @router /get-system-info [get] // @router /get-system-info [get]
func (c *ApiController) GetSystemInfo() { func (c *ApiController) GetSystemInfo() {
_, ok := c.RequireAdmin() _, ok := c.RequireAdmin()
@ -43,8 +42,8 @@ func (c *ApiController) GetSystemInfo() {
// GetVersionInfo // GetVersionInfo
// @Title GetVersionInfo // @Title GetVersionInfo
// @Tag System API // @Tag System API
// @Description get local git repo's latest release version info // @Description get version info like Casdoor release version and commit ID
// @Success 200 {string} local latest version hash of Casdoor // @Success 200 {object} util.VersionInfo The Response object
// @router /get-version-info [get] // @router /get-version-info [get]
func (c *ApiController) GetVersionInfo() { func (c *ApiController) GetVersionInfo() {
versionInfo, err := util.GetVersionInfo() versionInfo, err := util.GetVersionInfo()

View File

@ -2058,22 +2058,13 @@
"tags": [ "tags": [
"System API" "System API"
], ],
"description": "get user's system info", "description": "get system info like CPU and memory usage",
"operationId": "ApiController.GetSystemInfo", "operationId": "ApiController.GetSystemInfo",
"parameters": [
{
"in": "query",
"name": "id",
"description": "The id ( owner/name ) of the user",
"required": true,
"type": "string"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "The Response object", "description": "The Response object",
"schema": { "schema": {
"$ref": "#/definitions/object.SystemInfo" "$ref": "#/definitions/util.SystemInfo"
} }
} }
} }
@ -2323,11 +2314,14 @@
"tags": [ "tags": [
"System API" "System API"
], ],
"description": "get local git repo's latest release version info", "description": "get version info like Casdoor release version and commit ID",
"operationId": "ApiController.GetVersionInfo", "operationId": "ApiController.GetVersionInfo",
"responses": { "responses": {
"200": { "200": {
"description": "{string} local latest version hash of Casdoor" "description": "The Response object",
"schema": {
"$ref": "#/definitions/util.VersionInfo"
}
} }
} }
} }
@ -3494,6 +3488,23 @@
"operationId": "ApiController.UploadResource" "operationId": "ApiController.UploadResource"
} }
}, },
"/api/user": {
"get": {
"tags": [
"Account API"
],
"description": "return Laravel compatible user information according to OAuth 2.0",
"operationId": "ApiController.UserInfo2",
"responses": {
"200": {
"description": "The Response object",
"schema": {
"$ref": "#/definitions/LaravelResponse"
}
}
}
}
},
"/api/userinfo": { "/api/userinfo": {
"get": { "get": {
"tags": [ "tags": [
@ -3627,14 +3638,18 @@
} }
}, },
"definitions": { "definitions": {
"2268.0xc000528cf0.false": { "2306.0xc0000a7410.false": {
"title": "false", "title": "false",
"type": "object" "type": "object"
}, },
"2302.0xc000528d20.false": { "2340.0xc0000a7440.false": {
"title": "false", "title": "false",
"type": "object" "type": "object"
}, },
"LaravelResponse": {
"title": "LaravelResponse",
"type": "object"
},
"Response": { "Response": {
"title": "Response", "title": "Response",
"type": "object" "type": "object"
@ -3682,6 +3697,9 @@
"captchaType": { "captchaType": {
"type": "string" "type": "string"
}, },
"clientId": {
"type": "string"
},
"clientSecret": { "clientSecret": {
"type": "string" "type": "string"
}, },
@ -3758,10 +3776,10 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/2268.0xc000528cf0.false" "$ref": "#/definitions/2306.0xc0000a7410.false"
}, },
"data2": { "data2": {
"$ref": "#/definitions/2302.0xc000528d20.false" "$ref": "#/definitions/2340.0xc0000a7440.false"
}, },
"msg": { "msg": {
"type": "string" "type": "string"
@ -4830,10 +4848,6 @@
} }
} }
}, },
"object.SystemInfo": {
"title": "SystemInfo",
"type": "object"
},
"object.TableColumn": { "object.TableColumn": {
"title": "TableColumn", "title": "TableColumn",
"type": "object", "type": "object",
@ -5475,6 +5489,43 @@
"title": "CredentialCreationResponse", "title": "CredentialCreationResponse",
"type": "object" "type": "object"
}, },
"util.SystemInfo": {
"title": "SystemInfo",
"type": "object",
"properties": {
"cpuUsage": {
"type": "array",
"items": {
"type": "number",
"format": "double"
}
},
"memoryTotal": {
"type": "integer",
"format": "int64"
},
"memoryUsed": {
"type": "integer",
"format": "int64"
}
}
},
"util.VersionInfo": {
"title": "VersionInfo",
"type": "object",
"properties": {
"commitId": {
"type": "string"
},
"commitOffset": {
"type": "integer",
"format": "int64"
},
"version": {
"type": "string"
}
}
},
"webauthn.Credential": { "webauthn.Credential": {
"title": "Credential", "title": "Credential",
"type": "object" "type": "object"

View File

@ -1340,19 +1340,13 @@ paths:
get: get:
tags: tags:
- System API - System API
description: get user's system info description: get system info like CPU and memory usage
operationId: ApiController.GetSystemInfo operationId: ApiController.GetSystemInfo
parameters:
- in: query
name: id
description: The id ( owner/name ) of the user
required: true
type: string
responses: responses:
"200": "200":
description: The Response object description: The Response object
schema: schema:
$ref: '#/definitions/object.SystemInfo' $ref: '#/definitions/util.SystemInfo'
/api/get-token: /api/get-token:
get: get:
tags: tags:
@ -1515,11 +1509,13 @@ paths:
get: get:
tags: tags:
- System API - System API
description: get local git repo's latest release version info description: get version info like Casdoor release version and commit ID
operationId: ApiController.GetVersionInfo operationId: ApiController.GetVersionInfo
responses: responses:
"200": "200":
description: '{string} local latest version hash of Casdoor' description: The Response object
schema:
$ref: '#/definitions/util.VersionInfo'
/api/get-webhook: /api/get-webhook:
get: get:
tags: tags:
@ -2288,6 +2284,17 @@ paths:
tags: tags:
- Resource API - Resource API
operationId: ApiController.UploadResource operationId: ApiController.UploadResource
/api/user:
get:
tags:
- Account API
description: return Laravel compatible user information according to OAuth 2.0
operationId: ApiController.UserInfo2
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/LaravelResponse'
/api/userinfo: /api/userinfo:
get: get:
tags: tags:
@ -2374,12 +2381,15 @@ paths:
schema: schema:
$ref: '#/definitions/Response' $ref: '#/definitions/Response'
definitions: definitions:
2268.0xc000528cf0.false: 2306.0xc0000a7410.false:
title: "false" title: "false"
type: object type: object
2302.0xc000528d20.false: 2340.0xc0000a7440.false:
title: "false" title: "false"
type: object type: object
LaravelResponse:
title: LaravelResponse
type: object
Response: Response:
title: Response title: Response
type: object type: object
@ -2413,6 +2423,8 @@ definitions:
type: string type: string
captchaType: captchaType:
type: string type: string
clientId:
type: string
clientSecret: clientSecret:
type: string type: string
code: code:
@ -2464,9 +2476,9 @@ definitions:
type: object type: object
properties: properties:
data: data:
$ref: '#/definitions/2268.0xc000528cf0.false' $ref: '#/definitions/2306.0xc0000a7410.false'
data2: data2:
$ref: '#/definitions/2302.0xc000528d20.false' $ref: '#/definitions/2340.0xc0000a7440.false'
msg: msg:
type: string type: string
name: name:
@ -3183,9 +3195,6 @@ definitions:
type: string type: string
user: user:
type: string type: string
object.SystemInfo:
title: SystemInfo
type: object
object.TableColumn: object.TableColumn:
title: TableColumn title: TableColumn
type: object type: object
@ -3617,6 +3626,32 @@ definitions:
protocol.CredentialCreationResponse: protocol.CredentialCreationResponse:
title: CredentialCreationResponse title: CredentialCreationResponse
type: object type: object
util.SystemInfo:
title: SystemInfo
type: object
properties:
cpuUsage:
type: array
items:
type: number
format: double
memoryTotal:
type: integer
format: int64
memoryUsed:
type: integer
format: int64
util.VersionInfo:
title: VersionInfo
type: object
properties:
commitId:
type: string
commitOffset:
type: integer
format: int64
version:
type: string
webauthn.Credential: webauthn.Credential:
title: Credential title: Credential
type: object type: object