Struct lemmy_client::LemmyClient
source · pub struct LemmyClient { /* private fields */ }Expand description
API wrapper for lemmy
Implementations§
source§impl LemmyClient
impl LemmyClient
sourcepub fn new(options: ClientOptions) -> Self
pub fn new(options: ClientOptions) -> Self
Creates a new LemmyClient.
§Examples
use lemmy_client::{LemmyClient, ClientOptions};
let client = LemmyClient::new(ClientOptions {
domain: String::from("lemmy.ml"),
secure: true
});sourcepub fn headers(&self) -> &HashMap<String, String>
pub fn headers(&self) -> &HashMap<String, String>
Map of headers that will be included with each request.
sourcepub fn headers_mut(&mut self) -> &mut HashMap<String, String>
pub fn headers_mut(&mut self) -> &mut HashMap<String, String>
Mutable map of headers that will be included with each request. Use this method if you want to add headers other than the JWT.
sourcepub fn remove_jwt(&mut self)
pub fn remove_jwt(&mut self)
Remove the jwt if it is already set.
sourcepub async fn get_site(&self) -> Result<GetSiteResponse, Error>
pub async fn get_site(&self) -> Result<GetSiteResponse, Error>
Gets the site and, if you pass an authorized JWT, information about the logged in user.
HTTP GET /site
sourcepub async fn create_site(
&self,
form: CreateSite
) -> Result<GetSiteResponse, Error>
pub async fn create_site( &self, form: CreateSite ) -> Result<GetSiteResponse, Error>
Creates site during initial setup.
HTTP POST /site
sourcepub async fn edit_site(&self, form: EditSite) -> Result<GetSiteResponse, Error>
pub async fn edit_site(&self, form: EditSite) -> Result<GetSiteResponse, Error>
Edits your site.
HTTP PUT /site
sourcepub async fn get_modlog(
&self,
form: GetModlog
) -> Result<GetModlogResponse, Error>
pub async fn get_modlog( &self, form: GetModlog ) -> Result<GetModlogResponse, Error>
Gets the modlog.
HTTP GET /modlog
sourcepub async fn search(&self, form: Search) -> Result<SearchResponse, Error>
pub async fn search(&self, form: Search) -> Result<SearchResponse, Error>
Searches for content.
HTTP GET /search
sourcepub async fn resolve_object(
&self,
form: ResolveObject
) -> Result<ResolveObjectResponse, Error>
pub async fn resolve_object( &self, form: ResolveObject ) -> Result<ResolveObjectResponse, Error>
Fetches an object from a non-local instance.
HTTP GET /resolve_object
sourcepub async fn get_community(
&self,
form: GetCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn get_community( &self, form: GetCommunity ) -> Result<GetCommunityResponse, Error>
Gets a community.
HTTP GET /community
sourcepub async fn create_community(
&self,
form: CreateCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn create_community( &self, form: CreateCommunity ) -> Result<GetCommunityResponse, Error>
Creates a new community.
HTTP POST /community
sourcepub async fn edit_community(
&self,
form: EditCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn edit_community( &self, form: EditCommunity ) -> Result<GetCommunityResponse, Error>
Edits a community.
HTTP PUT /community
sourcepub async fn hide_community(
&self,
form: HideCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn hide_community( &self, form: HideCommunity ) -> Result<GetCommunityResponse, Error>
Hides a community from public view.
HTTP PUT /community_hide
sourcepub async fn list_communities(
&self,
form: ListCommunities
) -> Result<ListCommunitiesResponse, Error>
pub async fn list_communities( &self, form: ListCommunities ) -> Result<ListCommunitiesResponse, Error>
Lists communities.
HTTP GET /community/list
sourcepub async fn follow_community(
&self,
form: FollowCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn follow_community( &self, form: FollowCommunity ) -> Result<GetCommunityResponse, Error>
Subscribes to a community.
HTTP POST /community/follow
sourcepub async fn block_community(
&self,
form: BlockCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn block_community( &self, form: BlockCommunity ) -> Result<GetCommunityResponse, Error>
Blocks a community.
HTTP POST /community/block
sourcepub async fn delete_community(
&self,
form: DeleteCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn delete_community( &self, form: DeleteCommunity ) -> Result<GetCommunityResponse, Error>
Deletes a community.
HTTP POST /community/delete
sourcepub async fn remove_community(
&self,
form: RemoveCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn remove_community( &self, form: RemoveCommunity ) -> Result<GetCommunityResponse, Error>
Removes a community (moderation action).
HTTP POST /community/remove
sourcepub async fn transfer_community(
&self,
form: TransferCommunity
) -> Result<GetCommunityResponse, Error>
pub async fn transfer_community( &self, form: TransferCommunity ) -> Result<GetCommunityResponse, Error>
Transfers a community you own to another user on that community’s moderation team.
HTTP POST community/transfer
sourcepub async fn ban_from_community(
&self,
form: BanFromCommunity
) -> Result<BanFromCommunityResponse, Error>
pub async fn ban_from_community( &self, form: BanFromCommunity ) -> Result<BanFromCommunityResponse, Error>
Bans a user from a community.
HTTP POST /community/ban_user
sourcepub async fn add_mod_to_community(
&self,
form: AddModToCommunity
) -> Result<AddModToCommunityResponse, Error>
pub async fn add_mod_to_community( &self, form: AddModToCommunity ) -> Result<AddModToCommunityResponse, Error>
Adds a moderator to your community.
HTTP POST /community/mod
sourcepub async fn get_federated_instances(
&self,
form: FederatedInstances
) -> Result<GetFederatedInstancesResponse, Error>
pub async fn get_federated_instances( &self, form: FederatedInstances ) -> Result<GetFederatedInstancesResponse, Error>
Gets the instances that are federated with your instance.
HTTP GET /federated_instances
sourcepub async fn get_post(&self, form: GetPost) -> Result<GetPostResponse, Error>
pub async fn get_post(&self, form: GetPost) -> Result<GetPostResponse, Error>
Gets post.
HTTP GET /post
sourcepub async fn create_post(
&self,
form: CreatePost
) -> Result<GetPostResponse, Error>
pub async fn create_post( &self, form: CreatePost ) -> Result<GetPostResponse, Error>
Creates a post.
HTTP POST /post
sourcepub async fn edit_post(&self, form: EditPost) -> Result<GetPostResponse, Error>
pub async fn edit_post(&self, form: EditPost) -> Result<GetPostResponse, Error>
Edits a post you have already created.
HTTP PUT /post
sourcepub async fn delete_post(
&self,
form: DeletePost
) -> Result<GetPostResponse, Error>
pub async fn delete_post( &self, form: DeletePost ) -> Result<GetPostResponse, Error>
Deletes a post you have made.
HTTP POST /post/delete
sourcepub async fn remove_post(
&self,
form: RemovePost
) -> Result<GetPostResponse, Error>
pub async fn remove_post( &self, form: RemovePost ) -> Result<GetPostResponse, Error>
Removes a post (moderator action).
HTTP POST /post/remove
sourcepub async fn mark_post_as_read(
&self,
form: MarkPostAsRead
) -> Result<GetPostResponse, Error>
pub async fn mark_post_as_read( &self, form: MarkPostAsRead ) -> Result<GetPostResponse, Error>
Marks a post as read.
HTTP POST /post/mark_as_read
sourcepub async fn lock_post(&self, form: LockPost) -> Result<GetPostResponse, Error>
pub async fn lock_post(&self, form: LockPost) -> Result<GetPostResponse, Error>
Prevents users from commenting on the post (moderator action).
HTTP POST /post/lock
sourcepub async fn feature_post(
&self,
form: FeaturePost
) -> Result<GetPostResponse, Error>
pub async fn feature_post( &self, form: FeaturePost ) -> Result<GetPostResponse, Error>
Pins a post to the top of the community page (moderator action).
HTTP POST /post/feature
sourcepub async fn list_posts(
&self,
form: GetPosts
) -> Result<GetPostsResponse, Error>
pub async fn list_posts( &self, form: GetPosts ) -> Result<GetPostsResponse, Error>
Gets posts with a variety of filters.
HTTP GET /post/list
sourcepub async fn like_post(
&self,
form: CreatePostLike
) -> Result<GetPostResponse, Error>
pub async fn like_post( &self, form: CreatePostLike ) -> Result<GetPostResponse, Error>
Votes on a post.
HTTP POST /post/like
sourcepub async fn list_post_likes(
&self,
form: ListPostLikes
) -> Result<ListPostLikesResponse, Error>
pub async fn list_post_likes( &self, form: ListPostLikes ) -> Result<ListPostLikesResponse, Error>
Lists the likes for a post.
HTTP GET /post/like/list
sourcepub async fn save_post(&self, form: SavePost) -> Result<GetPostResponse, Error>
pub async fn save_post(&self, form: SavePost) -> Result<GetPostResponse, Error>
Saves a post to your favorites list.
HTTP PUT /post/save
sourcepub async fn report_post(
&self,
form: CreatePostReport
) -> Result<PostReportResponse, Error>
pub async fn report_post( &self, form: CreatePostReport ) -> Result<PostReportResponse, Error>
Reports a post to the moderator team of the community the post is in, the admin team of your instance, and the admin team of the poster’s instance.
HTTP POST /post/report
sourcepub async fn resolve_post_report(
&self,
form: ResolvePostReport
) -> Result<PostReportResponse, Error>
pub async fn resolve_post_report( &self, form: ResolvePostReport ) -> Result<PostReportResponse, Error>
Resolves a post report (moderator action).
HTTP PUT /post/report/resolve
sourcepub async fn list_post_reports(
&self,
form: ListPostReports
) -> Result<ListPostReportsResponse, Error>
pub async fn list_post_reports( &self, form: ListPostReports ) -> Result<ListPostReportsResponse, Error>
Gets reports of posts that you are able to moderate.
HTTP GET /post/report/list
sourcepub async fn get_post_url_metadata(
&self,
form: GetSiteMetadata
) -> Result<GetSiteMetadataResponse, Error>
pub async fn get_post_url_metadata( &self, form: GetSiteMetadata ) -> Result<GetSiteMetadataResponse, Error>
Gets the metadata of a given site.
HTTP POST /post/site_metadata
sourcepub async fn get_comment(
&self,
form: GetComment
) -> Result<CommentResponse, Error>
pub async fn get_comment( &self, form: GetComment ) -> Result<CommentResponse, Error>
Gets a comment.
HTTP GET /comment
sourcepub async fn create_comment(
&self,
form: CreateComment
) -> Result<CommentResponse, Error>
pub async fn create_comment( &self, form: CreateComment ) -> Result<CommentResponse, Error>
Creates a new comment.
HTTP POST /comment
sourcepub async fn edit_comment(
&self,
form: EditComment
) -> Result<CommentResponse, Error>
pub async fn edit_comment( &self, form: EditComment ) -> Result<CommentResponse, Error>
Edits one of your already-created comments.
HTTP PUT /comment
sourcepub async fn delete_comment(
&self,
form: DeleteComment
) -> Result<CommentResponse, Error>
pub async fn delete_comment( &self, form: DeleteComment ) -> Result<CommentResponse, Error>
Deletes one of your already-existing comments.
HTTP POST /comment/delete
sourcepub async fn remove_comment(
&self,
form: RemoveComment
) -> Result<CommentResponse, Error>
pub async fn remove_comment( &self, form: RemoveComment ) -> Result<CommentResponse, Error>
Removes a post (moderator action).
HTTP POST /comment/remove
sourcepub async fn mark_reply_as_read(
&self,
form: MarkCommentReplyAsRead
) -> Result<CommentReplyResponse, Error>
pub async fn mark_reply_as_read( &self, form: MarkCommentReplyAsRead ) -> Result<CommentReplyResponse, Error>
Marks a reply to one of your posts or comments as read.
HTTP POST /comment/mark_as_read
sourcepub async fn distinguish_comment(
&self,
form: DistinguishComment
) -> Result<CommentResponse, Error>
pub async fn distinguish_comment( &self, form: DistinguishComment ) -> Result<CommentResponse, Error>
Pins a comment to the top of a post’s comment section (speak as moderator).
HTTP POST /comment/distinguish
sourcepub async fn like_comment(
&self,
form: CreateCommentLike
) -> Result<CommentResponse, Error>
pub async fn like_comment( &self, form: CreateCommentLike ) -> Result<CommentResponse, Error>
Votes on a comment.
HTTP POST /comment/like
sourcepub async fn list_comment_likes(
&self,
form: ListCommentLikes
) -> Result<ListCommentLikesResponse, Error>
pub async fn list_comment_likes( &self, form: ListCommentLikes ) -> Result<ListCommentLikesResponse, Error>
Gets the votes for a comment.
HTTP GET /comment/like/list
sourcepub async fn save_comment(
&self,
form: SaveComment
) -> Result<CommentResponse, Error>
pub async fn save_comment( &self, form: SaveComment ) -> Result<CommentResponse, Error>
Saves a comment to your favorites list.
HTTP PUT /comment/save
sourcepub async fn list_comments(
&self,
form: GetComments
) -> Result<GetCommentsResponse, Error>
pub async fn list_comments( &self, form: GetComments ) -> Result<GetCommentsResponse, Error>
Gets comments with various filters.
HTTP GET /comment/list
sourcepub async fn create_comment_report(
&self,
form: CreateCommentReport
) -> Result<CommentResponse, Error>
pub async fn create_comment_report( &self, form: CreateCommentReport ) -> Result<CommentResponse, Error>
Reports a comment to the moderator team of the community the comment is in, your instance’s admin team, and the commentor’s instance’s admin team.
HTTP POST /comment/report
sourcepub async fn resolve_comment_report(
&self,
form: ResolveCommentReport
) -> Result<CommentReportResponse, Error>
pub async fn resolve_comment_report( &self, form: ResolveCommentReport ) -> Result<CommentReportResponse, Error>
Resolves a report on a comment made in a community you moderate or instance you administrate.
HTTP PUT /comment/report/resolve
sourcepub async fn list_comment_reports(
&self,
form: ListCommentReports
) -> Result<ListCommentReportsResponse, Error>
pub async fn list_comment_reports( &self, form: ListCommentReports ) -> Result<ListCommentReportsResponse, Error>
Lists reports for comments in communities you moderate or instances you adminstrate.
HTTP GET /comment/report/list
sourcepub async fn create_private_message(
&self,
form: CreatePrivateMessage
) -> Result<PrivateMessageResponse, Error>
pub async fn create_private_message( &self, form: CreatePrivateMessage ) -> Result<PrivateMessageResponse, Error>
Creates and send a private message to another user.
HTTP POST /private_message
sourcepub async fn edit_private_message(
&self,
form: EditPrivateMessage
) -> Result<PrivateMessageResponse, Error>
pub async fn edit_private_message( &self, form: EditPrivateMessage ) -> Result<PrivateMessageResponse, Error>
Edits a private message you have already sent.
HTTP PUT /private_message
sourcepub async fn list_private_messages(
&self,
form: GetPrivateMessages
) -> Result<PrivateMessagesResponse, Error>
pub async fn list_private_messages( &self, form: GetPrivateMessages ) -> Result<PrivateMessagesResponse, Error>
Lists private messages that have been sent to you.
HTTP GET /private_message/list
sourcepub async fn delete_private_message(
&self,
form: DeletePrivateMessage
) -> Result<PrivateMessageResponse, Error>
pub async fn delete_private_message( &self, form: DeletePrivateMessage ) -> Result<PrivateMessageResponse, Error>
Deletes a private that you have already sent.
HTTP POST /private_message/delete
sourcepub async fn mark_private_message_as_read(
&self,
form: MarkPrivateMessageAsRead
) -> Result<PrivateMessageResponse, Error>
pub async fn mark_private_message_as_read( &self, form: MarkPrivateMessageAsRead ) -> Result<PrivateMessageResponse, Error>
Marks a private message that was sent to you as read.
HTTP POST /private_message/mark_as_read
sourcepub async fn create_private_message_report(
&self,
form: CreatePrivateMessageReport
) -> Result<PrivateMessageReportResponse, Error>
pub async fn create_private_message_report( &self, form: CreatePrivateMessageReport ) -> Result<PrivateMessageReportResponse, Error>
Reports a private message that was sent to you to your instance’s admin team and the sender’s instance’s admin team.
HTTP POST /private_message/report
sourcepub async fn resolve_private_message_report(
&self,
form: ResolvePrivateMessageReport
) -> Result<PrivateMessageReportResponse, Error>
pub async fn resolve_private_message_report( &self, form: ResolvePrivateMessageReport ) -> Result<PrivateMessageReportResponse, Error>
Resolves a report of a private message sent to a user on the instance you administrate.
HTTP PUT /private_message/report/resolve
sourcepub async fn list_private_message_reports(
&self,
form: ListPrivateMessageReports
) -> Result<ListPrivateMessageReportsResponse, Error>
pub async fn list_private_message_reports( &self, form: ListPrivateMessageReports ) -> Result<ListPrivateMessageReportsResponse, Error>
Lists reports of private messages received on the isntance you administrate.
HTTP GET /private_message/report/list
sourcepub async fn get_person(
&self,
form: GetPersonDetails
) -> Result<GetPersonDetailsResponse, Error>
pub async fn get_person( &self, form: GetPersonDetails ) -> Result<GetPersonDetailsResponse, Error>
Gets the publicly viewable details of a user’s account.
HTTP GET /user
sourcepub async fn register_account(
&self,
form: Register
) -> Result<RegistrationApplicationResponse, Error>
pub async fn register_account( &self, form: Register ) -> Result<RegistrationApplicationResponse, Error>
Registers a new account on an instance.
HTTP POST /user/register
sourcepub async fn get_captcha(&self) -> Result<GetCaptchaResponse, Error>
pub async fn get_captcha(&self) -> Result<GetCaptchaResponse, Error>
Gets a captcha.
HTTP GET /user/get_captcha
sourcepub async fn export_settings(&self) -> Result<String, Error>
pub async fn export_settings(&self) -> Result<String, Error>
Exports a backup of your user settings - including your saved content, followed communities, and blocks - as JSON.
HTTP GET /user/export_settings
sourcepub async fn import_settings(
&self,
form: String
) -> Result<SuccessResponse, Error>
pub async fn import_settings( &self, form: String ) -> Result<SuccessResponse, Error>
Imports a backup of your user settings.
HTTP POST /user/import_settings
sourcepub async fn list_mentions(
&self,
form: GetPersonMentions
) -> Result<GetPersonMentionsResponse, Error>
pub async fn list_mentions( &self, form: GetPersonMentions ) -> Result<GetPersonMentionsResponse, Error>
Gets mentions of the authenticated user.
HTTP GET /user/mention
sourcepub async fn mark_mention_as_read(
&self,
form: MarkPersonMentionAsRead
) -> Result<PersonMentionResponse, Error>
pub async fn mark_mention_as_read( &self, form: MarkPersonMentionAsRead ) -> Result<PersonMentionResponse, Error>
Marks a mention as read.
HTTP POST /user/mention/mark_as_read
sourcepub async fn list_replies(
&self,
form: GetReplies
) -> Result<GetRepliesResponse, Error>
pub async fn list_replies( &self, form: GetReplies ) -> Result<GetRepliesResponse, Error>
Gets replies to your posts and comments.
HTTP GET /user/replies
sourcepub async fn ban_from_site(
&self,
form: BanPerson
) -> Result<BanPersonResponse, Error>
pub async fn ban_from_site( &self, form: BanPerson ) -> Result<BanPersonResponse, Error>
Bans a person from your instance.
HTTP POST /user/ban
sourcepub async fn list_banned_users(&self) -> Result<BannedPersonsResponse, Error>
pub async fn list_banned_users(&self) -> Result<BannedPersonsResponse, Error>
Gets users banned who are banned from your isntance.
HTTP GET /user/banned
sourcepub async fn block_person(
&self,
form: BlockPerson
) -> Result<BlockPersonResponse, Error>
pub async fn block_person( &self, form: BlockPerson ) -> Result<BlockPersonResponse, Error>
Blocks a person.
HTTP POST /user/block
sourcepub async fn login(&self, form: Login) -> Result<LoginResponse, Error>
pub async fn login(&self, form: Login) -> Result<LoginResponse, Error>
Logs into the instance, giving you a JWT to use to make authorized requests.
HTTP POST /user/login
sourcepub async fn logout(&self) -> Result<String, Error>
pub async fn logout(&self) -> Result<String, Error>
Deletes the active session associated with the JWT.
HTTP POST /user/logout
sourcepub async fn delete_account(
&self,
form: DeleteAccount
) -> Result<GetPersonDetailsResponse, Error>
pub async fn delete_account( &self, form: DeleteAccount ) -> Result<GetPersonDetailsResponse, Error>
Deletes your account.
HTTP POST /user/delete_account
sourcepub async fn reset_password(
&self,
form: PasswordReset
) -> Result<SuccessResponse, Error>
pub async fn reset_password( &self, form: PasswordReset ) -> Result<SuccessResponse, Error>
Sends an email to your account (if you have one) with a one time link to change your password. Use this if you forgot your password.
HTTP POST /user/password_reset
sourcepub async fn change_password_after_reset(
&self,
form: PasswordChangeAfterReset
) -> Result<SuccessResponse, Error>
pub async fn change_password_after_reset( &self, form: PasswordChangeAfterReset ) -> Result<SuccessResponse, Error>
Follows through with one time link password reset request.
HTTP POST /user/password_change
sourcepub async fn mark_all_notifications_as_read(
&self
) -> Result<GetRepliesResponse, Error>
pub async fn mark_all_notifications_as_read( &self ) -> Result<GetRepliesResponse, Error>
Marks all notifications (replies, mentions, private messages) as read.
HTTP POST /user/mark_all_as_read
sourcepub async fn save_user_settings(
&self,
form: SaveUserSettings
) -> Result<SuccessResponse, Error>
pub async fn save_user_settings( &self, form: SaveUserSettings ) -> Result<SuccessResponse, Error>
Saves your account settings.
HTTP PUT /user/save_user_settings
sourcepub async fn change_password(
&self,
form: ChangePassword
) -> Result<LoginResponse, Error>
pub async fn change_password( &self, form: ChangePassword ) -> Result<LoginResponse, Error>
Changes your password if you are already logged in.
HTTP PUT /user/change_password
sourcepub async fn report_count(
&self,
form: GetReportCount
) -> Result<GetReportCountResponse, Error>
pub async fn report_count( &self, form: GetReportCount ) -> Result<GetReportCountResponse, Error>
Gets number of reports you can resolve.
HTTP GET /user/report_count
sourcepub async fn unread_count(&self) -> Result<GetUnreadCountResponse, Error>
pub async fn unread_count(&self) -> Result<GetUnreadCountResponse, Error>
Gets the number of unread notifications.
HTTP GET /user/unread_count
sourcepub async fn verify_email(
&self,
form: VerifyEmail
) -> Result<SuccessResponse, Error>
pub async fn verify_email( &self, form: VerifyEmail ) -> Result<SuccessResponse, Error>
Verifies your email. Used when the instance you are registering an account on requires email verification.
HTTP POST /user/verify_email
sourcepub async fn leave_admin(&self) -> Result<GetSiteResponse, Error>
pub async fn leave_admin(&self) -> Result<GetSiteResponse, Error>
Leave your instance’s admin team.
HTTP POST /user/leave_admin
sourcepub async fn generate_totp_secret(
&self
) -> Result<GenerateTotpSecretResponse, Error>
pub async fn generate_totp_secret( &self ) -> Result<GenerateTotpSecretResponse, Error>
Generates a secret to enable time-based one time passwords for two-factor authentication.
After this, you will need to call /user/totp/update with a vaild token to enable it.
HTTP POST /user/totp/generate
sourcepub async fn update_totp(
&self,
form: UpdateTotp
) -> Result<UpdateTotpResponse, Error>
pub async fn update_totp( &self, form: UpdateTotp ) -> Result<UpdateTotpResponse, Error>
Enables/disables two-factor authentivation.
To enable, you must first call /user/totp/generate to generate a token to pass to this.
You can only disable this if it is already enabled. Again, you must pass a valid TOTP.
HTTP POST /user/totp/update
sourcepub async fn list_logins(&self) -> Result<Vec<LoginToken>, Error>
pub async fn list_logins(&self) -> Result<Vec<LoginToken>, Error>
Lists login tokens for your user’s active sessions.
HTTP GET /user/list_logins
sourcepub async fn validate_auth(&self) -> Result<SuccessResponse, Error>
pub async fn validate_auth(&self) -> Result<SuccessResponse, Error>
Returns an error message if your auth token is invalid.
HTTP GET /user/validate_auth
sourcepub async fn add_admin(&self, form: AddAdmin) -> Result<AddAdminResponse, Error>
pub async fn add_admin(&self, form: AddAdmin) -> Result<AddAdminResponse, Error>
Adds a user to your instance’s admin team.
HTTP POST admin/add
sourcepub async fn unread_registration_application_count(
&self
) -> Result<GetUnreadRegistrationApplicationCountResponse, Error>
pub async fn unread_registration_application_count( &self ) -> Result<GetUnreadRegistrationApplicationCountResponse, Error>
Gets the number of unread registration applications for the instance you administrate.
HTTP GET /admin/registration_application/count
sourcepub async fn list_registration_applications(
&self,
form: ListRegistrationApplications
) -> Result<ListRegistrationApplicationsResponse, Error>
pub async fn list_registration_applications( &self, form: ListRegistrationApplications ) -> Result<ListRegistrationApplicationsResponse, Error>
Gets applications to register an account on the instance you administer.
HTTP GET /admin/registration_application/list
sourcepub async fn approve_registration_application(
&self,
form: ApproveRegistrationApplication
) -> Result<RegistrationApplicationResponse, Error>
pub async fn approve_registration_application( &self, form: ApproveRegistrationApplication ) -> Result<RegistrationApplicationResponse, Error>
Approves a pending registration application.
HTTP PUT /admin/registration_application/approve
sourcepub async fn purge_person(
&self,
form: PurgePerson
) -> Result<SuccessResponse, Error>
pub async fn purge_person( &self, form: PurgePerson ) -> Result<SuccessResponse, Error>
Purges a user from the database.
HTTP POST /admin/purge/person
sourcepub async fn purge_community(
&self,
form: PurgeCommunity
) -> Result<SuccessResponse, Error>
pub async fn purge_community( &self, form: PurgeCommunity ) -> Result<SuccessResponse, Error>
Purges a community from the database.
HTTP POST /admin/purge/community
sourcepub async fn purge_post(
&self,
form: PurgePost
) -> Result<SuccessResponse, Error>
pub async fn purge_post( &self, form: PurgePost ) -> Result<SuccessResponse, Error>
Purges a post from the datbase.
HTTP POST /admin/purge/post
sourcepub async fn purge_comment(
&self,
form: PurgeComment
) -> Result<SuccessResponse, Error>
pub async fn purge_comment( &self, form: PurgeComment ) -> Result<SuccessResponse, Error>
Purges a comment from the database.
HTTP POST /admin/purge/comment
sourcepub async fn create_custom_emoji(
&self,
form: CreateCustomEmoji
) -> Result<CustomEmojiResponse, Error>
pub async fn create_custom_emoji( &self, form: CreateCustomEmoji ) -> Result<CustomEmojiResponse, Error>
Creates a custom emoji.
HTTP POST /custom_emoji
sourcepub async fn edit_custom_emoji(
&self,
form: EditCustomEmoji
) -> Result<CustomEmojiResponse, Error>
pub async fn edit_custom_emoji( &self, form: EditCustomEmoji ) -> Result<CustomEmojiResponse, Error>
Edits an existing custom emoji.
HTTP PUT /custom_emoji
sourcepub async fn delete_custom_emoji(
&self,
form: DeleteCustomEmoji
) -> Result<CustomEmojiResponse, Error>
pub async fn delete_custom_emoji( &self, form: DeleteCustomEmoji ) -> Result<CustomEmojiResponse, Error>
Deletes an existing custom emoji.
HTTP POST /custom_emoji/delete