-
-
Notifications
You must be signed in to change notification settings - Fork 886
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding comments to all API related types. Fixes #2846
- Loading branch information
1 parent
88a0d2f
commit 784a3b3
Showing
36 changed files
with
484 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ use ts_rs::TS; | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Get a community. Must provide either an id, or a name. | ||
pub struct GetCommunity { | ||
pub id: Option<CommunityId>, | ||
/// Example: star_trek , or [email protected] | ||
|
@@ -26,6 +27,7 @@ pub struct GetCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// The community response. | ||
pub struct GetCommunityResponse { | ||
pub community_view: CommunityView, | ||
pub site: Option<Site>, | ||
|
@@ -41,13 +43,21 @@ pub struct GetCommunityResponse { | |
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
/// Create a community. | ||
pub struct CreateCommunity { | ||
/// The unique name. | ||
pub name: String, | ||
/// A longer title. | ||
pub title: String, | ||
/// A longer sidebar, or description of your community, in markdown. | ||
pub description: Option<String>, | ||
/// An icon URL. | ||
pub icon: Option<String>, | ||
/// A banner URL. | ||
pub banner: Option<String>, | ||
/// Whether its an NSFW community. | ||
pub nsfw: Option<bool>, | ||
/// Whether to restrict posting only to moderators. | ||
pub posting_restricted_to_mods: Option<bool>, | ||
pub discussion_languages: Option<Vec<LanguageId>>, | ||
pub auth: Sensitive<String>, | ||
|
@@ -56,6 +66,7 @@ pub struct CreateCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// A simple community response. | ||
pub struct CommunityResponse { | ||
pub community_view: CommunityView, | ||
pub discussion_languages: Vec<LanguageId>, | ||
|
@@ -65,6 +76,7 @@ pub struct CommunityResponse { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Fetches a list of communities. | ||
pub struct ListCommunities { | ||
pub type_: Option<ListingType>, | ||
pub sort: Option<SortType>, | ||
|
@@ -76,6 +88,7 @@ pub struct ListCommunities { | |
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// The response for listing communities. | ||
pub struct ListCommunitiesResponse { | ||
pub communities: Vec<CommunityView>, | ||
} | ||
|
@@ -84,6 +97,7 @@ pub struct ListCommunitiesResponse { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Ban a user from a community. | ||
pub struct BanFromCommunity { | ||
pub community_id: CommunityId, | ||
pub person_id: PersonId, | ||
|
@@ -97,6 +111,7 @@ pub struct BanFromCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// The response for banning a user from a community. | ||
pub struct BanFromCommunityResponse { | ||
pub person_view: PersonView, | ||
pub banned: bool, | ||
|
@@ -105,6 +120,7 @@ pub struct BanFromCommunityResponse { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Add a moderator to a community. | ||
pub struct AddModToCommunity { | ||
pub community_id: CommunityId, | ||
pub person_id: PersonId, | ||
|
@@ -115,6 +131,7 @@ pub struct AddModToCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// The response of adding a moderator to a community. | ||
pub struct AddModToCommunityResponse { | ||
pub moderators: Vec<CommunityModeratorView>, | ||
} | ||
|
@@ -123,13 +140,20 @@ pub struct AddModToCommunityResponse { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Edit a community. | ||
pub struct EditCommunity { | ||
pub community_id: CommunityId, | ||
/// A longer title. | ||
pub title: Option<String>, | ||
/// A longer sidebar, or description of your community, in markdown. | ||
pub description: Option<String>, | ||
/// An icon URL. | ||
pub icon: Option<String>, | ||
/// A banner URL. | ||
pub banner: Option<String>, | ||
/// Whether its an NSFW community. | ||
pub nsfw: Option<bool>, | ||
/// Whether to restrict posting only to moderators. | ||
pub posting_restricted_to_mods: Option<bool>, | ||
pub discussion_languages: Option<Vec<LanguageId>>, | ||
pub auth: Sensitive<String>, | ||
|
@@ -139,6 +163,8 @@ pub struct EditCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Hide a community from the main view. | ||
// TODO this should really be a part of edit community. And why does it contain a reason, that should be in the mod tables. | ||
pub struct HideCommunity { | ||
pub community_id: CommunityId, | ||
pub hidden: bool, | ||
|
@@ -150,6 +176,7 @@ pub struct HideCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Delete your own community. | ||
pub struct DeleteCommunity { | ||
pub community_id: CommunityId, | ||
pub deleted: bool, | ||
|
@@ -160,6 +187,7 @@ pub struct DeleteCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Remove a community (only doable by moderators). | ||
pub struct RemoveCommunity { | ||
pub community_id: CommunityId, | ||
pub removed: bool, | ||
|
@@ -171,6 +199,7 @@ pub struct RemoveCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Follow / subscribe to a community. | ||
pub struct FollowCommunity { | ||
pub community_id: CommunityId, | ||
pub follow: bool, | ||
|
@@ -180,6 +209,7 @@ pub struct FollowCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Block a community. | ||
pub struct BlockCommunity { | ||
pub community_id: CommunityId, | ||
pub block: bool, | ||
|
@@ -190,6 +220,7 @@ pub struct BlockCommunity { | |
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// The block community response. | ||
pub struct BlockCommunityResponse { | ||
pub community_view: CommunityView, | ||
pub blocked: bool, | ||
|
@@ -198,6 +229,7 @@ pub struct BlockCommunityResponse { | |
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Transfer a community to a new owner. | ||
pub struct TransferCommunity { | ||
pub community_id: CommunityId, | ||
pub person_id: PersonId, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.