server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(logger slog.Logger, excludePaths []string) func(http.Handler) http.Handler

Types

type ErrBadParameter

type ErrBadParameter struct {
	// contains filtered or unexported fields
}

func (ErrBadParameter) Error

func (e ErrBadParameter) Error() string

func (ErrBadParameter) UserError

func (e ErrBadParameter) UserError() string

type ErrIDNotFound

type ErrIDNotFound struct {
	// contains filtered or unexported fields
}

func (ErrIDNotFound) Error

func (e ErrIDNotFound) Error() string

func (ErrIDNotFound) UserError

func (e ErrIDNotFound) UserError() string

type ErrParamNotDefined

type ErrParamNotDefined struct {
	// contains filtered or unexported fields
}

func (ErrParamNotDefined) Error

func (e ErrParamNotDefined) Error() string

func (ErrParamNotDefined) UserError

func (e ErrParamNotDefined) UserError() string

type ErrUnauthorized

type ErrUnauthorized struct{}

func (ErrUnauthorized) Error

func (e ErrUnauthorized) Error() string

func (ErrUnauthorized) UserError

func (e ErrUnauthorized) UserError() string

type ImageType

type ImageType string
const (
	ArtistImage   ImageType = "artist"
	AlbumImage    ImageType = "album"
	PlaylistImage ImageType = "playlist"
)

type ReqAlbumArtistsGet

type ReqAlbumArtistsGet struct {
	AlbumArtistID uuid.UUID `path:"albumArtistID" description:"ID of the wanted album artist"`
}

func (ReqAlbumArtistsGet) Validate

func (r ReqAlbumArtistsGet) Validate() (validationMessages string, err error)

type ReqAlbumTracksGet

type ReqAlbumTracksGet struct {
	AlbumTrackID uuid.UUID `path:"albumTrackID" description:"ID of the wanted album track"`
}

func (ReqAlbumTracksGet) Validate

func (r ReqAlbumTracksGet) Validate() (validationMessages string, err error)

type ReqAlbumsAlbumArtistGet

type ReqAlbumsAlbumArtistGet struct {
	AlbumID  uuid.UUID        `path:"albumID" description:"ID of the wanted album"`
	ArtistID uuid.UUID        `path:"artistID" description:"ID of the wanted artist"`
	Role     types.ArtistRole `path:"role" description:"Role of the wanted artist"`
}

func (ReqAlbumsAlbumArtistGet) Validate

func (r ReqAlbumsAlbumArtistGet) Validate() (validationMessages string, err error)

type ReqAlbumsAlbumTrackGet

type ReqAlbumsAlbumTrackGet struct {
	AlbumID     uuid.UUID `path:"albumID" description:"ID of the wanted album track"`
	DiscNumber  int       `path:"discNumber" description:"Disc number of the wanted album track"`
	TrackNumber int       `path:"trackNumber" description:"Track number of the wanted album track"`
}

func (ReqAlbumsAlbumTrackGet) Validate

func (r ReqAlbumsAlbumTrackGet) Validate() (validationMessages string, err error)

type ReqAlbumsGet

type ReqAlbumsGet struct {
	AlbumID uuid.UUID `path:"albumID" description:"ID of the wanted album"`
}

func (ReqAlbumsGet) Validate

func (r ReqAlbumsGet) Validate() (validationMessages string, err error)

type ReqAlbumsTrackGet

type ReqAlbumsTrackGet struct {
	AlbumID uuid.UUID `path:"albumID" description:"ID of the wanted album"`
	TrackID uuid.UUID `path:"trackID" description:"ID of the wanted track"`
}

func (ReqAlbumsTrackGet) Validate

func (r ReqAlbumsTrackGet) Validate() (validationMessages string, err error)

type ReqAlbumsUpdate

type ReqAlbumsUpdate struct {
	AlbumID uuid.UUID `path:"albumID" description:"ID of the wanted album"`
	types.AlbumUpdate
}

func (ReqAlbumsUpdate) Validate

func (r ReqAlbumsUpdate) Validate() (validationMessages string, err error)

type ReqArtistsCreate

type ReqArtistsCreate struct {
	types.ArtistBase
}

func (ReqArtistsCreate) Validate

func (r ReqArtistsCreate) Validate() (validationMessages string, err error)

type ReqArtistsGet

type ReqArtistsGet struct {
	ArtistID uuid.UUID `path:"artistID" description:"ID of the wanted artist"`
}

func (ReqArtistsGet) Validate

func (r ReqArtistsGet) Validate() (validationMessages string, err error)

type ReqArtistsUpdate

type ReqArtistsUpdate struct {
	ArtistID uuid.UUID `path:"artistID" description:"ID of the wanted artist"`
	types.ArtistBase
}

func (ReqArtistsUpdate) Validate

func (r ReqArtistsUpdate) Validate() (validationMessages string, err error)

type ReqDevicesGet

type ReqDevicesGet struct {
	DeviceID uuid.UUID `path:"deviceID" description:"ID of the wanted device"`
}

func (ReqDevicesGet) Validate

func (r ReqDevicesGet) Validate() (validationMessages string, err error)

type ReqDevicesPlayerAddToQueue

type ReqDevicesPlayerAddToQueue struct {
	DeviceID uuid.UUID `path:"deviceID" description:"ID of the wanted device"`
	types.TrackDetailed
}

func (ReqDevicesPlayerAddToQueue) Validate

func (r ReqDevicesPlayerAddToQueue) Validate() (validationMessages string, err error)

type ReqDevicesPlayerSetRepeat

type ReqDevicesPlayerSetRepeat struct {
	DeviceID uuid.UUID `path:"deviceID" description:"ID of the wanted device"`
	types.SetDevicePlayerRepeatReq
}

func (ReqDevicesPlayerSetRepeat) Validate

func (r ReqDevicesPlayerSetRepeat) Validate() (validationMessages string, err error)

type ReqDevicesPlayerSetShuffle

type ReqDevicesPlayerSetShuffle struct {
	DeviceID uuid.UUID `path:"deviceID" description:"ID of the wanted device"`
	types.SetDevicePlayerShuffleReq
}

func (ReqDevicesPlayerSetShuffle) Validate

func (r ReqDevicesPlayerSetShuffle) Validate() (validationMessages string, err error)

type ReqDevicesPlayerSetState

type ReqDevicesPlayerSetState struct {
	DeviceID uuid.UUID `path:"deviceID" description:"ID of the wanted device"`
	types.PlayerState
}

func (ReqDevicesPlayerSetState) Validate

func (r ReqDevicesPlayerSetState) Validate() (validationMessages string, err error)

type ReqDevicesRegister

type ReqDevicesRegister struct {
	types.ReqDevicesRegister
}

func (ReqDevicesRegister) Validate

func (r ReqDevicesRegister) Validate() (validationMessages string, err error)

type ReqDevicesUpdatePlayContext

type ReqDevicesUpdatePlayContext struct {
	DeviceID uuid.UUID `path:"deviceID" description:"ID of the wanted device"`
	types.PlayContextDTO
}

func (ReqDevicesUpdatePlayContext) Validate

func (r ReqDevicesUpdatePlayContext) Validate() (validationMessages string, err error)

type ReqDevicesUpdatePlaybackState

type ReqDevicesUpdatePlaybackState struct {
	DeviceID uuid.UUID `path:"deviceID" description:"ID of the wanted device"`
	types.PlaybackStateDTO
}

func (ReqDevicesUpdatePlaybackState) Validate

func (r ReqDevicesUpdatePlaybackState) Validate() (validationMessages string, err error)

type ReqImportAlbum

type ReqImportAlbum struct {
	File     []byte            `form:"file" required:"true" description:"Zip file content" json:"-"`
	Metadata types.ImportAlbum `form:"metadata" required:"true" description:"Additional metadata" json:"-"`
}

func (ReqImportAlbum) Validate

func (r ReqImportAlbum) Validate() (validationMessages string, err error)

type ReqImportSearchMb

type ReqImportSearchMb struct {
	Artist string `query:"artist" description:"The name of the artist."`
	Album  string `query:"album" description:"The name of the album."`
}

func (ReqImportSearchMb) Validate

func (r ReqImportSearchMb) Validate() (validationMessages string, err error)

type ReqLikesGet

type ReqLikesGet struct {
	LikeID uuid.UUID `path:"likeID" description:"ID of the wanted like"`
}

func (ReqLikesGet) Validate

func (r ReqLikesGet) Validate() (validationMessages string, err error)

type ReqList

type ReqList struct {
	Count     bool               `query:"count" description:"Only return the count, not the payload."`
	SortOrder database.SortOrder `query:"sortOrder" description:"Sort ascending or descending."`
	SortBy    database.SortBy    `query:"sortBy" description:"Sort by key."`
}

func (ReqList) Validate

func (r ReqList) Validate() (validationMessages string, err error)

type ReqListPagination

type ReqListPagination struct {
	SortOrder database.SortOrder `query:"sortOrder" description:"Sort ascending or descending."`
	SortBy    database.SortBy    `query:"sortBy" description:"Sort by key."`
	Page      int                `query:"page" description:"The page of data wanted."`
	Limit     int                `query:"limit" description:"Number of results per page."`
}

func (ReqListPagination) Validate

func (r ReqListPagination) Validate() (validationMessages string, err error)

type ReqListPlaylistTracks

type ReqListPlaylistTracks struct {
	PlaylistID uuid.UUID          `path:"playlistID" description:"ID of the wanted playlist"`
	Count      bool               `query:"count" description:"Only return the count, not the payload."`
	SortOrder  database.SortOrder `query:"sortOrder" description:"Sort ascending or descending."`
	SortBy     database.SortBy    `query:"sortBy" description:"Sort by key."`
}

func (ReqListPlaylistTracks) Validate

func (r ReqListPlaylistTracks) Validate() (validationMessages string, err error)

type ReqListPlaylists

type ReqListPlaylists struct {
	Count         bool               `query:"count" description:"Only return the count, not the payload."`
	SortOrder     database.SortOrder `query:"sortOrder" description:"Sort ascending or descending."`
	SortBy        database.SortBy    `query:"sortBy" description:"Sort by key."`
	IncludePublic bool               `query:"includePublic" description:"Include public playlists"`
}

func (ReqListPlaylists) Validate

func (r ReqListPlaylists) Validate() (validationMessages string, err error)

type ReqListTrackPagination

type ReqListTrackPagination struct {
	types.TrackFilter
	Page  int `query:"page" description:"The page of data wanted."`
	Limit int `query:"limit" description:"Number of results per page."`
}

func (ReqListTrackPagination) Validate

func (r ReqListTrackPagination) Validate() (validationMessages string, err error)

type ReqListTracksOfAlbum

type ReqListTracksOfAlbum struct {
	AlbumID uuid.UUID `path:"albumID" description:"ID of the wanted album"`
	Count   bool      `query:"count" description:"Only return the count, not the payload."`
}

func (ReqListTracksOfAlbum) Validate

func (r ReqListTracksOfAlbum) Validate() (validationMessages string, err error)

type ReqMediaFilesGet

type ReqMediaFilesGet struct {
	MediafileID uuid.UUID `path:"mediafileID" description:"ID of the wanted media file"`
}

func (ReqMediaFilesGet) Validate

func (r ReqMediaFilesGet) Validate() (validationMessages string, err error)

type ReqMediaFilesGetFile

type ReqMediaFilesGetFile struct {
	MediafileID uuid.UUID `path:"mediafileID" description:"ID of the wanted media file"`
	Range       string    `header:"Range" description:"Optional HTTP Range header for partial content retrieval." example:"bytes=0-1023"`
}

func (ReqMediaFilesGetFile) Validate

func (r ReqMediaFilesGetFile) Validate() (validationMessages string, err error)

type ReqNoContent

type ReqNoContent struct{}

func (ReqNoContent) Validate

func (r ReqNoContent) Validate() (validationMessages string, err error)

type ReqPlaylistTracksGet

type ReqPlaylistTracksGet struct {
	PlaylistTrackID uuid.UUID `path:"playlistTrackID" description:"ID of the wanted playlist track"`
}

func (ReqPlaylistTracksGet) Validate

func (r ReqPlaylistTracksGet) Validate() (validationMessages string, err error)

type ReqPlaylistsAddTrack

type ReqPlaylistsAddTrack struct {
	PlaylistID uuid.UUID `path:"playlistID" description:"ID of the wanted playlist"`
	types.PlaylistTrackReq
}

func (ReqPlaylistsAddTrack) Validate

func (r ReqPlaylistsAddTrack) Validate() (validationMessages string, err error)

type ReqPlaylistsGet

type ReqPlaylistsGet struct {
	PlaylistID uuid.UUID `path:"playlistID" description:"ID of the wanted playlist"`
}

func (ReqPlaylistsGet) Validate

func (r ReqPlaylistsGet) Validate() (validationMessages string, err error)

type ReqPlaylistsUpdate

type ReqPlaylistsUpdate struct {
	PlaylistID uuid.UUID `path:"playlistID" description:"ID of the wanted playlist"`
	types.PlaylistBase
}

func (ReqPlaylistsUpdate) Validate

func (r ReqPlaylistsUpdate) Validate() (validationMessages string, err error)

type ReqRatingsGet

type ReqRatingsGet struct {
	RatingID uuid.UUID `path:"ratingID" description:"ID of the wanted rating"`
}

func (ReqRatingsGet) Validate

func (r ReqRatingsGet) Validate() (validationMessages string, err error)

type ReqSearch

type ReqSearch struct {
	SearchTerm string `query:"q" description:"Free text search string"`
}

func (ReqSearch) Validate

func (r ReqSearch) Validate() (validationMessages string, err error)

type ReqSmartPlaylistArtistGet

type ReqSmartPlaylistArtistGet struct {
	ID uuid.UUID `path:"artistID" description:"ID of the wanted smart playlist artist"`
}

func (ReqSmartPlaylistArtistGet) Validate

func (r ReqSmartPlaylistArtistGet) Validate() (validationMessages string, err error)

type ReqSmartPlaylistContentGet

type ReqSmartPlaylistContentGet struct {
	ID uuid.UUID `path:"contentID" description:"ID of the wanted smart playlist content"`
}

func (ReqSmartPlaylistContentGet) Validate

func (r ReqSmartPlaylistContentGet) Validate() (validationMessages string, err error)

type ReqSyncPlayHistory

type ReqSyncPlayHistory struct {
	types.SyncPlayHistoryReq
}

func (ReqSyncPlayHistory) Validate

func (r ReqSyncPlayHistory) Validate() (validationMessages string, err error)

type ReqSyncSync

type ReqSyncSync struct {
	types.SyncReq
}

func (ReqSyncSync) Validate

func (r ReqSyncSync) Validate() (validationMessages string, err error)

type ReqTokensBase

type ReqTokensBase struct {
	TokenID uuid.UUID `path:"tokenID" description:"ID of the wanted token"`
}

func (ReqTokensBase) Validate

func (r ReqTokensBase) Validate() (validationMessages string, err error)

type ReqTrackAnalysisGet

type ReqTrackAnalysisGet struct {
	ID uuid.UUID `path:"trackAnalysisID" description:"ID of the wanted track analysis"`
}

func (ReqTrackAnalysisGet) Validate

func (r ReqTrackAnalysisGet) Validate() (validationMessages string, err error)

type ReqTrackArtistsGet

type ReqTrackArtistsGet struct {
	TrackArtistID uuid.UUID `path:"trackArtistID" description:"ID of the wanted track artist"`
}

func (ReqTrackArtistsGet) Validate

func (r ReqTrackArtistsGet) Validate() (validationMessages string, err error)

type ReqTracksAddRating

type ReqTracksAddRating struct {
	TrackID uuid.UUID `path:"trackID" description:"ID of the wanted track"`
	types.RatingReq
}

func (ReqTracksAddRating) Validate

func (r ReqTracksAddRating) Validate() (validationMessages string, err error)

type ReqTracksGet

type ReqTracksGet struct {
	TrackID uuid.UUID `path:"trackID" description:"ID of the wanted track"`
}

func (ReqTracksGet) Validate

func (r ReqTracksGet) Validate() (validationMessages string, err error)

type ReqTracksUpdate

type ReqTracksUpdate struct {
	TrackID uuid.UUID `path:"trackID" description:"ID of the wanted track"`
	types.TrackUpdate
}

func (ReqTracksUpdate) Validate

func (r ReqTracksUpdate) Validate() (validationMessages string, err error)

type ReqUsersApiTokenCreate

type ReqUsersApiTokenCreate struct {
	types.CreateUserApiTokenReq
}

func (ReqUsersApiTokenCreate) Validate

func (r ReqUsersApiTokenCreate) Validate() (validationMessages string, err error)

type ReqUsersBase

type ReqUsersBase struct {
	UserID uuid.UUID `path:"userID" description:"ID of the wanted user"`
}

func (ReqUsersBase) Validate

func (r ReqUsersBase) Validate() (validationMessages string, err error)

type ReqUsersCreate

type ReqUsersCreate struct {
	types.CreateUserReq
}

func (ReqUsersCreate) Validate

func (r ReqUsersCreate) Validate() (validationMessages string, err error)

type ReqUsersList

type ReqUsersList struct {
	IncludeMachineUsers bool               `` /* 126-byte string literal not displayed */
	Count               bool               `query:"count" description:"Only return the count, not the payload."`
	SortOrder           database.SortOrder `query:"sortOrder" description:"Sort ascending or descending."`
	SortBy              database.SortBy    `query:"sortBy" description:"Sort by key."`
}

func (ReqUsersList) Validate

func (r ReqUsersList) Validate() (validationMessages string, err error)

type ReqUsersTokenDelete

type ReqUsersTokenDelete struct {
	TokenID uuid.UUID `path:"tokenID" description:"ID of the wanted token"`
}

func (ReqUsersTokenDelete) Validate

func (r ReqUsersTokenDelete) Validate() (validationMessages string, err error)

type ReqUsersUpdate

type ReqUsersUpdate struct {
	UserID uuid.UUID `path:"userID" description:"ID of the wanted user"`
	types.UpdateUserReq
}

func (ReqUsersUpdate) Validate

func (r ReqUsersUpdate) Validate() (validationMessages string, err error)

type ReqUsersUpdateProfile

type ReqUsersUpdateProfile struct {
	types.UpdateProfileReq
}

func (ReqUsersUpdateProfile) Validate

func (r ReqUsersUpdateProfile) Validate() (validationMessages string, err error)

type Request

type Request[T any] struct{}

func (Request[T]) Validate

func (r Request[T]) Validate() (validationMessages string, err error)

type Request1

type Request1 struct {
	AlbumID    uuid.UUID `path:"albumID"`
	SearchTerm string    `query:"q" required:"true" description:"Filter the album names"`
	types.RatingReq
}

func (Request1) Validate

func (r Request1) Validate() (validationMessages string, err error)

type Response

type Response struct {
	Payload any `json:"payload,omitempty"`
	Status  int `json:"-"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func (*Server) APIDocs

func (s *Server) APIDocs(refl *openapi31.Reflector) error

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

type ServerError

type ServerError interface {
	UserError() string
	Error() string
}

Jump to

Keyboard shortcuts

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