Documentation ¶
Index ¶
- func GetSong(ctx context.Context) (model.Song, bool)
- func MustGetSong(ctx context.Context) model.Song
- func SetSong(ctx context.Context, song model.Song) context.Context
- type Handler
- func (h *Handler) CheckModify(next http.Handler) http.Handler
- func (h *Handler) Create(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteAudio(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteBackground(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteCover(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteVideo(w http.ResponseWriter, r *http.Request)
- func (h *Handler) FetchSong(next http.Handler) http.Handler
- func (h *Handler) Find(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Get(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetAudio(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetBackground(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetCover(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetTxt(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetVideo(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ReplaceAudio(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ReplaceBackground(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ReplaceCover(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ReplaceTxt(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ReplaceVideo(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ServeHTTP(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 GetSong ¶
GetSong returns a model.Song instance from the context. If the context does not contain a song instance, the second return value will be false.
func MustGetSong ¶
MustGetSong returns a model.Song instance from the context. In contrast to GetSong this function panics if the context does not contain a song instance.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements the /v1/songs endpoints.
func NewHandler ¶
func NewHandler(logger *slog.Logger, songRepo song.Repository, songSvc song.Service, mediaStore media.Store, mediaSvc media.Service) *Handler
NewHandler creates a new Handler instance using the specified services.
func (*Handler) CheckModify ¶
CheckModify is a middleware that checks if modifications to the requested resource are allowed.
func (*Handler) Create ¶
func (h *Handler) Create(w http.ResponseWriter, r *http.Request)
Create implements the POST /v1/songs endpoint.
func (*Handler) Delete ¶
func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)
Delete implements the DELETE /v1/songs/{uuid} endpoint.
func (*Handler) DeleteAudio ¶
func (h *Handler) DeleteAudio(w http.ResponseWriter, r *http.Request)
DeleteAudio implements the DELETE /v1/songs/{uuid}/audio endpoint.
func (*Handler) DeleteBackground ¶
func (h *Handler) DeleteBackground(w http.ResponseWriter, r *http.Request)
DeleteBackground implements the DELETE /v1/songs/{uuid}/background endpoint.
func (*Handler) DeleteCover ¶
func (h *Handler) DeleteCover(w http.ResponseWriter, r *http.Request)
DeleteCover implements the DELETE /v1/songs/{uuid}/cover endpoint.
func (*Handler) DeleteVideo ¶
func (h *Handler) DeleteVideo(w http.ResponseWriter, r *http.Request)
DeleteVideo implements the DELETE /v1/songs/{uuid}/video endpoint.
func (*Handler) FetchSong ¶
FetchSong is a middleware that fetches the model.Song instance identified by the request and stores it in the request context.
func (*Handler) Find ¶
func (h *Handler) Find(w http.ResponseWriter, r *http.Request)
Find implements the GET /v1/songs endpoint.
func (*Handler) Get ¶
func (h *Handler) Get(w http.ResponseWriter, r *http.Request)
Get implements the GET /v1/songs/{uuid} endpoint.
func (*Handler) GetAudio ¶
func (h *Handler) GetAudio(w http.ResponseWriter, r *http.Request)
GetAudio implements the GET /v1/songs/{uuid}/audio endpoint.
func (*Handler) GetBackground ¶
func (h *Handler) GetBackground(w http.ResponseWriter, r *http.Request)
GetBackground implements the GET /v1/songs/{uuid}/background endpoint.
func (*Handler) GetCover ¶
func (h *Handler) GetCover(w http.ResponseWriter, r *http.Request)
GetCover implements the GET /v1/songs/{uuid}/cover endpoint.
func (*Handler) GetTxt ¶
func (h *Handler) GetTxt(w http.ResponseWriter, r *http.Request)
GetTxt implements the GET /v1/songs/{uuid}/txt endpoint.
func (*Handler) GetVideo ¶
func (h *Handler) GetVideo(w http.ResponseWriter, r *http.Request)
GetVideo implements the GET /v1/songs/{uuid}/video endpoint.
func (*Handler) ReplaceAudio ¶
func (h *Handler) ReplaceAudio(w http.ResponseWriter, r *http.Request)
ReplaceAudio implements the PUT /v1/songs/{uuid}/audio endpoint.
func (*Handler) ReplaceBackground ¶
func (h *Handler) ReplaceBackground(w http.ResponseWriter, r *http.Request)
ReplaceBackground implements the PUT /v1/songs/{uuid}/background endpoint.
func (*Handler) ReplaceCover ¶
func (h *Handler) ReplaceCover(w http.ResponseWriter, r *http.Request)
ReplaceCover implements the PUT /v1/songs/{uuid}/cover endpoint.
func (*Handler) ReplaceTxt ¶
func (h *Handler) ReplaceTxt(w http.ResponseWriter, r *http.Request)
ReplaceTxt implements the PUT /v1/songs/{uuid}/txt endpoint.
func (*Handler) ReplaceVideo ¶
func (h *Handler) ReplaceVideo(w http.ResponseWriter, r *http.Request)
ReplaceVideo implements the PUT /v1/songs/{uuid}/video endpoint.