Documentation
¶
Index ¶
- type Config
- type CurrentTrack
- type SpotifyClient
- type SpotifySyncServer
- func (s *SpotifySyncServer) Callback(w http.ResponseWriter, req *http.Request)
- func (s *SpotifySyncServer) CurrentTrack(w http.ResponseWriter, req *http.Request)
- func (s *SpotifySyncServer) Home(w http.ResponseWriter, req *http.Request)
- func (s *SpotifySyncServer) Login(w http.ResponseWriter, req *http.Request)
- func (s *SpotifySyncServer) PermitSharer(w http.ResponseWriter, req *http.Request)
- func (s *SpotifySyncServer) RegisterHandlers()
- func (s *SpotifySyncServer) Sync(w http.ResponseWriter, req *http.Request)
- type Track
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
sync.Mutex
Admins []string // Spotify user ids of people with admin priviliges
RegisteredUsers map[string]User `json:"registeredUsers"` // Users who are permitted to share music
Oauth2Cfg oauth2.Config
ListenAddress string
Host string
Filepath string `json:"-"`
}
func NewConfigFromFile ¶
type CurrentTrack ¶
type SpotifyClient ¶
type SpotifyClient struct {
Cfg *Config
// contains filtered or unexported fields
}
func NewSpotifyClient ¶
func NewSpotifyClient(cfg *Config) *SpotifyClient
func (*SpotifyClient) CurrentlyPlaying ¶
func (c *SpotifyClient) CurrentlyPlaying(ctx context.Context, user User) (CurrentTrack, error)
func (*SpotifyClient) UserFromToken ¶
type SpotifySyncServer ¶
type SpotifySyncServer struct {
SpotifyClient *SpotifyClient
Cfg *Config
}
func (*SpotifySyncServer) Callback ¶
func (s *SpotifySyncServer) Callback(w http.ResponseWriter, req *http.Request)
spotify oauth2 callback
func (*SpotifySyncServer) CurrentTrack ¶
func (s *SpotifySyncServer) CurrentTrack(w http.ResponseWriter, req *http.Request)
func (*SpotifySyncServer) Home ¶
func (s *SpotifySyncServer) Home(w http.ResponseWriter, req *http.Request)
func (*SpotifySyncServer) Login ¶
func (s *SpotifySyncServer) Login(w http.ResponseWriter, req *http.Request)
initiate spotify 3-legged oauth
func (*SpotifySyncServer) PermitSharer ¶
func (s *SpotifySyncServer) PermitSharer(w http.ResponseWriter, req *http.Request)
func (*SpotifySyncServer) RegisterHandlers ¶
func (s *SpotifySyncServer) RegisterHandlers()
func (*SpotifySyncServer) Sync ¶
func (s *SpotifySyncServer) Sync(w http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.