go-lemmy/routes.gen.go

1199 lines
34 KiB
Go

// Code generated by go.elara.ws/go-lemmy/cmd/gen (routes generator). DO NOT EDIT.
package lemmy
import (
"context"
types "go.elara.ws/go-lemmy/types"
)
// Add an admin to your site.
func (c *Client) AddAdmin(ctx context.Context, data types.AddAdmin) (*types.AddAdminResponse, error) {
resData := &types.AddAdminResponse{}
res, err := c.req(ctx, "POST", "/admin/add", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Add a moderator to your community.
func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommunity) (*types.AddModToCommunityResponse, error) {
resData := &types.AddModToCommunityResponse{}
res, err := c.req(ctx, "POST", "/community/mod", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Approve a registration application
func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types.ApproveRegistrationApplication) (*types.RegistrationApplicationResponse, error) {
resData := &types.RegistrationApplicationResponse{}
res, err := c.req(ctx, "PUT", "/admin/registration_application/approve", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Ban a user from a community.
func (c *Client) BanFromCommunity(ctx context.Context, data types.BanFromCommunity) (*types.BanFromCommunityResponse, error) {
resData := &types.BanFromCommunityResponse{}
res, err := c.req(ctx, "POST", "/community/ban_user", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Ban a person from your site.
func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.BanPersonResponse, error) {
resData := &types.BanPersonResponse{}
res, err := c.req(ctx, "POST", "/user/ban", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Block a community.
func (c *Client) BlockCommunity(ctx context.Context, data types.BlockCommunity) (*types.BlockCommunityResponse, error) {
resData := &types.BlockCommunityResponse{}
res, err := c.req(ctx, "POST", "/community/block", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Block a person.
func (c *Client) BlockPerson(ctx context.Context, data types.BlockPerson) (*types.BlockPersonResponse, error) {
resData := &types.BlockPersonResponse{}
res, err := c.req(ctx, "POST", "/user/block", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Change your user password.
func (c *Client) ChangePassword(ctx context.Context, data types.ChangePassword) (*types.LoginResponse, error) {
resData := &types.LoginResponse{}
res, err := c.req(ctx, "PUT", "/user/change_password", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Create a comment.
func (c *Client) CreateComment(ctx context.Context, data types.CreateComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "POST", "/comment", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Report a comment.
func (c *Client) CreateCommentReport(ctx context.Context, data types.CreateCommentReport) (*types.CommentReportResponse, error) {
resData := &types.CommentReportResponse{}
res, err := c.req(ctx, "POST", "/comment/report", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Create a new community.
func (c *Client) CreateCommunity(ctx context.Context, data types.CreateCommunity) (*types.CommunityResponse, error) {
resData := &types.CommunityResponse{}
res, err := c.req(ctx, "POST", "/community", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Create a new custom emoji
func (c *Client) CreateCustomEmoji(ctx context.Context, data types.CreateCustomEmoji) (*types.CustomEmojiResponse, error) {
resData := &types.CustomEmojiResponse{}
res, err := c.req(ctx, "POST", "/custom_emoji", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Create a post.
func (c *Client) CreatePost(ctx context.Context, data types.CreatePost) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "POST", "/post", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Report a post.
func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error) {
resData := &types.PostReportResponse{}
res, err := c.req(ctx, "POST", "/post/report", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Create a private message.
func (c *Client) CreatePrivateMessage(ctx context.Context, data types.CreatePrivateMessage) (*types.PrivateMessageResponse, error) {
resData := &types.PrivateMessageResponse{}
res, err := c.req(ctx, "POST", "/private_message", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Create a report for a private message.
func (c *Client) CreatePrivateMessageReport(ctx context.Context, data types.CreatePrivateMessageReport) (*types.PrivateMessageReportResponse, error) {
resData := &types.PrivateMessageReportResponse{}
res, err := c.req(ctx, "POST", "/private_message/report", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Create your site.
func (c *Client) CreateSite(ctx context.Context, data types.CreateSite) (*types.SiteResponse, error) {
resData := &types.SiteResponse{}
res, err := c.req(ctx, "POST", "/site", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Delete your account.
func (c *Client) DeleteAccount(ctx context.Context, data types.DeleteAccount) error {
resData := &types.EmptyResponse{}
res, err := c.req(ctx, "POST", "/user/delete_account", data, &resData)
if err != nil {
return err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return err
}
return nil
}
// Delete a comment.
func (c *Client) DeleteComment(ctx context.Context, data types.DeleteComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "POST", "/comment/delete", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Delete a community.
func (c *Client) DeleteCommunity(ctx context.Context, data types.DeleteCommunity) (*types.CommunityResponse, error) {
resData := &types.CommunityResponse{}
res, err := c.req(ctx, "POST", "/community/delete", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Delete a custom emoji
func (c *Client) DeleteCustomEmoji(ctx context.Context, data types.DeleteCustomEmoji) (*types.DeleteCustomEmojiResponse, error) {
resData := &types.DeleteCustomEmojiResponse{}
res, err := c.req(ctx, "POST", "/custom_emoji/delete", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Delete a post.
func (c *Client) DeletePost(ctx context.Context, data types.DeletePost) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "POST", "/post/delete", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Delete a private message.
func (c *Client) DeletePrivateMessage(ctx context.Context, data types.DeletePrivateMessage) (*types.PrivateMessageResponse, error) {
resData := &types.PrivateMessageResponse{}
res, err := c.req(ctx, "POST", "/private_message/delete", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Distinguishes a comment (speak as moderator)
func (c *Client) DistinguishComment(ctx context.Context, data types.DistinguishComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "POST", "/comment/distinguish", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Edit a comment.
func (c *Client) EditComment(ctx context.Context, data types.EditComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "PUT", "/comment", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Edit a community.
func (c *Client) EditCommunity(ctx context.Context, data types.EditCommunity) (*types.CommunityResponse, error) {
resData := &types.CommunityResponse{}
res, err := c.req(ctx, "PUT", "/community", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Edit an existing custom emoji
func (c *Client) EditCustomEmoji(ctx context.Context, data types.EditCustomEmoji) (*types.CustomEmojiResponse, error) {
resData := &types.CustomEmojiResponse{}
res, err := c.req(ctx, "PUT", "/custom_emoji", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Edit a post.
func (c *Client) EditPost(ctx context.Context, data types.EditPost) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "PUT", "/post", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Edit a private message.
func (c *Client) EditPrivateMessage(ctx context.Context, data types.EditPrivateMessage) (*types.PrivateMessageResponse, error) {
resData := &types.PrivateMessageResponse{}
res, err := c.req(ctx, "PUT", "/private_message", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Edit your site.
func (c *Client) EditSite(ctx context.Context, data types.EditSite) (*types.SiteResponse, error) {
resData := &types.SiteResponse{}
res, err := c.req(ctx, "PUT", "/site", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// A moderator can feature a community post ( IE stick it to the top of a community ).
func (c *Client) FeaturePost(ctx context.Context, data types.FeaturePost) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "POST", "/post/feature", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Follow / subscribe to a community.
func (c *Client) FollowCommunity(ctx context.Context, data types.FollowCommunity) (*types.CommunityResponse, error) {
resData := &types.CommunityResponse{}
res, err := c.req(ctx, "POST", "/community/follow", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get a list of banned users
func (c *Client) BannedPersons(ctx context.Context, data types.GetBannedPersons) (*types.BannedPersonsResponse, error) {
resData := &types.BannedPersonsResponse{}
res, err := c.getReq(ctx, "GET", "/user/banned", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Fetch a Captcha.
func (c *Client) Captcha(ctx context.Context, data types.GetCaptcha) (*types.GetCaptchaResponse, error) {
resData := &types.GetCaptchaResponse{}
res, err := c.getReq(ctx, "GET", "/user/get_captcha", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get / fetch comment.
func (c *Client) Comment(ctx context.Context, data types.GetComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.getReq(ctx, "GET", "/comment", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get / fetch comments.
func (c *Client) Comments(ctx context.Context, data types.GetComments) (*types.GetCommentsResponse, error) {
resData := &types.GetCommentsResponse{}
res, err := c.getReq(ctx, "GET", "/comment/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get / fetch a community.
func (c *Client) Community(ctx context.Context, data types.GetCommunity) (*types.GetCommunityResponse, error) {
resData := &types.GetCommunityResponse{}
res, err := c.getReq(ctx, "GET", "/community", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Fetch federated instances.
func (c *Client) FederatedInstances(ctx context.Context, data types.GetFederatedInstances) (*types.GetFederatedInstancesResponse, error) {
resData := &types.GetFederatedInstancesResponse{}
res, err := c.getReq(ctx, "GET", "/federated_instances", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get the modlog.
func (c *Client) Modlog(ctx context.Context, data types.GetModlog) (*types.GetModlogResponse, error) {
resData := &types.GetModlogResponse{}
res, err := c.getReq(ctx, "GET", "/modlog", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get the details for a person.
func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error) {
resData := &types.GetPersonDetailsResponse{}
res, err := c.getReq(ctx, "GET", "/user", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get mentions for your user.
func (c *Client) PersonMentions(ctx context.Context, data types.GetPersonMentions) (*types.GetPersonMentionsResponse, error) {
resData := &types.GetPersonMentionsResponse{}
res, err := c.getReq(ctx, "GET", "/user/mention", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get / fetch a post.
func (c *Client) Post(ctx context.Context, data types.GetPost) (*types.GetPostResponse, error) {
resData := &types.GetPostResponse{}
res, err := c.getReq(ctx, "GET", "/post", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get / fetch posts, with various filters.
func (c *Client) Posts(ctx context.Context, data types.GetPosts) (*types.GetPostsResponse, error) {
resData := &types.GetPostsResponse{}
res, err := c.getReq(ctx, "GET", "/post/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get / fetch private messages.
func (c *Client) PrivateMessages(ctx context.Context, data types.GetPrivateMessages) (*types.PrivateMessagesResponse, error) {
resData := &types.PrivateMessagesResponse{}
res, err := c.getReq(ctx, "GET", "/private_message/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get comment replies.
func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.GetRepliesResponse, error) {
resData := &types.GetRepliesResponse{}
res, err := c.getReq(ctx, "GET", "/user/replies", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get counts for your reports
func (c *Client) ReportCount(ctx context.Context, data types.GetReportCount) (*types.GetReportCountResponse, error) {
resData := &types.GetReportCountResponse{}
res, err := c.getReq(ctx, "GET", "/user/report_count", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Gets the site, and your user data.
func (c *Client) Site(ctx context.Context, data types.GetSite) (*types.GetSiteResponse, error) {
resData := &types.GetSiteResponse{}
res, err := c.getReq(ctx, "GET", "/site", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Fetch metadata for any given site.
func (c *Client) SiteMetadata(ctx context.Context, data types.GetSiteMetadata) (*types.GetSiteMetadataResponse, error) {
resData := &types.GetSiteMetadataResponse{}
res, err := c.getReq(ctx, "GET", "/post/site_metadata", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get your unread counts
func (c *Client) UnreadCount(ctx context.Context, data types.GetUnreadCount) (*types.GetUnreadCountResponse, error) {
resData := &types.GetUnreadCountResponse{}
res, err := c.getReq(ctx, "GET", "/user/unread_count", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Get the unread registration applications count.
func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context, data types.GetUnreadRegistrationApplicationCount) (*types.GetUnreadRegistrationApplicationCountResponse, error) {
resData := &types.GetUnreadRegistrationApplicationCountResponse{}
res, err := c.getReq(ctx, "GET", "/admin/registration_application/count", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Leave the Site admins.
func (c *Client) LeaveAdmin(ctx context.Context, data types.LeaveAdmin) (*types.GetSiteResponse, error) {
resData := &types.GetSiteResponse{}
res, err := c.req(ctx, "POST", "/user/leave_admin", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Like / vote on a comment.
func (c *Client) LikeComment(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "POST", "/comment/like", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Like / vote on a post.
func (c *Client) LikePost(ctx context.Context, data types.CreatePostLike) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "POST", "/post/like", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// List comment reports.
func (c *Client) CommentReports(ctx context.Context, data types.ListCommentReports) (*types.ListCommentReportsResponse, error) {
resData := &types.ListCommentReportsResponse{}
res, err := c.getReq(ctx, "GET", "/comment/report/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// List communities, with various filters.
func (c *Client) Communities(ctx context.Context, data types.ListCommunities) (*types.ListCommunitiesResponse, error) {
resData := &types.ListCommunitiesResponse{}
res, err := c.getReq(ctx, "GET", "/community/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// List post reports.
func (c *Client) PostReports(ctx context.Context, data types.ListPostReports) (*types.ListPostReportsResponse, error) {
resData := &types.ListPostReportsResponse{}
res, err := c.getReq(ctx, "GET", "/post/report/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// List private message reports.
func (c *Client) PrivateMessageReports(ctx context.Context, data types.ListPrivateMessageReports) (*types.ListPrivateMessageReportsResponse, error) {
resData := &types.ListPrivateMessageReportsResponse{}
res, err := c.getReq(ctx, "GET", "/private_message/report/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// List the registration applications.
func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRegistrationApplications) (*types.ListRegistrationApplicationsResponse, error) {
resData := &types.ListRegistrationApplicationsResponse{}
res, err := c.getReq(ctx, "GET", "/admin/registration_application/list", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// A moderator can lock a post ( IE disable new comments ).
func (c *Client) LockPost(ctx context.Context, data types.LockPost) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "POST", "/post/lock", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Log into lemmy.
func (c *Client) Login(ctx context.Context, data types.Login) (*types.LoginResponse, error) {
resData := &types.LoginResponse{}
res, err := c.req(ctx, "POST", "/user/login", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Mark all replies as read.
func (c *Client) MarkAllAsRead(ctx context.Context, data types.MarkAllAsRead) (*types.GetRepliesResponse, error) {
resData := &types.GetRepliesResponse{}
res, err := c.req(ctx, "POST", "/user/mark_all_as_read", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Mark a comment as read.
func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkCommentReplyAsRead) (*types.CommentReplyResponse, error) {
resData := &types.CommentReplyResponse{}
res, err := c.req(ctx, "POST", "/comment/mark_as_read", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Mark a person mention as read.
func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error) {
resData := &types.PersonMentionResponse{}
res, err := c.req(ctx, "POST", "/user/mention/mark_as_read", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Mark a post as read.
func (c *Client) MarkPostAsRead(ctx context.Context, data types.MarkPostAsRead) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "POST", "/post/mark_as_read", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Mark a private message as read.
func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data types.MarkPrivateMessageAsRead) (*types.PrivateMessageResponse, error) {
resData := &types.PrivateMessageResponse{}
res, err := c.req(ctx, "POST", "/private_message/mark_as_read", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Change your password from an email / token based reset.
func (c *Client) PasswordChangeAfterReset(ctx context.Context, data types.PasswordChangeAfterReset) (*types.LoginResponse, error) {
resData := &types.LoginResponse{}
res, err := c.req(ctx, "POST", "/user/password_change", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Reset your password.
func (c *Client) PasswordReset(ctx context.Context, data types.PasswordReset) error {
resData := &types.EmptyResponse{}
res, err := c.req(ctx, "POST", "/user/password_reset", data, &resData)
if err != nil {
return err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return err
}
return nil
}
// Purge / Delete a comment from the database.
func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/comment", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Purge / Delete a community from the database.
func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/community", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Purge / Delete a person from the database.
func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/person", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Purge / Delete a post from the database.
func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/post", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Register a new user.
func (c *Client) Register(ctx context.Context, data types.Register) (*types.LoginResponse, error) {
resData := &types.LoginResponse{}
res, err := c.req(ctx, "POST", "/user/register", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// A moderator remove for a comment.
func (c *Client) RemoveComment(ctx context.Context, data types.RemoveComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "POST", "/comment/remove", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// A moderator remove for a community.
func (c *Client) RemoveCommunity(ctx context.Context, data types.RemoveCommunity) (*types.CommunityResponse, error) {
resData := &types.CommunityResponse{}
res, err := c.req(ctx, "POST", "/community/remove", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// A moderator remove for a post.
func (c *Client) RemovePost(ctx context.Context, data types.RemovePost) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "POST", "/post/remove", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Resolve a comment report. Only a mod can do this.
func (c *Client) ResolveCommentReport(ctx context.Context, data types.ResolveCommentReport) (*types.CommentReportResponse, error) {
resData := &types.CommentReportResponse{}
res, err := c.req(ctx, "PUT", "/comment/report/resolve", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Fetch a non-local / federated object.
func (c *Client) ResolveObject(ctx context.Context, data types.ResolveObject) (*types.ResolveObjectResponse, error) {
resData := &types.ResolveObjectResponse{}
res, err := c.getReq(ctx, "GET", "/resolve_object", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Resolve a post report. Only a mod can do this.
func (c *Client) ResolvePostReport(ctx context.Context, data types.ResolvePostReport) (*types.PostReportResponse, error) {
resData := &types.PostReportResponse{}
res, err := c.req(ctx, "PUT", "/post/report/resolve", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Resolve a report for a private message.
func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data types.ResolvePrivateMessageReport) (*types.PrivateMessageReportResponse, error) {
resData := &types.PrivateMessageReportResponse{}
res, err := c.req(ctx, "PUT", "/private_message/report/resolve", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Save a comment.
func (c *Client) SaveComment(ctx context.Context, data types.SaveComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "PUT", "/comment/save", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Save a post.
func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.PostResponse, error) {
resData := &types.PostResponse{}
res, err := c.req(ctx, "PUT", "/post/save", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Save your user settings.
func (c *Client) SaveUserSettings(ctx context.Context, data types.SaveUserSettings) (*types.LoginResponse, error) {
resData := &types.LoginResponse{}
res, err := c.req(ctx, "PUT", "/user/save_user_settings", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Search lemmy.
func (c *Client) Search(ctx context.Context, data types.Search) (*types.SearchResponse, error) {
resData := &types.SearchResponse{}
res, err := c.getReq(ctx, "GET", "/search", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Transfer your community to an existing moderator.
func (c *Client) TransferCommunity(ctx context.Context, data types.TransferCommunity) (*types.GetCommunityResponse, error) {
resData := &types.GetCommunityResponse{}
res, err := c.req(ctx, "POST", "/community/transfer", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
// Verify your email
func (c *Client) VerifyEmail(ctx context.Context, data types.VerifyEmail) error {
resData := &types.EmptyResponse{}
res, err := c.req(ctx, "POST", "/user/verify_email", data, &resData)
if err != nil {
return err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return err
}
return nil
}