Documentation ¶
Index ¶
- func Routes(link_rpc link_rpc.LinkServiceClient) chi.Router
- type Handler
- func (h *Handler) Add(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Get(w http.ResponseWriter, r *http.Request)
- func (h *Handler) List(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Routes ¶
func Routes( link_rpc link_rpc.LinkServiceClient, ) chi.Router
Routes create a REST router
Types ¶
type Handler ¶
type Handler struct {
LinkServiceClient link_rpc.LinkServiceClient
}
func (*Handler) Add ¶
func (h *Handler) Add(w http.ResponseWriter, r *http.Request)
Add - add @Summary Add link @Description Add link @ID add-link @Accept json @Produce json @Group Links @Success 200 {object} link_rpc.AddResponse @Router /links [post] @Param link body link_rpc.AddRequest true "Link"
func (*Handler) Delete ¶
func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)
Delete - delete @Summary Delete link @Description Delete link @ID delete-link @Accept json @Produce json @Group Links @Success 200 "" @Router /links/{hash} [delete] @Param hash path string true "Hash"
func (*Handler) Get ¶
func (h *Handler) Get(w http.ResponseWriter, r *http.Request)
Get - get @Summary Get link @Description Get link @ID get-link @Accept json @Produce json @Group Links @Success 200 {object} link_rpc.GetResponse @NotFound 404 {object} link_rpc.GetResponse @Router /links/{hash} [get] @Param hash path string true "Hash"
func (*Handler) List ¶
func (h *Handler) List(w http.ResponseWriter, r *http.Request)
List - list @Summary List links @Description List links @ID list-links @Accept json @Produce json @Group Links @Success 200 {object} link_rpc.ListResponse @Router /links [get]
func (*Handler) Update ¶
func (h *Handler) Update(w http.ResponseWriter, r *http.Request)
Update - update @Summary Update link @Description Update link @ID update-link @Accept json @Produce json @Group Links @Success 200 {object} link_rpc.UpdateResponse @Router /links/:hash [put] @Param link body link_rpc.UpdateRequest true "Link"