Interface YouTubeAPIVersion3Service

All Known Implementing Classes:
YouTubeAPIVersion3ServiceImpl

public interface YouTubeAPIVersion3Service
Provides convenient access to YouTube service.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.api.services.youtube.model.PlaylistItem
    addPlaylistItem(String playlistId, String videoId)
    Add a previously uploaded video to specified YouTube playlist.
    com.google.api.services.youtube.model.Video
    Upload a video to predefined YouTube channel.
    com.google.api.services.youtube.model.Playlist
    createPlaylist(String title, String description, String... tags)
    Creates YouTube Playlist and adds it to the authorized account.
    com.google.api.services.youtube.model.Playlist
    Get playlist by title.
    com.google.api.services.youtube.model.PlaylistListResponse
    getMyPlaylists(String pageToken, long maxResults)
    Page through all YouTube playlists of predefined channel.
    com.google.api.services.youtube.model.PlaylistItemListResponse
    getPlaylistItems(String playlistId, String pageToken, long maxResults)
    Find YouTube playlist by id.
    com.google.api.services.youtube.model.Video
    Get video by id.
    void
    Configure the underlying YouTube instance.
    void
    Remove a previously created YouTube playlist.
    void
    Remove a previously uploaded video from YouTube.
    void
    removeVideoFromPlaylist(String playlistId, String videoId)
    Remove a previously uploaded video from specified YouTube playlist.
    com.google.api.services.youtube.model.SearchListResponse
    searchMyVideos(String queryTerm, String pageToken, long maxResults)
    Search for videos on predefined channel.
  • Method Details

    • initialize

      void initialize(ClientCredentials credentials) throws IOException
      Configure the underlying YouTube instance.
      Parameters:
      credentials - may not be null
      Throws:
      IOException - when configuration files not found.
    • searchMyVideos

      com.google.api.services.youtube.model.SearchListResponse searchMyVideos(String queryTerm, String pageToken, long maxResults) throws IOException
      Search for videos on predefined channel.
      Parameters:
      queryTerm - may not be null
      pageToken - may not be null
      maxResults - may not be null
      Returns:
      zero or more results. Will not be null.
      Throws:
      IOException - when search fails.
    • getVideoById

      com.google.api.services.youtube.model.Video getVideoById(String videoId) throws IOException
      Get video by id.
      Parameters:
      videoId - may not be null
      Returns:
      null when not found.
      Throws:
      IOException
    • getMyPlaylistByTitle

      com.google.api.services.youtube.model.Playlist getMyPlaylistByTitle(String title) throws IOException
      Get playlist by title.
      Parameters:
      title - may not be null
      Returns:
      null when not found.
      Throws:
      IOException - when lookup fails.
    • getMyPlaylists

      com.google.api.services.youtube.model.PlaylistListResponse getMyPlaylists(String pageToken, long maxResults) throws IOException
      Page through all YouTube playlists of predefined channel.
      Parameters:
      pageToken - identifies a page in result-set.
      maxResults - limit on number of results.
      Returns:
      zero or more Playlist
      Throws:
      IOException - when lookup fails.
    • getPlaylistItems

      com.google.api.services.youtube.model.PlaylistItemListResponse getPlaylistItems(String playlistId, String pageToken, long maxResults) throws IOException
      Find YouTube playlist by id.
      Parameters:
      playlistId - may not be null
      pageToken - may not be null
      maxResults - may not be null
      Returns:
      will not be null
      Throws:
      IOException - when lookup fails.
    • addVideoToMyChannel

      com.google.api.services.youtube.model.Video addVideoToMyChannel(VideoUpload videoUpload) throws IOException
      Upload a video to predefined YouTube channel.
      Parameters:
      videoUpload - may not be null
      Returns:
      YouTube object with non-null id.
      Throws:
      IOException - when transaction fails.
    • addPlaylistItem

      com.google.api.services.youtube.model.PlaylistItem addPlaylistItem(String playlistId, String videoId) throws IOException
      Add a previously uploaded video to specified YouTube playlist.
      Parameters:
      playlistId - may not be null
      videoId - may not be null
      Returns:
      YouTube object which describes mapping, with non-null id.
      Throws:
      IOException
    • createPlaylist

      com.google.api.services.youtube.model.Playlist createPlaylist(String title, String description, String... tags) throws IOException
      Creates YouTube Playlist and adds it to the authorized account.
      Parameters:
      title - may not be null
      description - may not be null
      tags - zero or more tags to be applied to playlist on YouTube.
      Throws:
      IOException
    • removeMyVideo

      void removeMyVideo(String videoId) throws Exception
      Remove a previously uploaded video from YouTube.
      Parameters:
      videoId - may not be null
      Throws:
      Exception - when transaction fails.
    • removeVideoFromPlaylist

      void removeVideoFromPlaylist(String playlistId, String videoId) throws IOException
      Remove a previously uploaded video from specified YouTube playlist.
      Parameters:
      playlistId - may not be null
      videoId - may not be null
      Throws:
      IOException - when transaction fails.
    • removeMyPlaylist

      void removeMyPlaylist(String playlistId) throws IOException
      Remove a previously created YouTube playlist.
      Parameters:
      playlistId - may not be null
      Throws:
      IOException - when transaction fails.