controllers

package
v0.0.0-...-93edf92 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2018 License: BSD-3-Clause Imports: 28 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCache

func SetCache(c cache.Store)

SetCache sets the Party cache store used by controllers

func SetSpotifyAuth

func SetSpotifyAuth(spotifyAuth spotify.Authenticator, spotifyDefaultAuth clientcredentials.Config)

SetSpotifyAuth sets the Spotify client factories used by controllers

Types

type Auth

type Auth struct {
	Controller
	// contains filtered or unexported fields
}

Auth controller for Party authentication

func NewAuth

func NewAuth(spotifyKey, spotifySecret, spotifyCallback string) Auth

NewAuth creates a new Auth controller

func (*Auth) Finished

func (cr *Auth) Finished() gin.HandlerFunc

Finished displays a success message and is suitable for detection in mobile app

func (*Auth) GetToken

func (cr *Auth) GetToken() gin.HandlerFunc

GetToken retreives the Spotify access token for the current user

func (*Auth) GuestPing

func (cr *Auth) GuestPing() gin.HandlerFunc

GuestPing replies to a guest's ping request with "pong"

func (*Auth) Login

func (cr *Auth) Login() gin.HandlerFunc

Login to Party via Spotify's Authorization Grant OAuth flow

func (*Auth) Logout

func (cr *Auth) Logout() gin.HandlerFunc

Logout the current user, if logged in

func (*Auth) Mobile

func (cr *Auth) Mobile() gin.HandlerFunc

Mobile responds with a pretty spinner for mobile client users

func (*Auth) SpotifyCallback

func (cr *Auth) SpotifyCallback() gin.HandlerFunc

SpotifyCallback completes Spotify's Authorization Grant OAuth flow

type Controller

type Controller struct {
	Cache              cache.Store
	SpotifyAuth        spotify.Authenticator
	SpotifyDefaultAuth clientcredentials.Config
}

Controller template

func (*Controller) ClientFromSession

func (cr *Controller) ClientFromSession(c *gin.Context) (*spotify.Client, error)

ClientFromSession gets a Spotify client from the session's user

func (*Controller) RequestURI

func (cr *Controller) RequestURI(c *gin.Context) string

RequestURI gets the full request URI given a Gin request context

func (*Controller) Setup

func (cr *Controller) Setup()

Setup a Controller with a Party cache store and Spotify client factories

type Events

type Events struct {
	Controller
}

Events controller

func NewEvents

func NewEvents() Events

NewEvents creates a new Party controller

func (*Events) Stream

func (cr *Events) Stream(ch string) gin.HandlerFunc

Stream events to a client EventSource

type History

type History struct {
	Controller
}

History controller

func NewHistory

func NewHistory() History

NewHistory creates a new History controller

func (*History) Get

func (cr *History) Get() gin.HandlerFunc

Get the current user's party's History

type Index

type Index struct {
	Controller
}

Index controller

func NewIndex

func NewIndex() Index

NewIndex creates a new Index controller

func (*Index) Get

func (cr *Index) Get() gin.HandlerFunc

Get the index page view

type Party

type Party struct {
	Controller
}

Party controller

func NewParty

func NewParty() Party

NewParty creates a new Party controller

func (*Party) End

func (cr *Party) End() gin.HandlerFunc

End the current user's party

func (*Party) Get

func (cr *Party) Get() gin.HandlerFunc

Get the current user's party

func (*Party) Join

func (cr *Party) Join() gin.HandlerFunc

Join a party as a guest

func (*Party) PruneExpiredGuests

func (cr *Party) PruneExpiredGuests()

PruneExpiredGuests from active parties every five seconds

func (*Party) Start

func (cr *Party) Start() gin.HandlerFunc

Start a new party for the current user

type Playback

type Playback struct {
	Controller
}

Playback controller

func NewPlayback

func NewPlayback() Playback

NewPlayback creates a new Playback controller

func (*Playback) Pause

func (cr *Playback) Pause() gin.HandlerFunc

Pause the party's playlist from playing

func (*Playback) Play

func (cr *Playback) Play() gin.HandlerFunc

Play the party's playlist or resume from paused state

func (*Playback) Skip

func (cr *Playback) Skip() gin.HandlerFunc

Skip they party's current track

type Playlists

type Playlists struct {
	Controller
}

Playlists controller

func NewPlaylists

func NewPlaylists() Playlists

NewPlaylists creates a new Playlists controller

func (*Playlists) Get

func (cr *Playlists) Get() gin.HandlerFunc

Get the user's (host's) current playlist

func (*Playlists) Patch

func (cr *Playlists) Patch() gin.HandlerFunc

Patch the current playlist via the new playlist's Spotify ID

type Queue

type Queue struct {
	Controller
}

Queue controller

func NewQueue

func NewQueue() Queue

NewQueue creates a new Queue controller

func (*Queue) Get

func (cr *Queue) Get() gin.HandlerFunc

Get the current user's party's queue

type Search struct {
	Controller
}

Search controller

func NewSearch

func NewSearch() Search

NewSearch creates a new Search controller

func (*Search) SearchTracks

func (cr *Search) SearchTracks() gin.HandlerFunc

SearchTracks searches for Spotify tracks given a query string

Jump to

Keyboard shortcuts

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