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/// Request body for updating channel/livestream metadata
66///
67/// At least one field must be specified. Requires `channel:write` scope.
68///
69/// # Example
70/// ```
71/// let update = kick_api::UpdateChannelRequest {
72/// category_id: None,
73/// stream_title: Some("New stream title!".to_string()),
74/// custom_tags: Some(vec!["rust".to_string(), "coding".to_string()]),
75/// };
76/// ```
77#[derive(Debug, Clone, Serialize, Deserialize)]
78pub struct UpdateChannelRequest {
79 /// Category ID to set for the stream (minimum 1)
80 #[serde(skip_serializing_if = "Option::is_none")]
81 pub category_id: Option<u32>,
82
83 /// Stream title (minimum 1 character)
84 #[serde(skip_serializing_if = "Option::is_none")]
85 pub stream_title: Option<String>,
86
87 /// Custom tags for the stream (maximum 10)
88 #[serde(skip_serializing_if = "Option::is_none")]
89 pub custom_tags: Option<Vec<String>>,
90}
91
92/// Live stream information
93#[derive(Debug, Clone, Serialize, Deserialize)]
94pub struct Stream {
95 /// Custom tags set by the streamer
96 #[serde(default)]
97 pub custom_tags: Vec<String>,
98
99 /// Whether the stream is currently live
100 pub is_live: bool,
101
102 /// Whether the stream is marked as mature content
103 pub is_mature: bool,
104
105 /// Stream key identifier
106 pub key: String,
107
108 /// Stream language code (e.g., "en")
109 pub language: String,
110
111 /// When the stream started (ISO 8601)
112 pub start_time: String,
113
114 /// Stream thumbnail URL
115 #[serde(skip_serializing_if = "Option::is_none")]
116 pub thumbnail: Option<String>,
117
118 /// Stream URL
119 pub url: String,
120
121 /// Current viewer count
122 pub viewer_count: u32,
123}