Documentation
¶
Index ¶
- Constants
- type Handler
- func (h *Handler) GetAll(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetById(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetPostsByUserAddress(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetPostsByUserAddressAndIndex(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetUserPosts(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) Post(ctx context.Context, w http.ResponseWriter, r *http.Request) error
Constants ¶
const BasePath = "/posts"
const GetAllPath = v1.Version + BasePath + "/all"
const GetByIdPath = v1.Version + BasePath + "/id/{id}"
const GetPostsByUserAddressAndIndexPath = v1.Version + BasePath + "/{address}/{index}"
const GetPostsByUserAddressPath = v1.Version + BasePath + "/{address}"
const GetUserPostsPath = v1.Version + BasePath
const PostPath = v1.Version + BasePath
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) GetAll ¶
@Summary Get all posts @Description Get all posts with pagination @Tags posts @Produce json @Param page query int false "Page number" default(0) @Param pageSize query int false "Page size" default(100) @Success 200 {array} post.Post @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Router /v1/posts/all [get]
func (*Handler) GetById ¶
@Summary Get a post by ID @Description Get a specific post by its ID @Tags posts @Produce json @Param id path int true "Post ID" @Success 200 {object} post.Post @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Router /v1/posts/id/{id} [get]
func (*Handler) GetPostsByUserAddress ¶
func (h *Handler) GetPostsByUserAddress(ctx context.Context, w http.ResponseWriter, r *http.Request) error
@Summary Get posts by user address @Description Get all posts by a specific user address @Tags posts @Produce json @Param address path string true "User Address" @Param page query int false "Page number" default(0) @Param pageSize query int false "Page size" default(100) @Success 200 {array} post.Post @Failure 400 {object} v1.ErrorResponse @Router /v1/posts/{address} [get]
func (*Handler) GetPostsByUserAddressAndIndex ¶
func (h *Handler) GetPostsByUserAddressAndIndex(ctx context.Context, w http.ResponseWriter, r *http.Request) error
@Summary Get a post by user address and index @Description Get a specific post by user address and index @Tags posts @Produce json @Param address path string true "User Address" @Param index path int true "Post Index" @Success 200 {object} post.Post @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Router /v1/posts/{address}/{index} [get]
func (*Handler) GetUserPosts ¶
@Summary Get posts of user who made the request @Description Get all posts by a specific user address @Tags posts @Produce json @Param page query int false "Page number" default(0) @Param pageSize query int false "Page size" default(100) @Success 200 {array} post.Post @Failure 400 {object} v1.ErrorResponse @Router /v1/posts [get]