use crate::{Client, RoboatError};
use reqwest::header;
mod request_types;
const UNREAD_CONVERSATION_COUNT_API: &str =
"https://chat.roblox.com/v2/get-unread-conversation-count";
impl Client {
pub async fn unread_conversation_count(&self) -> Result<u64, RoboatError> {
let cookie_string = self.cookie_string()?;
let request_result = self
.reqwest_client
.get(UNREAD_CONVERSATION_COUNT_API)
.header(header::COOKIE, cookie_string)
.send()
.await;
let response = Self::validate_request_result(request_result).await?;
let raw = Self::parse_to_raw::<request_types::UnreadMessageCountResponse>(response).await?;
Ok(raw.count)
}
}