use super::MessageV3Event;
use serde_json::Value;
pub(crate) fn ready(
channel_sync_session_id: &str,
generation: u64,
) -> Result<MessageV3Event, crate::ImError> {
super::encode(
"im:channel-sync-ready",
serde_json::json!({
"channelSyncSessionId": channel_sync_session_id,
"generation": generation,
"defaultPageSize": crate::channel_sync::PAGE_SIZE,
}),
)
}
pub(crate) fn page(
channel_sync_session_id: &str,
generation: u64,
items: Vec<Value>,
has_more: bool,
next_cursor: Option<&str>,
) -> Result<MessageV3Event, crate::ImError> {
super::encode(
"im:channel-sync-page",
serde_json::json!({
"channelSyncSessionId": channel_sync_session_id,
"generation": generation,
"items": items,
"hasMore": has_more,
"nextCursor": next_cursor,
}),
)
}
pub(crate) fn complete(
channel_sync_session_id: &str,
generation: u64,
) -> Result<MessageV3Event, crate::ImError> {
super::encode(
"im:channel-sync-complete",
serde_json::json!({
"channelSyncSessionId": channel_sync_session_id,
"generation": generation,
}),
)
}
pub(crate) fn subtopics_ready(parent_channel_id: &str) -> Result<MessageV3Event, crate::ImError> {
super::encode(
"im:subtopics-sync-ready",
serde_json::json!({
"channelId": parent_channel_id,
}),
)
}