import '../channels/channel_id.dart'; import '../common/common.dart'; import '../reverse_engineering/pages/playlist_page.dart'; import '../reverse_engineering/youtube_http_client.dart'; import '../videos/video.dart'; import '../videos/video_id.dart'; import 'playlist.dart'; import 'playlist_id.dart'; /// Queries related to YouTube playlists. class PlaylistClient { final YoutubeHttpClient _httpClient; /// Initializes an instance of [PlaylistClient] PlaylistClient(this._httpClient); /// Gets the metadata associated with the specified playlist. Future get(dynamic id) async { id = PlaylistId.fromString(id); var response = await PlaylistPage.get(_httpClient, (id as PlaylistId).value); return Playlist( id, response.title ?? '', response.author ?? '', response.description ?? '', ThumbnailSet(id.value), Engagement(response.viewCount ?? 0, null, null), response.videoCount); } /// Enumerates videos included in the specified playlist. Stream