feat: add verification to channel model

- clean up response models
- change verification status serialization
This commit is contained in:
ThetaDev 2022-10-18 11:45:51 +02:00
parent 4d80dffcd5
commit 9aafb84e0f
35 changed files with 459 additions and 451 deletions

View file

@ -4,6 +4,7 @@ use serde::Deserialize;
use serde_with::serde_as;
use serde_with::{DefaultOnError, VecSkipError};
use crate::serializer::text::TextComponent;
use crate::serializer::{
ignore_any,
text::{AccessibilityText, AttributedText, Text, TextComponents},
@ -12,9 +13,9 @@ use crate::serializer::{
use super::{
url_endpoint::BrowseEndpoint, ContinuationEndpoint, ContinuationItemRenderer, Icon,
MusicContinuation, Thumbnails, VideoOwner,
MusicContinuation, Thumbnails,
};
use super::{ResponseContext, YouTubeListItem};
use super::{ChannelBadge, ResponseContext, YouTubeListItem};
/*
#VIDEO DETAILS
@ -175,6 +176,27 @@ pub(crate) struct ToggleButton {
pub accessibility_data: String,
}
/// Video channel information
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct VideoOwner {
pub video_owner_renderer: VideoOwnerRenderer,
}
/// Video channel information
#[serde_as]
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct VideoOwnerRenderer {
pub title: TextComponent,
pub thumbnail: Thumbnails,
#[serde_as(as = "Option<Text>")]
pub subscriber_count_text: Option<String>,
#[serde(default)]
#[serde_as(as = "VecSkipError<_>")]
pub badges: Vec<ChannelBadge>,
}
/// Shows additional video metadata. Its only known use is for
/// the Creative Commonse License.
#[derive(Debug, Deserialize)]
@ -382,13 +404,6 @@ pub(crate) struct CommentItemSectionHeader {
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CommentItemSectionHeaderRenderer {
/// Approximate comment count (e.g. `81`, `2.2K`, `705K`)
///
/// The accurate count is included in the first comment response.
///
/// Is `None` if there are no comments.
#[serde_as(as = "Option<Text>")]
pub contextual_info: Option<String>,
pub menu: CommentItemSectionHeaderMenu,
}