botx_api/api/v3/chats/info/
models.rs1use chrono::{DateTime, Utc};
2use serde::{Serialize, Deserialize};
3use uuid::Uuid;
4
5use crate::{bot::models::{ChatType, UserKind}, api::models::{ChatNotFound, ErrorFromMessagingService}};
6
7#[derive(Debug, Serialize, Deserialize, Clone)]
9pub struct ChatInfoResponse {
10 pub result: ChatInfoResult,
12}
13
14#[derive(Debug, Serialize, Deserialize, Clone)]
16pub struct ChatInfoResult {
17 pub chat_type: ChatType,
18 pub creator: Uuid,
19 pub description: Option<String>,
20 pub group_chat_id: Uuid,
21 pub inserted_at: DateTime<Utc>,
22 pub members: Vec<ChatMember>,
23 pub name: String,
24 pub shared_history: bool,
25}
26
27#[derive(Debug, Serialize, Deserialize, Clone)]
29pub struct ChatMember {
30 pub admin: bool,
32
33 pub server_id: Uuid,
35
36 pub user_huid: Uuid,
38
39 pub user_kind: UserKind,
41}
42
43#[derive(Debug, Serialize, Deserialize, Clone)]
45#[serde(tag = "reason")]
46pub enum ChatInfoError {
47 #[serde(rename(serialize = "chat_not_found", deserialize = "chat_not_found"))]
49 ChatNotFound(ChatNotFound),
50
51 #[serde(rename(serialize = "error_from_messaging_service", deserialize = "error_from_messaging_service"))]
53 ErrorFromMessagingService(ErrorFromMessagingService),
54
55 #[serde(other)]
58 Other,
59}