Lines
100 %
Functions
38.28 %
Branches
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
#[derive(Deserialize)]
pub struct GetTokenInfo {
pub data: TokenInfo,
}
pub struct TokenInfo {
#[serde(rename = "userId")]
pub _user_id: String,
#[serde(rename = "account")]
pub _account: String,
#[serde(rename = "name")]
pub _name: String,
pub roles: HashMap<String, bool>,
#[serde(rename = "clientId")]
pub _client_id: String,
#[serde(rename = "scopes")]
pub _scopes: Vec<String>,
pub struct GetCount {
pub data: GetCountData,
pub struct GetCountData {
pub count: u64,
pub struct GetUnit {
pub data: Unit,
/// The unit response that is from broker GET API and **ONLY be serialized for CSV**.
#[derive(Deserialize, Serialize)]
pub struct Unit {
#[serde(rename = "unitId")]
pub unit_id: String,
pub code: String,
#[serde(rename = "createdAt")]
pub created_at: String,
#[serde(rename = "modifiedAt")]
pub modified_at: String,
#[serde(rename = "ownerId")]
pub owner_id: String,
#[serde(rename(deserialize = "memberIds"), skip_serializing)]
pub member_ids: Vec<String>,
#[serde(rename(serialize = "memberIds"))]
pub member_ids_str: Option<String>,
pub name: String,
#[serde(skip_serializing)]
pub info: Map<String, Value>,
#[serde(rename(serialize = "info"))]
pub info_str: Option<String>,
pub struct PostApplication {
pub data: PostApplicationData,
pub struct PostApplicationData {
#[serde(rename = "applicationId")]
pub application_id: String,
pub password: Option<String>,
pub struct GetApplication {
pub data: GetApplicationData,
pub struct GetApplicationData {
#[serde(rename = "unitCode")]
pub unit_code: String,
#[serde(rename = "hostUri")]
pub host_uri: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub ttl: Option<usize>,
pub length: Option<usize>,
#[derive(Serialize)]
pub struct GetApplicationStats {
pub data: GetApplicationStatsData,
pub struct GetApplicationStatsData {
pub uldata: Stats,
#[serde(rename = "dldataResp")]
pub dldata_resp: Stats,
#[serde(rename = "dldataResult")]
pub dldata_result: Stats,
pub struct PostNetwork {
pub data: PostNetworkData,
pub struct PostNetworkData {
#[serde(rename = "networkId")]
pub network_id: String,
pub struct GetNetwork {
pub data: GetNetworkData,
pub struct GetNetworkData {
pub unit_id: Option<String>,
pub unit_code: Option<String>,
pub struct GetNetworkStats {
pub data: GetNetworkStatsData,
pub struct GetNetworkStatsData {
pub dldata: Stats,
pub ctrl: Stats,
#[derive(Default, Serialize)]
pub struct Stats {
pub consumers: usize,
pub messages: usize,
#[serde(rename = "publishRate")]
pub publish_rate: f64,
#[serde(rename = "deliverRate")]
pub deliver_rate: f64,
pub struct GetDevice {
pub data: Device,
pub struct Device {
#[serde(rename = "deviceId")]
pub _device_id: String,
pub _unit_id: String,
pub _unit_code: Option<String>,
pub _network_id: String,
#[serde(rename = "networkCode")]
pub _network_code: String,
#[serde(rename = "networkAddr")]
pub network_addr: String,
pub _created_at: String,
pub _modified_at: String,
#[serde(rename = "info")]
pub _info: Map<String, Value>,