kick_api/models/
livestream.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct Livestream {
8 pub broadcaster_user_id: u64,
10
11 #[serde(skip_serializing_if = "Option::is_none")]
13 pub category: Option<LivestreamCategoryInfo>,
14
15 pub channel_id: u64,
17
18 #[serde(default)]
20 pub custom_tags: Vec<String>,
21
22 pub has_mature_content: bool,
24
25 pub language: String,
27
28 #[serde(skip_serializing_if = "Option::is_none")]
30 pub profile_picture: Option<String>,
31
32 pub slug: String,
34
35 pub started_at: String,
37
38 pub stream_title: String,
40
41 #[serde(skip_serializing_if = "Option::is_none")]
43 pub thumbnail: Option<String>,
44
45 pub viewer_count: u64,
47}
48
49#[derive(Debug, Clone, Serialize, Deserialize)]
51pub struct LivestreamCategoryInfo {
52 pub id: u32,
54
55 pub name: String,
57
58 #[serde(skip_serializing_if = "Option::is_none")]
60 pub slug: Option<String>,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
67pub struct LivestreamStats {
68 pub total_count: u64,
70}
71
72#[derive(Debug, Clone, Copy)]
74pub enum LivestreamSort {
75 ViewerCount,
77 StartedAt,
79}
80
81impl LivestreamSort {
82 pub(crate) fn as_str(&self) -> &'static str {
83 match self {
84 LivestreamSort::ViewerCount => "viewer_count",
85 LivestreamSort::StartedAt => "started_at",
86 }
87 }
88}