feat: add go backend API docs

Signed-off-by: Kininaru <shiftregister233@outlook.com>
This commit is contained in:
Kininaru
2021-03-29 23:40:25 +08:00
parent 5c49693bc0
commit 3a13b8e73c
27 changed files with 2578 additions and 7 deletions

View File

@ -20,6 +20,11 @@ import (
"github.com/casdoor/casdoor/object"
)
// @Title GetOrganizations
// @Description get organizations
// @Param owner query string true "owner"
// @Success 200 {array} object.Organization The Response object
// @router /get-organizations [get]
func (c *ApiController) GetOrganizations() {
owner := c.Input().Get("owner")
@ -27,6 +32,11 @@ func (c *ApiController) GetOrganizations() {
c.ServeJSON()
}
// @Title GetOrganization
// @Description get organization
// @Param id query string true "organization id"
// @Success 200 {object} object.Organization The Response object
// @router /get-organization [get]
func (c *ApiController) GetOrganization() {
id := c.Input().Get("id")
@ -34,6 +44,12 @@ func (c *ApiController) GetOrganization() {
c.ServeJSON()
}
// @Title UpdateOrganization
// @Description update organization
// @Param id query string true "The id of the organization"
// @Param body body object.Organization true "The details of the organization"
// @Success 200 {object} controllers.Response The Response object
// @router /update-organization [post]
func (c *ApiController) UpdateOrganization() {
id := c.Input().Get("id")
@ -47,6 +63,11 @@ func (c *ApiController) UpdateOrganization() {
c.ServeJSON()
}
// @Title AddOrganization
// @Description add organization
// @Param body body object.Organization true "The details of the organization"
// @Success 200 {object} controllers.Response The Response object
// @router /add-organization [post]
func (c *ApiController) AddOrganization() {
var organization object.Organization
err := json.Unmarshal(c.Ctx.Input.RequestBody, &organization)
@ -58,6 +79,11 @@ func (c *ApiController) AddOrganization() {
c.ServeJSON()
}
// @Title DeleteOrganization
// @Description delete organization
// @Param body body object.Organization true "The details of the organization"
// @Success 200 {object} controllers.Response The Response object
// @router /delete-organization [post]
func (c *ApiController) DeleteOrganization() {
var organization object.Organization
err := json.Unmarshal(c.Ctx.Input.RequestBody, &organization)