llmrix_rust_sdk/resources/
conversations.rs1use std::sync::Arc;
2use crate::{error::Result, model::*, transport::*};
3
4pub struct ConversationsResource {
6 pub(crate) t: Arc<Transport>,
7}
8
9impl ConversationsResource {
10 pub async fn create(&self, req: ConversationCreateRequest) -> Result<Conversation> {
12 self.t.post(&path_conversations(), &req).await
13 }
14
15 pub async fn list(&self, last_id: i64, size: u32) -> Result<PageResult<Conversation>> {
17 let path = format!("{}?lastId={}&size={}", path_conversations(), last_id, size);
18 self.t.get(&path).await
19 }
20
21 pub async fn get(&self, id: &str) -> Result<Conversation> {
23 self.t.get(&path_conversation(id)).await
24 }
25
26 pub async fn update(&self, id: &str, req: ConversationUpdateRequest) -> Result<Conversation> {
28 self.t.patch(&path_conversation(id), &req).await
29 }
30
31 pub async fn delete(&self, id: &str) -> Result<()> {
33 self.t.delete(&path_conversation(id)).await
34 }
35
36 pub async fn messages(&self, id: &str, last_id: i64, size: u32) -> Result<PageResult<Message>> {
38 let path = format!("{}?lastId={}&size={}", path_messages(id), last_id, size);
39 self.t.get(&path).await
40 }
41}