src/structs/fullchannel.rs
28 lines · 853 bytes
1use invidious::structs::channel::Channel;
2use serde::{Deserialize, Serialize};
3use thousands::Separable;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct FullChannel {
7 pub author: String,
8 pub author_id: String,
9 pub author_url: String,
10 pub thumbnail: String,
11 pub description: String,
12 pub sub_count: String,
13 pub total_views: String,
14}
15
16impl From<Channel> for FullChannel {
17 fn from(original: Channel) -> Self {
18 Self {
19 author: original.author,
20 author_id: original.authorId,
21 author_url: original.authorUrl,
22 thumbnail: original.authorThumbnails[4].url.clone(),
23 description: original.description,
24 sub_count: original.subCount.separate_with_commas(),
25 total_views: original.totalViews.separate_with_commas(),
26 }
27 }
28}