fache 0.1.351

发车工具箱
Documentation
// https://www.rustxiu.com/zh-cn/docs/httpapi/http-api
// 定义Rust的xiu库的响应结果

use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ApiResXiu {
    pub error_code: i32,
    pub desp: String,
    pub data: Vec<DataItemXiu>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DataItemXiu {
    pub publisher: PublisherXiu,
    pub subscriber_count: u32,
    pub subscribers: HashMap<String, SubscriberXiu>,
    pub total_recv_bytes: u64,
    pub total_send_bytes: u64,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PublisherXiu {
    pub audio: PublisherAudioXiu,
    pub id: String,
    pub identifier: IdentifierXiu,

    #[serde(rename = "recv_bitrate(kbits/s)")]
    pub recv_bitrate_kbits_s: u32,

    pub remote_address: String,
    pub start_time: String,
    pub video: PublisherVideoXiu,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PublisherAudioXiu {
    #[serde(rename = "bitrate(kbits/s)")]
    pub bitrate_kbits_s: u32,
    pub channels: u8,
    pub profile: String,
    pub samplerate: u32,
    pub sound_format: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IdentifierXiu {
    pub rtmp: RtmpXiu,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RtmpXiu {
    pub app_name: String,
    pub stream_name: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PublisherVideoXiu {
    #[serde(rename = "bitrate(kbits/s)")]
    pub bitrate_kbits_s: u32,
    pub codec: String,
    pub frame_rate: u8,
    pub gop: u32,
    pub height: u32,
    pub level: String,
    pub profile: String,
    pub width: u32,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SubscriberXiu {
    pub id: String,
    pub remote_address: String,

    #[serde(rename = "send_bitrate(kbits/s)")]
    pub send_bitrate_kbits_s: u32,

    pub start_time: String,
    pub sub_type: String,

    #[serde(rename = "total_send_bytes(kbits/s)")]
    pub total_send_bytes_kbits_s: u64,
}