safe_vk/responses/member.rs
1use crate::User;
2use serde::Deserialize;
3
4/// Contains counts, participants, chat restrictions, profiles, and groups data
5#[derive(Debug, Deserialize)]
6pub struct Members {
7 /// The total number of conversation members
8 pub count: u64,
9 /// A list of conversation members
10 pub items: Vec<Member>,
11 /// Restrictions applied to the conversation
12 pub chat_restrictions: Option<ChatRestrictions>,
13 /// List of users profiles
14 pub profiles: Vec<User>,
15 /// List of groups involved in the conversation
16 pub groups: Vec<Group>,
17}
18
19/// Represents an individual member within the conversation
20#[derive(Debug, Deserialize)]
21pub struct Member {
22 /// The member's identifier
23 pub member_id: i32,
24 /// Identifier of the user who invited the member
25 pub invited_by: i32,
26 /// The date and time the member was added to the conversation, in Unix Timestamp format
27 pub join_date: u64,
28 /// Indicates whether the member is an administrator.
29 #[serde(default)]
30 pub is_admin: bool,
31 /// Indicates whether the member has the ability to remove other members
32 /// This field may not be present if the member is a bot, a detail not explicitly mentioned in the VK API documentation
33 #[serde(default)]
34 pub can_kick: bool,
35}
36
37/// Information regarding the chat's administrative restrictions
38#[derive(Debug, Deserialize)]
39pub struct ChatRestrictions {
40 /// True if only administrators can promote users to admin status
41 pub admins_promote_users: bool,
42 /// True if only administrators can edit the chat info
43 pub only_admins_edit_info: bool,
44 /// True if only administrators can edit the pinned message
45 pub only_admins_edit_pin: bool,
46 /// True if only administrators can invite new users to the chat
47 pub only_admins_invite: bool,
48 /// True if only administrators can remove users from the chat
49 pub only_admins_kick: bool,
50}
51
52/// Represents a group within the conversation
53#[derive(Debug, Deserialize)]
54pub struct Group {
55 /// The group's identifier
56 pub id: i32,
57 /// The name of the group
58 pub name: String,
59 /// The group's screen name or alias
60 pub screen_name: String,
61 /// Indicates the group's closed status with an integer (likely 0 for open, 1 for closed)
62 pub is_closed: i32,
63 /// The type of the group (e.g., "group")
64 #[serde(rename = "type")]
65 pub group_type: String,
66 /// URL to the group's photo of size 50x50 pixels
67 pub photo_50: String,
68 /// URL to the group's photo of size 100x100 pixels
69 pub photo_100: String,
70 /// URL to the group's photo of size 200x200 pixels
71 pub photo_200: String,
72}