Documentation ¶
Index ¶
- type DataList
- type Handler
- func (h *Handler) Article(c *fiber.Ctx) error
- func (h *Handler) ArticleList(c *fiber.Ctx) error
- func (h *Handler) CreateArticle(c *fiber.Ctx) error
- func (h *Handler) CurrentUser(c *fiber.Ctx) error
- func (h *Handler) DeleteArticle(c *fiber.Ctx) error
- func (h *Handler) GetArticle(c *fiber.Ctx) error
- func (h *Handler) GetProfile(c *fiber.Ctx) error
- func (h *Handler) Login(c *fiber.Ctx) error
- func (h *Handler) Register(r *fiber.App)
- func (h *Handler) SignUp(c *fiber.Ctx) error
- func (h *Handler) UpdateArticle(c *fiber.Ctx) error
- func (h *Handler) UpdateUser(c *fiber.Ctx) error
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Article ¶
Article godoc @Summary Get all articles with Limit and Offset. @Description Get most recent article globally. Auth is optional @ID get-article @Tags article @Accept json @Produce json @Param limit path int true "Limit number of articles returned (default is 20)" @Param offset path int true "Offset/skip number of articles (default is 0)" @Success 200 {object} articleDataListResponse @Failure 500 {object} utils.Error @Router /articles/{limit}/{offset} [get]
func (*Handler) ArticleList ¶
ArticleList godoc @Summary Get all articles @Description Get article list. Auth not required @ID get-article-lists @Tags article @Accept json @Produce json @Success 200 {object} articleDataListResponse @Failure 400 {object} utils.Error @Failure 500 {object} utils.Error @Router /articles/list [get]
func (*Handler) CreateArticle ¶
CreateArticle godoc @Summary Create an article @Description Create an article. Auth is require @ID create-article @Tags article @Accept json @Produce json @Param article body articleCreateRequest true "Article to create" @Success 201 {object} singleArticleResponse @Failure 401 {object} utils.Error @Failure 422 {object} utils.Error @Failure 500 {object} utils.Error @Security ApiKeyAuth @Router /articles [post]
func (*Handler) CurrentUser ¶
CurrentUser godoc @Summary Get the current user @Description Gets the currently logged-in user @ID current-user @Tags user @Accept json @Produce json @Success 200 {object} userResponse @Failure 400 {object} utils.Error @Failure 401 {object} utils.Error @Failure 422 {object} utils.Error @Failure 404 {object} utils.Error @Failure 500 {object} utils.Error @Security ApiKeyAuth @Router /user [get]
func (*Handler) DeleteArticle ¶
DeleteArticle godoc @Summary Delete an article @Description Delete an article. Auth is required @ID delete-article @Tags article @Accept json @Produce json @Param id path int true "ID of the article to delete" @Success 200 {object} map[string]interface{} @Failure 401 {object} utils.Error @Failure 404 {object} utils.Error @Failure 500 {object} utils.Error @Security ApiKeyAuth @Router /articles/{id} [delete]
func (*Handler) GetArticle ¶
GetArticle godoc @Summary Get an article @Description Get an article. Auth not required @ID get-article-by-id @Tags article @Accept json @Produce json @Param id path int true "ID of the article to get" @Success 200 {object} singleArticleResponse @Failure 400 {object} utils.Error @Failure 500 {object} utils.Error @Router /articles/{id} [get]
func (*Handler) GetProfile ¶
GetProfile godoc @Summary Get a profile @Description Get a profile of a user of the system. Auth is optional @ID get-profile @Tags profile @Accept json @Produce json @Param username path string true "Username of the profile to get" @Success 200 {object} userResponse @Failure 400 {object} utils.Error @Failure 401 {object} utils.Error @Failure 422 {object} utils.Error @Failure 404 {object} utils.Error @Failure 500 {object} utils.Error @Security ApiKeyAuth @Router /profiles/{username} [get]
func (*Handler) Login ¶
Login godoc @Summary Login for existing user @Description Login for existing user @ID login @Tags user @Accept json @Produce json @Param user body userLoginRequest true "Credentials to use" @Success 200 {object} userResponse @Failure 400 {object} utils.Error @Failure 401 {object} utils.Error @Failure 422 {object} utils.Error @Failure 404 {object} utils.Error @Failure 500 {object} utils.Error @Router /users/login [post]
func (*Handler) SignUp ¶
SignUp godoc @Summary Register a new user @Description Register a new user @ID sign-up @Tags user @Accept json @Produce json @Param user body userRegisterRequest true "User info for registration" @Success 201 {object} userResponse @Failure 400 {object} utils.Error @Failure 404 {objects} utils.Error @Failure 500 {objects} utils.Error @Router /users [post]
func (*Handler) UpdateArticle ¶
UpdateArticle godoc @Summary Update an article @Description Update an article. Auth is required @ID update-article @Tags article @Accept json @Produce json @Param id path int true "ID of the article to update" @Param article body articleUpdateRequest true "Article to update" @Success 200 {object} singleArticleResponse @Failure 400 {object} utils.Error @Failure 401 {object} utils.Error @Failure 422 {object} utils.Error @Failure 404 {object} utils.Error @Failure 500 {object} utils.Error @Security ApiKeyAuth @Router /articles/{id} [put]
func (*Handler) UpdateUser ¶
UpdateUser godoc @Summary Update current user @Description Update user information for current user @ID update-user @Tags user @Accept json @Produce json @Param user body userUpdateRequest true "User details to update. At least **one** field is required." @Success 200 {object} userResponse @Failure 400 {object} utils.Error @Failure 401 {object} utils.Error @Failure 422 {object} utils.Error @Failure 404 {object} utils.Error @Failure 500 {object} utils.Error @Security ApiKeyAuth @Router /user [put]