handlers

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

package handlers implements route handlers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAliasHandler

func CreateAliasHandler(store aliasStore) http.HandlerFunc

CreateAliasHandler creates new aliases for a given artist, album, or track.

func DeleteAlbumHandler

func DeleteAlbumHandler(store db.AlbumStore) http.HandlerFunc

func DeleteAliasHandler

func DeleteAliasHandler(store aliasStore) http.HandlerFunc

DeleteAliasHandler deletes an alias for a given artist or album ID.

func DeleteApiKeyHandler

func DeleteApiKeyHandler(store db.UserStore) http.HandlerFunc

func DeleteArtistHandler

func DeleteArtistHandler(store db.ArtistStore) http.HandlerFunc

func DeleteListenHandler

func DeleteListenHandler(store db.ListenStore) http.HandlerFunc

func DeleteTrackHandler

func DeleteTrackHandler(store db.TrackStore) http.HandlerFunc

func ExportHandler added in v0.0.10

func ExportHandler(store db.ExportStore) http.HandlerFunc

func GenerateApiKeyHandler

func GenerateApiKeyHandler(store db.UserStore) http.HandlerFunc

func GetAlbumHandler

func GetAlbumHandler(store db.AlbumStore) func(w http.ResponseWriter, r *http.Request)

func GetAliasesHandler

func GetAliasesHandler(store aliasStore) http.HandlerFunc

GetAliasesHandler retrieves all aliases for a given artist or album ID.

func GetApiKeysHandler

func GetApiKeysHandler(store db.UserStore) http.HandlerFunc

func GetArtistHandler

func GetArtistHandler(store db.ArtistStore) func(w http.ResponseWriter, r *http.Request)

func GetArtistsForItemHandler added in v0.0.8

func GetArtistsForItemHandler(store db.ArtistStore) http.HandlerFunc

func GetCfgHandler added in v0.0.14

func GetCfgHandler() http.HandlerFunc

func GetInterestHandler added in v0.1.0

func GetInterestHandler(store db.ListenStore) func(w http.ResponseWriter, r *http.Request)

func GetListenActivityHandler

func GetListenActivityHandler(store db.ListenStore) func(w http.ResponseWriter, r *http.Request)

func GetListensHandler

func GetListensHandler(store db.ListenStore) func(w http.ResponseWriter, r *http.Request)

func GetTopAlbumsHandler

func GetTopAlbumsHandler(store db.AlbumStore) func(w http.ResponseWriter, r *http.Request)

func GetTopArtistsHandler

func GetTopArtistsHandler(store db.ArtistStore) func(w http.ResponseWriter, r *http.Request)

func GetTopTracksHandler

func GetTopTracksHandler(store db.TrackStore) func(w http.ResponseWriter, r *http.Request)

func GetTrackHandler

func GetTrackHandler(store db.TrackStore) func(w http.ResponseWriter, r *http.Request)

func HealthHandler

func HealthHandler() http.HandlerFunc

func ImageHandler

func ImageHandler(store db.ImageStore) http.HandlerFunc

func LbzSubmitListenHandler

func LbzSubmitListenHandler(store submitListenHandlerStore, mbzc mbz.MusicBrainzCaller) func(w http.ResponseWriter, r *http.Request)

func LbzValidateTokenHandler

func LbzValidateTokenHandler() http.HandlerFunc

func LoginHandler

func LoginHandler(store db.UserStore) http.HandlerFunc

func LogoutHandler

func LogoutHandler(store db.UserStore) http.HandlerFunc

func MeHandler

func MeHandler() http.HandlerFunc

func MergeArtistsHandler

func MergeArtistsHandler(store db.ArtistStore) http.HandlerFunc

func MergeReleaseGroupsHandler

func MergeReleaseGroupsHandler(store db.AlbumStore) http.HandlerFunc

func MergeTracksHandler

func MergeTracksHandler(store db.TrackStore) http.HandlerFunc

func NowPlayingHandler added in v0.0.14

func NowPlayingHandler(store db.TrackStore) http.HandlerFunc

func OptsFromRequest

func OptsFromRequest(r *http.Request) db.GetItemsOpts

func ReplaceImageHandler

func ReplaceImageHandler(store replaceImageStore) http.HandlerFunc

func SearchHandler

func SearchHandler(store searchStore) http.HandlerFunc

func SetPrimaryAliasHandler

func SetPrimaryAliasHandler(store aliasStore) http.HandlerFunc

sets the primary alias for albums, artists, and tracks

func SetPrimaryArtistHandler added in v0.0.8

func SetPrimaryArtistHandler(store db.ArtistStore) http.HandlerFunc

func StatsHandler

func StatsHandler(store statsStore) http.HandlerFunc

func SubmitListenWithIDHandler added in v0.0.14

func SubmitListenWithIDHandler(store db.ListenStore) http.HandlerFunc

func SummaryHandler added in v0.0.15

func SummaryHandler(store summaryHandlerStore) http.HandlerFunc

func TimeframeFromRequest added in v0.0.15

func TimeframeFromRequest(r *http.Request) db.Timeframe

func UpdateAlbumHandler added in v0.0.6

func UpdateAlbumHandler(store db.DB) http.HandlerFunc

func UpdateApiKeyLabelHandler

func UpdateApiKeyLabelHandler(store db.UserStore) http.HandlerFunc

func UpdateMbzIdHandler added in v0.1.0

func UpdateMbzIdHandler(store mbzidStore) func(w http.ResponseWriter, r *http.Request)

func UpdateTrackHandler added in v0.1.8

func UpdateTrackHandler(store db.DB) http.HandlerFunc

func UpdateUserHandler

func UpdateUserHandler(store db.UserStore) http.HandlerFunc

Types

type LbzAdditionalInfo

type LbzAdditionalInfo struct {
	MediaPlayer             string   `json:"media_player,omitempty"`
	SubmissionClient        string   `json:"submission_client,omitempty"`
	SubmissionClientVersion string   `json:"submission_client_version,omitempty"`
	ReleaseMBID             string   `json:"release_mbid,omitempty"`
	ReleaseGroupMBID        string   `json:"release_group_mbid,omitempty"`
	ArtistMBIDs             []string `json:"artist_mbids,omitempty"`
	ArtistNames             []string `json:"artist_names,omitempty"`
	RecordingMBID           string   `json:"recording_mbid,omitempty"`
	DurationMs              int32    `json:"duration_ms,omitempty"`
	Duration                int32    `json:"duration,omitempty"`
	Tags                    []string `json:"tags,omitempty"`
	AlbumArtist             string   `json:"albumartist,omitempty"`
}

type LbzArtist added in v0.0.5

type LbzArtist struct {
	ArtistMBID string `json:"artist_mbid"`
	ArtistName string `json:"artist_credit_name"`
}

type LbzListenType

type LbzListenType string
const (
	ListenTypeSingle     LbzListenType = "single"
	ListenTypePlayingNow LbzListenType = "playing_now"
	ListenTypeImport     LbzListenType = "import"
)

type LbzMBIDMapping added in v0.0.5

type LbzMBIDMapping struct {
	ReleaseMBID   string      `json:"release_mbid"`
	RecordingMBID string      `json:"recording_mbid"`
	ArtistMBIDs   []string    `json:"artist_mbids"`
	Artists       []LbzArtist `json:"artists"`
}

type LbzSubmitListenPayload

type LbzSubmitListenPayload struct {
	ListenedAt int64        `json:"listened_at,omitempty"`
	TrackMeta  LbzTrackMeta `json:"track_metadata"`
}

type LbzSubmitListenRequest

type LbzSubmitListenRequest struct {
	ListenType LbzListenType            `json:"listen_type,omitempty"`
	Payload    []LbzSubmitListenPayload `json:"payload,omitempty"`
}

type LbzTrackMeta

type LbzTrackMeta struct {
	ArtistName     string            `json:"artist_name"` // required
	TrackName      string            `json:"track_name"`  // required
	ReleaseName    string            `json:"release_name,omitempty"`
	MBIDMapping    LbzMBIDMapping    `json:"mbid_mapping"`
	AdditionalInfo LbzAdditionalInfo `json:"additional_info,omitempty"`
}

type LbzValidateResponse

type LbzValidateResponse struct {
	Code     int    `json:"code"`
	Error    string `json:"error,omitempty"`
	Message  string `json:"message,omitempty"`
	Valid    bool   `json:"valid,omitempty"`
	UserName string `json:"user_name,omitempty"`
}

type NowPlayingResponse added in v0.0.14

type NowPlayingResponse struct {
	CurrentlyPlaying bool         `json:"currently_playing"`
	Track            models.Track `json:"track"`
}

type ReplaceImageResponse

type ReplaceImageResponse struct {
	Success bool   `json:"success"`
	Image   string `json:"image"`
	Message string `json:"message,omitempty"`
}

type SearchResults

type SearchResults struct {
	Artists []*models.Artist `json:"artists"`
	Albums  []*models.Album  `json:"albums"`
	Tracks  []*models.Track  `json:"tracks"`
}

type ServerConfig added in v0.0.14

type ServerConfig struct {
	DefaultTheme string `json:"default_theme"`
}

type StatsResponse

type StatsResponse struct {
	ListenCount     int64 `json:"listen_count"`
	TrackCount      int64 `json:"track_count"`
	AlbumCount      int64 `json:"album_count"`
	ArtistCount     int64 `json:"artist_count"`
	MinutesListened int64 `json:"minutes_listened"`
}

Jump to

Keyboard shortcuts

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