nil_client/client/
chat.rs1use super::Client;
5use crate::error::Result;
6use crate::http;
7use nil_core::chat::ChatMessageId;
8use nil_payload::chat::*;
9
10impl Client {
11 pub async fn get_chat_history(
12 &self,
13 req: GetChatHistoryRequest,
14 ) -> Result<GetChatHistoryResponse> {
15 http::json_post("get-chat-history")
16 .body(req)
17 .server(self.server)
18 .maybe_authorization(self.authorization.as_ref())
19 .user_agent(&self.user_agent)
20 .send()
21 .await
22 }
23
24 pub async fn push_chat_message(&self, req: PushChatMessageRequest) -> Result<ChatMessageId> {
25 http::json_post("push-chat-message")
26 .body(req)
27 .server(self.server)
28 .maybe_authorization(self.authorization.as_ref())
29 .user_agent(&self.user_agent)
30 .send()
31 .await
32 }
33}