use serde::Serialize;
use super::channels::WsSubscriptionArg;
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct WsSubRequest {
pub op: String,
pub args: Vec<WsSubscriptionArg>,
}
impl WsSubRequest {
pub fn subscribe(args: Vec<WsSubscriptionArg>) -> Self {
Self {
op: "subscribe".to_string(),
args,
}
}
pub fn unsubscribe(args: Vec<WsSubscriptionArg>) -> Self {
Self {
op: "unsubscribe".to_string(),
args,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct WsLoginRequest {
pub op: String,
pub args: Vec<WsLoginArg>,
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WsLoginArg {
pub api_key: String,
pub passphrase: String,
pub timestamp: String,
pub sign: String,
}
#[derive(Debug, Clone, Serialize)]
pub struct WsApiRequest {
pub id: String,
pub op: String,
pub args: Vec<serde_json::Value>,
}