70 lines
2.0 KiB
Go
70 lines
2.0 KiB
Go
package user
|
|
|
|
import (
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"git.anthrove.art/Anthrove/otter-cage/pkg/api"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// CreateApiKey handles POST requests to /user/:user_id/source/:user_source_id/key
|
|
//
|
|
// @Summary Saves a API Key for a Specific user and their UserSource
|
|
// @Description Saves a API Key.
|
|
// @Tags API Key
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param user_id path string true "User ID"
|
|
// @Param user_user_id path string true "User Source ID"
|
|
// @Success 200 {object} api.Response[string] "API Key"
|
|
// @Router /user/{user_id}/source/{user_source_id}/key [post]
|
|
func CreateApiKey(c *gin.Context) {
|
|
response := api.Response[string]{
|
|
Meta: api.Meta{},
|
|
Data: "",
|
|
}
|
|
c.JSON(http.StatusOK, response)
|
|
}
|
|
|
|
// GetApiKey handles GET requests to /user/:user_id/source/:user_source_id/key
|
|
//
|
|
// @Summary Gets a API Key for a Specific user and their UserSource
|
|
// @Description Gets a API Key.
|
|
// @Tags API Key
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param user_id path string true "User ID"
|
|
// @Param user_user_id path string true "User Source ID"
|
|
// @Success 200 {object} api.Response[string] "API Key"
|
|
// @Router /user/{user_id}/source/{user_source_id}/key [get]
|
|
func GetApiKey(c *gin.Context) {
|
|
response := api.Response[string]{
|
|
Meta: api.Meta{},
|
|
Data: "",
|
|
}
|
|
c.JSON(http.StatusOK, response)
|
|
}
|
|
|
|
// DeleteApiKey handles GET requests to /user/:user_id/source/:user_source_id/key
|
|
//
|
|
// @Summary Gets a API Key for a Specific user and their UserSource
|
|
// @Description Gets a API Key.
|
|
// @Tags API Key
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param user_id path string true "User ID"
|
|
// @Param user_user_id path string true "User Source ID"
|
|
// @Success 204
|
|
// @Router /user/{user_id}/source/{user_source_id}/key [delete]
|
|
func DeleteApiKey(c *gin.Context) {
|
|
response := api.Response[string]{
|
|
Meta: api.Meta{
|
|
Status: strconv.Itoa(http.StatusOK),
|
|
StatusMessage: "success",
|
|
},
|
|
Data: "",
|
|
}
|
|
c.JSON(http.StatusNoContent, response)
|
|
}
|