serverclient

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: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEVICES_PATH = []string{"api", "devices"}

Functions

This section is empty.

Types

type ErrStatus

type ErrStatus struct {
	Status   int
	Refused  bool
	TimedOut bool
}

func (ErrStatus) Error

func (e ErrStatus) Error() string

type FileUpload

type FileUpload struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Data []byte `json:"data"`
}

type ServerClient

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

func New

func New(baseUrl string, slogHandler slog.Handler) ServerClient

func (ServerClient) AddPlayCount

func (s ServerClient) AddPlayCount(ctx context.Context, trackID uuid.UUID) error

func (ServerClient) AddPlaylist

func (s ServerClient) AddPlaylist(ctx context.Context, playlist types.Playlist) error

func (ServerClient) AddPlaylistTrack

func (s ServerClient) AddPlaylistTrack(ctx context.Context, playlistID, albumID, trackID uuid.UUID) error

func (ServerClient) AddSmartPlaylist

func (s ServerClient) AddSmartPlaylist(ctx context.Context, playlist types.PlaylistBase, filter types.TrackFilter) error

func (*ServerClient) AuthToken

func (s *ServerClient) AuthToken() string

func (ServerClient) CheckStatus

func (s ServerClient) CheckStatus(ctx context.Context) (h types.ServerApiInfo, err error)

func (ServerClient) CountAlbums

func (s ServerClient) CountAlbums(ctx context.Context) (cnt int, err error)

func (ServerClient) CountArtists

func (s ServerClient) CountArtists(ctx context.Context) (cnt int, err error)

func (ServerClient) CountLikedTracks

func (s ServerClient) CountLikedTracks(ctx context.Context) (cnt int, err error)

func (ServerClient) CountPlaylistTracks

func (s ServerClient) CountPlaylistTracks(ctx context.Context, playlistID uuid.UUID) (int, error)

func (ServerClient) CountPlaylists

func (s ServerClient) CountPlaylists(ctx context.Context) (int, error)

func (ServerClient) CountTracks

func (s ServerClient) CountTracks(ctx context.Context) (cnt int, err error)

func (ServerClient) CreateAPIToken

func (s ServerClient) CreateAPIToken(ctx context.Context, name string) (token string, err error)

func (ServerClient) CreateArtist

func (s ServerClient) CreateArtist(ctx context.Context, artistData types.ArtistBase) error

func (ServerClient) CreateUser

func (s ServerClient) CreateUser(ctx context.Context, email, username, password string, roles []types.UserRole) error

func (ServerClient) DeletePlaylist

func (s ServerClient) DeletePlaylist(ctx context.Context, id uuid.UUID) error

func (ServerClient) DeletePlaylistTrack

func (s ServerClient) DeletePlaylistTrack(ctx context.Context, id uuid.UUID) error

func (ServerClient) DeleteToken

func (s ServerClient) DeleteToken(ctx context.Context, tokenID uuid.UUID) error

func (ServerClient) DeleteUser

func (s ServerClient) DeleteUser(ctx context.Context, id uuid.UUID) error

func (ServerClient) DeleteUserToken

func (s ServerClient) DeleteUserToken(ctx context.Context, tokenID uuid.UUID) error

func (ServerClient) DeviceDelete

func (s ServerClient) DeviceDelete(ctx context.Context, deviceID uuid.UUID) error

func (ServerClient) DeviceDeleteToken

func (s ServerClient) DeviceDeleteToken(ctx context.Context, deviceID uuid.UUID) error

func (ServerClient) DeviceNextTrack

func (s ServerClient) DeviceNextTrack(ctx context.Context, deviceID uuid.UUID) (err error)

func (ServerClient) DevicePlayPause

func (s ServerClient) DevicePlayPause(ctx context.Context, deviceID uuid.UUID) (err error)

func (ServerClient) DevicePlayerAddToQueue

func (s ServerClient) DevicePlayerAddToQueue(ctx context.Context, deviceID uuid.UUID, track types.TrackDetailed) (err error)

func (ServerClient) DevicePlayerSetRepeat

func (s ServerClient) DevicePlayerSetRepeat(ctx context.Context, deviceID uuid.UUID, repeatType types.RepeatType) (err error)

func (ServerClient) DevicePlayerSetShuffle

func (s ServerClient) DevicePlayerSetShuffle(ctx context.Context, deviceID uuid.UUID, active bool) (err error)

func (ServerClient) DevicePlayerStop

func (s ServerClient) DevicePlayerStop(ctx context.Context, deviceID uuid.UUID) (err error)

func (ServerClient) DevicePreviousTrack

func (s ServerClient) DevicePreviousTrack(ctx context.Context, deviceID uuid.UUID) (err error)

func (ServerClient) DeviceSetPlayerState

func (s ServerClient) DeviceSetPlayerState(ctx context.Context, deviceID uuid.UUID, pc types.PlayerState) (err error)

func (ServerClient) DownloadAlbumCover

func (s ServerClient) DownloadAlbumCover(ctx context.Context, albumID uuid.UUID, size imagemagick.ImageSize, w io.Writer) error

func (ServerClient) DownloadArtistImage

func (s ServerClient) DownloadArtistImage(ctx context.Context, artistID string, size imagemagick.ImageSize, w io.Writer) error

func (ServerClient) DownloadMediaFile

func (s ServerClient) DownloadMediaFile(ctx context.Context, id uuid.UUID, w io.Writer) error

func (ServerClient) DownloadMediaFilePart

func (s ServerClient) DownloadMediaFilePart(ctx context.Context, id uuid.UUID, startByte, endByte int, w io.Writer) (finalBytes bool, err error)

func (ServerClient) DownloadPlaylistImage

func (s ServerClient) DownloadPlaylistImage(ctx context.Context, id uuid.UUID, size imagemagick.ImageSize, w io.Writer) error

func (ServerClient) FilterTracks

func (s ServerClient) FilterTracks(ctx context.Context, filter types.TrackFilter, page, limit int) (types.ListPaginationPayload[types.TrackDetailed], error)

func (ServerClient) GetAlbum

func (s ServerClient) GetAlbum(ctx context.Context, albumID uuid.UUID) (album types.Album, err error)

func (ServerClient) GetAlbumArtist

func (s ServerClient) GetAlbumArtist(ctx context.Context, albumID, artistID uuid.UUID, role types.ArtistRole) (albumArtist types.AlbumArtist, err error)

func (ServerClient) GetAlbumArtistByID

func (s ServerClient) GetAlbumArtistByID(ctx context.Context, id uuid.UUID) (albumArtist types.AlbumArtist, err error)

func (ServerClient) GetAlbumDetailed

func (s ServerClient) GetAlbumDetailed(ctx context.Context, albumID uuid.UUID) (album types.AlbumDetailed, err error)

func (ServerClient) GetAlbumTrack

func (s ServerClient) GetAlbumTrack(ctx context.Context, albumID uuid.UUID, discNumber, trackNumber int) (albumTrack types.AlbumTrack, err error)

func (ServerClient) GetAlbumTrackByID

func (s ServerClient) GetAlbumTrackByID(ctx context.Context, id uuid.UUID) (albumTrack types.AlbumTrack, err error)

func (ServerClient) GetArtist

func (s ServerClient) GetArtist(ctx context.Context, artistID uuid.UUID) (artist types.Artist, err error)

func (ServerClient) GetArtistTopTracks

func (s ServerClient) GetArtistTopTracks(ctx context.Context, artistID uuid.UUID) ([]types.TrackDetailed, error)

func (ServerClient) GetLike

func (s ServerClient) GetLike(ctx context.Context, id uuid.UUID) (like types.Like, err error)

func (ServerClient) GetMediaFile

func (s ServerClient) GetMediaFile(ctx context.Context, id uuid.UUID) (mediaFile types.MediaFile, err error)

func (ServerClient) GetPlaylist

func (s ServerClient) GetPlaylist(ctx context.Context, id uuid.UUID) (playlist types.Playlist, err error)

func (ServerClient) GetPlaylistTrack

func (s ServerClient) GetPlaylistTrack(ctx context.Context, id uuid.UUID) (playlistTrack types.PlaylistTrack, err error)

func (ServerClient) GetRating

func (s ServerClient) GetRating(ctx context.Context, id uuid.UUID) (rating types.Rating, err error)

func (ServerClient) GetSmartPlaylistArtist

func (s ServerClient) GetSmartPlaylistArtist(ctx context.Context, id uuid.UUID) (artist types.SmartPlaylistArtist, err error)

func (ServerClient) GetSmartPlaylistContent

func (s ServerClient) GetSmartPlaylistContent(ctx context.Context, id uuid.UUID) (content types.SmartPlaylistContent, err error)

func (ServerClient) GetSyncState

func (s ServerClient) GetSyncState(ctx context.Context, changesSince time.Time) (syncState types.SyncState, err error)

func (ServerClient) GetTrack

func (s ServerClient) GetTrack(ctx context.Context, trackID uuid.UUID) (track types.Track, err error)

func (ServerClient) GetTrackAnalysisByID

func (s ServerClient) GetTrackAnalysisByID(ctx context.Context, id uuid.UUID) (trackAnalysis types.TrackAnalysis, err error)

func (ServerClient) GetTrackArtistByID

func (s ServerClient) GetTrackArtistByID(ctx context.Context, id uuid.UUID) (trackArtist types.TrackArtist, err error)

func (ServerClient) GetTrackDetailed

func (s ServerClient) GetTrackDetailed(ctx context.Context, trackID, albumID uuid.UUID) (track types.TrackDetailed, err error)

func (ServerClient) GetTrackRatings

func (s ServerClient) GetTrackRatings(ctx context.Context, trackID uuid.UUID) (ratings []types.Rating, err error)

func (ServerClient) GetUser

func (s ServerClient) GetUser(ctx context.Context) (user types.UserDetails, err error)

func (ServerClient) ImportAlbum

func (s ServerClient) ImportAlbum(ctx context.Context, r io.Reader, filename string, musicbrainzID *string) error

func (ServerClient) LikeTrack

func (s ServerClient) LikeTrack(ctx context.Context, trackID uuid.UUID) error

func (ServerClient) ListAlbums

func (s ServerClient) ListAlbums(ctx context.Context, sortBy database.SortBy, sortOrder database.SortOrder) (albums []types.AlbumDetailed, err error)

func (ServerClient) ListAlbumsByArtist

func (s ServerClient) ListAlbumsByArtist(ctx context.Context, artistID uuid.UUID, sortBy database.SortBy, sortOrder database.SortOrder) (albums []types.AlbumDetailed, err error)

func (ServerClient) ListArtists

func (s ServerClient) ListArtists(ctx context.Context, sortBy database.SortBy, sortOrder database.SortOrder) (artists []types.ArtistDetailed, err error)

func (ServerClient) ListDevices

func (s ServerClient) ListDevices(ctx context.Context) (devices []types.DeviceDetailed, err error)

func (ServerClient) ListEntityEvents

func (s ServerClient) ListEntityEvents(ctx context.Context) (events []types.EntityEvent, err error)

func (ServerClient) ListFeaturedAlbumsByArtist

func (s ServerClient) ListFeaturedAlbumsByArtist(ctx context.Context, artistID uuid.UUID, sortBy database.SortBy, sortOrder database.SortOrder) (albums []types.AlbumDetailed, err error)

func (ServerClient) ListImportItems

func (s ServerClient) ListImportItems(ctx context.Context, page, limit int) (types.ListPaginationPayload[types.Import], error)

func (ServerClient) ListLikedTracks

func (s ServerClient) ListLikedTracks(ctx context.Context) ([]types.TrackDetailed, error)

func (ServerClient) ListPlaylistTracks

func (s ServerClient) ListPlaylistTracks(ctx context.Context, playlistID uuid.UUID, sortBy database.SortBy, sortOrder database.SortOrder) ([]types.TrackDetailed, error)

func (ServerClient) ListPlaylists

func (s ServerClient) ListPlaylists(ctx context.Context, includePublic bool, sortBy database.SortBy, sortOrder database.SortOrder) ([]types.Playlist, error)

func (ServerClient) ListTracksByAlbum

func (s ServerClient) ListTracksByAlbum(ctx context.Context, albumID string) (tracks []types.Track, err error)

func (ServerClient) ListTracksDetailedByAlbum

func (s ServerClient) ListTracksDetailedByAlbum(ctx context.Context, albumID uuid.UUID) (tracks []types.TrackDetailed, err error)

func (ServerClient) ListUserRoles

func (s ServerClient) ListUserRoles(ctx context.Context) ([]types.UserRole, error)

func (ServerClient) ListUserTokens

func (s ServerClient) ListUserTokens(ctx context.Context) (tokens []types.TokenLimited, err error)

func (ServerClient) ListUsers

func (s ServerClient) ListUsers(ctx context.Context, includeMachineUsers bool) (users []types.UserDetails, err error)

func (ServerClient) Login

func (s ServerClient) Login(ctx context.Context, email, password string, longLivedToken bool) (resp types.LoginResp, err error)

func (ServerClient) Logout

func (s ServerClient) Logout(ctx context.Context) (err error)

func (ServerClient) RateTrack

func (s ServerClient) RateTrack(ctx context.Context, trackID uuid.UUID, value int) error

func (*ServerClient) RegisterDevice

func (s *ServerClient) RegisterDevice(ctx context.Context, deviceID *uuid.UUID, deviceDetails types.DeviceBase) (newDeviceID uuid.UUID, err error)

func (ServerClient) SearchFull

func (s ServerClient) SearchFull(ctx context.Context, searchTerm string) (si []types.SearchItem, err error)

func (ServerClient) SearchMusicBrainz

func (s ServerClient) SearchMusicBrainz(ctx context.Context, artist, album string) (types.ListPayload[musicbrainz.SearchResults], error)

func (*ServerClient) SetAuthToken

func (s *ServerClient) SetAuthToken(token string)

func (ServerClient) SubscribeDeviceEvents

func (s ServerClient) SubscribeDeviceEvents(ctx context.Context, deviceID uuid.UUID, handler sse.EventHandler) error

func (ServerClient) SyncPlayHistory

func (s ServerClient) SyncPlayHistory(ctx context.Context, changesSince time.Time, newItems []types.PlayHistory) (syncState types.PlayHistorySyncState, err error)

func (ServerClient) UnlikeTrack

func (s ServerClient) UnlikeTrack(ctx context.Context, trackID uuid.UUID) error

func (ServerClient) UpdateAlbum

func (s ServerClient) UpdateAlbum(ctx context.Context, albumID uuid.UUID, albumData types.AlbumUpdate) error

func (ServerClient) UpdateArtist

func (s ServerClient) UpdateArtist(ctx context.Context, artistID uuid.UUID, artistData types.Artist) error

func (ServerClient) UpdatePlayContext

func (s ServerClient) UpdatePlayContext(ctx context.Context, pc types.PlayContext) error

func (ServerClient) UpdatePlaybackState

func (s ServerClient) UpdatePlaybackState(ctx context.Context, ps types.PlaybackState) error

func (ServerClient) UpdatePlaylist

func (s ServerClient) UpdatePlaylist(ctx context.Context, id uuid.UUID, data types.Playlist) error

func (ServerClient) UpdateProfile

func (s ServerClient) UpdateProfile(ctx context.Context, data types.UpdateProfileReq) error

func (ServerClient) UpdateTrack

func (s ServerClient) UpdateTrack(ctx context.Context, id uuid.UUID, data types.TrackUpdate) error

func (ServerClient) UpdateUser

func (s ServerClient) UpdateUser(ctx context.Context, userID uuid.UUID, email, username string, password *string, roles []types.UserRole) error

func (ServerClient) UploadAlbumImage

func (s ServerClient) UploadAlbumImage(ctx context.Context, id uuid.UUID, img FileUpload) error

func (ServerClient) UploadArtistImage

func (s ServerClient) UploadArtistImage(ctx context.Context, artistID uuid.UUID, img FileUpload) error

func (ServerClient) UploadPlaylistImage

func (s ServerClient) UploadPlaylistImage(ctx context.Context, id uuid.UUID, img FileUpload) error

func (ServerClient) UploadUserImage

func (s ServerClient) UploadUserImage(ctx context.Context, r io.Reader, filename string) error

Jump to

Keyboard shortcuts

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