use super::ZapApiError;
use super::ZapService;
use serde_json::Value;
use std::collections::HashMap;
pub fn channels(service: &ZapService) -> Result<Value, ZapApiError> {
let params = HashMap::new();
super::call(service, "websocket", "view", "channels", params)
}
pub fn message(
service: &ZapService,
channelid: String,
messageid: String,
) -> Result<Value, ZapApiError> {
let mut params = HashMap::new();
params.insert("channelId".to_string(), channelid);
params.insert("messageId".to_string(), messageid);
super::call(service, "websocket", "view", "message", params)
}
pub fn messages(
service: &ZapService,
channelid: String,
start: String,
count: String,
payloadpreviewlength: String,
) -> Result<Value, ZapApiError> {
let mut params = HashMap::new();
params.insert("channelId".to_string(), channelid);
params.insert("start".to_string(), start);
params.insert("count".to_string(), count);
params.insert("payloadPreviewLength".to_string(), payloadpreviewlength);
super::call(service, "websocket", "view", "messages", params)
}
pub fn break_text_message(service: &ZapService) -> Result<Value, ZapApiError> {
let params = HashMap::new();
super::call(service, "websocket", "view", "breakTextMessage", params)
}
pub fn send_text_message(
service: &ZapService,
channelid: String,
outgoing: String,
message: String,
) -> Result<Value, ZapApiError> {
let mut params = HashMap::new();
params.insert("channelId".to_string(), channelid);
params.insert("outgoing".to_string(), outgoing);
params.insert("message".to_string(), message);
super::call(service, "websocket", "action", "sendTextMessage", params)
}
pub fn set_break_text_message(
service: &ZapService,
message: String,
outgoing: String,
) -> Result<Value, ZapApiError> {
let mut params = HashMap::new();
params.insert("message".to_string(), message);
params.insert("outgoing".to_string(), outgoing);
super::call(
service,
"websocket",
"action",
"setBreakTextMessage",
params,
)
}