1 use lemmy_db_schema::newtypes::{CommunityId, PersonId};
2 use lemmy_db_views_actor::{
3 community_moderator_view::CommunityModeratorView,
4 community_view::CommunityView,
5 person_view::PersonViewSafe,
7 use lemmy_utils::Sensitive;
8 use serde::{Deserialize, Serialize};
10 #[derive(Debug, Serialize, 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<Sensitive<String>>,
18 #[derive(Debug, Serialize, Deserialize)]
19 pub struct GetCommunityResponse {
20 pub community_view: CommunityView,
21 pub moderators: Vec<CommunityModeratorView>,
25 #[derive(Debug, Serialize, 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>,
33 pub auth: Sensitive<String>,
36 #[derive(Debug, Serialize, Deserialize, Clone)]
37 pub struct CommunityResponse {
38 pub community_view: CommunityView,
41 #[derive(Serialize, 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<Sensitive<String>>,
50 #[derive(Serialize, Deserialize, Debug)]
51 pub struct ListCommunitiesResponse {
52 pub communities: Vec<CommunityView>,
55 #[derive(Debug, Serialize, 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>,
63 pub auth: Sensitive<String>,
66 #[derive(Debug, Serialize, Deserialize, Clone)]
67 pub struct BanFromCommunityResponse {
68 pub person_view: PersonViewSafe,
72 #[derive(Debug, Serialize, Deserialize)]
73 pub struct AddModToCommunity {
74 pub community_id: CommunityId,
75 pub person_id: PersonId,
77 pub auth: Sensitive<String>,
80 #[derive(Debug, Serialize, Deserialize, Clone)]
81 pub struct AddModToCommunityResponse {
82 pub moderators: Vec<CommunityModeratorView>,
85 #[derive(Debug, Serialize, 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>,
93 pub auth: Sensitive<String>,
96 #[derive(Debug, Serialize, Deserialize)]
97 pub struct HideCommunity {
98 pub community_id: CommunityId,
100 pub reason: Option<String>,
101 pub auth: Sensitive<String>,
104 #[derive(Debug, Serialize, Deserialize)]
105 pub struct DeleteCommunity {
106 pub community_id: CommunityId,
108 pub auth: Sensitive<String>,
111 #[derive(Debug, Serialize, Deserialize)]
112 pub struct RemoveCommunity {
113 pub community_id: CommunityId,
115 pub reason: Option<String>,
116 pub expires: Option<i64>,
117 pub auth: Sensitive<String>,
120 #[derive(Debug, Serialize, Deserialize)]
121 pub struct FollowCommunity {
122 pub community_id: CommunityId,
124 pub auth: Sensitive<String>,
127 #[derive(Debug, Serialize, Deserialize)]
128 pub struct BlockCommunity {
129 pub community_id: CommunityId,
131 pub auth: Sensitive<String>,
134 #[derive(Debug, Serialize, Deserialize, Clone)]
135 pub struct BlockCommunityResponse {
136 pub community_view: CommunityView,
140 #[derive(Debug, Serialize, Deserialize)]
141 pub struct TransferCommunity {
142 pub community_id: CommunityId,
143 pub person_id: PersonId,
144 pub auth: Sensitive<String>,