botx_api/api/v3/chats/create/
models.rs1use serde::{Serialize, Deserialize};
2use uuid::Uuid;
3
4use crate::bot::models::ChatType;
5
6#[derive(Debug, Serialize, Deserialize, Default, Clone, Builder)]
8#[builder(setter(into, prefix = "with", strip_option))]
9pub struct CreateChatRequest {
10 pub name : String,
12
13 #[builder(default)]
15 pub description: Option<String>,
16
17 pub chat_type: ChatType,
19
20 pub members: Vec<Uuid>,
22
23 #[builder(default)]
25 pub avatar: Option<String>,
26
27 pub shared_history: bool,
29}
30
31#[derive(Debug, Serialize, Deserialize, Clone)]
33pub struct CreateChatResponse {
34 pub result: CreateChatResult,
36}
37
38#[derive(Debug, Serialize, Deserialize, Clone)]
39pub struct CreateChatResult {
40 pub chat_id: Uuid,
42}
43
44#[derive(Debug, Serialize, Deserialize, Clone)]
46#[serde(tag = "reason")]
47pub enum CreateChatError {
48 #[serde(rename(serialize = "chat_not_found", deserialize = "chat_not_found"))]
50 ChatCreationIsProhibited(ChatCreationIsProhibited),
51
52 #[serde(other)]
55 Other,
56}
57
58#[derive(Debug, Serialize, Deserialize, Clone)]
60pub struct ChatCreationIsProhibited {
61 pub errors: Vec<String>,
63
64 pub error_data: ChatCreationIsProhibitedData,
66}
67
68#[derive(Debug, Serialize, Deserialize, Clone)]
69pub struct ChatCreationIsProhibitedData {
70 pub bot_id: Uuid,
72}