handlers

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 27 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 db.DB) http.HandlerFunc

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

func DeleteAlbumHandler

func DeleteAlbumHandler(store db.DB) http.HandlerFunc

func DeleteAliasHandler

func DeleteAliasHandler(store db.DB) http.HandlerFunc

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

func DeleteApiKeyHandler

func DeleteApiKeyHandler(store db.DB) http.HandlerFunc

func DeleteArtistHandler

func DeleteArtistHandler(store db.DB) http.HandlerFunc

func DeleteListenHandler

func DeleteListenHandler(store db.DB) http.HandlerFunc

func DeleteTrackHandler

func DeleteTrackHandler(store db.DB) http.HandlerFunc

func ExportHandler added in v0.0.10

func ExportHandler(store db.DB) http.HandlerFunc

func GenerateApiKeyHandler

func GenerateApiKeyHandler(store db.DB) http.HandlerFunc

func GetAlbumHandler

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

func GetAliasesHandler

func GetAliasesHandler(store db.DB) http.HandlerFunc

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

func GetApiKeysHandler

func GetApiKeysHandler(store db.DB) http.HandlerFunc

func GetArtistHandler

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

func GetArtistsForItemHandler added in v0.0.8

func GetArtistsForItemHandler(store db.DB) http.HandlerFunc

func GetListenActivityHandler

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

func GetListensHandler

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

func GetTopAlbumsHandler

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

func GetTopArtistsHandler

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

func GetTopTracksHandler

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

func GetTrackHandler

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

func HealthHandler

func HealthHandler() http.HandlerFunc

func ImageHandler

func ImageHandler(store db.DB) http.HandlerFunc

func LbzSubmitListenHandler

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

func LbzValidateTokenHandler

func LbzValidateTokenHandler(store db.DB) http.HandlerFunc

func LoginHandler

func LoginHandler(store db.DB) http.HandlerFunc

func LogoutHandler

func LogoutHandler(store db.DB) http.HandlerFunc

func MeHandler

func MeHandler(store db.DB) http.HandlerFunc

func MergeArtistsHandler

func MergeArtistsHandler(store db.DB) http.HandlerFunc

func MergeReleaseGroupsHandler

func MergeReleaseGroupsHandler(store db.DB) http.HandlerFunc

func MergeTracksHandler

func MergeTracksHandler(store db.DB) http.HandlerFunc

func OptsFromRequest

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

func ReplaceImageHandler

func ReplaceImageHandler(store db.DB) http.HandlerFunc

func SearchHandler

func SearchHandler(store db.DB) http.HandlerFunc

func SetPrimaryAliasHandler

func SetPrimaryAliasHandler(store db.DB) http.HandlerFunc

sets the primary alias for albums, artists, and tracks

func SetPrimaryArtistHandler added in v0.0.8

func SetPrimaryArtistHandler(store db.DB) http.HandlerFunc

func StatsHandler

func StatsHandler(store db.DB) http.HandlerFunc

func UpdateAlbumHandler added in v0.0.6

func UpdateAlbumHandler(store db.DB) http.HandlerFunc

func UpdateApiKeyLabelHandler

func UpdateApiKeyLabelHandler(store db.DB) http.HandlerFunc

func UpdateUserHandler

func UpdateUserHandler(store db.DB) 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 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 StatsResponse

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

Jump to

Keyboard shortcuts

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