songs

package
v0.0.0-...-c05fae0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSong

func GetSong(ctx context.Context) (model.Song, bool)

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

func MustGetSong(ctx context.Context) model.Song

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.

func SetSong

func SetSong(ctx context.Context, song model.Song) context.Context

SetSong sets the song instance in ctx.

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

func (h *Handler) CheckModify(next http.Handler) http.Handler

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

func (h *Handler) FetchSong(next http.Handler) http.Handler

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.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP processes HTTP requests for h.

func (*Handler) Update

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

Update implements the PATCH /v1/songs/{uuid} endpoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL