1 use lemmy_db_schema::{CommunityId, PersonId};
2 use lemmy_db_views_actor::{
3 community_follower_view::CommunityFollowerView,
4 community_moderator_view::CommunityModeratorView,
5 community_view::CommunityView,
6 person_view::PersonViewSafe,
8 use serde::{Deserialize, Serialize};
10 #[derive(Deserialize)]
11 pub struct GetCommunity {
12 pub id: Option<CommunityId>,
13 pub name: Option<String>,
14 pub auth: Option<String>,
18 pub struct GetCommunityResponse {
19 pub community_view: CommunityView,
20 pub moderators: Vec<CommunityModeratorView>,
24 #[derive(Deserialize)]
25 pub struct CreateCommunity {
28 pub description: Option<String>,
29 pub icon: Option<String>,
30 pub banner: Option<String>,
31 pub nsfw: Option<bool>,
35 #[derive(Serialize, Clone)]
36 pub struct CommunityResponse {
37 pub community_view: CommunityView,
40 #[derive(Deserialize, Debug)]
41 pub struct ListCommunities {
44 pub page: Option<i64>,
45 pub limit: Option<i64>,
46 pub auth: Option<String>,
49 #[derive(Serialize, Debug)]
50 pub struct ListCommunitiesResponse {
51 pub communities: Vec<CommunityView>,
54 #[derive(Deserialize, Clone)]
55 pub struct BanFromCommunity {
56 pub community_id: CommunityId,
57 pub person_id: PersonId,
59 pub remove_data: bool,
60 pub reason: Option<String>,
61 pub expires: Option<i64>,
65 #[derive(Serialize, Clone)]
66 pub struct BanFromCommunityResponse {
67 pub person_view: PersonViewSafe,
71 #[derive(Deserialize)]
72 pub struct AddModToCommunity {
73 pub community_id: CommunityId,
74 pub person_id: PersonId,
79 #[derive(Serialize, Clone)]
80 pub struct AddModToCommunityResponse {
81 pub moderators: Vec<CommunityModeratorView>,
84 #[derive(Deserialize)]
85 pub struct EditCommunity {
86 pub community_id: CommunityId,
88 pub description: Option<String>,
89 pub icon: Option<String>,
90 pub banner: Option<String>,
91 pub nsfw: Option<bool>,
95 #[derive(Deserialize)]
96 pub struct DeleteCommunity {
97 pub community_id: CommunityId,
102 #[derive(Deserialize)]
103 pub struct RemoveCommunity {
104 pub community_id: CommunityId,
106 pub reason: Option<String>,
107 pub expires: Option<i64>,
111 #[derive(Deserialize)]
112 pub struct FollowCommunity {
113 pub community_id: CommunityId,
118 #[derive(Deserialize)]
119 pub struct GetFollowedCommunities {
124 pub struct GetFollowedCommunitiesResponse {
125 pub communities: Vec<CommunityFollowerView>,
128 #[derive(Deserialize)]
129 pub struct TransferCommunity {
130 pub community_id: CommunityId,
131 pub person_id: PersonId,