Adding endpoint comments. Fixes #50 (#56)

This commit is contained in:
Dessalines 2022-05-22 15:45:53 -04:00 committed by GitHub
parent 57de18c17e
commit 07919905c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,6 +154,7 @@ export class LemmyHttp {
/**
* Gets the site, and your user data.
* `HTTP.GET /site`
*/
async getSite(form: GetSite): Promise<GetSiteResponse> {
return this.wrapper(HttpType.Get, "/site", form);
@ -161,6 +162,7 @@ export class LemmyHttp {
/**
* Create your site.
* `HTTP.POST /site`
*/
async createSite(form: CreateSite): Promise<SiteResponse> {
return this.wrapper(HttpType.Post, "/site", form);
@ -168,6 +170,7 @@ export class LemmyHttp {
/**
* Edit your site.
* `HTTP.PUT /site`
*/
async editSite(form: EditSite): Promise<SiteResponse> {
return this.wrapper(HttpType.Put, "/site", form);
@ -175,6 +178,7 @@ export class LemmyHttp {
/**
* Leave the Site admins.
* `HTTP.POST /user/leave_admin`
*/
async leaveAdmin(form: LeaveAdmin): Promise<GetSiteResponse> {
return this.wrapper(HttpType.Post, "/user/leave_admin", form);
@ -182,6 +186,7 @@ export class LemmyHttp {
/**
* Get your site configuration.
* `HTTP.GET /site/config`
*/
async getSiteConfig(form: GetSiteConfig): Promise<GetSiteConfigResponse> {
return this.wrapper(HttpType.Get, "/site/config", form);
@ -189,6 +194,7 @@ export class LemmyHttp {
/**
* Save your site config.
* `HTTP.PUT /site/config`
*/
async saveSiteConfig(form: SaveSiteConfig): Promise<GetSiteConfigResponse> {
return this.wrapper(HttpType.Put, "/site/config", form);
@ -196,6 +202,7 @@ export class LemmyHttp {
/**
* Get the modlog.
* `HTTP.GET /modlog`
*/
async getModlog(form: GetModlog): Promise<GetModlogResponse> {
return this.wrapper(HttpType.Get, "/modlog", form);
@ -203,6 +210,7 @@ export class LemmyHttp {
/**
* Search lemmy.
* `HTTP.GET /search`
*/
async search(form: Search): Promise<SearchResponse> {
return this.wrapper(HttpType.Get, "/search", form);
@ -210,6 +218,7 @@ export class LemmyHttp {
/**
* Fetch a non-local / federated object.
* `HTTP.GET /resolve_object`
*/
async resolveObject(form: ResolveObject): Promise<ResolveObjectResponse> {
return this.wrapper(HttpType.Get, "/resolve_object", form);
@ -217,6 +226,7 @@ export class LemmyHttp {
/**
* Create a new community.
* `HTTP.POST /community`
*/
async createCommunity(form: CreateCommunity): Promise<CommunityResponse> {
return this.wrapper(HttpType.Post, "/community", form);
@ -224,6 +234,7 @@ export class LemmyHttp {
/**
* Get / fetch a community.
* `HTTP.GET /community`
*/
async getCommunity(form: GetCommunity): Promise<GetCommunityResponse> {
return this.wrapper(HttpType.Get, "/community", form);
@ -231,6 +242,7 @@ export class LemmyHttp {
/**
* Edit a community.
* `HTTP.PUT /community`
*/
async editCommunity(form: EditCommunity): Promise<CommunityResponse> {
return this.wrapper(HttpType.Put, "/community", form);
@ -238,6 +250,7 @@ export class LemmyHttp {
/**
* List communities, with various filters.
* `HTTP.GET /community/list`
*/
async listCommunities(
form: ListCommunities
@ -247,6 +260,7 @@ export class LemmyHttp {
/**
* Follow / subscribe to a community.
* `HTTP.POST /community/follow`
*/
async followCommunity(
form: FollowCommunity
@ -256,6 +270,7 @@ export class LemmyHttp {
/**
* Block a community.
* `HTTP.POST /community/block`
*/
async blockCommunity(form: BlockCommunity): Promise<BlockCommunityResponse> {
return this.wrapper(HttpType.Post, "/community/block", form);
@ -263,6 +278,7 @@ export class LemmyHttp {
/**
* Delete a community.
* `HTTP.POST /community/delete`
*/
async deleteCommunity(form: DeleteCommunity): Promise<CommunityResponse> {
return this.wrapper(HttpType.Post, "/community/delete", form);
@ -270,6 +286,7 @@ export class LemmyHttp {
/**
* A moderator remove for a community.
* `HTTP.POST /community/remove`
*/
async removeCommunity(form: RemoveCommunity): Promise<CommunityResponse> {
return this.wrapper(HttpType.Post, "/community/remove", form);
@ -277,6 +294,7 @@ export class LemmyHttp {
/**
* Transfer your community to an existing moderator.
* `HTTP.POST /community/transfer`
*/
async transferCommunity(
form: TransferCommunity
@ -286,6 +304,7 @@ export class LemmyHttp {
/**
* Ban a user from a community.
* `HTTP.POST /community/ban_user`
*/
async banFromCommunity(
form: BanFromCommunity
@ -295,6 +314,7 @@ export class LemmyHttp {
/**
* Add a moderator to your community.
* `HTTP.POST /community/mod`
*/
async addModToCommunity(
form: AddModToCommunity
@ -304,6 +324,7 @@ export class LemmyHttp {
/**
* Create a post.
* `HTTP.POST /post`
*/
async createPost(form: CreatePost): Promise<PostResponse> {
return this.wrapper(HttpType.Post, "/post", form);
@ -311,6 +332,7 @@ export class LemmyHttp {
/**
* Get / fetch a post.
* `HTTP.GET /post`
*/
async getPost(form: GetPost): Promise<GetPostResponse> {
return this.wrapper(HttpType.Get, "/post", form);
@ -318,6 +340,7 @@ export class LemmyHttp {
/**
* Edit a post.
* `HTTP.PUT /post`
*/
async editPost(form: EditPost): Promise<PostResponse> {
return this.wrapper(HttpType.Put, "/post", form);
@ -325,6 +348,7 @@ export class LemmyHttp {
/**
* Delete a post.
* `HTTP.POST /post/delete`
*/
async deletePost(form: DeletePost): Promise<PostResponse> {
return this.wrapper(HttpType.Post, "/post/delete", form);
@ -332,6 +356,7 @@ export class LemmyHttp {
/**
* A moderator remove for a post.
* `HTTP.POST /post/remove`
*/
async removePost(form: RemovePost): Promise<PostResponse> {
return this.wrapper(HttpType.Post, "/post/remove", form);
@ -339,6 +364,7 @@ export class LemmyHttp {
/**
* A moderator can lock a post ( IE disable new comments ).
* `HTTP.POST /post/lock`
*/
async lockPost(form: LockPost): Promise<PostResponse> {
return this.wrapper(HttpType.Post, "/post/lock", form);
@ -346,6 +372,7 @@ export class LemmyHttp {
/**
* A moderator can sticky a post ( IE stick it to the top of a community ).
* `HTTP.POST /post/sticky`
*/
async stickyPost(form: StickyPost): Promise<PostResponse> {
return this.wrapper(HttpType.Post, "/post/sticky", form);
@ -353,6 +380,7 @@ export class LemmyHttp {
/**
* Get / fetch posts, with various filters.
* `HTTP.GET /post/list`
*/
async getPosts(form: GetPosts): Promise<GetPostsResponse> {
return this.wrapper(HttpType.Get, "/post/list", form);
@ -360,6 +388,7 @@ export class LemmyHttp {
/**
* Like / vote on a post.
* `HTTP.POST /post/like`
*/
async likePost(form: CreatePostLike): Promise<PostResponse> {
return this.wrapper(HttpType.Post, "/post/like", form);
@ -367,6 +396,7 @@ export class LemmyHttp {
/**
* Save a post.
* `HTTP.PUT /post/save`
*/
async savePost(form: SavePost): Promise<PostResponse> {
return this.wrapper(HttpType.Put, "/post/save", form);
@ -374,6 +404,7 @@ export class LemmyHttp {
/**
* Report a post.
* `HTTP.POST /post/report`
*/
async createPostReport(form: CreatePostReport): Promise<PostReportResponse> {
return this.wrapper(HttpType.Post, "/post/report", form);
@ -381,6 +412,7 @@ export class LemmyHttp {
/**
* Resolve a post report. Only a mod can do this.
* `HTTP.PUT /post/report/resolve`
*/
async resolvePostReport(
form: ResolvePostReport
@ -390,6 +422,7 @@ export class LemmyHttp {
/**
* List post reports.
* `HTTP.GET /post/report/list`
*/
async listPostReports(
form: ListPostReports
@ -399,6 +432,7 @@ export class LemmyHttp {
/**
* Fetch metadata for any given site.
* `HTTP.GET /post/site_metadata`
*/
async getSiteMetadata(
form: GetSiteMetadata
@ -408,6 +442,7 @@ export class LemmyHttp {
/**
* Create a comment.
* `HTTP.POST /comment`
*/
async createComment(form: CreateComment): Promise<CommentResponse> {
return this.wrapper(HttpType.Post, "/comment", form);
@ -415,6 +450,7 @@ export class LemmyHttp {
/**
* Edit a comment.
* `HTTP.PUT /comment`
*/
async editComment(form: EditComment): Promise<CommentResponse> {
return this.wrapper(HttpType.Put, "/comment", form);
@ -422,6 +458,7 @@ export class LemmyHttp {
/**
* Delete a comment.
* `HTTP.POST /comment/delete`
*/
async deleteComment(form: DeleteComment): Promise<CommentResponse> {
return this.wrapper(HttpType.Post, "/comment/delete", form);
@ -429,6 +466,7 @@ export class LemmyHttp {
/**
* A moderator remove for a comment.
* `HTTP.POST /comment/remove`
*/
async removeComment(form: RemoveComment): Promise<CommentResponse> {
return this.wrapper(HttpType.Post, "/comment/remove", form);
@ -436,6 +474,7 @@ export class LemmyHttp {
/**
* Mark a comment as read.
* `HTTP.POST /comment/mark_as_read`
*/
async markCommentAsRead(form: MarkCommentAsRead): Promise<CommentResponse> {
return this.wrapper(HttpType.Post, "/comment/mark_as_read", form);
@ -443,6 +482,7 @@ export class LemmyHttp {
/**
* Like / vote on a comment.
* `HTTP.POST /comment/like`
*/
async likeComment(form: CreateCommentLike): Promise<CommentResponse> {
return this.wrapper(HttpType.Post, "/comment/like", form);
@ -450,6 +490,7 @@ export class LemmyHttp {
/**
* Save a comment.
* `HTTP.PUT /comment/save`
*/
async saveComment(form: SaveComment): Promise<CommentResponse> {
return this.wrapper(HttpType.Put, "/comment/save", form);
@ -457,6 +498,7 @@ export class LemmyHttp {
/**
* Get / fetch comments.
* `HTTP.GET /comment/list`
*/
async getComments(form: GetComments): Promise<GetCommentsResponse> {
return this.wrapper(HttpType.Get, "/comment/list", form);
@ -464,6 +506,7 @@ export class LemmyHttp {
/**
* Report a comment.
* `HTTP.POST /comment/report`
*/
async createCommentReport(
form: CreateCommentReport
@ -473,6 +516,7 @@ export class LemmyHttp {
/**
* Resolve a comment report. Only a mod can do this.
* `HTTP.PUT /comment/report/resolve`
*/
async resolveCommentReport(
form: ResolveCommentReport
@ -482,6 +526,7 @@ export class LemmyHttp {
/**
* List comment reports.
* `HTTP.GET /comment/report/list`
*/
async listCommentReports(
form: ListCommentReports
@ -491,6 +536,7 @@ export class LemmyHttp {
/**
* Get / fetch private messages.
* `HTTP.GET /private_message/list`
*/
async getPrivateMessages(
form: GetPrivateMessages
@ -500,6 +546,7 @@ export class LemmyHttp {
/**
* Create a private message.
* `HTTP.POST /private_message`
*/
async createPrivateMessage(
form: CreatePrivateMessage
@ -509,6 +556,7 @@ export class LemmyHttp {
/**
* Edit a private message.
* `HTTP.PUT /private_message`
*/
async editPrivateMessage(
form: EditPrivateMessage
@ -518,6 +566,7 @@ export class LemmyHttp {
/**
* Delete a private message.
* `HTTP.POST /private_message/delete`
*/
async deletePrivateMessage(
form: DeletePrivateMessage
@ -527,6 +576,7 @@ export class LemmyHttp {
/**
* Mark a private message as read.
* `HTTP.POST /private_message/mark_as_read`
*/
async markPrivateMessageAsRead(
form: MarkPrivateMessageAsRead
@ -536,6 +586,7 @@ export class LemmyHttp {
/**
* Register a new user.
* `HTTP.POST /user/register`
*/
async register(form: Register): Promise<LoginResponse> {
return this.wrapper(HttpType.Post, "/user/register", form);
@ -543,6 +594,7 @@ export class LemmyHttp {
/**
* Log into lemmy.
* `HTTP.POST /user/login`
*/
async login(form: Login): Promise<LoginResponse> {
return this.wrapper(HttpType.Post, "/user/login", form);
@ -550,6 +602,7 @@ export class LemmyHttp {
/**
* Get the details for a person.
* `HTTP.GET /user`
*/
async getPersonDetails(
form: GetPersonDetails
@ -559,6 +612,7 @@ export class LemmyHttp {
/**
* Get mentions for your user.
* `HTTP.GET /user/mention`
*/
async getPersonMentions(
form: GetPersonMentions
@ -568,6 +622,7 @@ export class LemmyHttp {
/**
* Mark a person mention as read.
* `HTTP.POST /user/mention/mark_as_read`
*/
async markPersonMentionAsRead(
form: MarkPersonMentionAsRead
@ -577,6 +632,7 @@ export class LemmyHttp {
/**
* Get comment replies.
* `HTTP.GET /user/replies`
*/
async getReplies(form: GetReplies): Promise<GetRepliesResponse> {
return this.wrapper(HttpType.Get, "/user/replies", form);
@ -584,6 +640,7 @@ export class LemmyHttp {
/**
* Ban a person from your site.
* `HTTP.POST /user/ban`
*/
async banPerson(form: BanPerson): Promise<BanPersonResponse> {
return this.wrapper(HttpType.Post, "/user/ban", form);
@ -591,6 +648,7 @@ export class LemmyHttp {
/**
* Get a list of banned users
* `HTTP.GET /user/banned`
*/
async getBannedPersons(
form: GetBannedPersons
@ -600,6 +658,7 @@ export class LemmyHttp {
/**
* Block a person.
* `HTTP.POST /user/block`
*/
async blockPerson(form: BlockPerson): Promise<BlockPersonResponse> {
return this.wrapper(HttpType.Post, "/user/block", form);
@ -607,6 +666,7 @@ export class LemmyHttp {
/**
* Fetch a Captcha.
* `HTTP.GET /user/get_captcha`
*/
async getCaptcha(): Promise<GetCaptchaResponse> {
return this.wrapper(HttpType.Get, "/user/get_captcha", {});
@ -614,6 +674,7 @@ export class LemmyHttp {
/**
* Delete your account.
* `HTTP.POST /user/delete_account`
*/
async deleteAccount(form: DeleteAccount): Promise<DeleteAccountResponse> {
return this.wrapper(HttpType.Post, "/user/delete_account", form);
@ -621,6 +682,7 @@ export class LemmyHttp {
/**
* Reset your password.
* `HTTP.POST /user/password_reset`
*/
async passwordReset(form: PasswordReset): Promise<PasswordResetResponse> {
return this.wrapper(HttpType.Post, "/user/password_reset", form);
@ -628,6 +690,7 @@ export class LemmyHttp {
/**
* Change your password from an email / token based reset.
* `HTTP.POST /user/password_change`
*/
async passwordChange(form: PasswordChange): Promise<LoginResponse> {
return this.wrapper(HttpType.Post, "/user/password_change", form);
@ -635,6 +698,7 @@ export class LemmyHttp {
/**
* Mark all replies as read.
* `HTTP.POST /user/mark_all_as_read`
*/
async markAllAsRead(form: MarkAllAsRead): Promise<GetRepliesResponse> {
return this.wrapper(HttpType.Post, "/user/mark_all_as_read", form);
@ -642,6 +706,7 @@ export class LemmyHttp {
/**
* Save your user settings.
* `HTTP.PUT /user/save_user_settings`
*/
async saveUserSettings(form: SaveUserSettings): Promise<LoginResponse> {
return this.wrapper(HttpType.Put, "/user/save_user_settings", form);
@ -649,6 +714,7 @@ export class LemmyHttp {
/**
* Change your user password.
* `HTTP.PUT /user/change_password`
*/
async changePassword(form: ChangePassword): Promise<LoginResponse> {
return this.wrapper(HttpType.Put, "/user/change_password", form);
@ -656,6 +722,7 @@ export class LemmyHttp {
/**
* Get counts for your reports
* `HTTP.GET /user/report_count`
*/
async getReportCount(form: GetReportCount): Promise<GetReportCountResponse> {
return this.wrapper(HttpType.Get, "/user/report_count", form);
@ -663,6 +730,7 @@ export class LemmyHttp {
/**
* Get your unread counts
* `HTTP.GET /user/unread_count`
*/
async getUnreadCount(form: GetUnreadCount): Promise<GetUnreadCountResponse> {
return this.wrapper(HttpType.Get, "/user/unread_count", form);
@ -670,6 +738,7 @@ export class LemmyHttp {
/**
* Verify your email
* `HTTP.POST /user/verify_email`
*/
async verifyEmail(form: VerifyEmail): Promise<VerifyEmailResponse> {
return this.wrapper(HttpType.Post, "/user/verify_email", form);
@ -677,6 +746,7 @@ export class LemmyHttp {
/**
* Add an admin to your site.
* `HTTP.POST /admin/add`
*/
async addAdmin(form: AddAdmin): Promise<AddAdminResponse> {
return this.wrapper(HttpType.Post, "/admin/add", form);
@ -684,6 +754,7 @@ export class LemmyHttp {
/**
* Get the unread registration applications count.
* `HTTP.GET /admin/registration_application/count`
*/
async getUnreadRegistrationApplicationCount(
form: GetUnreadRegistrationApplicationCount
@ -696,7 +767,8 @@ export class LemmyHttp {
}
/**
* List the unread registration applications.
* List the registration applications.
* `HTTP.GET /admin/registration_application/list`
*/
async listRegistrationApplications(
form: ListRegistrationApplications
@ -710,6 +782,7 @@ export class LemmyHttp {
/**
* Approve a registration application
* `HTTP.PUT /admin/registration_application/approve`
*/
async approveRegistrationApplication(
form: ApproveRegistrationApplication