Documentation ¶
Index ¶
- type AddItemsToPlaylistBody
- type AddItemsToPlaylistPayload
- type CreatePlaylistBody
- type CreatePlaylistPayload
- type Playlist
- type PlaylistItem
- type VideoID
- type VideoSearchResult
- type YouTubeClient
- func (c *YouTubeClient) AddItemsToPlaylist(accessToken string, payload AddItemsToPlaylistPayload) error
- func (c *YouTubeClient) CreatePlaylist(accessToken string, payload CreatePlaylistPayload) (*youtube.Playlist, error)
- func (c *YouTubeClient) DeletePlaylist(accessToken, playlistID string) error
- func (c *YouTubeClient) GetCurrentUserPlaylists(accessToken string) (YouTubePlaylistsResponse, error)
- func (c *YouTubeClient) GetPlaylistItems(playlistID, accessToken string) (YouTubePlaylistItemsResponse, error)
- func (c *YouTubeClient) RequestToken(payload url.Values) (utils.TokenResponse, error)
- func (c *YouTubeClient) SearchVideos(accessToken, query string, maxResults int64) ([]utils.UnifiedTrackSearchResult, error)
- type YouTubeHandler
- func (h *YouTubeHandler) AddItemsToPlaylistHandler(c *gin.Context)
- func (h *YouTubeHandler) CallbackHandler(c *gin.Context)
- func (h *YouTubeHandler) CheckAuthHandler(c *gin.Context)
- func (h *YouTubeHandler) CreatePlaylistHandler(c *gin.Context)
- func (h *YouTubeHandler) DeletePlaylistHandler(c *gin.Context)
- func (h *YouTubeHandler) GetCurrentUserPlaylistsHandler(c *gin.Context)
- func (h *YouTubeHandler) GetPlaylistItemsHandler(c *gin.Context)
- func (h *YouTubeHandler) LoginHandler(c *gin.Context)
- func (h *YouTubeHandler) LogoutHandler(c *gin.Context)
- func (h *YouTubeHandler) SearchVideosHandler(c *gin.Context)
- type YouTubePlaylistItemsResponse
- type YouTubePlaylistsResponse
- type YouTubeService
- func (s *YouTubeService) AddItemsToPlaylist(userID string, payload AddItemsToPlaylistPayload) error
- func (s *YouTubeService) CreatePlaylist(userID string, payload CreatePlaylistPayload) (*youtube.Playlist, error)
- func (s *YouTubeService) DeletePlaylist(userID, playlistID string) error
- func (s *YouTubeService) GetCurrentUserPlaylists(userID string) (YouTubePlaylistsResponse, error)
- func (s *YouTubeService) GetPlaylistItems(userID, playlistID string) (YouTubePlaylistItemsResponse, error)
- func (s *YouTubeService) HandleCallback(code, userID, sessionID string) error
- func (s *YouTubeService) SearchVideos(userID, artistName, songTitle string) ([]utils.UnifiedTrackSearchResult, error)
- func (s *YouTubeService) StartLoginFlow() (string, string, error)
- type YouTubeVideoSearchResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddItemsToPlaylistBody ¶
type AddItemsToPlaylistBody struct { UserID string `json:"userId"` Payload AddItemsToPlaylistPayload `json:"payload"` }
type CreatePlaylistBody ¶
type CreatePlaylistBody struct { UserID string `json:"userId"` Payload CreatePlaylistPayload `json:"payload"` }
type CreatePlaylistPayload ¶
type PlaylistItem ¶
type VideoSearchResult ¶
type YouTubeClient ¶
type YouTubeClient struct {
AppContext *utils.AppContext
}
func NewYouTubeClient ¶
func NewYouTubeClient(appCtx *utils.AppContext) *YouTubeClient
func (*YouTubeClient) AddItemsToPlaylist ¶
func (c *YouTubeClient) AddItemsToPlaylist(accessToken string, payload AddItemsToPlaylistPayload) error
Adds items to an existing YouTube playlist
func (*YouTubeClient) CreatePlaylist ¶
func (c *YouTubeClient) CreatePlaylist(accessToken string, payload CreatePlaylistPayload) (*youtube.Playlist, error)
Creates a new YouTube playlist
func (*YouTubeClient) DeletePlaylist ¶
func (c *YouTubeClient) DeletePlaylist(accessToken, playlistID string) error
Deletes the specified YouTube playlist
func (*YouTubeClient) GetCurrentUserPlaylists ¶
func (c *YouTubeClient) GetCurrentUserPlaylists(accessToken string) (YouTubePlaylistsResponse, error)
Gets the current user's playlists
func (*YouTubeClient) GetPlaylistItems ¶
func (c *YouTubeClient) GetPlaylistItems(playlistID, accessToken string) (YouTubePlaylistItemsResponse, error)
Gets a playlist's items
func (*YouTubeClient) RequestToken ¶
func (c *YouTubeClient) RequestToken(payload url.Values) (utils.TokenResponse, error)
Requests a new access token from Google
func (*YouTubeClient) SearchVideos ¶
func (c *YouTubeClient) SearchVideos(accessToken, query string, maxResults int64) ([]utils.UnifiedTrackSearchResult, error)
Searches for videos on YouTube based on a query
type YouTubeHandler ¶
type YouTubeHandler struct {
// contains filtered or unexported fields
}
func NewYouTubeHandler ¶
func NewYouTubeHandler(youTubeService *YouTubeService) *YouTubeHandler
func (*YouTubeHandler) AddItemsToPlaylistHandler ¶
func (h *YouTubeHandler) AddItemsToPlaylistHandler(c *gin.Context)
Handles the insertion of multiple items into a YouTube playlist
func (*YouTubeHandler) CallbackHandler ¶
func (h *YouTubeHandler) CallbackHandler(c *gin.Context)
After user authorizes the application, Google redirects to a specified callback URL
func (*YouTubeHandler) CheckAuthHandler ¶
func (h *YouTubeHandler) CheckAuthHandler(c *gin.Context)
Checks YouTube authentication status for a specific user
func (*YouTubeHandler) CreatePlaylistHandler ¶
func (h *YouTubeHandler) CreatePlaylistHandler(c *gin.Context)
Handles the creation of a new playlist
func (*YouTubeHandler) DeletePlaylistHandler ¶
func (h *YouTubeHandler) DeletePlaylistHandler(c *gin.Context)
Handles the deletion of a YouTube playlist
func (*YouTubeHandler) GetCurrentUserPlaylistsHandler ¶
func (h *YouTubeHandler) GetCurrentUserPlaylistsHandler(c *gin.Context)
Handles the retrieval of the current user's YouTube playlists
func (*YouTubeHandler) GetPlaylistItemsHandler ¶
func (h *YouTubeHandler) GetPlaylistItemsHandler(c *gin.Context)
Handles the retrieval of the current user's Spotify playlists
func (*YouTubeHandler) LoginHandler ¶
func (h *YouTubeHandler) LoginHandler(c *gin.Context)
Sends the session ID and redirect auth URL to the frontend
func (*YouTubeHandler) LogoutHandler ¶
func (h *YouTubeHandler) LogoutHandler(c *gin.Context)
Handles a Google de-authentication
func (*YouTubeHandler) SearchVideosHandler ¶
func (h *YouTubeHandler) SearchVideosHandler(c *gin.Context)
Handles the retrieval of videos that match the given artist name and song title
type YouTubePlaylistItemsResponse ¶
type YouTubePlaylistItemsResponse struct {
Items []PlaylistItem `json:"items"`
}
type YouTubeService ¶
type YouTubeService struct { YouTubeClient *YouTubeClient Auth0Service *auth0.Auth0Service }
func NewYouTubeService ¶
func NewYouTubeService(youTubeClient *YouTubeClient, auth0Service *auth0.Auth0Service) *YouTubeService
func (*YouTubeService) AddItemsToPlaylist ¶
func (s *YouTubeService) AddItemsToPlaylist(userID string, payload AddItemsToPlaylistPayload) error
Wrapper service function for AddItemsToPlaylist client function
func (*YouTubeService) CreatePlaylist ¶
func (s *YouTubeService) CreatePlaylist(userID string, payload CreatePlaylistPayload) (*youtube.Playlist, error)
Wrapper service function for CreatePlaylist client function
func (*YouTubeService) DeletePlaylist ¶
func (s *YouTubeService) DeletePlaylist(userID, playlistID string) error
Wrapper service function for DeletePlaylist client function
func (*YouTubeService) GetCurrentUserPlaylists ¶
func (s *YouTubeService) GetCurrentUserPlaylists(userID string) (YouTubePlaylistsResponse, error)
Wrapper service function for GetCurrentUserPlaylists client function
func (*YouTubeService) GetPlaylistItems ¶
func (s *YouTubeService) GetPlaylistItems(userID, playlistID string) (YouTubePlaylistItemsResponse, error)
Wrapper service function for GetPlaylistItems client function
func (*YouTubeService) HandleCallback ¶
func (s *YouTubeService) HandleCallback(code, userID, sessionID string) error
Handles the callback after user has successfully authorized our app on Google's auth page
func (*YouTubeService) SearchVideos ¶
func (s *YouTubeService) SearchVideos(userID, artistName, songTitle string) ([]utils.UnifiedTrackSearchResult, error)
Wrapper service function for SearchVideos client function
func (*YouTubeService) StartLoginFlow ¶
func (s *YouTubeService) StartLoginFlow() (string, string, error)
Completes the initial steps of the authorization code flow with PKCE
type YouTubeVideoSearchResponse ¶
type YouTubeVideoSearchResponse struct {
Items []VideoSearchResult `json:"items"`
}