room

package
v0.0.0-...-f77910f Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParametersFromRequest

func ParametersFromRequest(r *http.Request) (code string, guest_id string, password string)

ParametersFromRequest returns the room code from the URL parameter and the guest name / room password from the Basic auth header

Types

type Guest

type Guest struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	QueuedTracks int    `json:"queued_tracks"`
}

type InsertGuestRequest

type InsertGuestRequest struct {
	Name string
}

type InsertRoomParams

type InsertRoomParams struct {
	Name     string `json:"name"`
	Password string `json:"password"`
	HostID   string `json:"host_id"`
}

type Member

type Member struct {
	ID           string `json:"user_id"`
	Username     string `json:"username"`
	DisplayName  string `json:"display_name"`
	SpotifyName  string `json:"spotify_name"`
	SpotifyImage string `json:"spotify_image"`
	IsModerator  bool   `json:"is_moderator"`
	QueuedTracks int    `json:"queued_tracks"`
}

type QueuedTrack

type QueuedTrack struct {
	TrackID   string
	AddedBy   string
	Timestamp time.Time
	Played    bool
}

type Room

type Room struct {
	ID      string    `json:"id"`
	Code    string    `json:"code"`
	Name    string    `json:"name"`
	Host    user.User `json:"host"`
	Created time.Time `json:"created"`
}

type RoomResponse

type RoomResponse struct {
	Room  Room   `json:"room"`
	Guest *Guest `json:"guest_data"`
}

type Store

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

func NewStore

func NewStore(db *sql.DB) *Store

func (*Store) AddMember

func (s *Store) AddMember(ctx context.Context, roomID string, userID string) error

func (*Store) AddMemberByUsername

func (s *Store) AddMemberByUsername(ctx context.Context, roomID string, username string, isModerator bool) error

func (*Store) DeleteByCode

func (s *Store) DeleteByCode(ctx context.Context, roomCode string) error

func (*Store) GetAllMembers

func (s *Store) GetAllMembers(ctx context.Context, roomID string) ([]Member, error)

func (*Store) GetAllRoomGuests

func (s *Store) GetAllRoomGuests(ctx context.Context, roomID string) ([]Guest, error)

func (*Store) GetByCode

func (s *Store) GetByCode(ctx context.Context, code string) (Room, error)

func (*Store) GetEncryptedRoomTokens

func (s *Store) GetEncryptedRoomTokens(ctx context.Context, code string) (accessToken []byte, accessTokenExpiry time.Time, refreshToken []byte, err error)

func (*Store) GetGuestName

func (s *Store) GetGuestName(ctx context.Context, roomID string, guestID string) (string, error)

func (*Store) GetHostID

func (s *Store) GetHostID(ctx context.Context, code string) (string, error)

func (*Store) GetQueueTrackAddedBy

func (s *Store) GetQueueTrackAddedBy(ctx context.Context, roomID string) (tracks []QueuedTrack, err error)

func (*Store) GetUserHostedRooms

func (s *Store) GetUserHostedRooms(ctx context.Context, userID string, isOpen bool) ([]Room, error)

func (*Store) GetUserJoinedRooms

func (s *Store) GetUserJoinedRooms(ctx context.Context, userID string, isOpen bool) ([]Room, error)

func (*Store) Insert

func (s *Store) Insert(ctx context.Context, insertParams InsertRoomParams) (Room, error)

func (*Store) InsertGuest

func (s *Store) InsertGuest(ctx context.Context, roomCode string, name string) (*Guest, error)

func (*Store) InsertGuestWithID

func (s *Store) InsertGuestWithID(ctx context.Context, roomCode string, name string, guestID string) (*Guest, error)

func (*Store) MarkTracksAsPlayedSince

func (s *Store) MarkTracksAsPlayedSince(ctx context.Context, roomID string, since time.Time) error

func (*Store) RemoveMember

func (s *Store) RemoveMember(ctx context.Context, roomID string, userID string) error

func (*Store) SetIsOpen

func (s *Store) SetIsOpen(ctx context.Context, roomID string, isOpen bool) error

func (*Store) SetModerator

func (s *Store) SetModerator(ctx context.Context, roomID string, userID string, isModerator bool) error

func (*Store) SetQueueTrackGuest

func (s *Store) SetQueueTrackGuest(ctx context.Context, roomCode string, trackID string, guestID string) error

func (*Store) SetQueueTrackUser

func (s *Store) SetQueueTrackUser(ctx context.Context, roomCode string, trackID string, userID string) error

func (*Store) UpdatePassword

func (s *Store) UpdatePassword(ctx context.Context, roomID string, newPassword string) error

func (*Store) UpdateSpotifyToken

func (s *Store) UpdateSpotifyToken(ctx context.Context, code string, oauthToken *oauth2.Token) error

func (*Store) UserIsMember

func (s *Store) UserIsMember(ctx context.Context, roomID string, userID string) (bool, error)

func (*Store) ValidatePassword

func (s *Store) ValidatePassword(ctx context.Context, code string, password string) (bool, error)

Jump to

Keyboard shortcuts

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