Added docs via swagger
This commit is contained in:
@ -8,6 +8,33 @@ import (
|
||||
)
|
||||
|
||||
func AddListItem(c echo.Context) error {
|
||||
// swagger:operation PUT /lists/{listID} lists addListItem
|
||||
// ---
|
||||
// summary: Adds an item to a list
|
||||
// consumes:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: listID
|
||||
// in: path
|
||||
// description: ID of the list to use
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: body
|
||||
// in: body
|
||||
// schema:
|
||||
// "$ref": "#/definitions/ListItem"
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ListItem"
|
||||
// "400":
|
||||
// "$ref": "#/responses/Message"
|
||||
// "500":
|
||||
// "$ref": "#/responses/Message"
|
||||
|
||||
// TODO: return 403 if you dont have the right to add an item to that list
|
||||
|
||||
// Get the list ID
|
||||
id := c.Param("id")
|
||||
// Make int
|
||||
@ -20,6 +47,31 @@ func AddListItem(c echo.Context) error {
|
||||
}
|
||||
|
||||
func UpdateListItem(c echo.Context) error {
|
||||
// swagger:operation PUT /item/{itemID} lists updateListItem
|
||||
// ---
|
||||
// summary: Updates a list item
|
||||
// consumes:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: itemID
|
||||
// in: path
|
||||
// description: ID of the item to update
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: body
|
||||
// in: body
|
||||
// schema:
|
||||
// "$ref": "#/definitions/ListItem"
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ListItem"
|
||||
// "400":
|
||||
// "$ref": "#/responses/Message"
|
||||
// "500":
|
||||
// "$ref": "#/responses/Message"
|
||||
|
||||
// Get the item ID
|
||||
id := c.Param("id")
|
||||
// Make int
|
||||
@ -73,4 +125,4 @@ func updateOrCreateListItemHelper(listID, itemID int64, c echo.Context) error {
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, finalItem)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user