Documentation
¶
Index ¶
- type Handler
- func (h *Handler) CreateBlog() http.HandlerFunc
- func (h *Handler) DeleteBlog() http.HandlerFunc
- func (h *Handler) GetBlog() http.HandlerFunc
- func (h *Handler) GetBlogByPath() http.HandlerFunc
- func (h *Handler) GetTags() http.HandlerFunc
- func (h *Handler) ListBlogs() http.HandlerFunc
- func (h *Handler) SyncBlogs() http.HandlerFunc
- func (h *Handler) UpdateBlog() http.HandlerFunc
- type RequestParams
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 NewHandler ¶
func NewHandler(blogManager *blogmanager.BlogManager) (*Handler, error)
func (*Handler) CreateBlog ¶
func (h *Handler) CreateBlog() http.HandlerFunc
@Id createBlog @Summary Create blog @Description Create a new blog @Tags blog @Accept json @Produce json @Param blog body request.CreateBlogRequest true "Created blog" @Success 200 {object} handler.Response{data=entity.Blog} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs [post]
func (*Handler) DeleteBlog ¶
func (h *Handler) DeleteBlog() http.HandlerFunc
@Id deleteBlog @Summary Delete blog @Description Delete specified blog by ID @Tags blog @Produce json @Param id path string true "Blog ID" @Success 200 {object} handler.Response{data=string} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs/{id} [delete]
func (*Handler) GetBlog ¶
func (h *Handler) GetBlog() http.HandlerFunc
@Id getBlog @Summary Get blog @Description Get blog information by blog ID @Tags blog @Produce json @Param id path string true "Blog ID" @Success 200 {object} handler.Response{data=entity.Blog} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs/{id} [get]
func (*Handler) GetBlogByPath ¶
func (h *Handler) GetBlogByPath() http.HandlerFunc
@Id getBlogByPath @Summary Get blog by path @Description Get blog information by blog path @Tags blog @Produce json @Param blogPath path string true "Blog Path" @Success 200 {object} handler.Response{data=entity.Blog} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs/path/{blogPath} [get]
func (*Handler) GetTags ¶
func (h *Handler) GetTags() http.HandlerFunc
@Id getTags @Summary Get tags @Description Get all tags @Tags blog @Produce json @Success 200 {object} handler.Response{data=map[string]int} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs/tags [get]
func (*Handler) ListBlogs ¶
func (h *Handler) ListBlogs() http.HandlerFunc
@Id listBlog @Summary List blogs @Description List all blogs @Tags blog @Produce json @Success 200 {object} handler.Response{data=[]entity.Blog} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs [get]
func (*Handler) SyncBlogs ¶
func (h *Handler) SyncBlogs() http.HandlerFunc
@Id syncBlogs @Summary Sync blogs @Description Sync blogs information from GitHub repository @Tags blog @Produce json @Success 200 {object} handler.Response{data=string} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs/sync [post]
func (*Handler) UpdateBlog ¶
func (h *Handler) UpdateBlog() http.HandlerFunc
@Id updateBlog @Summary Update blog @Description Update the specified blog @Tags blog @Accept json @Produce json @Param id path string true "Blog ID" @Param blog body request.UpdateBlogRequest true "Updated blog" @Success 200 {object} handler.Response{data=entity.Blog} "Success" @Failure 400 {object} error "Bad Request" @Failure 401 {object} error "Unauthorized" @Failure 429 {object} error "Too Many Requests" @Failure 404 {object} error "Not Found" @Failure 500 {object} error "Internal Server Error" @Security BasicAuth @Router /api/v1/blogs/{id} [put]