Expand description
§kick-api
Rust client for the Kick.com API.
Covers channels, users, chat, moderation, rewards, event subscriptions, and live chat over WebSocket. Handles OAuth 2.1 (PKCE) authentication and automatic retry on rate limits (429).
§Live Chat (no auth required)
use kick_api::LiveChatClient;
// Connect by username
let mut chat = LiveChatClient::connect_by_username("xqc").await?;
// Or connect by chatroom ID directly
// let mut chat = LiveChatClient::connect(668).await?;
while let Some(msg) = chat.next_message().await? {
println!("{}: {}", msg.sender.username, msg.content);
}§REST API (requires OAuth token)
use kick_api::{KickApiClient, SendMessageRequest};
let client = KickApiClient::with_token("your_oauth_token".to_string());
// Channels
let channel = client.channels().get("xqc").await?;
// Users
let me = client.users().get_me().await?;
// Chat
let msg = SendMessageRequest {
r#type: "user".to_string(),
content: "Hello chat!".to_string(),
broadcaster_user_id: Some(12345),
reply_to_message_id: None,
};
client.chat().send_message(msg).await?;§Authentication
Kick uses OAuth 2.1 with PKCE. Use KickOAuth to handle the flow:
use kick_api::KickOAuth;
// Load from KICK_CLIENT_ID, KICK_CLIENT_SECRET, KICK_REDIRECT_URI
let oauth = KickOAuth::from_env()?;
let scopes = vec!["chat:write", "user:read", "channel:read"];
let (auth_url, csrf_token, pkce_verifier) = oauth.get_authorization_url(scopes);
// Send the user to auth_url, then exchange the code:
// let token = oauth.exchange_code(code, pkce_verifier).await?;Structs§
- Badge
Image - Image URLs for a subscriber badge.
- BanRequest
- Request body for banning a user
- Category
- Stream category information
- Channel
- Channel information
- Channel
Info - Public channel information from Kick’s v2 API.
- Channel
Reward - Channel reward structure
- Channel
Reward Redemption - Channel reward redemption
- Channel
User - Broadcaster’s user profile.
- Channels
Api - Channels API - handles all channel-related endpoints
- ChatApi
- Chat API - handles chat message endpoints
- Chat
Badge - A badge displayed next to a user’s name in chat
- Chat
Identity - Visual identity information for a chat sender
- Chat
Message Metadata - Metadata attached to a reply message
- Chat
Sender - Sender information for a live chat message
- Chatroom
Info - Chatroom settings for a channel.
- Create
Reward Request - Request body for creating a new reward
- Event
Subscription - An active event subscription
- Events
Api - Events API - handles webhook/event subscription endpoints
- Failed
Redemption - Failed redemption (when batch operations fail)
- Kick
ApiClient - Main Kick API client
- KickO
Auth - Holds OAuth credentials and client for Kick.com
- Live
Chat Client - Client for receiving live chat messages over Kick’s Pusher WebSocket.
- Live
Chat Message - A live chat message received over the Pusher WebSocket
- Livestream
Category - Category information for a livestream.
- Livestream
Info - Current livestream information.
- Manage
Redemptions Request - Request body for accepting/rejecting redemptions
- Manage
Redemptions Response - Response when accepting/rejecting redemptions
- Moderation
Api - Moderation API - handles ban/unban endpoints
- OAuth
Token Response - OAuth token response from Kick
- Original
Message - The content of the message being replied to
- Original
Sender - The sender of the message being replied to
- Pusher
Event - A raw Pusher event received from the WebSocket.
- Redemption
User - User information in a redemption
- Rewards
Api - Rewards API - handles all channel reward endpoints
- Send
Message Request - Request body for sending a chat message
- Send
Message Response - Response from sending a chat message
- Stream
- Live stream information
- Subscribe
Event - A single event to subscribe to
- Subscribe
Request - Request body for creating event subscriptions
- Subscribe
Result - Result of a single event subscription attempt
- Subscriber
Badge - A subscriber badge tier for a channel.
- Token
Introspection - Token introspection response
- Unban
Request - Request body for unbanning a user
- Update
Reward Request - Request body for updating a reward
- User
- User information
- Users
Api - Users API - handles all user-related endpoints
Enums§
- Failure
Reason - Reasons why a redemption operation failed
- Kick
ApiError - Redemption
Status - Redemption status
Functions§
- fetch_
channel_ info - Fetch public channel information from Kick’s v2 API.