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 /// Example: star_trek , or star_trek@xyz.tld
14 pub name: Option<String>,
15 pub auth: Option<String>,
19 pub struct GetCommunityResponse {
20 pub community_view: CommunityView,
21 pub moderators: Vec<CommunityModeratorView>,
25 #[derive(Deserialize)]
26 pub struct CreateCommunity {
29 pub description: Option<String>,
30 pub icon: Option<String>,
31 pub banner: Option<String>,
32 pub nsfw: Option<bool>,
36 #[derive(Serialize, Clone)]
37 pub struct CommunityResponse {
38 pub community_view: CommunityView,
41 #[derive(Deserialize, Debug)]
42 pub struct ListCommunities {
43 pub type_: Option<String>,
44 pub sort: Option<String>,
45 pub page: Option<i64>,
46 pub limit: Option<i64>,
47 pub auth: Option<String>,
50 #[derive(Serialize, Debug)]
51 pub struct ListCommunitiesResponse {
52 pub communities: Vec<CommunityView>,
55 #[derive(Deserialize, Clone)]
56 pub struct BanFromCommunity {
57 pub community_id: CommunityId,
58 pub person_id: PersonId,
60 pub remove_data: Option<bool>,
61 pub reason: Option<String>,
62 pub expires: Option<i64>,
66 #[derive(Serialize, Clone)]
67 pub struct BanFromCommunityResponse {
68 pub person_view: PersonViewSafe,
72 #[derive(Deserialize)]
73 pub struct AddModToCommunity {
74 pub community_id: CommunityId,
75 pub person_id: PersonId,
80 #[derive(Serialize, Clone)]
81 pub struct AddModToCommunityResponse {
82 pub moderators: Vec<CommunityModeratorView>,
85 #[derive(Deserialize)]
86 pub struct EditCommunity {
87 pub community_id: CommunityId,
88 pub title: Option<String>,
89 pub description: Option<String>,
90 pub icon: Option<String>,
91 pub banner: Option<String>,
92 pub nsfw: Option<bool>,
96 #[derive(Deserialize)]
97 pub struct DeleteCommunity {
98 pub community_id: CommunityId,
103 #[derive(Deserialize)]
104 pub struct RemoveCommunity {
105 pub community_id: CommunityId,
107 pub reason: Option<String>,
108 pub expires: Option<i64>,
112 #[derive(Deserialize)]
113 pub struct FollowCommunity {
114 pub community_id: CommunityId,
119 #[derive(Deserialize)]
120 pub struct GetFollowedCommunities {
125 pub struct GetFollowedCommunitiesResponse {
126 pub communities: Vec<CommunityFollowerView>,
129 #[derive(Deserialize)]
130 pub struct TransferCommunity {
131 pub community_id: CommunityId,
132 pub person_id: PersonId,