mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: add go backend API docs
Signed-off-by: Kininaru <shiftregister233@outlook.com>
This commit is contained in:
@ -20,6 +20,11 @@ import (
|
||||
"github.com/casdoor/casdoor/object"
|
||||
)
|
||||
|
||||
// @Title GetTokens
|
||||
// @Description get tokens
|
||||
// @Param owner query string true "The owner of tokens"
|
||||
// @Success 200 {array} object.Token The Response object
|
||||
// @router /get-tokens [get]
|
||||
func (c *ApiController) GetTokens() {
|
||||
owner := c.Input().Get("owner")
|
||||
|
||||
@ -27,6 +32,11 @@ func (c *ApiController) GetTokens() {
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title GetToken
|
||||
// @Description get token
|
||||
// @Param id query string true "The id of token"
|
||||
// @Success 200 {object} object.Token The Response object
|
||||
// @router /get-token [get]
|
||||
func (c *ApiController) GetToken() {
|
||||
id := c.Input().Get("id")
|
||||
|
||||
@ -34,6 +44,12 @@ func (c *ApiController) GetToken() {
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title UpdateToken
|
||||
// @Description update token
|
||||
// @Param id query string true "The id of token"
|
||||
// @Param body body object.Token true "Details of the token"
|
||||
// @Success 200 {object} controllers.Response The Response object
|
||||
// @router /update-token [post]
|
||||
func (c *ApiController) UpdateToken() {
|
||||
id := c.Input().Get("id")
|
||||
|
||||
@ -47,6 +63,11 @@ func (c *ApiController) UpdateToken() {
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title AddToken
|
||||
// @Description add token
|
||||
// @Param body body object.Token true "Details of the token"
|
||||
// @Success 200 {object} controllers.Response The Response object
|
||||
// @router /add-token [post]
|
||||
func (c *ApiController) AddToken() {
|
||||
var token object.Token
|
||||
err := json.Unmarshal(c.Ctx.Input.RequestBody, &token)
|
||||
@ -58,6 +79,11 @@ func (c *ApiController) AddToken() {
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title DeleteToken
|
||||
// @Description delete token
|
||||
// @Param body body object.Token true "Details of the token"
|
||||
// @Success 200 {object} controllers.Response The Response object
|
||||
// @router /delete-token [post]
|
||||
func (c *ApiController) DeleteToken() {
|
||||
var token object.Token
|
||||
err := json.Unmarshal(c.Ctx.Input.RequestBody, &token)
|
||||
@ -69,6 +95,14 @@ func (c *ApiController) DeleteToken() {
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title GetOAuthToken
|
||||
// @Description get oAuth token
|
||||
// @Param grant_type query string true "oAuth grant type"
|
||||
// @Param client_id query string true "oAuth client id"
|
||||
// @Param client_secret query string true "oAuth client secret"
|
||||
// @Param code query string true "oAuth code"
|
||||
// @Success 200 {object} object.TokenWrapper The Response object
|
||||
// @router /login/oauth/access_token [post]
|
||||
func (c *ApiController) GetOAuthToken() {
|
||||
grantType := c.Input().Get("grant_type")
|
||||
clientId := c.Input().Get("client_id")
|
||||
|
Reference in New Issue
Block a user