services

package
v0.0.0-...-a1716bb Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitServices

func InitServices()

Types

type SpotifyUserPlaylistService

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

TODO: removed this, it is unnecessary, especially that all these values can be found in config obj

func (*SpotifyUserPlaylistService) DeleteFavTracksSnapshot

func (ups *SpotifyUserPlaylistService) DeleteFavTracksSnapshot(username string, timestamp string) (*models.FavTracksSnapshot, error)

func (*SpotifyUserPlaylistService) DeletePlaylistsSnapshot

func (ups *SpotifyUserPlaylistService) DeletePlaylistsSnapshot(username string, timestamp string) (*models.PlaylistsSnapshot, error)

func (*SpotifyUserPlaylistService) DownloadCurrentUserPlaylists

func (ups *SpotifyUserPlaylistService) DownloadCurrentUserPlaylists(accessToken string) (playlists []models.SpPlaylist, err *models.SpAPIError)

DownloadCurrentUserPlaylists more info: https://developer.spotify.com/console/get-current-user-playlists/

func (*SpotifyUserPlaylistService) DownloadPlaylistTracks

func (ups *SpotifyUserPlaylistService) DownloadPlaylistTracks(accessToken string, href string, total int) (tracks []models.SpPlaylistTrack, err *models.SpAPIError)

func (*SpotifyUserPlaylistService) DownloadSavedFavTracks

func (ups *SpotifyUserPlaylistService) DownloadSavedFavTracks(accessToken string) (tracks []models.SpAddedTrack, err *models.SpAPIError)

func (*SpotifyUserPlaylistService) GetAllFavTracksSnapshots

func (ups *SpotifyUserPlaylistService) GetAllFavTracksSnapshots(username string) []models.FavTracksSnapshot

func (*SpotifyUserPlaylistService) GetAllPlaylistsSnapshots

func (ups *SpotifyUserPlaylistService) GetAllPlaylistsSnapshots(username string) []models.PlaylistsSnapshot

func (*SpotifyUserPlaylistService) GetFavTracksSnapshotByTimestamp

func (ups *SpotifyUserPlaylistService) GetFavTracksSnapshotByTimestamp(username string, timestamp string) (*models.FavTracksSnapshot, error)

func (*SpotifyUserPlaylistService) GetPlaylistsSnapshotByTimestamp

func (ups *SpotifyUserPlaylistService) GetPlaylistsSnapshotByTimestamp(username string, timestamp string) (*models.PlaylistsSnapshot, error)

func (*SpotifyUserPlaylistService) SaveFavTracksSnapshot

func (ups *SpotifyUserPlaylistService) SaveFavTracksSnapshot(ft *models.FavTracksSnapshot) (saved bool)

func (*SpotifyUserPlaylistService) SavePlaylistsSnapshot

func (ups *SpotifyUserPlaylistService) SavePlaylistsSnapshot(ps *models.PlaylistsSnapshot) (saved bool)

type UserPlaylistService

type UserPlaylistService interface {
	DownloadCurrentUserPlaylists(accessToken string) (playlists []models.SpPlaylist, err *models.SpAPIError)
	DownloadPlaylistTracks(accessToken string, href string, total int) (tracks []models.SpPlaylistTrack, err *models.SpAPIError)
	DownloadSavedFavTracks(accessToken string) (tracks []models.SpAddedTrack, err *models.SpAPIError)
	SaveFavTracksSnapshot(ft *models.FavTracksSnapshot) (saved bool)
	SavePlaylistsSnapshot(ps *models.PlaylistsSnapshot) (saved bool)
	GetFavTracksSnapshotByTimestamp(username string, timestamp string) (*models.FavTracksSnapshot, error)
	GetPlaylistsSnapshotByTimestamp(username string, timestamp string) (*models.PlaylistsSnapshot, error)
	GetAllFavTracksSnapshots(username string) []models.FavTracksSnapshot
	GetAllPlaylistsSnapshots(username string) []models.PlaylistsSnapshot
	DeletePlaylistsSnapshot(username string, timestamp string) (*models.PlaylistsSnapshot, error)
	DeleteFavTracksSnapshot(username string, timestamp string) (*models.FavTracksSnapshot, error)
}
var UserPlaylist UserPlaylistService

func NewSpotifyUserPlaylistService

func NewSpotifyUserPlaylistService(spotifyDB db.SpotifyDBClient) UserPlaylistService

func NewUserPlaylistTestService

func NewUserPlaylistTestService(currentSnapshots []models.SpAddedTrack, tracksSnapshots []models.FavTracksSnapshot) UserPlaylistService

type UserPlaylistTestService

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

func (*UserPlaylistTestService) DeleteFavTracksSnapshot

func (ups *UserPlaylistTestService) DeleteFavTracksSnapshot(username string, timestamp string) (*models.FavTracksSnapshot, error)

func (*UserPlaylistTestService) DeletePlaylistsSnapshot

func (ups *UserPlaylistTestService) DeletePlaylistsSnapshot(username string, timestamp string) (*models.PlaylistsSnapshot, error)

func (*UserPlaylistTestService) DownloadCurrentUserPlaylists

func (ups *UserPlaylistTestService) DownloadCurrentUserPlaylists(accessToken string) (playlists []models.SpPlaylist, err *models.SpAPIError)

func (*UserPlaylistTestService) DownloadPlaylistTracks

func (ups *UserPlaylistTestService) DownloadPlaylistTracks(accessToken string, href string, total int) (tracks []models.SpPlaylistTrack, err *models.SpAPIError)

func (*UserPlaylistTestService) DownloadSavedFavTracks

func (ups *UserPlaylistTestService) DownloadSavedFavTracks(accessToken string) (tracks []models.SpAddedTrack, err *models.SpAPIError)

func (*UserPlaylistTestService) GetAllFavTracksSnapshots

func (ups *UserPlaylistTestService) GetAllFavTracksSnapshots(username string) []models.FavTracksSnapshot

func (*UserPlaylistTestService) GetAllPlaylistsSnapshots

func (ups *UserPlaylistTestService) GetAllPlaylistsSnapshots(username string) []models.PlaylistsSnapshot

func (*UserPlaylistTestService) GetFavTracksSnapshotByTimestamp

func (ups *UserPlaylistTestService) GetFavTracksSnapshotByTimestamp(username string, timestamp string) (*models.FavTracksSnapshot, error)

func (*UserPlaylistTestService) GetPlaylistsSnapshotByTimestamp

func (ups *UserPlaylistTestService) GetPlaylistsSnapshotByTimestamp(username string, timestamp string) (*models.PlaylistsSnapshot, error)

func (*UserPlaylistTestService) SaveFavTracksSnapshot

func (ups *UserPlaylistTestService) SaveFavTracksSnapshot(ft *models.FavTracksSnapshot) (saved bool)

func (*UserPlaylistTestService) SavePlaylistsSnapshot

func (ups *UserPlaylistTestService) SavePlaylistsSnapshot(ps *models.PlaylistsSnapshot) (saved bool)

type UserService

type UserService struct {
	// contains filtered or unexported fields
}
var Users *UserService

func NewUserService

func NewUserService(cookiesDBClient db.CookiesDBClient, usersDB db.UsersDBClient) *UserService

func NewUserServiceTest

func NewUserServiceTest() *UserService

func (*UserService) Add

func (us *UserService) Add(user *models.User)

func (*UserService) AddUserCookie

func (us *UserService) AddUserCookie(cookieID string, username string)

func (*UserService) Exists

func (us *UserService) Exists(username string) (found bool)

func (*UserService) Get

func (us *UserService) Get(username string) (user *models.User, err error)

func (*UserService) GetCookieIDByUsername

func (us *UserService) GetCookieIDByUsername(username string) (string, error)

func (*UserService) GetUserByCookieID

func (us *UserService) GetUserByCookieID(cookieID string) (user *models.User, err error)

func (*UserService) GetUserByRequestCookieID

func (us *UserService) GetUserByRequestCookieID(r *http.Request) (user *models.User, err error)

func (*UserService) GetUserFromSpotify

func (us *UserService) GetUserFromSpotify(accessToken string) (user *models.SpUser, err error)

func (*UserService) GetUsernameByCookieID

func (us *UserService) GetUsernameByCookieID(cookieID string) (username string, found bool)

func (*UserService) RemoveUserCookie

func (us *UserService) RemoveUserCookie(cookieID string)

func (*UserService) Save

func (us *UserService) Save(user *models.User) (stored bool)

func (*UserService) StoreCookiesToDB

func (us *UserService) StoreCookiesToDB()

func (*UserService) SyncWithDB

func (us *UserService) SyncWithDB()

Jump to

Keyboard shortcuts

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