1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use crate::{
channel, playlist, stream, video, youtube::innertube::Api, Channel, Playlist, Stream, Video,
};
#[allow(missing_debug_implementations)]
#[derive(Clone, Default)]
pub struct Client {
pub(crate) api: Api,
}
impl Client {
pub fn new() -> Self {
Self::default()
}
pub async fn video(&self, id: video::Id) -> crate::Result<Video> {
Video::get(self.clone(), id).await
}
pub async fn streams(&self, id: video::Id) -> crate::Result<impl Iterator<Item = Stream>> {
stream::get(self.clone(), id).await
}
pub async fn playlist(&self, id: playlist::Id) -> crate::Result<Playlist> {
Playlist::get(self.clone(), id).await
}
pub async fn channel(&self, id: channel::Id) -> crate::Result<Channel> {
Channel::get(self.clone(), id).await
}
}