Skip to main content

kick_api/models/
channel.rs

1use serde::{Deserialize, Serialize};
2
3/// Channel information
4///
5/// Returned when fetching channel data via the `/channels` endpoint
6///
7/// # Example Response
8/// ```json
9/// {
10///   "broadcaster_user_id": 123456,
11///   "slug": "xqc",
12///   "stream_title": "LIVE NOW",
13///   "channel_description": "Welcome to my channel!"
14/// }
15/// ```
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct Channel {
18    /// Number of active subscribers
19    pub active_subscribers_count: u32,
20
21    /// Banner picture URL
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub banner_picture: Option<String>,
24
25    /// Unique broadcaster user identifier
26    pub broadcaster_user_id: u32,
27
28    /// Number of canceled subscribers
29    pub canceled_subscribers_count: u32,
30
31    /// Current stream category
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub category: Option<Category>,
34
35    /// Channel description text
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub channel_description: Option<String>,
38
39    /// Channel URL slug (unique username)
40    pub slug: String,
41
42    /// Current stream information (if live)
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub stream: Option<Stream>,
45
46    /// Current stream title
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub stream_title: Option<String>,
49}
50
51/// Stream category information
52#[derive(Debug, Clone, Serialize, Deserialize)]
53pub struct Category {
54    /// Unique category identifier
55    pub id: u32,
56
57    /// Category name (e.g., "Just Chatting", "Fortnite")
58    pub name: String,
59
60    /// Category thumbnail URL
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub thumbnail: Option<String>,
63}
64
65/// Live stream information
66#[derive(Debug, Clone, Serialize, Deserialize)]
67pub struct Stream {
68    /// Custom tags set by the streamer
69    #[serde(default)]
70    pub custom_tags: Vec<String>,
71
72    /// Whether the stream is currently live
73    pub is_live: bool,
74
75    /// Whether the stream is marked as mature content
76    pub is_mature: bool,
77
78    /// Stream key identifier
79    pub key: String,
80
81    /// Stream language code (e.g., "en")
82    pub language: String,
83
84    /// When the stream started (ISO 8601)
85    pub start_time: String,
86
87    /// Stream thumbnail URL
88    #[serde(skip_serializing_if = "Option::is_none")]
89    pub thumbnail: Option<String>,
90
91    /// Stream URL
92    pub url: String,
93
94    /// Current viewer count
95    pub viewer_count: u32,
96}