2 newtypes::{CommunityId, PersonId},
27 use serde::{Deserialize, Serialize};
28 use serde_with::skip_serializing_none;
29 #[cfg(feature = "full")]
32 #[skip_serializing_none]
33 #[derive(Debug, Serialize, Deserialize, Clone)]
34 #[cfg_attr(feature = "full", derive(TS))]
35 #[cfg_attr(feature = "full", ts(export))]
36 /// When someone is added as a community moderator.
37 pub struct ModAddCommunityView {
38 pub mod_add_community: ModAddCommunity,
39 pub moderator: Option<Person>,
40 pub community: Community,
41 pub modded_person: Person,
44 #[skip_serializing_none]
45 #[derive(Debug, Serialize, Deserialize, Clone)]
46 #[cfg_attr(feature = "full", derive(TS))]
47 #[cfg_attr(feature = "full", ts(export))]
48 /// When someone is added as a site moderator.
49 pub struct ModAddView {
51 pub moderator: Option<Person>,
52 pub modded_person: Person,
55 #[skip_serializing_none]
56 #[derive(Debug, Serialize, Deserialize, Clone)]
57 #[cfg_attr(feature = "full", derive(TS))]
58 #[cfg_attr(feature = "full", ts(export))]
59 /// When someone is banned from a community.
60 pub struct ModBanFromCommunityView {
61 pub mod_ban_from_community: ModBanFromCommunity,
62 pub moderator: Option<Person>,
63 pub community: Community,
64 pub banned_person: Person,
67 #[skip_serializing_none]
68 #[derive(Debug, Serialize, Deserialize, Clone)]
69 #[cfg_attr(feature = "full", derive(TS))]
70 #[cfg_attr(feature = "full", ts(export))]
71 /// When someone is banned from the site.
72 pub struct ModBanView {
74 pub moderator: Option<Person>,
75 pub banned_person: Person,
78 #[skip_serializing_none]
79 #[derive(Debug, Serialize, Deserialize, Clone)]
80 #[cfg_attr(feature = "full", derive(TS))]
81 #[cfg_attr(feature = "full", ts(export))]
82 /// When a community is hidden from public view.
83 pub struct ModHideCommunityView {
84 pub mod_hide_community: ModHideCommunity,
85 pub admin: Option<Person>,
86 pub community: Community,
89 #[skip_serializing_none]
90 #[derive(Debug, Serialize, Deserialize, Clone)]
91 #[cfg_attr(feature = "full", derive(TS))]
92 #[cfg_attr(feature = "full", ts(export))]
93 /// When a moderator locks a post (prevents new comments being made).
94 pub struct ModLockPostView {
95 pub mod_lock_post: ModLockPost,
96 pub moderator: Option<Person>,
98 pub community: Community,
101 #[skip_serializing_none]
102 #[derive(Debug, Serialize, Deserialize, Clone)]
103 #[cfg_attr(feature = "full", derive(TS))]
104 #[cfg_attr(feature = "full", ts(export))]
105 /// When a moderator removes a comment.
106 pub struct ModRemoveCommentView {
107 pub mod_remove_comment: ModRemoveComment,
108 pub moderator: Option<Person>,
109 pub comment: Comment,
110 pub commenter: Person,
112 pub community: Community,
115 #[skip_serializing_none]
116 #[derive(Debug, Serialize, Deserialize, Clone)]
117 #[cfg_attr(feature = "full", derive(TS))]
118 #[cfg_attr(feature = "full", ts(export))]
119 /// When a moderator removes a community.
120 pub struct ModRemoveCommunityView {
121 pub mod_remove_community: ModRemoveCommunity,
122 pub moderator: Option<Person>,
123 pub community: Community,
126 #[skip_serializing_none]
127 #[derive(Debug, Serialize, Deserialize, Clone)]
128 #[cfg_attr(feature = "full", derive(TS))]
129 #[cfg_attr(feature = "full", ts(export))]
130 /// When a moderator removes a post.
131 pub struct ModRemovePostView {
132 pub mod_remove_post: ModRemovePost,
133 pub moderator: Option<Person>,
135 pub community: Community,
138 #[skip_serializing_none]
139 #[derive(Debug, Serialize, Deserialize, Clone)]
140 #[cfg_attr(feature = "full", derive(TS))]
141 #[cfg_attr(feature = "full", ts(export))]
142 /// When a moderator features a post on a community (pins it to the top).
143 pub struct ModFeaturePostView {
144 pub mod_feature_post: ModFeaturePost,
145 pub moderator: Option<Person>,
147 pub community: Community,
150 #[skip_serializing_none]
151 #[derive(Debug, Serialize, Deserialize, Clone)]
152 #[cfg_attr(feature = "full", derive(TS))]
153 #[cfg_attr(feature = "full", ts(export))]
154 /// When a moderator transfers a community to a new owner.
155 pub struct ModTransferCommunityView {
156 pub mod_transfer_community: ModTransferCommunity,
157 pub moderator: Option<Person>,
158 pub community: Community,
159 pub modded_person: Person,
162 #[skip_serializing_none]
163 #[derive(Debug, Serialize, Deserialize, Clone)]
164 #[cfg_attr(feature = "full", derive(TS))]
165 #[cfg_attr(feature = "full", ts(export))]
166 /// When an admin purges a comment.
167 pub struct AdminPurgeCommentView {
168 pub admin_purge_comment: AdminPurgeComment,
169 pub admin: Option<Person>,
173 #[skip_serializing_none]
174 #[derive(Debug, Serialize, Deserialize, Clone)]
175 #[cfg_attr(feature = "full", derive(TS))]
176 #[cfg_attr(feature = "full", ts(export))]
177 /// When an admin purges a community.
178 pub struct AdminPurgeCommunityView {
179 pub admin_purge_community: AdminPurgeCommunity,
180 pub admin: Option<Person>,
183 #[skip_serializing_none]
184 #[derive(Debug, Serialize, Deserialize, Clone)]
185 #[cfg_attr(feature = "full", derive(TS))]
186 #[cfg_attr(feature = "full", ts(export))]
187 /// When an admin purges a person.
188 pub struct AdminPurgePersonView {
189 pub admin_purge_person: AdminPurgePerson,
190 pub admin: Option<Person>,
193 #[skip_serializing_none]
194 #[derive(Debug, Serialize, Deserialize, Clone)]
195 #[cfg_attr(feature = "full", derive(TS))]
196 #[cfg_attr(feature = "full", ts(export))]
197 /// When an admin purges a post.
198 pub struct AdminPurgePostView {
199 pub admin_purge_post: AdminPurgePost,
200 pub admin: Option<Person>,
201 pub community: Community,
204 #[skip_serializing_none]
205 #[derive(Debug, Serialize, Deserialize, Clone, Copy)]
206 #[cfg_attr(feature = "full", derive(TS))]
207 #[cfg_attr(feature = "full", ts(export))]
208 /// Querying / filtering the modlog.
209 pub struct ModlogListParams {
210 pub community_id: Option<CommunityId>,
211 pub mod_person_id: Option<PersonId>,
212 pub other_person_id: Option<PersonId>,
213 pub page: Option<i64>,
214 pub limit: Option<i64>,
215 pub hide_modlog_names: bool,