📝 Create missing models for API documentation

This commit is contained in:
2024-01-18 00:09:26 +01:00
parent e0190f4bb5
commit 607682884c
6 changed files with 68 additions and 49 deletions

View File

@ -68,16 +68,16 @@ func CreateOrUpdateHostname(c *gin.Context, isUpdate bool) {
c.JSON(http.StatusOK, gin.H{"hostname": hostname})
}
// @Summary Delete a hostname from the database
// @Description List all details for a given category
// @ID delete-hostnames-by-category-and-name
// @Produce json
// @Param category path string true "Category of the hostname"
// @Param hostname path string true "Hostname to delete"
// @Success 200 {json} json "Hostname"
// @Security Bearer
// @Tags Manipulate existing Hostnames
// @Router /{category}/{hostname} [delete]
// @Summary Delete a hostname from the database
// @Description List all details for a given category
// @ID delete-hostnames-by-category-and-name
// @Produce json
// @Param category path string true "Category of the hostname"
// @Param hostname path string true "Hostname to delete"
// @Success 200 {object} models.SimpleHostnameResponse "Hostname"
// @Security Bearer
// @Tags Manipulate existing Hostnames
// @Router /{category}/{hostname} [delete]
func DeleteHostname(c *gin.Context) {
category := c.Param("category")
hostname := c.Param("hostname")
@ -90,15 +90,15 @@ func DeleteHostname(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"hostname": hostname})
}
// @Summary Return a list of hosts and their details filtered by category
// @Description List all details for a given category
// @ID list-hostnames-by-category
// @Produce json
// @Param category path string true "Category of the hostname"
// @Success 200 {json} json "Hostname"
// @Security Bearer
// @Tags Querying Hostnames
// @Router /{category} [get]
// @Summary Return a list of hosts and their details filtered by category
// @Description List all details for a given category
// @ID list-hostnames-by-category
// @Produce json
// @Param category path string true "Category of the hostname"
// @Success 200 {array} models.Hostname "An array of responses"
// @Security Bearer
// @Tags Querying Hostnames
// @Router /{category} [get]
func ListHostnamesByCategory(c *gin.Context) {
category := c.Param("category")
@ -114,16 +114,16 @@ func ListHostnamesByCategory(c *gin.Context) {
c.JSON(http.StatusOK, hostnames)
}
// @Summary Return a single hostname by Category and Name
// @Description Return details for a single hostname identified by its category
// @ID get-hostname-by-category-and-name
// @Produce json
// @Param category path string true "Category of the hostname"
// @Param hostname path string true "Category of the hostname"
// @Security Bearer
// @Success 200 {json} json "Hostname"
// @Tags Querying Hostnames
// @Router /{category}/{hostname} [get]
// @Summary Return a single hostname by Category and Name
// @Description Return details for a single hostname identified by its category
// @ID get-hostname-by-category-and-name
// @Produce json
// @Param category path string true "Category of the hostname"
// @Param hostname path string true "Category of the hostname"
// @Success 200 {object} models.Hostname "A single response object"
// @Security Bearer
// @Tags Querying Hostnames
// @Router /{category}/{hostname} [get]
func GetHostnameByCategoryAndName(c *gin.Context) {
category := c.Param("category")
hostname := c.Param("hostname")