Documentation
¶
Index ¶
- func DecodeResponse(data json.RawMessage, out any) error
- type Client
- func (c *Client) AddAdmin(ctx context.Context, data types.AddAdmin) (*types.AddAdminResponse, error)
- func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommunity) (*types.AddModToCommunityResponse, error)
- func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types.ApproveRegistrationApplication) (*types.RegistrationApplicationResponse, error)
- func (c *Client) BanFromCommunity(ctx context.Context, data types.BanFromCommunity) (*types.BanFromCommunityResponse, error)
- func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.BanPersonResponse, error)
- func (c *Client) BannedPersons(ctx context.Context, data types.GetBannedPersons) (*types.BannedPersonsResponse, error)
- func (c *Client) BlockCommunity(ctx context.Context, data types.BlockCommunity) (*types.BlockCommunityResponse, error)
- func (c *Client) BlockPerson(ctx context.Context, data types.BlockPerson) (*types.BlockPersonResponse, error)
- func (c *Client) Captcha(ctx context.Context, data types.GetCaptcha) (*types.GetCaptchaResponse, error)
- func (c *Client) ChangePassword(ctx context.Context, data types.ChangePassword) (*types.LoginResponse, error)
- func (c *Client) ClientLogin(ctx context.Context, l types.Login) error
- func (c *Client) Comment(ctx context.Context, data types.GetComment) (*types.CommentResponse, error)
- func (c *Client) CommentReports(ctx context.Context, data types.ListCommentReports) (*types.ListCommentReportsResponse, error)
- func (c *Client) Comments(ctx context.Context, data types.GetComments) (*types.GetCommentsResponse, error)
- func (c *Client) Communities(ctx context.Context, data types.ListCommunities) (*types.ListCommunitiesResponse, error)
- func (c *Client) Community(ctx context.Context, data types.GetCommunity) (*types.GetCommunityResponse, error)
- func (c *Client) CommunityJoin(ctx context.Context, data types.CommunityJoin) (*types.CommunityJoinResponse, error)
- func (c *Client) CreateComment(ctx context.Context, data types.CreateComment) (*types.CommentResponse, error)
- func (c *Client) CreateCommentLike(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error)
- func (c *Client) CreateCommentReport(ctx context.Context, data types.CreateCommentReport) (*types.CommentReportResponse, error)
- func (c *Client) CreateCommunity(ctx context.Context, data types.CreateCommunity) (*types.CommunityResponse, error)
- func (c *Client) CreatePost(ctx context.Context, data types.CreatePost) (*types.PostResponse, error)
- func (c *Client) CreatePostLike(ctx context.Context, data types.CreatePostLike) (*types.PostResponse, error)
- func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error)
- func (c *Client) CreatePrivateMessage(ctx context.Context, data types.CreatePrivateMessage) (*types.PrivateMessageResponse, error)
- func (c *Client) CreatePrivateMessageReport(ctx context.Context, data types.CreatePrivateMessageReport) (*types.PrivateMessageReportResponse, error)
- func (c *Client) CreateSite(ctx context.Context, data types.CreateSite) (*types.SiteResponse, error)
- func (c *Client) DeleteAccount(ctx context.Context, data types.DeleteAccount) (*types.DeleteAccountResponse, error)
- func (c *Client) DeleteComment(ctx context.Context, data types.DeleteComment) (*types.CommentResponse, error)
- func (c *Client) DeleteCommunity(ctx context.Context, data types.DeleteCommunity) (*types.CommunityResponse, error)
- func (c *Client) DeletePost(ctx context.Context, data types.DeletePost) (*types.PostResponse, error)
- func (c *Client) DeletePrivateMessage(ctx context.Context, data types.DeletePrivateMessage) (*types.PrivateMessageResponse, error)
- func (c *Client) EditComment(ctx context.Context, data types.EditComment) (*types.CommentResponse, error)
- func (c *Client) EditCommunity(ctx context.Context, data types.EditCommunity) (*types.CommunityResponse, error)
- func (c *Client) EditPost(ctx context.Context, data types.EditPost) (*types.PostResponse, error)
- func (c *Client) EditPrivateMessage(ctx context.Context, data types.EditPrivateMessage) (*types.PrivateMessageResponse, error)
- func (c *Client) EditSite(ctx context.Context, data types.EditSite) (*types.SiteResponse, error)
- func (c *Client) FeaturePost(ctx context.Context, data types.FeaturePost) (*types.PostResponse, error)
- func (c *Client) FollowCommunity(ctx context.Context, data types.FollowCommunity) (*types.CommunityResponse, error)
- func (c *Client) HideCommunity(ctx context.Context, data types.HideCommunity) (*types.CommunityResponse, error)
- func (c *Client) LeaveAdmin(ctx context.Context, data types.LeaveAdmin) (*types.GetSiteResponse, error)
- func (c *Client) LockPost(ctx context.Context, data types.LockPost) (*types.PostResponse, error)
- func (c *Client) Login(ctx context.Context, data types.Login) (*types.LoginResponse, error)
- func (c *Client) MarkAllAsRead(ctx context.Context, data types.MarkAllAsRead) (*types.GetRepliesResponse, error)
- func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkCommentReplyAsRead) (*types.CommentReplyResponse, error)
- func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error)
- func (c *Client) MarkPostAsRead(ctx context.Context, data types.MarkPostAsRead) (*types.PostResponse, error)
- func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data types.MarkPrivateMessageAsRead) (*types.PrivateMessageResponse, error)
- func (c *Client) ModJoin(ctx context.Context, data types.ModJoin) (*types.ModJoinResponse, error)
- func (c *Client) Modlog(ctx context.Context, data types.GetModlog) (*types.GetModlogResponse, error)
- func (c *Client) PasswordChangeAfterReset(ctx context.Context, data types.PasswordChangeAfterReset) (*types.LoginResponse, error)
- func (c *Client) PasswordReset(ctx context.Context, data types.PasswordReset) (*types.PasswordResetResponse, error)
- func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error)
- func (c *Client) PersonMentions(ctx context.Context, data types.GetPersonMentions) (*types.GetPersonMentionsResponse, error)
- func (c *Client) Post(ctx context.Context, data types.GetPost) (*types.GetPostResponse, error)
- func (c *Client) PostJoin(ctx context.Context, data types.PostJoin) (*types.PostJoinResponse, error)
- func (c *Client) PostReports(ctx context.Context, data types.ListPostReports) (*types.ListPostReportsResponse, error)
- func (c *Client) Posts(ctx context.Context, data types.GetPosts) (*types.GetPostsResponse, error)
- func (c *Client) PrivateMessageReports(ctx context.Context, data types.ListPrivateMessageReports) (*types.ListPrivateMessageReportsResponse, error)
- func (c *Client) PrivateMessages(ctx context.Context, data types.GetPrivateMessages) (*types.PrivateMessagesResponse, error)
- func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error)
- func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error)
- func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error)
- func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.PurgeItemResponse, error)
- func (c *Client) Register(ctx context.Context, data types.Register) (*types.LoginResponse, error)
- func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRegistrationApplications) (*types.ListRegistrationApplicationsResponse, error)
- func (c *Client) RemoveComment(ctx context.Context, data types.RemoveComment) (*types.CommentResponse, error)
- func (c *Client) RemoveCommunity(ctx context.Context, data types.RemoveCommunity) (*types.CommunityResponse, error)
- func (c *Client) RemovePost(ctx context.Context, data types.RemovePost) (*types.PostResponse, error)
- func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.GetRepliesResponse, error)
- func (c *Client) ReportCount(ctx context.Context, data types.GetReportCount) (*types.GetReportCountResponse, error)
- func (c *Client) ResolveCommentReport(ctx context.Context, data types.ResolveCommentReport) (*types.CommentReportResponse, error)
- func (c *Client) ResolveObject(ctx context.Context, data types.ResolveObject) (*types.ResolveObjectResponse, error)
- func (c *Client) ResolvePostReport(ctx context.Context, data types.ResolvePostReport) (*types.PostReportResponse, error)
- func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data types.ResolvePrivateMessageReport) (*types.PrivateMessageReportResponse, error)
- func (c *Client) SaveComment(ctx context.Context, data types.SaveComment) (*types.CommentResponse, error)
- func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.PostResponse, error)
- func (c *Client) SaveUserSettings(ctx context.Context, data types.SaveUserSettings) (*types.LoginResponse, error)
- func (c *Client) Search(ctx context.Context, data types.Search) (*types.SearchResponse, error)
- func (c *Client) Site(ctx context.Context, data types.GetSite) (*types.GetSiteResponse, error)
- func (c *Client) SiteMetadata(ctx context.Context, data types.GetSiteMetadata) (*types.GetSiteMetadataResponse, error)
- func (c *Client) TransferCommunity(ctx context.Context, data types.TransferCommunity) (*types.GetCommunityResponse, error)
- func (c *Client) UnreadCount(ctx context.Context, data types.GetUnreadCount) (*types.GetUnreadCountResponse, error)
- func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context, data types.GetUnreadRegistrationApplicationCount) (*types.GetUnreadRegistrationApplicationCountResponse, error)
- func (c *Client) UserJoin(ctx context.Context, data types.UserJoin) (*types.UserJoinResponse, error)
- func (c *Client) VerifyEmail(ctx context.Context, data types.VerifyEmail) (*types.VerifyEmailResponse, error)
- type WSClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeResponse ¶
func DecodeResponse(data json.RawMessage, out any) error
Types ¶
type Client ¶
type Client struct { Token string // contains filtered or unexported fields }
Client is a client for Lemmy's HTTP API
func NewWithClient ¶
NewWithClient creates a new Lemmy client with the given HTTP client
func (*Client) AddModToCommunity ¶
func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommunity) (*types.AddModToCommunityResponse, error)
func (*Client) ApproveRegistrationApplication ¶
func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types.ApproveRegistrationApplication) (*types.RegistrationApplicationResponse, error)
func (*Client) BanFromCommunity ¶
func (c *Client) BanFromCommunity(ctx context.Context, data types.BanFromCommunity) (*types.BanFromCommunityResponse, error)
func (*Client) BannedPersons ¶
func (c *Client) BannedPersons(ctx context.Context, data types.GetBannedPersons) (*types.BannedPersonsResponse, error)
func (*Client) BlockCommunity ¶
func (c *Client) BlockCommunity(ctx context.Context, data types.BlockCommunity) (*types.BlockCommunityResponse, error)
func (*Client) BlockPerson ¶
func (c *Client) BlockPerson(ctx context.Context, data types.BlockPerson) (*types.BlockPersonResponse, error)
func (*Client) Captcha ¶
func (c *Client) Captcha(ctx context.Context, data types.GetCaptcha) (*types.GetCaptchaResponse, error)
func (*Client) ChangePassword ¶
func (c *Client) ChangePassword(ctx context.Context, data types.ChangePassword) (*types.LoginResponse, error)
func (*Client) ClientLogin ¶
ClientLogin logs in to Lemmy by sending an HTTP request to the login endpoint. It stores the returned token in the client for future use.
func (*Client) Comment ¶
func (c *Client) Comment(ctx context.Context, data types.GetComment) (*types.CommentResponse, error)
func (*Client) CommentReports ¶ added in v0.17.0
func (c *Client) CommentReports(ctx context.Context, data types.ListCommentReports) (*types.ListCommentReportsResponse, error)
func (*Client) Comments ¶
func (c *Client) Comments(ctx context.Context, data types.GetComments) (*types.GetCommentsResponse, error)
func (*Client) Communities ¶ added in v0.17.0
func (c *Client) Communities(ctx context.Context, data types.ListCommunities) (*types.ListCommunitiesResponse, error)
func (*Client) Community ¶
func (c *Client) Community(ctx context.Context, data types.GetCommunity) (*types.GetCommunityResponse, error)
func (*Client) CommunityJoin ¶
func (c *Client) CommunityJoin(ctx context.Context, data types.CommunityJoin) (*types.CommunityJoinResponse, error)
func (*Client) CreateComment ¶
func (c *Client) CreateComment(ctx context.Context, data types.CreateComment) (*types.CommentResponse, error)
func (*Client) CreateCommentLike ¶
func (c *Client) CreateCommentLike(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error)
func (*Client) CreateCommentReport ¶
func (c *Client) CreateCommentReport(ctx context.Context, data types.CreateCommentReport) (*types.CommentReportResponse, error)
func (*Client) CreateCommunity ¶
func (c *Client) CreateCommunity(ctx context.Context, data types.CreateCommunity) (*types.CommunityResponse, error)
func (*Client) CreatePost ¶
func (c *Client) CreatePost(ctx context.Context, data types.CreatePost) (*types.PostResponse, error)
func (*Client) CreatePostLike ¶
func (c *Client) CreatePostLike(ctx context.Context, data types.CreatePostLike) (*types.PostResponse, error)
func (*Client) CreatePostReport ¶
func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error)
func (*Client) CreatePrivateMessage ¶
func (c *Client) CreatePrivateMessage(ctx context.Context, data types.CreatePrivateMessage) (*types.PrivateMessageResponse, error)
func (*Client) CreatePrivateMessageReport ¶ added in v0.17.0
func (c *Client) CreatePrivateMessageReport(ctx context.Context, data types.CreatePrivateMessageReport) (*types.PrivateMessageReportResponse, error)
func (*Client) CreateSite ¶
func (c *Client) CreateSite(ctx context.Context, data types.CreateSite) (*types.SiteResponse, error)
func (*Client) DeleteAccount ¶
func (c *Client) DeleteAccount(ctx context.Context, data types.DeleteAccount) (*types.DeleteAccountResponse, error)
func (*Client) DeleteComment ¶
func (c *Client) DeleteComment(ctx context.Context, data types.DeleteComment) (*types.CommentResponse, error)
func (*Client) DeleteCommunity ¶
func (c *Client) DeleteCommunity(ctx context.Context, data types.DeleteCommunity) (*types.CommunityResponse, error)
func (*Client) DeletePost ¶
func (c *Client) DeletePost(ctx context.Context, data types.DeletePost) (*types.PostResponse, error)
func (*Client) DeletePrivateMessage ¶
func (c *Client) DeletePrivateMessage(ctx context.Context, data types.DeletePrivateMessage) (*types.PrivateMessageResponse, error)
func (*Client) EditComment ¶
func (c *Client) EditComment(ctx context.Context, data types.EditComment) (*types.CommentResponse, error)
func (*Client) EditCommunity ¶
func (c *Client) EditCommunity(ctx context.Context, data types.EditCommunity) (*types.CommunityResponse, error)
func (*Client) EditPrivateMessage ¶
func (c *Client) EditPrivateMessage(ctx context.Context, data types.EditPrivateMessage) (*types.PrivateMessageResponse, error)
func (*Client) FeaturePost ¶ added in v0.17.0
func (c *Client) FeaturePost(ctx context.Context, data types.FeaturePost) (*types.PostResponse, error)
func (*Client) FollowCommunity ¶
func (c *Client) FollowCommunity(ctx context.Context, data types.FollowCommunity) (*types.CommunityResponse, error)
func (*Client) HideCommunity ¶
func (c *Client) HideCommunity(ctx context.Context, data types.HideCommunity) (*types.CommunityResponse, error)
func (*Client) LeaveAdmin ¶
func (c *Client) LeaveAdmin(ctx context.Context, data types.LeaveAdmin) (*types.GetSiteResponse, error)
func (*Client) MarkAllAsRead ¶
func (c *Client) MarkAllAsRead(ctx context.Context, data types.MarkAllAsRead) (*types.GetRepliesResponse, error)
func (*Client) MarkCommentReplyAsRead ¶ added in v0.17.0
func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkCommentReplyAsRead) (*types.CommentReplyResponse, error)
func (*Client) MarkPersonMentionAsRead ¶
func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error)
func (*Client) MarkPostAsRead ¶
func (c *Client) MarkPostAsRead(ctx context.Context, data types.MarkPostAsRead) (*types.PostResponse, error)
func (*Client) MarkPrivateMessageAsRead ¶
func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data types.MarkPrivateMessageAsRead) (*types.PrivateMessageResponse, error)
func (*Client) PasswordChangeAfterReset ¶
func (c *Client) PasswordChangeAfterReset(ctx context.Context, data types.PasswordChangeAfterReset) (*types.LoginResponse, error)
func (*Client) PasswordReset ¶
func (c *Client) PasswordReset(ctx context.Context, data types.PasswordReset) (*types.PasswordResetResponse, error)
func (*Client) PersonDetails ¶
func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error)
func (*Client) PersonMentions ¶
func (c *Client) PersonMentions(ctx context.Context, data types.GetPersonMentions) (*types.GetPersonMentionsResponse, error)
func (*Client) PostReports ¶ added in v0.17.0
func (c *Client) PostReports(ctx context.Context, data types.ListPostReports) (*types.ListPostReportsResponse, error)
func (*Client) PrivateMessageReports ¶ added in v0.17.0
func (c *Client) PrivateMessageReports(ctx context.Context, data types.ListPrivateMessageReports) (*types.ListPrivateMessageReportsResponse, error)
func (*Client) PrivateMessages ¶
func (c *Client) PrivateMessages(ctx context.Context, data types.GetPrivateMessages) (*types.PrivateMessagesResponse, error)
func (*Client) PurgeComment ¶ added in v0.17.0
func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error)
func (*Client) PurgeCommunity ¶ added in v0.17.0
func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error)
func (*Client) PurgePerson ¶ added in v0.17.0
func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error)
func (*Client) RegistrationApplications ¶ added in v0.17.0
func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRegistrationApplications) (*types.ListRegistrationApplicationsResponse, error)
func (*Client) RemoveComment ¶
func (c *Client) RemoveComment(ctx context.Context, data types.RemoveComment) (*types.CommentResponse, error)
func (*Client) RemoveCommunity ¶
func (c *Client) RemoveCommunity(ctx context.Context, data types.RemoveCommunity) (*types.CommunityResponse, error)
func (*Client) RemovePost ¶
func (c *Client) RemovePost(ctx context.Context, data types.RemovePost) (*types.PostResponse, error)
func (*Client) Replies ¶
func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.GetRepliesResponse, error)
func (*Client) ReportCount ¶
func (c *Client) ReportCount(ctx context.Context, data types.GetReportCount) (*types.GetReportCountResponse, error)
func (*Client) ResolveCommentReport ¶
func (c *Client) ResolveCommentReport(ctx context.Context, data types.ResolveCommentReport) (*types.CommentReportResponse, error)
func (*Client) ResolveObject ¶
func (c *Client) ResolveObject(ctx context.Context, data types.ResolveObject) (*types.ResolveObjectResponse, error)
func (*Client) ResolvePostReport ¶
func (c *Client) ResolvePostReport(ctx context.Context, data types.ResolvePostReport) (*types.PostReportResponse, error)
func (*Client) ResolvePrivateMessageReport ¶ added in v0.17.0
func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data types.ResolvePrivateMessageReport) (*types.PrivateMessageReportResponse, error)
func (*Client) SaveComment ¶
func (c *Client) SaveComment(ctx context.Context, data types.SaveComment) (*types.CommentResponse, error)
func (*Client) SaveUserSettings ¶
func (c *Client) SaveUserSettings(ctx context.Context, data types.SaveUserSettings) (*types.LoginResponse, error)
func (*Client) SiteMetadata ¶
func (c *Client) SiteMetadata(ctx context.Context, data types.GetSiteMetadata) (*types.GetSiteMetadataResponse, error)
func (*Client) TransferCommunity ¶
func (c *Client) TransferCommunity(ctx context.Context, data types.TransferCommunity) (*types.GetCommunityResponse, error)
func (*Client) UnreadCount ¶
func (c *Client) UnreadCount(ctx context.Context, data types.GetUnreadCount) (*types.GetUnreadCountResponse, error)
func (*Client) UnreadRegistrationApplicationCount ¶
func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context, data types.GetUnreadRegistrationApplicationCount) (*types.GetUnreadRegistrationApplicationCountResponse, error)
func (*Client) VerifyEmail ¶
func (c *Client) VerifyEmail(ctx context.Context, data types.VerifyEmail) (*types.VerifyEmailResponse, error)
type WSClient ¶
type WSClient struct { Token string // contains filtered or unexported fields }
WSClient is a client for Lemmy's WebSocket API
func NewWebSocket ¶
NewWebSocket creates and returns a new WSClient, and starts a goroutine to read server responses and errors
func (*WSClient) ClientLogin ¶
ClientLogin logs in to Lemmy by sending an HTTP request to the login endpoint. It stores the returned token in the client for future use.
func (*WSClient) Errors ¶
Errors returns a channel that receives errors received while attempting to read responses
func (*WSClient) OnReconnect ¶ added in v0.17.0
func (*WSClient) Request ¶
Request sends a request to the server. If data is nil, the authentication token will be sent instead. If data has an Auth field, it will be set to the authentication token automatically.
func (*WSClient) Responses ¶
func (c *WSClient) Responses() <-chan types.LemmyWebSocketMsg
Responses returns a channel that receives messages from Lemmy.