controller

package
v0.0.0-...-f6f569b Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MIN_MS_FILTER = 30000
	DEFAULT_LIMIT         = 50
)

Variables

View Source
var (
	SearchMissingError, _ = json.MarshalIndent(requests.ErrorResponse{
		Error: "No search term present",
	}, "", " ")
)
View Source
var (
	SongIDMissingError, _ = json.MarshalIndent(requests.ErrorResponse{
		Error: "No song specified",
	}, "", " ")
)

Functions

func GetTopItemsByMonth

func GetTopItemsByMonth(w http.ResponseWriter, r *http.Request)

Types

type AddMemberRequest

type AddMemberRequest struct {
	Username    string `json:"username"`
	IsModerator bool   `json:"is_moderator"`
}

type AlbumStatsResponse

type AlbumStatsResponse struct {
	Album    *z_spotify.FullAlbum `json:"album"`
	Streams  []*Stream            `json:"streams"`
	Rankings []MonthRanking       `json:"rankings"`
}

type ArtistStatsResponse

type ArtistStatsResponse struct {
	Artist   *z_spotify.FullArtist `json:"artist"`
	Streams  []*Stream             `json:"streams"`
	Rankings []MonthRanking        `json:"rankings"`
}

type Controller

type Controller struct{}

func (*Controller) AddGuest

func (*Controller) AddGuest(w http.ResponseWriter, r *http.Request)

func (*Controller) AddMember

func (*Controller) AddMember(w http.ResponseWriter, r *http.Request)

func (*Controller) CreateRoom

func (c *Controller) CreateRoom(w http.ResponseWriter, r *http.Request)

func (*Controller) CreateUser

func (c *Controller) CreateUser(w http.ResponseWriter, r *http.Request)

func (*Controller) CurrentUser

func (c *Controller) CurrentUser(w http.ResponseWriter, r *http.Request)

func (*Controller) DeleteMember

func (*Controller) DeleteMember(w http.ResponseWriter, r *http.Request)

func (*Controller) DeleteRoom

func (*Controller) DeleteRoom(w http.ResponseWriter, r *http.Request)

func (*Controller) Devices

func (c *Controller) Devices(w http.ResponseWriter, r *http.Request)

func (*Controller) GetAlbum

func (c *Controller) GetAlbum(w http.ResponseWriter, r *http.Request)

func (*Controller) GetAlbumStatsByURI

func (c *Controller) GetAlbumStatsByURI(w http.ResponseWriter, r *http.Request)

func (*Controller) GetAllHistory

func (c *Controller) GetAllHistory(w http.ResponseWriter, r *http.Request)

func (*Controller) GetAllStreamsByURI

func (c *Controller) GetAllStreamsByURI(w http.ResponseWriter, r *http.Request)

func (*Controller) GetArtist

func (c *Controller) GetArtist(w http.ResponseWriter, r *http.Request)

func (*Controller) GetArtistStatsByURI

func (c *Controller) GetArtistStatsByURI(w http.ResponseWriter, r *http.Request)

func (*Controller) GetPlayback

func (c *Controller) GetPlayback(w http.ResponseWriter, r *http.Request)

func (*Controller) GetPlaylist

func (c *Controller) GetPlaylist(w http.ResponseWriter, r *http.Request)

func (*Controller) GetQueue

func (c *Controller) GetQueue(w http.ResponseWriter, r *http.Request)

func (*Controller) GetRoom

func (c *Controller) GetRoom(w http.ResponseWriter, r *http.Request)

func (*Controller) GetRoomGuestsAndMembers

func (*Controller) GetRoomGuestsAndMembers(w http.ResponseWriter, r *http.Request)

func (*Controller) GetRoomPermissions

func (c *Controller) GetRoomPermissions(w http.ResponseWriter, r *http.Request)

func (*Controller) GetSpotifyLoginURL

func (c *Controller) GetSpotifyLoginURL(w http.ResponseWriter, r *http.Request)

func (*Controller) GetToken

func (c *Controller) GetToken(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTopAlbumsByMonth

func (c *Controller) GetTopAlbumsByMonth(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTopAlbumsByYear

func (c *Controller) GetTopAlbumsByYear(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTopArtistsByMonth

func (c *Controller) GetTopArtistsByMonth(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTopArtistsByYear

func (c *Controller) GetTopArtistsByYear(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTopTracksByMonth

func (c *Controller) GetTopTracksByMonth(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTopTracksByYear

func (c *Controller) GetTopTracksByYear(w http.ResponseWriter, r *http.Request)

func (*Controller) GetTrackStatsByURI

func (c *Controller) GetTrackStatsByURI(w http.ResponseWriter, r *http.Request)

func (*Controller) GetUserHostedRooms

func (c *Controller) GetUserHostedRooms(w http.ResponseWriter, r *http.Request)

func (*Controller) GetUserJoinedRooms

func (c *Controller) GetUserJoinedRooms(w http.ResponseWriter, r *http.Request)

func (*Controller) GetVersion

func (c *Controller) GetVersion(w http.ResponseWriter, r *http.Request)

func (*Controller) Health

func (c *Controller) Health(w http.ResponseWriter, r *http.Request)

func (*Controller) JoinRoomAsMember

func (*Controller) JoinRoomAsMember(w http.ResponseWriter, r *http.Request)

func (*Controller) Next

func (c *Controller) Next(w http.ResponseWriter, r *http.Request)

func (*Controller) Pause

func (c *Controller) Pause(w http.ResponseWriter, r *http.Request)

func (*Controller) Play

func (c *Controller) Play(w http.ResponseWriter, r *http.Request)

func (*Controller) Previous

func (c *Controller) Previous(w http.ResponseWriter, r *http.Request)

func (*Controller) PushToQueue

func (c *Controller) PushToQueue(w http.ResponseWriter, r *http.Request)

func (*Controller) SearchByUser

func (c *Controller) SearchByUser(w http.ResponseWriter, r *http.Request)

func (*Controller) SearchFromRoom

func (c *Controller) SearchFromRoom(w http.ResponseWriter, r *http.Request)

func (*Controller) SetModerator

func (*Controller) SetModerator(w http.ResponseWriter, r *http.Request)

func (*Controller) SetVolume

func (c *Controller) SetVolume(w http.ResponseWriter, r *http.Request)

func (*Controller) SpotifyAuthRedirect

func (c *Controller) SpotifyAuthRedirect(w http.ResponseWriter, r *http.Request)

func (*Controller) SuggestedTracks

func (c *Controller) SuggestedTracks(w http.ResponseWriter, r *http.Request)

func (*Controller) UnlinkSpotify

func (c *Controller) UnlinkSpotify(w http.ResponseWriter, r *http.Request)

func (*Controller) UpdatePassword

func (*Controller) UpdatePassword(w http.ResponseWriter, r *http.Request)

func (*Controller) UploadHistory

func (c *Controller) UploadHistory(w http.ResponseWriter, r *http.Request)

func (*Controller) UserHasSpotifyHistory

func (c *Controller) UserHasSpotifyHistory(w http.ResponseWriter, r *http.Request)

func (*Controller) UserPlaylists

func (c *Controller) UserPlaylists(w http.ResponseWriter, r *http.Request)

type CreateUserBody

type CreateUserBody struct {
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	Password    string `json:"password"`
}

type CreateUserResponse

type CreateUserResponse struct {
	User      user.User `json:"user"`
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
}

type GetRoomAuthLevelResponse

type GetRoomAuthLevelResponse struct {
	IsMember    bool `json:"is_member"`
	IsModerator bool `json:"is_moderator"`
	IsHost      bool `json:"is_host"`
}

type GetRoomGuestsAndMembersResponse

type GetRoomGuestsAndMembersResponse struct {
	Guests  []room.Guest  `json:"guests"`
	Members []room.Member `json:"members"`
}

type GetRoomsResponse

type GetRoomsResponse struct {
	Rooms []room.Room `json:"rooms"`
}

type GetSpotifyLoginURLResponse

type GetSpotifyLoginURLResponse struct {
	URL string `json:"url"`
}

type HistoryEntry

type HistoryEntry struct {
	Timestamp       time.Time            `json:"timestamp"`
	TrackName       string               `json:"track_name"`
	AlbumName       string               `json:"album_name"`
	MsPlayed        int32                `json:"ms_played"`
	SpotifyTrackUri string               `json:"spotify_track_uri"`
	SpotifyAlbumUri string               `json:"spotify_album_uri"`
	ImageURL        string               `json:"image_url"`
	Artists         []HistoryEntryArtist `json:"artists"`
}

type HistoryEntryArtist

type HistoryEntryArtist struct {
	Name string `json:"name"`
	URI  string `json:"uri"`
}

type HistoryResponse

type HistoryResponse struct {
	History     []HistoryEntry `json:"history"`
	LastFetched *time.Time     `json:"last_fetched"`
}

type MonthRanking

type MonthRanking struct {
	Year     int `json:"year"`
	Month    int `json:"month"`
	Position int `json:"position"`
}

type PermissionLevel

type PermissionLevel int
const (
	IncorrectPassword PermissionLevel = iota
	NotAuthorized
	Guest
	Member
	Moderator
	Host
)

type RequestContext

type RequestContext struct {
	Room            *room.Room
	UserID          string
	GuestID         string
	PermissionLevel PermissionLevel
}

type SetModeratorRequest

type SetModeratorRequest struct {
	UserID      string `json:"user_id"`
	IsModerator bool   `json:"is_moderator"`
}

type Stream

type Stream struct {
	Timestamp        time.Time `json:"timestamp"`
	TrackName        string    `json:"track_name"`
	ArtistName       string    `json:"artist_name"`
	AlbumName        string    `json:"album_name"`
	MsPlayed         int       `json:"ms_played"`
	SpotifyTrackUri  string    `json:"spotify_track_uri"`
	SpotifyArtistUri string    `json:"spotify_artist_uri"`
	SpotifyAlbumUri  string    `json:"spotify_album_uri"`
}

type TokenResponse

type TokenResponse struct {
	Token     string     `json:"token"`
	ExpiresAt time.Time  `json:"expires_at"`
	User      *user.User `json:"user"`
}

type TopAlbumsResponse

type TopAlbumsResponse struct {
	Rankings  []*history.MonthTopAlbums      `json:"rankings"`
	AlbumData map[string]z_spotify.FullAlbum `json:"album_data"`
}

type TopArtistsResponse

type TopArtistsResponse struct {
	Rankings   []*history.MonthTopArtists      `json:"rankings"`
	ArtistData map[string]z_spotify.FullArtist `json:"artist_data"`
}

type TopTracksResponse

type TopTracksResponse struct {
	Rankings  []*history.MonthTopTracks      `json:"rankings"`
	TrackData map[string]z_spotify.FullTrack `json:"track_data"`
}

type TrackStatsResponse

type TrackStatsResponse struct {
	Track    *z_spotify.FullTrack `json:"track"`
	Streams  []*Stream            `json:"streams"`
	Rankings []MonthRanking       `json:"rankings"`
}

type UpdatePasswordRequest

type UpdatePasswordRequest struct {
	NewPassword string `json:"new_password"`
}

Jump to

Keyboard shortcuts

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