diff --git a/docs/VERSIONS.json b/docs/VERSIONS.json index 7811093..9e59288 100644 --- a/docs/VERSIONS.json +++ b/docs/VERSIONS.json @@ -5,6 +5,7 @@ "v0.1.2", "v0.1.3", "v0.1.4", - "v0.1.5" + "v0.1.5", + "v0.1.6" ] } \ No newline at end of file diff --git a/docs/v0.1.6/api_paths.html b/docs/v0.1.6/api_paths.html new file mode 100644 index 0000000..756e1ae --- /dev/null +++ b/docs/v0.1.6/api_paths.html @@ -0,0 +1,153 @@ + + + + + + +jplaw.api_paths API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.api_paths

+
+
+

Helper variables for converting between function and API path / request type.

+
+ +Expand source code + +
"""
+Helper variables for converting between function and API path / request type.
+"""
+
+from jplaw.types.http_type import HttpType
+
+API_VERSION = "/api/v3"
+API_PATH = {
+    "login" :                               { "method": HttpType.POST    , "path": "/user/login"                            },
+    "getPost" :                             { "method": HttpType.GET     , "path": "/post"                                  },
+    "getCommunity" :                        { "method": HttpType.GET     , "path": "/community"                             },
+    "listCommunities" :                     { "method": HttpType.GET     , "path": "/community/list"                        },
+    "getPosts" :                            { "method": HttpType.GET     , "path": "/post/list"                             },
+    "createPost" :                          { "method": HttpType.POST    , "path": "/post"                                  },
+    "editPost" :                            { "method": HttpType.PUT     , "path": "/post"                                  },
+    "createComment" :                       { "method": HttpType.POST    , "path": "/comment"                               },
+    "likePost" :                            { "method": HttpType.POST    , "path": "/post/like"                             },
+    "likeComment" :                         { "method": HttpType.POST    , "path": "/comment/like"                          },
+    "followCommunity" :                     { "method": HttpType.POST    , "path": "/community/follow"                      },
+    "resolveObject":                        { "method": HttpType.GET     , "path": "/resolve_object"                        },
+    "search":                               { "method": HttpType.GET     , "path": "/search"                                },
+    "getSite":                              { "method": HttpType.GET     , "path": "/site"                                  },
+    "leaveAdmin":                           { "method": HttpType.POST    , "path": "/user/leave_admin"                      },
+    "register":                             { "method": HttpType.POST    , "path": "/user/register"                         },
+    "getPersonDetails":                     { "method": HttpType.GET     , "path": "/user"                                  },
+    "getPersonMentions":                    { "method": HttpType.GET     , "path": "/user/mention"                          },
+    "markPersonMentionAsRead":              { "method": HttpType.POST    , "path": "/user/mention/mark_as_read"             },
+    "getReplies":                           { "method": HttpType.GET     , "path": "/user/replies"                          },
+    "banPerson":                            { "method": HttpType.POST    , "path": "/user/ban"                              },
+    "getBannedPersons":                     { "method": HttpType.GET     , "path": "/user/banned"                           },
+    "blockPerson":                          { "method": HttpType.POST    , "path": "/user/block"                            },
+    "deleteAccount":                        { "method": HttpType.POST    , "path": "/user/delete_account"                   },
+    "passwordReset":                        { "method": HttpType.POST    , "path": "/user/password_reset"                   },
+    "passwordChangeAfterReset":             { "method": HttpType.POST    , "path": "/user/password_change"                  },
+    "saveUserSettings":                     { "method": HttpType.PUT     , "path": "/user/save_user_settings"               },
+    "markAllAsRead":                        { "method": HttpType.GET     , "path": "/user/mark_all_as_read"                 },
+    "changePassword":                       { "method": HttpType.PUT     , "path": "/user/change_password"                  },
+    "getReportCount":                       { "method": HttpType.GET     , "path": "/user/report_count"                     },
+    "getUnreadCount":                       { "method": HttpType.GET     , "path": "/user/unread_count"                     },
+    "verifyEmail":                          { "method": HttpType.POST    , "path": "/user/verify_email"                     },
+    "addAdmin":                             { "method": HttpType.POST    , "path": "/admin/add"                             },
+    "getUnreadRegistrationApplicationCount":{ "method": HttpType.GET     , "path": "/admin/registration_application/count"  },
+    "listRegistrationApplications":         { "method": HttpType.GET     , "path": "/admin/registration_application/list"   },
+    "createCustomEmoji":                    { "method": HttpType.GET     , "path": "/custom_emoji"                          },
+    "editCustomEmoji":                      { "method": HttpType.PUT     , "path": "/custom_emoji"                          },
+    "deleteCustomEmoji":                    { "method": HttpType.POST    , "path": "/custom_emoji/delete"                   },
+    "addModToCommunity":                    { "method": HttpType.POST    , "path": "/community/mod"                         },
+    "approveRegistrationApplication":       { "method": HttpType.PUT     , "path": "/admin/registration_application/approve"},
+    "blockCommunity":                       { "method": HttpType.POST    , "path": "/community/block"                       },
+    "createCommentReport":                  { "method": HttpType.POST    , "path": "/comment/report"                        },
+    "createCommunity":                      { "method": HttpType.POST    , "path": "/community"                             },
+    "createPostReport":                     { "method": HttpType.POST    , "path": "/post/report"                           },
+    "createPrivateMessage":                 { "method": HttpType.POST    , "path": "/private_message"                       },
+    "createPrivateMessageReport":           { "method": HttpType.POST    , "path": "/private_message/report"                },
+    "editPrivateMessage":                   { "method": HttpType.PUT     , "path": "/private_message"                       },
+    "deletePrivateMessage":                 { "method": HttpType.POST    , "path": "/private_message/delete"                },
+    "markPrivateMessageAsRead":             { "method": HttpType.POST    , "path": "/private_message/mark_as_read"          },
+    "deleteComment":                        { "method": HttpType.POST    , "path": "/comment/delete"                        },
+    "deleteCommunity":                      { "method": HttpType.POST    , "path": "/community/delete"                      },
+    "removeComment":                        { "method": HttpType.POST    , "path": "/comment/remove"                        },
+    "deletePost":                           { "method": HttpType.POST    , "path": "/post/delete"                           },
+    "distinguishComment":                   { "method": HttpType.POST    , "path": "/comment/distinguish"                   },
+    "editComment":                          { "method": HttpType.PUT     , "path": "/comment"                               },
+    "editCommunity":                        { "method": HttpType.PUT     , "path": "/community"                             },
+    "banFromCommunity":                     { "method": HttpType.POST    , "path": "/community/ban_user"                    },
+    "editSite":                             { "method": HttpType.PUT     , "path": "/site"                                  },
+    "featurePost":                          { "method": HttpType.POST    , "path": "/post/feature"                          },
+    "getFederatedInstances":                { "method": HttpType.GET     , "path": "/federated_instances"                   },
+    "createSite":                           { "method": HttpType.POST    , "path": "/site"                                  },
+    "getCaptcha":                           { "method": HttpType.GET     , "path": "/user/get_captcha"                      },
+    "getComment":                           { "method": HttpType.GET     , "path": "/comment"                               },
+    "getComments":                          { "method": HttpType.GET     , "path": "/comment/list"                          },
+    "getModlog":                            { "method": HttpType.GET     , "path": "/modlog"                                },
+    "getPrivateMessages":                   { "method": HttpType.GET     , "path": "/private_message/list"                  },
+    "listCommentReports":                   { "method": HttpType.GET     , "path": "/comment/report/list"                   },
+    "listPostReports":                      { "method": HttpType.GET     , "path": "/post/report/list"                      },
+    "listPrivateMessageReports":            { "method": HttpType.GET     , "path": "/private_message/report/list"           },
+    "lockPost":                             { "method": HttpType.POST    , "path": "/post/lock"                             },
+    "markCommentReplyAsRead":               { "method": HttpType.POST    , "path": "/comment/mark_as_read"                  },
+    "markPostAsRead":                       { "method": HttpType.POST    , "path": "/post/mark_as_read"                     },
+    "purgeComment":                         { "method": HttpType.POST    , "path": "/admin/purge/comment"                   },
+    "purgeCommunity":                       { "method": HttpType.POST    , "path": "/admin/purge/community"                 },
+    "purgePost":                            { "method": HttpType.POST    , "path": "/admin/purge/post"                      },
+    "purgePerson":                          { "method": HttpType.POST    , "path": "/admin/purge/person"                    },
+    "removeCommunity":                      { "method": HttpType.POST    , "path": "/community/remove"                      },
+    "resolveCommentReport":                 { "method": HttpType.PUT     , "path": "/comment/report/resolve"                },
+    "resolvePostReport":                    { "method": HttpType.PUT     , "path": "/post/report/resolve"                   },
+    "resolvePrivateMessageReport":          { "method": HttpType.PUT     , "path": "/private_message/report/resolve"        },
+    "saveComment":                          { "method": HttpType.PUT     , "path": "/comment/save"                          },
+    "savePost":                             { "method": HttpType.PUT     , "path": "/post/save"                             },
+    "transferCommunity":                    { "method": HttpType.POST    , "path": "/community/transfer"                    },
+    "getSiteMetadata":                      { "method": HttpType.GET     , "path": "/post/site_metadata"                    },
+    "removePost":                           { "method": HttpType.POST    , "path": "/post/remove"                           },
+}
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/comment.html b/docs/v0.1.6/comment.html new file mode 100644 index 0000000..de445b0 --- /dev/null +++ b/docs/v0.1.6/comment.html @@ -0,0 +1,1320 @@ + + + + + + +jplaw.comment API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.comment

+
+
+

Comment class. Designed to allow Lemmy.Comment functions.

+
+ +Expand source code + +
"""
+Comment class. Designed to allow Lemmy.Comment functions.
+"""
+from jplaw.requestor import Requestor
+from jplaw.api_paths import *
+from jplaw.types.listing_type import ListingType
+from jplaw.types.comment_sort_type import CommentSortType
+
+class Comment():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+        
+    def create(self, post_id:int, content:str, parent_id:int=None, language_id:int=None, instance:str=None):
+        """
+        Create a comment
+        
+        Args:
+            post_id (int): ID of the post to create a comment on
+            content (str): Contents of the comment
+            parent_id (int): Parent comment ID. Optional. Default/If None, posts comment directly to post.
+            language_id (int): Language ID
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "content": content,
+            "post_id": post_id,
+        }
+        optional={
+            "language_id": language_id,
+            "parent_id": parent_id
+        }
+        res = self._req.lemmyRequest("createComment", instance=instance, form=form, optional=optional, auth=True)
+        
+        return res["comment_view"]
+        
+    def like(self, comment_id:int, score:int=1, instance:str=None):
+        """
+        Like a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            score (int): Score of the comment. -1/0/1 dislikes, removes like, and likes a comment.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        if(score > 1):
+            score = 1
+        if(score < -1):
+            score = -1
+        form = {
+            "comment_id": comment_id,
+            "score": score
+        }
+        res = self._req.lemmyRequest("likeComment", instance=instance, form=form, auth=True)
+        return res["comment_view"]
+        
+    def report(self, comment_id:int, reason:str, instance:str=None):
+        """
+        Report a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            reason (str): Reason for reporting the comment
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment report response
+        """
+        form = {
+            "comment_id": comment_id,
+            "reason": reason
+            }
+        res = self._req.lemmyRequest("createCommentReport", instance=instance, form=form, auth=True)
+        return res
+        
+    def delete(self, comment_id:int, deleted:bool=True, instance:str=None):
+        """
+        Delete a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            deleted (bool): If comment is deleted. Optional. Defaults to true
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id,
+            "deleted": deleted
+            }
+        res = self._req.lemmyRequest("deleteComment", instance=instance, form=form, auth=True)
+        return res["comment_view"]
+        
+    def remove(self, comment_id:int, mod_person_id:int, when_:str, removed:bool=True, reason:str=None, instance:str=None):
+        """
+        Moderator remove a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            mod_person_id (int): ID of the moderator removing the comment
+            when_ (str): Timestamp for when the comment was removed
+            removed (bool): If the comment is removed. Optional. Defaults to true.
+            deleted (bool): If comment is deleted. Optional. Defaults to true
+            reason (str): Reason for removing the comment. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id,
+            "mod_person_id": mod_person_id,
+            "when_": when_,
+            "removed": removed,
+            }
+        optional={
+            "reason":reason,
+            }
+        res = self._req.lemmyRequest("removeComment", instance=instance, form=form, optional=optional, auth=True)
+        return res["comment_view"]
+        
+    def distinguish(self, comment_id:int, distinguished:bool=True, instance:str=None):
+        """
+        Distinguish a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            distinguished (bool): If comment is distinguished. Optional. Defaults to true
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id,
+            "distinguished": distinguished,
+            }
+        res = self._req.lemmyRequest("distinguishComment", instance=instance, form=form, auth=True)
+        return res["comment_view"]
+        
+    def edit(self, comment_id:int, content:str=None, language_id:int=None, form_id:str=None, instance:str=None):
+        """
+        Edit a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            content (str): content of the comment
+            language_id (int): Language of the comment
+            form_id (str): ???
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id
+            }
+        optional={
+            "content":content,
+            "language_id":language_id,
+            "form_id":form_id,
+            }
+        res = self._req.lemmyRequest("editComment", instance=instance, form=form, optional=optional, auth=True)
+        return res["comment_view"]
+        
+    def get(self, comment_id:int, instance:str=None, auth:bool=True):    
+        """
+        Get a comment by id
+        
+        Args:
+            comment_id (int): ID of the comment
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether to authenticate using login or not. Optional. Defaults to True
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id
+            }
+        res = self._req.lemmyRequest("getComment", instance=instance, form=form, optional=optional, auth=auth)
+        return res["comment_view"]
+        
+    def list(self, 
+        comment_type:ListingType=None, 
+        sort:CommentSortType=None, 
+        max_depth:int=None, 
+        page:int=None, 
+        limit:int=None, 
+        community_id:int=None, 
+        post_id:int=None, 
+        community_name:str=None, 
+        parent_id:int=None,
+        saved_only:bool=None,
+        instance:str=None, 
+        auth:bool=True):
+        """
+        Get comments in a post
+        
+        Args:
+            comment_id (int): ID of the comment
+            comment_type (ListingType): Comment type. Optional.
+            sort (CommentSortType): Sort type. Optional.
+            max_depth (int): Max tree depth. Optional.
+            page (int): Page number. Optional.
+            limit (int): Comment count limit. Optional.
+            community_id (int): ID of community to get comment from. Optional.
+            post_id (int): ID of post to get comments from. Optional.
+            community_name (str): Name of community to get comments from. Optional.
+            parent_id (int): ID of parent comment to get replies to. Optional.
+            saved_only (bool): Filter by only saved comments. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether or not to authenticate. Optional. True by default.
+        Returns:
+            Comment list
+        """
+        form = {
+            "comment_id": comment_id
+            }
+        optional={
+            "type_"             : type_             ,
+            "sort"              : sort              ,
+            "max_depth"         : max_depth         ,
+            "page"              : page              ,
+            "limit"             : limit             ,
+            "post_id"           : post_id           ,
+            "community_id"      : community_id      ,
+            "community_name"    : community_name    ,
+            "parent_id"         : parent_id         ,
+            "saved_only"        : saved_only        ,
+            }
+       
+        res = self._req.lemmyRequest("getComments", instance=instance, form=form, optional=optional, auth=auth)
+        return res["comment_view"]
+    
+    def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=None, community_id:int=None, instance:str=None):
+        """
+        Get list of comment reports
+        
+        Args:
+            page (int): Page number. Optional.
+            limit (int): Comment count limit. Optional.
+            unresolved_only (bool): If only unresolved reports should be listed. Optional.
+            community_id (int): ID of community to get comment from. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment report list response
+        """
+        form = {}
+        optional={
+            "page"           : page            ,
+            "limit"          : limit           ,
+            "community_id"   : community_id    ,
+            "unresolved_only": unresolved_only ,
+            }
+        res = self._req.lemmyRequest("listCommentReports", instance=instance, form=form, optional=optional, auth=auth)
+        return
+        
+    def markReplyAsRead(self, comment_reply_id:int, read:bool=True, instance:str=None):
+        """
+        Mark a reply as read
+        
+        Args:
+            comment_reply_id (int): ID of comment reply.
+            read (bool): If reply is marked as read. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment reply marked as read response
+        """
+        form = {
+            "comment_reply_id"  : comment_reply_id  ,
+            "read"              : read              ,
+            }
+        res = self._req.lemmyRequest("markCommentReplyAsRead", instance=instance, form=form, auth=auth)
+        return
+    
+    def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+        """
+        Resolve a comment report
+        
+        Args:
+            report_id (int): ID of report.
+            resolved (bool): If reply is marked as read. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Report resolved response
+        """
+        form = {
+            "report_id"  : report_id ,
+            "resolved"   : resolved  ,
+            }
+        res = self._req.lemmyRequest("resolveCommentReport", instance=instance, form=form, auth=auth)
+        return
+    
+    def save(self, comment_id:int, save:bool=True, instance:str=None):
+        """
+        Save a comment
+        
+        Args:
+            comment_id (int): ID of comment.
+            save (bool): If comment is saved or not. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Report resolved response
+        """
+        form = {
+            "comment_id"  : comment_id ,
+            "save"   : save,
+            }
+        res = self._req.lemmyRequest("saveComment", instance=instance, form=form, auth=auth)
+        return
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Comment +(_req: Requestor) +
+
+
+
+ +Expand source code + +
class Comment():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+        
+    def create(self, post_id:int, content:str, parent_id:int=None, language_id:int=None, instance:str=None):
+        """
+        Create a comment
+        
+        Args:
+            post_id (int): ID of the post to create a comment on
+            content (str): Contents of the comment
+            parent_id (int): Parent comment ID. Optional. Default/If None, posts comment directly to post.
+            language_id (int): Language ID
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "content": content,
+            "post_id": post_id,
+        }
+        optional={
+            "language_id": language_id,
+            "parent_id": parent_id
+        }
+        res = self._req.lemmyRequest("createComment", instance=instance, form=form, optional=optional, auth=True)
+        
+        return res["comment_view"]
+        
+    def like(self, comment_id:int, score:int=1, instance:str=None):
+        """
+        Like a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            score (int): Score of the comment. -1/0/1 dislikes, removes like, and likes a comment.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        if(score > 1):
+            score = 1
+        if(score < -1):
+            score = -1
+        form = {
+            "comment_id": comment_id,
+            "score": score
+        }
+        res = self._req.lemmyRequest("likeComment", instance=instance, form=form, auth=True)
+        return res["comment_view"]
+        
+    def report(self, comment_id:int, reason:str, instance:str=None):
+        """
+        Report a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            reason (str): Reason for reporting the comment
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment report response
+        """
+        form = {
+            "comment_id": comment_id,
+            "reason": reason
+            }
+        res = self._req.lemmyRequest("createCommentReport", instance=instance, form=form, auth=True)
+        return res
+        
+    def delete(self, comment_id:int, deleted:bool=True, instance:str=None):
+        """
+        Delete a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            deleted (bool): If comment is deleted. Optional. Defaults to true
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id,
+            "deleted": deleted
+            }
+        res = self._req.lemmyRequest("deleteComment", instance=instance, form=form, auth=True)
+        return res["comment_view"]
+        
+    def remove(self, comment_id:int, mod_person_id:int, when_:str, removed:bool=True, reason:str=None, instance:str=None):
+        """
+        Moderator remove a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            mod_person_id (int): ID of the moderator removing the comment
+            when_ (str): Timestamp for when the comment was removed
+            removed (bool): If the comment is removed. Optional. Defaults to true.
+            deleted (bool): If comment is deleted. Optional. Defaults to true
+            reason (str): Reason for removing the comment. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id,
+            "mod_person_id": mod_person_id,
+            "when_": when_,
+            "removed": removed,
+            }
+        optional={
+            "reason":reason,
+            }
+        res = self._req.lemmyRequest("removeComment", instance=instance, form=form, optional=optional, auth=True)
+        return res["comment_view"]
+        
+    def distinguish(self, comment_id:int, distinguished:bool=True, instance:str=None):
+        """
+        Distinguish a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            distinguished (bool): If comment is distinguished. Optional. Defaults to true
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id,
+            "distinguished": distinguished,
+            }
+        res = self._req.lemmyRequest("distinguishComment", instance=instance, form=form, auth=True)
+        return res["comment_view"]
+        
+    def edit(self, comment_id:int, content:str=None, language_id:int=None, form_id:str=None, instance:str=None):
+        """
+        Edit a comment
+        
+        Args:
+            comment_id (int): ID of the comment
+            content (str): content of the comment
+            language_id (int): Language of the comment
+            form_id (str): ???
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id
+            }
+        optional={
+            "content":content,
+            "language_id":language_id,
+            "form_id":form_id,
+            }
+        res = self._req.lemmyRequest("editComment", instance=instance, form=form, optional=optional, auth=True)
+        return res["comment_view"]
+        
+    def get(self, comment_id:int, instance:str=None, auth:bool=True):    
+        """
+        Get a comment by id
+        
+        Args:
+            comment_id (int): ID of the comment
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether to authenticate using login or not. Optional. Defaults to True
+        Returns:
+            Comment response
+        """
+        form = {
+            "comment_id": comment_id
+            }
+        res = self._req.lemmyRequest("getComment", instance=instance, form=form, optional=optional, auth=auth)
+        return res["comment_view"]
+        
+    def list(self, 
+        comment_type:ListingType=None, 
+        sort:CommentSortType=None, 
+        max_depth:int=None, 
+        page:int=None, 
+        limit:int=None, 
+        community_id:int=None, 
+        post_id:int=None, 
+        community_name:str=None, 
+        parent_id:int=None,
+        saved_only:bool=None,
+        instance:str=None, 
+        auth:bool=True):
+        """
+        Get comments in a post
+        
+        Args:
+            comment_id (int): ID of the comment
+            comment_type (ListingType): Comment type. Optional.
+            sort (CommentSortType): Sort type. Optional.
+            max_depth (int): Max tree depth. Optional.
+            page (int): Page number. Optional.
+            limit (int): Comment count limit. Optional.
+            community_id (int): ID of community to get comment from. Optional.
+            post_id (int): ID of post to get comments from. Optional.
+            community_name (str): Name of community to get comments from. Optional.
+            parent_id (int): ID of parent comment to get replies to. Optional.
+            saved_only (bool): Filter by only saved comments. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether or not to authenticate. Optional. True by default.
+        Returns:
+            Comment list
+        """
+        form = {
+            "comment_id": comment_id
+            }
+        optional={
+            "type_"             : type_             ,
+            "sort"              : sort              ,
+            "max_depth"         : max_depth         ,
+            "page"              : page              ,
+            "limit"             : limit             ,
+            "post_id"           : post_id           ,
+            "community_id"      : community_id      ,
+            "community_name"    : community_name    ,
+            "parent_id"         : parent_id         ,
+            "saved_only"        : saved_only        ,
+            }
+       
+        res = self._req.lemmyRequest("getComments", instance=instance, form=form, optional=optional, auth=auth)
+        return res["comment_view"]
+    
+    def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=None, community_id:int=None, instance:str=None):
+        """
+        Get list of comment reports
+        
+        Args:
+            page (int): Page number. Optional.
+            limit (int): Comment count limit. Optional.
+            unresolved_only (bool): If only unresolved reports should be listed. Optional.
+            community_id (int): ID of community to get comment from. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment report list response
+        """
+        form = {}
+        optional={
+            "page"           : page            ,
+            "limit"          : limit           ,
+            "community_id"   : community_id    ,
+            "unresolved_only": unresolved_only ,
+            }
+        res = self._req.lemmyRequest("listCommentReports", instance=instance, form=form, optional=optional, auth=auth)
+        return
+        
+    def markReplyAsRead(self, comment_reply_id:int, read:bool=True, instance:str=None):
+        """
+        Mark a reply as read
+        
+        Args:
+            comment_reply_id (int): ID of comment reply.
+            read (bool): If reply is marked as read. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Comment reply marked as read response
+        """
+        form = {
+            "comment_reply_id"  : comment_reply_id  ,
+            "read"              : read              ,
+            }
+        res = self._req.lemmyRequest("markCommentReplyAsRead", instance=instance, form=form, auth=auth)
+        return
+    
+    def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+        """
+        Resolve a comment report
+        
+        Args:
+            report_id (int): ID of report.
+            resolved (bool): If reply is marked as read. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Report resolved response
+        """
+        form = {
+            "report_id"  : report_id ,
+            "resolved"   : resolved  ,
+            }
+        res = self._req.lemmyRequest("resolveCommentReport", instance=instance, form=form, auth=auth)
+        return
+    
+    def save(self, comment_id:int, save:bool=True, instance:str=None):
+        """
+        Save a comment
+        
+        Args:
+            comment_id (int): ID of comment.
+            save (bool): If comment is saved or not. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Report resolved response
+        """
+        form = {
+            "comment_id"  : comment_id ,
+            "save"   : save,
+            }
+        res = self._req.lemmyRequest("saveComment", instance=instance, form=form, auth=auth)
+        return
+
+

Methods

+
+
+def create(self, post_id: int, content: str, parent_id: int = None, language_id: int = None, instance: str = None) +
+
+

Create a comment

+

Args

+
+
post_id : int
+
ID of the post to create a comment on
+
content : str
+
Contents of the comment
+
parent_id : int
+
Parent comment ID. Optional. Default/If None, posts comment directly to post.
+
language_id : int
+
Language ID
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment response

+
+ +Expand source code + +
def create(self, post_id:int, content:str, parent_id:int=None, language_id:int=None, instance:str=None):
+    """
+    Create a comment
+    
+    Args:
+        post_id (int): ID of the post to create a comment on
+        content (str): Contents of the comment
+        parent_id (int): Parent comment ID. Optional. Default/If None, posts comment directly to post.
+        language_id (int): Language ID
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment response
+    """
+    form = {
+        "content": content,
+        "post_id": post_id,
+    }
+    optional={
+        "language_id": language_id,
+        "parent_id": parent_id
+    }
+    res = self._req.lemmyRequest("createComment", instance=instance, form=form, optional=optional, auth=True)
+    
+    return res["comment_view"]
+
+
+
+def delete(self, comment_id: int, deleted: bool = True, instance: str = None) +
+
+

Delete a comment

+

Args

+
+
comment_id : int
+
ID of the comment
+
deleted : bool
+
If comment is deleted. Optional. Defaults to true
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment response

+
+ +Expand source code + +
def delete(self, comment_id:int, deleted:bool=True, instance:str=None):
+    """
+    Delete a comment
+    
+    Args:
+        comment_id (int): ID of the comment
+        deleted (bool): If comment is deleted. Optional. Defaults to true
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment response
+    """
+    form = {
+        "comment_id": comment_id,
+        "deleted": deleted
+        }
+    res = self._req.lemmyRequest("deleteComment", instance=instance, form=form, auth=True)
+    return res["comment_view"]
+
+
+
+def distinguish(self, comment_id: int, distinguished: bool = True, instance: str = None) +
+
+

Distinguish a comment

+

Args

+
+
comment_id : int
+
ID of the comment
+
distinguished : bool
+
If comment is distinguished. Optional. Defaults to true
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment response

+
+ +Expand source code + +
def distinguish(self, comment_id:int, distinguished:bool=True, instance:str=None):
+    """
+    Distinguish a comment
+    
+    Args:
+        comment_id (int): ID of the comment
+        distinguished (bool): If comment is distinguished. Optional. Defaults to true
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment response
+    """
+    form = {
+        "comment_id": comment_id,
+        "distinguished": distinguished,
+        }
+    res = self._req.lemmyRequest("distinguishComment", instance=instance, form=form, auth=True)
+    return res["comment_view"]
+
+
+
+def edit(self, comment_id: int, content: str = None, language_id: int = None, form_id: str = None, instance: str = None) +
+
+

Edit a comment

+

Args

+
+
comment_id : int
+
ID of the comment
+
content : str
+
content of the comment
+
language_id : int
+
Language of the comment
+
form_id : str
+
???
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment response

+
+ +Expand source code + +
def edit(self, comment_id:int, content:str=None, language_id:int=None, form_id:str=None, instance:str=None):
+    """
+    Edit a comment
+    
+    Args:
+        comment_id (int): ID of the comment
+        content (str): content of the comment
+        language_id (int): Language of the comment
+        form_id (str): ???
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment response
+    """
+    form = {
+        "comment_id": comment_id
+        }
+    optional={
+        "content":content,
+        "language_id":language_id,
+        "form_id":form_id,
+        }
+    res = self._req.lemmyRequest("editComment", instance=instance, form=form, optional=optional, auth=True)
+    return res["comment_view"]
+
+
+
+def get(self, comment_id: int, instance: str = None, auth: bool = True) +
+
+

Get a comment by id

+

Args

+
+
comment_id : int
+
ID of the comment
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : bool
+
Whether to authenticate using login or not. Optional. Defaults to True
+
+

Returns

+

Comment response

+
+ +Expand source code + +
def get(self, comment_id:int, instance:str=None, auth:bool=True):    
+    """
+    Get a comment by id
+    
+    Args:
+        comment_id (int): ID of the comment
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (bool): Whether to authenticate using login or not. Optional. Defaults to True
+    Returns:
+        Comment response
+    """
+    form = {
+        "comment_id": comment_id
+        }
+    res = self._req.lemmyRequest("getComment", instance=instance, form=form, optional=optional, auth=auth)
+    return res["comment_view"]
+
+
+
+def like(self, comment_id: int, score: int = 1, instance: str = None) +
+
+

Like a comment

+

Args

+
+
comment_id : int
+
ID of the comment
+
score : int
+
Score of the comment. -1/0/1 dislikes, removes like, and likes a comment.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment response

+
+ +Expand source code + +
def like(self, comment_id:int, score:int=1, instance:str=None):
+    """
+    Like a comment
+    
+    Args:
+        comment_id (int): ID of the comment
+        score (int): Score of the comment. -1/0/1 dislikes, removes like, and likes a comment.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment response
+    """
+    if(score > 1):
+        score = 1
+    if(score < -1):
+        score = -1
+    form = {
+        "comment_id": comment_id,
+        "score": score
+    }
+    res = self._req.lemmyRequest("likeComment", instance=instance, form=form, auth=True)
+    return res["comment_view"]
+
+
+
+def list(self, comment_type: ListingType = None, sort: CommentSortType = None, max_depth: int = None, page: int = None, limit: int = None, community_id: int = None, post_id: int = None, community_name: str = None, parent_id: int = None, saved_only: bool = None, instance: str = None, auth: bool = True) +
+
+

Get comments in a post

+

Args

+
+
comment_id : int
+
ID of the comment
+
comment_type : ListingType
+
Comment type. Optional.
+
sort : CommentSortType
+
Sort type. Optional.
+
max_depth : int
+
Max tree depth. Optional.
+
page : int
+
Page number. Optional.
+
limit : int
+
Comment count limit. Optional.
+
community_id : int
+
ID of community to get comment from. Optional.
+
post_id : int
+
ID of post to get comments from. Optional.
+
community_name : str
+
Name of community to get comments from. Optional.
+
parent_id : int
+
ID of parent comment to get replies to. Optional.
+
saved_only : bool
+
Filter by only saved comments. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : bool
+
Whether or not to authenticate. Optional. True by default.
+
+

Returns

+

Comment list

+
+ +Expand source code + +
def list(self, 
+    comment_type:ListingType=None, 
+    sort:CommentSortType=None, 
+    max_depth:int=None, 
+    page:int=None, 
+    limit:int=None, 
+    community_id:int=None, 
+    post_id:int=None, 
+    community_name:str=None, 
+    parent_id:int=None,
+    saved_only:bool=None,
+    instance:str=None, 
+    auth:bool=True):
+    """
+    Get comments in a post
+    
+    Args:
+        comment_id (int): ID of the comment
+        comment_type (ListingType): Comment type. Optional.
+        sort (CommentSortType): Sort type. Optional.
+        max_depth (int): Max tree depth. Optional.
+        page (int): Page number. Optional.
+        limit (int): Comment count limit. Optional.
+        community_id (int): ID of community to get comment from. Optional.
+        post_id (int): ID of post to get comments from. Optional.
+        community_name (str): Name of community to get comments from. Optional.
+        parent_id (int): ID of parent comment to get replies to. Optional.
+        saved_only (bool): Filter by only saved comments. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (bool): Whether or not to authenticate. Optional. True by default.
+    Returns:
+        Comment list
+    """
+    form = {
+        "comment_id": comment_id
+        }
+    optional={
+        "type_"             : type_             ,
+        "sort"              : sort              ,
+        "max_depth"         : max_depth         ,
+        "page"              : page              ,
+        "limit"             : limit             ,
+        "post_id"           : post_id           ,
+        "community_id"      : community_id      ,
+        "community_name"    : community_name    ,
+        "parent_id"         : parent_id         ,
+        "saved_only"        : saved_only        ,
+        }
+   
+    res = self._req.lemmyRequest("getComments", instance=instance, form=form, optional=optional, auth=auth)
+    return res["comment_view"]
+
+
+
+def listReports(self, page: int = None, limit: int = None, unresolved_only: bool = None, community_id: int = None, instance: str = None) +
+
+

Get list of comment reports

+

Args

+
+
page : int
+
Page number. Optional.
+
limit : int
+
Comment count limit. Optional.
+
unresolved_only : bool
+
If only unresolved reports should be listed. Optional.
+
community_id : int
+
ID of community to get comment from. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment report list response

+
+ +Expand source code + +
def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=None, community_id:int=None, instance:str=None):
+    """
+    Get list of comment reports
+    
+    Args:
+        page (int): Page number. Optional.
+        limit (int): Comment count limit. Optional.
+        unresolved_only (bool): If only unresolved reports should be listed. Optional.
+        community_id (int): ID of community to get comment from. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment report list response
+    """
+    form = {}
+    optional={
+        "page"           : page            ,
+        "limit"          : limit           ,
+        "community_id"   : community_id    ,
+        "unresolved_only": unresolved_only ,
+        }
+    res = self._req.lemmyRequest("listCommentReports", instance=instance, form=form, optional=optional, auth=auth)
+    return
+
+
+
+def markReplyAsRead(self, comment_reply_id: int, read: bool = True, instance: str = None) +
+
+

Mark a reply as read

+

Args

+
+
comment_reply_id : int
+
ID of comment reply.
+
read : bool
+
If reply is marked as read. Optional. Defaults to True
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment reply marked as read response

+
+ +Expand source code + +
def markReplyAsRead(self, comment_reply_id:int, read:bool=True, instance:str=None):
+    """
+    Mark a reply as read
+    
+    Args:
+        comment_reply_id (int): ID of comment reply.
+        read (bool): If reply is marked as read. Optional. Defaults to True
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment reply marked as read response
+    """
+    form = {
+        "comment_reply_id"  : comment_reply_id  ,
+        "read"              : read              ,
+        }
+    res = self._req.lemmyRequest("markCommentReplyAsRead", instance=instance, form=form, auth=auth)
+    return
+
+
+
+def remove(self, comment_id: int, mod_person_id: int, when_: str, removed: bool = True, reason: str = None, instance: str = None) +
+
+

Moderator remove a comment

+

Args

+
+
comment_id : int
+
ID of the comment
+
mod_person_id : int
+
ID of the moderator removing the comment
+
when_ : str
+
Timestamp for when the comment was removed
+
removed : bool
+
If the comment is removed. Optional. Defaults to true.
+
deleted : bool
+
If comment is deleted. Optional. Defaults to true
+
reason : str
+
Reason for removing the comment. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment response

+
+ +Expand source code + +
def remove(self, comment_id:int, mod_person_id:int, when_:str, removed:bool=True, reason:str=None, instance:str=None):
+    """
+    Moderator remove a comment
+    
+    Args:
+        comment_id (int): ID of the comment
+        mod_person_id (int): ID of the moderator removing the comment
+        when_ (str): Timestamp for when the comment was removed
+        removed (bool): If the comment is removed. Optional. Defaults to true.
+        deleted (bool): If comment is deleted. Optional. Defaults to true
+        reason (str): Reason for removing the comment. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment response
+    """
+    form = {
+        "comment_id": comment_id,
+        "mod_person_id": mod_person_id,
+        "when_": when_,
+        "removed": removed,
+        }
+    optional={
+        "reason":reason,
+        }
+    res = self._req.lemmyRequest("removeComment", instance=instance, form=form, optional=optional, auth=True)
+    return res["comment_view"]
+
+
+
+def report(self, comment_id: int, reason: str, instance: str = None) +
+
+

Report a comment

+

Args

+
+
comment_id : int
+
ID of the comment
+
reason : str
+
Reason for reporting the comment
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Comment report response

+
+ +Expand source code + +
def report(self, comment_id:int, reason:str, instance:str=None):
+    """
+    Report a comment
+    
+    Args:
+        comment_id (int): ID of the comment
+        reason (str): Reason for reporting the comment
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Comment report response
+    """
+    form = {
+        "comment_id": comment_id,
+        "reason": reason
+        }
+    res = self._req.lemmyRequest("createCommentReport", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def resolveReport(self, report_id: int, resolved: bool = True, instance: str = None) +
+
+

Resolve a comment report

+

Args

+
+
report_id : int
+
ID of report.
+
resolved : bool
+
If reply is marked as read. Optional. Defaults to True
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Report resolved response

+
+ +Expand source code + +
def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+    """
+    Resolve a comment report
+    
+    Args:
+        report_id (int): ID of report.
+        resolved (bool): If reply is marked as read. Optional. Defaults to True
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Report resolved response
+    """
+    form = {
+        "report_id"  : report_id ,
+        "resolved"   : resolved  ,
+        }
+    res = self._req.lemmyRequest("resolveCommentReport", instance=instance, form=form, auth=auth)
+    return
+
+
+
+def save(self, comment_id: int, save: bool = True, instance: str = None) +
+
+

Save a comment

+

Args

+
+
comment_id : int
+
ID of comment.
+
save : bool
+
If comment is saved or not. Optional. Defaults to True
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Report resolved response

+
+ +Expand source code + +
def save(self, comment_id:int, save:bool=True, instance:str=None):
+    """
+    Save a comment
+    
+    Args:
+        comment_id (int): ID of comment.
+        save (bool): If comment is saved or not. Optional. Defaults to True
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Report resolved response
+    """
+    form = {
+        "comment_id"  : comment_id ,
+        "save"   : save,
+        }
+    res = self._req.lemmyRequest("saveComment", instance=instance, form=form, auth=auth)
+    return
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/community.html b/docs/v0.1.6/community.html new file mode 100644 index 0000000..ec0d0d9 --- /dev/null +++ b/docs/v0.1.6/community.html @@ -0,0 +1,1212 @@ + + + + + + +jplaw.community API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.community

+
+
+

Community class. Designed to allow Lemmy.Community functions.

+
+ +Expand source code + +
"""
+Community class. Designed to allow Lemmy.Community functions.
+"""
+from .requestor import Requestor
+from .api_paths import *
+from typing import List
+from .types.listing_type import ListingType
+from .types.sort_type import SortType
+
+class Community():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+        
+    def get(self, name:str, instance:str=None, auth:bool=True):
+        """
+        Get community information
+        
+        Args:
+            name (str): Name of the community. Federated communities can be accessed by [community]@[instance] 
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            Community Information. Throws an error if community_not_found (happens if community has not been federated or does not exist)
+        """
+        form = {
+            "name": name
+        }
+        res = self._req.lemmyRequest("getCommunity", instance=instance, form=form, auth=auth)
+        return res["community_view"]
+        
+    def list(self, 
+        type: ListingType=None, 
+        sort:SortType=None,
+        show_nsfw: bool=None,
+        page:int=None, 
+        limit:int=None, 
+        instance:str=None, 
+        auth:bool=True): 
+        """
+        Get a list of communities (federated or local)
+        
+        Args:
+            type (ListingType): Type of community (all or local). Optional
+            sort (SortType): Sorting Mode. Optional
+            show_nsfw (bool): Whether or not to show nsfw communities. Optional. 
+            page (int): Page number. Optional
+            limit (int): Limit for number of posts. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            List of communities
+        """
+        form={}
+        optional={
+            "sort"      : sort,
+            "type"      : type,
+            "show_nsfw" : show_nsfw,
+            "page"      : page,
+            "limit"     : limit
+            }
+        res = self._req.lemmyRequest("listCommunities", instance=instance, form=form, optional=optional, auth=auth)
+        return res["communities"]
+        
+    def follow(self, community_id:int, follow:bool=True, instance:str=None):
+        """
+        Follow or subscribe to a community
+        
+        Args:
+            community_id (int): ID of the community
+            follow (bool): If true, subscribed to or following the community. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            List of communities
+        """
+        form={
+            "community_id": community_id,
+            "follow": follow
+        }
+        res = self._req.lemmyRequest("followCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+    def addMod(self, community_id:int, person_id:int, added:bool=True, instance:str=None): 
+        """
+        Add or remove a moderator from a community
+        
+        Args:
+            community_id (int): ID of the community
+            person_id (int): User ID of the person to add as a moderator
+            added (bool): If true, person is added as a moderator. If false, person is removed as a moderator. Optonal. Default True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Added moderator response
+        """
+        form={
+            "community_id": community_id,
+            "person_id": person_id,
+            "added": added,
+        }
+        res = self._req.lemmyRequest("addModToCommunity", instance=instance, form=form, auth=True)
+        return res
+    
+    def banPerson(self, community_id:int, person_id:int, ban:bool, remove_data:bool=None, reason:str=None, expires:int=None, instance:str=None):
+        """
+        Ban a person from a community
+        
+        Args:
+            community_id (int): ID of the community
+            person_id (int): User ID of the person to ban
+            ban (bool): If true, person is banned. If false, person is unbanned Optonal. Default True
+            remove_data (bool): ??? Presumably removes the user's posts and comments or removes their data from the instance. Optional.
+            reason (str): Reason for banning user. Optional
+            expires (int): Unix timestamp of ban expiry (seconds)
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Banned community response
+        """
+        form={
+            "community_id": community_id,
+            "person_id": person_id,
+            "ban": ban,
+        }
+        optional={
+            "remove_data": remove_data,
+            "reason": reason,
+            "expires": expires,
+        }
+        res = self._req.lemmyRequest("banFromCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def block(self, community_id:int, block:bool=True, instance:str=None):
+        """
+        Block a community
+        
+        Args:
+            community_id (int): ID of the community
+            ban (bool): If true, community blocked. If false, community is unblocked. Optonal. Default True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Blocked community response
+        """
+        form={
+            "community_id": community_id,
+            "block": block,
+            }
+        res = self._req.lemmyRequest("blockCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+        
+    def create(self, name:str, 
+        title:str, 
+        description:str=None, 
+        icon:str=None, 
+        banner:str=None, 
+        nsfw:bool=None, 
+        posting_restricted_to_mods:bool=None, 
+        discussion_languages:List[int]=None, 
+        instance:str=None):
+        """
+        Create a community
+        
+        Args:
+            name (str): Name of the community
+            title (str): Title of the community. Can have spaces.
+            description (str): Description of the community. Optional.
+            icon (str): URL of the community icon. Optional.
+            banner (str): URL of the community banner image. Optional.
+            nsfw (bool): If true, community is NSFW. Optional.
+            posting_restricted_to_mods (bool): If true, only moderators can post. Optional.
+            discussion_languages (List[int]): List of langages in community. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Created community response
+        """
+        form={
+            "name": name,
+            "title": title,
+            }
+        optional={
+            "description": description,
+            "icon": icon,
+            "banner": banner,
+            "nsfw": nsfw,
+            "posting_restricted_to_mods": posting_restricted_to_mods,
+            "discussion_languages": discussion_languages,
+            }
+        res = self._req.lemmyRequest("createCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res["community_view"]
+        
+    def delete(self, community_id:int, deleted:bool=True, instance:str=None):
+        """
+        Delete a community
+        
+        Args:
+            community_id (int): ID of the community
+            deleted (bool): If true, community is deleted. If false, community is not deleted. Optonal. Default True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Deleted community response
+        """
+        form={
+            "community_id": community_id,
+            "deleted": deleted,
+            }
+        res = self._req.lemmyRequest("deleteCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+    
+    def edit(self, 
+        community_id:int, 
+        title:str=None, 
+        description:str=None, 
+        icon:str=None, 
+        banner:str=None, 
+        nsfw:bool=None, 
+        posting_restricted_to_mods:bool=None, 
+        discussion_languages:List[int]=None, 
+        instance:str=None):
+        """
+        Edit a community. Excluding optional items does not edit those items.
+        
+        Args:
+            community_id (int): ID of the community to edit
+            title (str): Title of the community. Can have spaces. Optional
+            description (str): Description of the community. Optional.
+            icon (str): URL of the community icon. Optional.
+            banner (str): URL of the community banner image. Optional.
+            nsfw (bool): If true, community is NSFW. Optional.
+            posting_restricted_to_mods (bool): If true, only moderators can post. Optional.
+            discussion_languages (List[int]): List of langages in community. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Edited community response
+        """
+        form={
+            "community_id": community_id,
+            }
+        optional={
+            "title": title,
+            "description": description,
+            "icon": icon,
+            "banner": banner,
+            "nsfw": nsfw,
+            "posting_restricted_to_mods": posting_restricted_to_mods,
+            "discussion_languages": discussion_languages,
+            }
+        res = self._req.lemmyRequest("createCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res["community_view"]
+        
+    def remove(self, community_id:int, removed:bool=True, reason:str=None, expires:int=None, instance:str=None):
+        """
+        Remove a community
+        
+        Args:
+            community_id (int): ID of the community
+            removed (bool): If true, community is removed. If false, community is restored. Optonal. Default True
+            reason (str): Reason for community removal. Optional.
+            expires (int): Unix timestamp (seconds) of expiry.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Removed community response
+        """
+        form={
+            "community_id": community_id,
+            "removed":removed,
+            }
+        optional={
+            "reason": reason,
+            "expires": expires,
+            }
+        res = self._req.lemmyRequest("removeCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res["community_view"]
+    
+    def transfer(self, community_id:int, person_id:int, instance:str=None):
+        """
+        Transfer ownership of a community
+        
+        Args:
+            community_id (int): ID of the community
+            person_id (int): User ID of the person to transfer ownership to
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Removed community response
+        """
+        form={
+            "community_id": community_id,
+            "person_id":person_id,
+            }
+        res = self._req.lemmyRequest("transferCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Community +(_req: Requestor) +
+
+
+
+ +Expand source code + +
class Community():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+        
+    def get(self, name:str, instance:str=None, auth:bool=True):
+        """
+        Get community information
+        
+        Args:
+            name (str): Name of the community. Federated communities can be accessed by [community]@[instance] 
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            Community Information. Throws an error if community_not_found (happens if community has not been federated or does not exist)
+        """
+        form = {
+            "name": name
+        }
+        res = self._req.lemmyRequest("getCommunity", instance=instance, form=form, auth=auth)
+        return res["community_view"]
+        
+    def list(self, 
+        type: ListingType=None, 
+        sort:SortType=None,
+        show_nsfw: bool=None,
+        page:int=None, 
+        limit:int=None, 
+        instance:str=None, 
+        auth:bool=True): 
+        """
+        Get a list of communities (federated or local)
+        
+        Args:
+            type (ListingType): Type of community (all or local). Optional
+            sort (SortType): Sorting Mode. Optional
+            show_nsfw (bool): Whether or not to show nsfw communities. Optional. 
+            page (int): Page number. Optional
+            limit (int): Limit for number of posts. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            List of communities
+        """
+        form={}
+        optional={
+            "sort"      : sort,
+            "type"      : type,
+            "show_nsfw" : show_nsfw,
+            "page"      : page,
+            "limit"     : limit
+            }
+        res = self._req.lemmyRequest("listCommunities", instance=instance, form=form, optional=optional, auth=auth)
+        return res["communities"]
+        
+    def follow(self, community_id:int, follow:bool=True, instance:str=None):
+        """
+        Follow or subscribe to a community
+        
+        Args:
+            community_id (int): ID of the community
+            follow (bool): If true, subscribed to or following the community. Optional. Defaults to True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            List of communities
+        """
+        form={
+            "community_id": community_id,
+            "follow": follow
+        }
+        res = self._req.lemmyRequest("followCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+    def addMod(self, community_id:int, person_id:int, added:bool=True, instance:str=None): 
+        """
+        Add or remove a moderator from a community
+        
+        Args:
+            community_id (int): ID of the community
+            person_id (int): User ID of the person to add as a moderator
+            added (bool): If true, person is added as a moderator. If false, person is removed as a moderator. Optonal. Default True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Added moderator response
+        """
+        form={
+            "community_id": community_id,
+            "person_id": person_id,
+            "added": added,
+        }
+        res = self._req.lemmyRequest("addModToCommunity", instance=instance, form=form, auth=True)
+        return res
+    
+    def banPerson(self, community_id:int, person_id:int, ban:bool, remove_data:bool=None, reason:str=None, expires:int=None, instance:str=None):
+        """
+        Ban a person from a community
+        
+        Args:
+            community_id (int): ID of the community
+            person_id (int): User ID of the person to ban
+            ban (bool): If true, person is banned. If false, person is unbanned Optonal. Default True
+            remove_data (bool): ??? Presumably removes the user's posts and comments or removes their data from the instance. Optional.
+            reason (str): Reason for banning user. Optional
+            expires (int): Unix timestamp of ban expiry (seconds)
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Banned community response
+        """
+        form={
+            "community_id": community_id,
+            "person_id": person_id,
+            "ban": ban,
+        }
+        optional={
+            "remove_data": remove_data,
+            "reason": reason,
+            "expires": expires,
+        }
+        res = self._req.lemmyRequest("banFromCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def block(self, community_id:int, block:bool=True, instance:str=None):
+        """
+        Block a community
+        
+        Args:
+            community_id (int): ID of the community
+            ban (bool): If true, community blocked. If false, community is unblocked. Optonal. Default True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Blocked community response
+        """
+        form={
+            "community_id": community_id,
+            "block": block,
+            }
+        res = self._req.lemmyRequest("blockCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+        
+    def create(self, name:str, 
+        title:str, 
+        description:str=None, 
+        icon:str=None, 
+        banner:str=None, 
+        nsfw:bool=None, 
+        posting_restricted_to_mods:bool=None, 
+        discussion_languages:List[int]=None, 
+        instance:str=None):
+        """
+        Create a community
+        
+        Args:
+            name (str): Name of the community
+            title (str): Title of the community. Can have spaces.
+            description (str): Description of the community. Optional.
+            icon (str): URL of the community icon. Optional.
+            banner (str): URL of the community banner image. Optional.
+            nsfw (bool): If true, community is NSFW. Optional.
+            posting_restricted_to_mods (bool): If true, only moderators can post. Optional.
+            discussion_languages (List[int]): List of langages in community. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Created community response
+        """
+        form={
+            "name": name,
+            "title": title,
+            }
+        optional={
+            "description": description,
+            "icon": icon,
+            "banner": banner,
+            "nsfw": nsfw,
+            "posting_restricted_to_mods": posting_restricted_to_mods,
+            "discussion_languages": discussion_languages,
+            }
+        res = self._req.lemmyRequest("createCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res["community_view"]
+        
+    def delete(self, community_id:int, deleted:bool=True, instance:str=None):
+        """
+        Delete a community
+        
+        Args:
+            community_id (int): ID of the community
+            deleted (bool): If true, community is deleted. If false, community is not deleted. Optonal. Default True
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Deleted community response
+        """
+        form={
+            "community_id": community_id,
+            "deleted": deleted,
+            }
+        res = self._req.lemmyRequest("deleteCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+    
+    def edit(self, 
+        community_id:int, 
+        title:str=None, 
+        description:str=None, 
+        icon:str=None, 
+        banner:str=None, 
+        nsfw:bool=None, 
+        posting_restricted_to_mods:bool=None, 
+        discussion_languages:List[int]=None, 
+        instance:str=None):
+        """
+        Edit a community. Excluding optional items does not edit those items.
+        
+        Args:
+            community_id (int): ID of the community to edit
+            title (str): Title of the community. Can have spaces. Optional
+            description (str): Description of the community. Optional.
+            icon (str): URL of the community icon. Optional.
+            banner (str): URL of the community banner image. Optional.
+            nsfw (bool): If true, community is NSFW. Optional.
+            posting_restricted_to_mods (bool): If true, only moderators can post. Optional.
+            discussion_languages (List[int]): List of langages in community. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Edited community response
+        """
+        form={
+            "community_id": community_id,
+            }
+        optional={
+            "title": title,
+            "description": description,
+            "icon": icon,
+            "banner": banner,
+            "nsfw": nsfw,
+            "posting_restricted_to_mods": posting_restricted_to_mods,
+            "discussion_languages": discussion_languages,
+            }
+        res = self._req.lemmyRequest("createCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res["community_view"]
+        
+    def remove(self, community_id:int, removed:bool=True, reason:str=None, expires:int=None, instance:str=None):
+        """
+        Remove a community
+        
+        Args:
+            community_id (int): ID of the community
+            removed (bool): If true, community is removed. If false, community is restored. Optonal. Default True
+            reason (str): Reason for community removal. Optional.
+            expires (int): Unix timestamp (seconds) of expiry.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Removed community response
+        """
+        form={
+            "community_id": community_id,
+            "removed":removed,
+            }
+        optional={
+            "reason": reason,
+            "expires": expires,
+            }
+        res = self._req.lemmyRequest("removeCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res["community_view"]
+    
+    def transfer(self, community_id:int, person_id:int, instance:str=None):
+        """
+        Transfer ownership of a community
+        
+        Args:
+            community_id (int): ID of the community
+            person_id (int): User ID of the person to transfer ownership to
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Removed community response
+        """
+        form={
+            "community_id": community_id,
+            "person_id":person_id,
+            }
+        res = self._req.lemmyRequest("transferCommunity", instance=instance, form=form, auth=True)
+        return res["community_view"]
+
+

Methods

+
+
+def addMod(self, community_id: int, person_id: int, added: bool = True, instance: str = None) +
+
+

Add or remove a moderator from a community

+

Args

+
+
community_id : int
+
ID of the community
+
person_id : int
+
User ID of the person to add as a moderator
+
added : bool
+
If true, person is added as a moderator. If false, person is removed as a moderator. Optonal. Default True
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Added moderator response

+
+ +Expand source code + +
def addMod(self, community_id:int, person_id:int, added:bool=True, instance:str=None): 
+    """
+    Add or remove a moderator from a community
+    
+    Args:
+        community_id (int): ID of the community
+        person_id (int): User ID of the person to add as a moderator
+        added (bool): If true, person is added as a moderator. If false, person is removed as a moderator. Optonal. Default True
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Added moderator response
+    """
+    form={
+        "community_id": community_id,
+        "person_id": person_id,
+        "added": added,
+    }
+    res = self._req.lemmyRequest("addModToCommunity", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def banPerson(self, community_id: int, person_id: int, ban: bool, remove_data: bool = None, reason: str = None, expires: int = None, instance: str = None) +
+
+

Ban a person from a community

+

Args

+
+
community_id : int
+
ID of the community
+
person_id : int
+
User ID of the person to ban
+
ban : bool
+
If true, person is banned. If false, person is unbanned Optonal. Default True
+
remove_data : bool
+
??? Presumably removes the user's posts and comments or removes their data from the instance. Optional.
+
reason : str
+
Reason for banning user. Optional
+
expires : int
+
Unix timestamp of ban expiry (seconds)
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Banned community response

+
+ +Expand source code + +
def banPerson(self, community_id:int, person_id:int, ban:bool, remove_data:bool=None, reason:str=None, expires:int=None, instance:str=None):
+    """
+    Ban a person from a community
+    
+    Args:
+        community_id (int): ID of the community
+        person_id (int): User ID of the person to ban
+        ban (bool): If true, person is banned. If false, person is unbanned Optonal. Default True
+        remove_data (bool): ??? Presumably removes the user's posts and comments or removes their data from the instance. Optional.
+        reason (str): Reason for banning user. Optional
+        expires (int): Unix timestamp of ban expiry (seconds)
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Banned community response
+    """
+    form={
+        "community_id": community_id,
+        "person_id": person_id,
+        "ban": ban,
+    }
+    optional={
+        "remove_data": remove_data,
+        "reason": reason,
+        "expires": expires,
+    }
+    res = self._req.lemmyRequest("banFromCommunity", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def block(self, community_id: int, block: bool = True, instance: str = None) +
+
+

Block a community

+

Args

+
+
community_id : int
+
ID of the community
+
ban : bool
+
If true, community blocked. If false, community is unblocked. Optonal. Default True
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Blocked community response

+
+ +Expand source code + +
def block(self, community_id:int, block:bool=True, instance:str=None):
+    """
+    Block a community
+    
+    Args:
+        community_id (int): ID of the community
+        ban (bool): If true, community blocked. If false, community is unblocked. Optonal. Default True
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Blocked community response
+    """
+    form={
+        "community_id": community_id,
+        "block": block,
+        }
+    res = self._req.lemmyRequest("blockCommunity", instance=instance, form=form, auth=True)
+    return res["community_view"]
+
+
+
+def create(self, name: str, title: str, description: str = None, icon: str = None, banner: str = None, nsfw: bool = None, posting_restricted_to_mods: bool = None, discussion_languages: List[int] = None, instance: str = None) +
+
+

Create a community

+

Args

+
+
name : str
+
Name of the community
+
title : str
+
Title of the community. Can have spaces.
+
description : str
+
Description of the community. Optional.
+
icon : str
+
URL of the community icon. Optional.
+
banner : str
+
URL of the community banner image. Optional.
+
nsfw : bool
+
If true, community is NSFW. Optional.
+
posting_restricted_to_mods : bool
+
If true, only moderators can post. Optional.
+
discussion_languages : List[int]
+
List of langages in community. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Created community response

+
+ +Expand source code + +
def create(self, name:str, 
+    title:str, 
+    description:str=None, 
+    icon:str=None, 
+    banner:str=None, 
+    nsfw:bool=None, 
+    posting_restricted_to_mods:bool=None, 
+    discussion_languages:List[int]=None, 
+    instance:str=None):
+    """
+    Create a community
+    
+    Args:
+        name (str): Name of the community
+        title (str): Title of the community. Can have spaces.
+        description (str): Description of the community. Optional.
+        icon (str): URL of the community icon. Optional.
+        banner (str): URL of the community banner image. Optional.
+        nsfw (bool): If true, community is NSFW. Optional.
+        posting_restricted_to_mods (bool): If true, only moderators can post. Optional.
+        discussion_languages (List[int]): List of langages in community. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Created community response
+    """
+    form={
+        "name": name,
+        "title": title,
+        }
+    optional={
+        "description": description,
+        "icon": icon,
+        "banner": banner,
+        "nsfw": nsfw,
+        "posting_restricted_to_mods": posting_restricted_to_mods,
+        "discussion_languages": discussion_languages,
+        }
+    res = self._req.lemmyRequest("createCommunity", instance=instance, form=form, optional=optional, auth=True)
+    return res["community_view"]
+
+
+
+def delete(self, community_id: int, deleted: bool = True, instance: str = None) +
+
+

Delete a community

+

Args

+
+
community_id : int
+
ID of the community
+
deleted : bool
+
If true, community is deleted. If false, community is not deleted. Optonal. Default True
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Deleted community response

+
+ +Expand source code + +
def delete(self, community_id:int, deleted:bool=True, instance:str=None):
+    """
+    Delete a community
+    
+    Args:
+        community_id (int): ID of the community
+        deleted (bool): If true, community is deleted. If false, community is not deleted. Optonal. Default True
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Deleted community response
+    """
+    form={
+        "community_id": community_id,
+        "deleted": deleted,
+        }
+    res = self._req.lemmyRequest("deleteCommunity", instance=instance, form=form, auth=True)
+    return res["community_view"]
+
+
+
+def edit(self, community_id: int, title: str = None, description: str = None, icon: str = None, banner: str = None, nsfw: bool = None, posting_restricted_to_mods: bool = None, discussion_languages: List[int] = None, instance: str = None) +
+
+

Edit a community. Excluding optional items does not edit those items.

+

Args

+
+
community_id : int
+
ID of the community to edit
+
title : str
+
Title of the community. Can have spaces. Optional
+
description : str
+
Description of the community. Optional.
+
icon : str
+
URL of the community icon. Optional.
+
banner : str
+
URL of the community banner image. Optional.
+
nsfw : bool
+
If true, community is NSFW. Optional.
+
posting_restricted_to_mods : bool
+
If true, only moderators can post. Optional.
+
discussion_languages : List[int]
+
List of langages in community. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Edited community response

+
+ +Expand source code + +
def edit(self, 
+    community_id:int, 
+    title:str=None, 
+    description:str=None, 
+    icon:str=None, 
+    banner:str=None, 
+    nsfw:bool=None, 
+    posting_restricted_to_mods:bool=None, 
+    discussion_languages:List[int]=None, 
+    instance:str=None):
+    """
+    Edit a community. Excluding optional items does not edit those items.
+    
+    Args:
+        community_id (int): ID of the community to edit
+        title (str): Title of the community. Can have spaces. Optional
+        description (str): Description of the community. Optional.
+        icon (str): URL of the community icon. Optional.
+        banner (str): URL of the community banner image. Optional.
+        nsfw (bool): If true, community is NSFW. Optional.
+        posting_restricted_to_mods (bool): If true, only moderators can post. Optional.
+        discussion_languages (List[int]): List of langages in community. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Edited community response
+    """
+    form={
+        "community_id": community_id,
+        }
+    optional={
+        "title": title,
+        "description": description,
+        "icon": icon,
+        "banner": banner,
+        "nsfw": nsfw,
+        "posting_restricted_to_mods": posting_restricted_to_mods,
+        "discussion_languages": discussion_languages,
+        }
+    res = self._req.lemmyRequest("createCommunity", instance=instance, form=form, optional=optional, auth=True)
+    return res["community_view"]
+
+
+
+def follow(self, community_id: int, follow: bool = True, instance: str = None) +
+
+

Follow or subscribe to a community

+

Args

+
+
community_id : int
+
ID of the community
+
follow : bool
+
If true, subscribed to or following the community. Optional. Defaults to True
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of communities

+
+ +Expand source code + +
def follow(self, community_id:int, follow:bool=True, instance:str=None):
+    """
+    Follow or subscribe to a community
+    
+    Args:
+        community_id (int): ID of the community
+        follow (bool): If true, subscribed to or following the community. Optional. Defaults to True
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        List of communities
+    """
+    form={
+        "community_id": community_id,
+        "follow": follow
+    }
+    res = self._req.lemmyRequest("followCommunity", instance=instance, form=form, auth=True)
+    return res["community_view"]
+
+
+
+def get(self, name: str, instance: str = None, auth: bool = True) +
+
+

Get community information

+

Args

+
+
name : str
+
Name of the community. Federated communities can be accessed by [community]@[instance]
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : str
+
If true, authenticates using internal token from login. Optional. Default True
+
+

Returns

+

Community Information. Throws an error if community_not_found (happens if community has not been federated or does not exist)

+
+ +Expand source code + +
def get(self, name:str, instance:str=None, auth:bool=True):
+    """
+    Get community information
+    
+    Args:
+        name (str): Name of the community. Federated communities can be accessed by [community]@[instance] 
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (str): If true, authenticates using internal token from login. Optional. Default True
+    Returns:
+        Community Information. Throws an error if community_not_found (happens if community has not been federated or does not exist)
+    """
+    form = {
+        "name": name
+    }
+    res = self._req.lemmyRequest("getCommunity", instance=instance, form=form, auth=auth)
+    return res["community_view"]
+
+
+
+def list(self, type: ListingType = None, sort: SortType = None, show_nsfw: bool = None, page: int = None, limit: int = None, instance: str = None, auth: bool = True) +
+
+

Get a list of communities (federated or local)

+

Args

+
+
type : ListingType
+
Type of community (all or local). Optional
+
sort : SortType
+
Sorting Mode. Optional
+
show_nsfw : bool
+
Whether or not to show nsfw communities. Optional.
+
page : int
+
Page number. Optional
+
limit : int
+
Limit for number of posts. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : str
+
If true, authenticates using internal token from login. Optional. Default True
+
+

Returns

+

List of communities

+
+ +Expand source code + +
def list(self, 
+    type: ListingType=None, 
+    sort:SortType=None,
+    show_nsfw: bool=None,
+    page:int=None, 
+    limit:int=None, 
+    instance:str=None, 
+    auth:bool=True): 
+    """
+    Get a list of communities (federated or local)
+    
+    Args:
+        type (ListingType): Type of community (all or local). Optional
+        sort (SortType): Sorting Mode. Optional
+        show_nsfw (bool): Whether or not to show nsfw communities. Optional. 
+        page (int): Page number. Optional
+        limit (int): Limit for number of posts. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (str): If true, authenticates using internal token from login. Optional. Default True
+    Returns:
+        List of communities
+    """
+    form={}
+    optional={
+        "sort"      : sort,
+        "type"      : type,
+        "show_nsfw" : show_nsfw,
+        "page"      : page,
+        "limit"     : limit
+        }
+    res = self._req.lemmyRequest("listCommunities", instance=instance, form=form, optional=optional, auth=auth)
+    return res["communities"]
+
+
+
+def remove(self, community_id: int, removed: bool = True, reason: str = None, expires: int = None, instance: str = None) +
+
+

Remove a community

+

Args

+
+
community_id : int
+
ID of the community
+
removed : bool
+
If true, community is removed. If false, community is restored. Optonal. Default True
+
reason : str
+
Reason for community removal. Optional.
+
expires : int
+
Unix timestamp (seconds) of expiry.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Removed community response

+
+ +Expand source code + +
def remove(self, community_id:int, removed:bool=True, reason:str=None, expires:int=None, instance:str=None):
+    """
+    Remove a community
+    
+    Args:
+        community_id (int): ID of the community
+        removed (bool): If true, community is removed. If false, community is restored. Optonal. Default True
+        reason (str): Reason for community removal. Optional.
+        expires (int): Unix timestamp (seconds) of expiry.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Removed community response
+    """
+    form={
+        "community_id": community_id,
+        "removed":removed,
+        }
+    optional={
+        "reason": reason,
+        "expires": expires,
+        }
+    res = self._req.lemmyRequest("removeCommunity", instance=instance, form=form, optional=optional, auth=True)
+    return res["community_view"]
+
+
+
+def transfer(self, community_id: int, person_id: int, instance: str = None) +
+
+

Transfer ownership of a community

+

Args

+
+
community_id : int
+
ID of the community
+
person_id : int
+
User ID of the person to transfer ownership to
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Removed community response

+
+ +Expand source code + +
def transfer(self, community_id:int, person_id:int, instance:str=None):
+    """
+    Transfer ownership of a community
+    
+    Args:
+        community_id (int): ID of the community
+        person_id (int): User ID of the person to transfer ownership to
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Removed community response
+    """
+    form={
+        "community_id": community_id,
+        "person_id":person_id,
+        }
+    res = self._req.lemmyRequest("transferCommunity", instance=instance, form=form, auth=True)
+    return res["community_view"]
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/emoji.html b/docs/v0.1.6/emoji.html new file mode 100644 index 0000000..ca52102 --- /dev/null +++ b/docs/v0.1.6/emoji.html @@ -0,0 +1,370 @@ + + + + + + +jplaw.emoji API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.emoji

+
+
+

Emoji class. Designed to allow Lemmy.Emoji functions.

+
+ +Expand source code + +
"""
+Emoji class. Designed to allow Lemmy.Emoji functions.
+"""
+from jplaw.requestor import Requestor
+from jplaw.api_paths import *
+from typing import List
+from jplaw.types.modlog_action_type import ModlogActionType
+from jplaw.types.listing_type import ListingType
+from jplaw.types.registration_mode import RegistrationMode
+
+class Emoji():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    
+    def create(self, category:str, shortcode:str, image_url:str, alt_text:str, keywords:List[str], instance:str=None):
+        """
+        Create a custom emoji
+        
+        Args:
+            category (str): Category of the emoji
+            shortcode (str): Short code used to type the emoji
+            image_url (str): URL of the image to use
+            alt_text (str): Alt text (hover or screenreader) of the emoji
+            keywords (List[str]): Keywords of the emoji.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Emoji created response
+        """
+        form={
+            "category": category,
+            "shortcode": shortcode,
+            "image_url": image_url,
+            "alt_text": alt_text,
+            "keywords": keywords
+            }
+        res = self._req.lemmyRequest("createCustomEmoji", instance=instance, form=form, auth=auth)
+        return res
+        
+    def edit(self, emoji_id:int, category:str=None, image_url:str=None, alt_text:str=None, keywords:List[str]=None, instance:str=None):
+        """
+        Edit a custom emoji. Excluded optional arguments are not modified.
+        
+        Args:
+            emoji_id (int): ID of the emoji
+            category (str): Category of the emoji. Optional
+            image_url (str): URL of the image to use. Optional
+            alt_text (str): Alt text (hover or screenreader) of the emoji. Optional
+            keywords (List[str]): Keywords of the emoji. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Emoji edited response
+        """
+        form={
+            "id": emoji_id,
+            "category": category,
+            "image_url": image_url,
+            "alt_text": alt_text,
+            "keywords": keywords
+            }
+        res = self._req.lemmyRequest("editCustomEmoji", instance=instance, form=form, auth=auth)
+        return res
+        
+    def delete(self, emoji_id:int, instance:str=None):
+        """
+        Delete a custom emoji from the website
+        
+        Args:
+            emoji_id (int): ID of emoji to delete
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Emoji deleted response
+        """
+        form={
+            "id": emoji_id
+            }
+        res = self._req.lemmyRequest("deleteCustomEmoji", instance=instance, form=form, auth=auth)
+        return res
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Emoji +(_req: Requestor) +
+
+
+
+ +Expand source code + +
class Emoji():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    
+    def create(self, category:str, shortcode:str, image_url:str, alt_text:str, keywords:List[str], instance:str=None):
+        """
+        Create a custom emoji
+        
+        Args:
+            category (str): Category of the emoji
+            shortcode (str): Short code used to type the emoji
+            image_url (str): URL of the image to use
+            alt_text (str): Alt text (hover or screenreader) of the emoji
+            keywords (List[str]): Keywords of the emoji.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Emoji created response
+        """
+        form={
+            "category": category,
+            "shortcode": shortcode,
+            "image_url": image_url,
+            "alt_text": alt_text,
+            "keywords": keywords
+            }
+        res = self._req.lemmyRequest("createCustomEmoji", instance=instance, form=form, auth=auth)
+        return res
+        
+    def edit(self, emoji_id:int, category:str=None, image_url:str=None, alt_text:str=None, keywords:List[str]=None, instance:str=None):
+        """
+        Edit a custom emoji. Excluded optional arguments are not modified.
+        
+        Args:
+            emoji_id (int): ID of the emoji
+            category (str): Category of the emoji. Optional
+            image_url (str): URL of the image to use. Optional
+            alt_text (str): Alt text (hover or screenreader) of the emoji. Optional
+            keywords (List[str]): Keywords of the emoji. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Emoji edited response
+        """
+        form={
+            "id": emoji_id,
+            "category": category,
+            "image_url": image_url,
+            "alt_text": alt_text,
+            "keywords": keywords
+            }
+        res = self._req.lemmyRequest("editCustomEmoji", instance=instance, form=form, auth=auth)
+        return res
+        
+    def delete(self, emoji_id:int, instance:str=None):
+        """
+        Delete a custom emoji from the website
+        
+        Args:
+            emoji_id (int): ID of emoji to delete
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+        Returns:
+            Emoji deleted response
+        """
+        form={
+            "id": emoji_id
+            }
+        res = self._req.lemmyRequest("deleteCustomEmoji", instance=instance, form=form, auth=auth)
+        return res
+
+

Methods

+
+
+def create(self, category: str, shortcode: str, image_url: str, alt_text: str, keywords: List[str], instance: str = None) +
+
+

Create a custom emoji

+

Args

+
+
category : str
+
Category of the emoji
+
shortcode : str
+
Short code used to type the emoji
+
image_url : str
+
URL of the image to use
+
alt_text : str
+
Alt text (hover or screenreader) of the emoji
+
keywords : List[str]
+
Keywords of the emoji.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Emoji created response

+
+ +Expand source code + +
def create(self, category:str, shortcode:str, image_url:str, alt_text:str, keywords:List[str], instance:str=None):
+    """
+    Create a custom emoji
+    
+    Args:
+        category (str): Category of the emoji
+        shortcode (str): Short code used to type the emoji
+        image_url (str): URL of the image to use
+        alt_text (str): Alt text (hover or screenreader) of the emoji
+        keywords (List[str]): Keywords of the emoji.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Emoji created response
+    """
+    form={
+        "category": category,
+        "shortcode": shortcode,
+        "image_url": image_url,
+        "alt_text": alt_text,
+        "keywords": keywords
+        }
+    res = self._req.lemmyRequest("createCustomEmoji", instance=instance, form=form, auth=auth)
+    return res
+
+
+
+def delete(self, emoji_id: int, instance: str = None) +
+
+

Delete a custom emoji from the website

+

Args

+
+
emoji_id : int
+
ID of emoji to delete
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Emoji deleted response

+
+ +Expand source code + +
def delete(self, emoji_id:int, instance:str=None):
+    """
+    Delete a custom emoji from the website
+    
+    Args:
+        emoji_id (int): ID of emoji to delete
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Emoji deleted response
+    """
+    form={
+        "id": emoji_id
+        }
+    res = self._req.lemmyRequest("deleteCustomEmoji", instance=instance, form=form, auth=auth)
+    return res
+
+
+
+def edit(self, emoji_id: int, category: str = None, image_url: str = None, alt_text: str = None, keywords: List[str] = None, instance: str = None) +
+
+

Edit a custom emoji. Excluded optional arguments are not modified.

+

Args

+
+
emoji_id : int
+
ID of the emoji
+
category : str
+
Category of the emoji. Optional
+
image_url : str
+
URL of the image to use. Optional
+
alt_text : str
+
Alt text (hover or screenreader) of the emoji. Optional
+
keywords : List[str]
+
Keywords of the emoji. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Emoji edited response

+
+ +Expand source code + +
def edit(self, emoji_id:int, category:str=None, image_url:str=None, alt_text:str=None, keywords:List[str]=None, instance:str=None):
+    """
+    Edit a custom emoji. Excluded optional arguments are not modified.
+    
+    Args:
+        emoji_id (int): ID of the emoji
+        category (str): Category of the emoji. Optional
+        image_url (str): URL of the image to use. Optional
+        alt_text (str): Alt text (hover or screenreader) of the emoji. Optional
+        keywords (List[str]): Keywords of the emoji. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+    Returns:
+        Emoji edited response
+    """
+    form={
+        "id": emoji_id,
+        "category": category,
+        "image_url": image_url,
+        "alt_text": alt_text,
+        "keywords": keywords
+        }
+    res = self._req.lemmyRequest("editCustomEmoji", instance=instance, form=form, auth=auth)
+    return res
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/index.html b/docs/v0.1.6/index.html new file mode 100644 index 0000000..9736270 --- /dev/null +++ b/docs/v0.1.6/index.html @@ -0,0 +1,125 @@ + + + + + + +jplaw API documentation + + + + + + + + + + + +
+
+
+

Package jplaw

+
+
+

The jplaw library is designed to allow interactions with the API of Lemmy instances. For function access, see the submodules. For More information on the API, see the Lemmy API documentation.

+
+ +Expand source code + +
"""
+    The jplaw library is designed to allow interactions with the API of Lemmy instances. For function access, see the submodules. For More information on the API, see the Lemmy API documentation.
+"""
+__version__ = "0.1.6"
+"""Current package version"""
+
+__package__ = "jplaw"
+
+from .lemmy import Lemmy 
+
+
+
+

Sub-modules

+
+
jplaw.api_paths
+
+

Helper variables for converting between function and API path / request type.

+
+
jplaw.comment
+
+

Comment class. Designed to allow Lemmy.Comment functions.

+
+
jplaw.community
+
+

Community class. Designed to allow Lemmy.Community functions.

+
+
jplaw.emoji
+
+

Emoji class. Designed to allow Lemmy.Emoji functions.

+
+
jplaw.lemmy
+
+

The Lemmy object is used to interract with a Lemmy instance …

+
+
jplaw.post
+
+

Post class. Designed to allow Lemmy.Post functions.

+
+
jplaw.private_message
+
+

Private message class. Used to access functions for sending, reading, and reporting private messages.

+
+
jplaw.requestor
+
+

Requestor allows HTTP communication.

+
+
jplaw.site
+
+

Site class. Designed to allow Lemmy.Site functions.

+
+
jplaw.types
+
+

The jplaw.types submodule is used for Enums and data types used in jplaw.

+
+
jplaw.user
+
+

User class. Designed to allow Lemmy.User functions.

+
+
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/lemmy.html b/docs/v0.1.6/lemmy.html new file mode 100644 index 0000000..fe946cb --- /dev/null +++ b/docs/v0.1.6/lemmy.html @@ -0,0 +1,288 @@ + + + + + + +jplaw.lemmy API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.lemmy

+
+
+

The Lemmy object is used to interract with a Lemmy instance.

+

Creation can be done

+
import jplaw
+
+my_instance = "..."
+my_username = "..."
+my_password = "..."
+
+lem = jplaw.Lemmy(
+    instance=my_instance, 
+    username=my_username, 
+    password=my_password
+    )
+
+

Functions of subtypes can be done like so:

+
print(lem.Community.list())
+
+print(lem.Post.create(community_id=..., title="Test", body="test"))
+
+
+ +Expand source code + +
"""
+The Lemmy object is used to interract with a Lemmy instance.
+
+Creation can be done 
+
+```python
+import jplaw
+
+my_instance = "..."
+my_username = "..."
+my_password = "..."
+
+lem = jplaw.Lemmy(
+    instance=my_instance, 
+    username=my_username, 
+    password=my_password
+    )
+```
+
+Functions of subtypes can be done like so:
+
+```python
+print(lem.Community.list())
+
+print(lem.Post.create(community_id=..., title="Test", body="test"))
+```
+
+"""
+
+from jplaw.requestor import Requestor
+from jplaw.comment import Comment
+from jplaw.community import Community
+from jplaw.post import Post
+from jplaw.user import User
+from jplaw.site import Site
+from jplaw.emoji import Emoji
+from jplaw.private_message import PrivateMessage
+
+class Lemmy:
+    
+    Post: Post
+    """Post object. Allows Lemmy.Post functions"""
+    Community: Community
+    """Community object. Allows Lemmy.Community functions"""
+    Comment: Comment
+    """Comment object. Allows Lemmy.Comment functions"""
+    User: User
+    """User object. Allows Lemmy.User functions"""
+    Site: Site
+    """Site object. Allows Lemmy.Site functions"""
+    Emoji: Emoji
+    """Emoji object. Allows Lemmy.Emoji functions"""
+    PrivateMessage: PrivateMessage
+    """PrivateMessage object. Allows Lemmy.PrivateMessage functions"""
+    
+    def __enter__(self):
+        """Handle the context manager open."""
+        return self
+    
+    def __exit__(self, *_args):
+        """Handle the context manager close."""
+    
+    def __init__(self, instance:str, username:str = None, password:str = None):
+        """
+        Create a Lemmy object
+        
+        Args:
+            instance (str): URL of instance to log in to or use
+            username (str): username or email to log in with. Defaults to None (no authentication)
+            password (str): password of user. Defaults to None (no authentication)
+        Returns:
+            Lemmy object
+        """
+        
+        self.username = username
+        
+        # Login, get token, and set as header for future
+        self._req = Requestor(instance=instance, username=username, password=password, headers={})
+        
+        # Create objects for function access
+        self.Post = Post(self._req)
+        self.Community = Community(self._req)
+        self.Comment = Comment(self._req)
+        self.User = User(self._req)
+        self.Site = Site(self._req)
+        self.Emoji = Emoji(self._req)
+        self.PrivateMessage = PrivateMessage(self._req)
+        # print(self._req.headers.get("Authorization"))
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Lemmy +(instance: str, username: str = None, password: str = None) +
+
+

Create a Lemmy object

+

Args

+
+
instance : str
+
URL of instance to log in to or use
+
username : str
+
username or email to log in with. Defaults to None (no authentication)
+
password : str
+
password of user. Defaults to None (no authentication)
+
+

Returns

+

Lemmy object

+
+ +Expand source code + +
class Lemmy:
+    
+    Post: Post
+    """Post object. Allows Lemmy.Post functions"""
+    Community: Community
+    """Community object. Allows Lemmy.Community functions"""
+    Comment: Comment
+    """Comment object. Allows Lemmy.Comment functions"""
+    User: User
+    """User object. Allows Lemmy.User functions"""
+    Site: Site
+    """Site object. Allows Lemmy.Site functions"""
+    Emoji: Emoji
+    """Emoji object. Allows Lemmy.Emoji functions"""
+    PrivateMessage: PrivateMessage
+    """PrivateMessage object. Allows Lemmy.PrivateMessage functions"""
+    
+    def __enter__(self):
+        """Handle the context manager open."""
+        return self
+    
+    def __exit__(self, *_args):
+        """Handle the context manager close."""
+    
+    def __init__(self, instance:str, username:str = None, password:str = None):
+        """
+        Create a Lemmy object
+        
+        Args:
+            instance (str): URL of instance to log in to or use
+            username (str): username or email to log in with. Defaults to None (no authentication)
+            password (str): password of user. Defaults to None (no authentication)
+        Returns:
+            Lemmy object
+        """
+        
+        self.username = username
+        
+        # Login, get token, and set as header for future
+        self._req = Requestor(instance=instance, username=username, password=password, headers={})
+        
+        # Create objects for function access
+        self.Post = Post(self._req)
+        self.Community = Community(self._req)
+        self.Comment = Comment(self._req)
+        self.User = User(self._req)
+        self.Site = Site(self._req)
+        self.Emoji = Emoji(self._req)
+        self.PrivateMessage = PrivateMessage(self._req)
+        # print(self._req.headers.get("Authorization"))
+
+

Class variables

+
+
var CommentComment
+
+

Comment object. Allows Lemmy.Comment functions

+
+
var CommunityCommunity
+
+

Community object. Allows Lemmy.Community functions

+
+
var EmojiEmoji
+
+

Emoji object. Allows Lemmy.Emoji functions

+
+
var PostPost
+
+

Post object. Allows Lemmy.Post functions

+
+
var PrivateMessagePrivateMessage
+
+

PrivateMessage object. Allows Lemmy.PrivateMessage functions

+
+
var SiteSite
+
+

Site object. Allows Lemmy.Site functions

+
+
var UserUser
+
+

User object. Allows Lemmy.User functions

+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/post.html b/docs/v0.1.6/post.html new file mode 100644 index 0000000..7b5230b --- /dev/null +++ b/docs/v0.1.6/post.html @@ -0,0 +1,1475 @@ + + + + + + +jplaw.post API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.post

+
+
+

Post class. Designed to allow Lemmy.Post functions.

+
+ +Expand source code + +
"""
+Post class. Designed to allow Lemmy.Post functions.
+"""
+from jplaw.requestor import Requestor
+from jplaw.api_paths import *
+from jplaw.types.post_feature_type import PostFeatureType
+from jplaw.types.listing_type import ListingType
+from jplaw.types.sort_type import SortType
+
+class Post():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+        
+    def list(self, type:ListingType=None, sort:SortType=None, page:int=None, limit:int=None, community_id:int=None, community_name:str=None, saved_only:bool=None, instance:str=None, auth:bool=True):
+        """
+        Get a list of posts in a community
+        
+        Args:
+            type (ListingType): Type of post. Optional
+            sort (SortType): Sorting Mode. Optional
+            page (int): Page number. Optional
+            limit (int): Limit for number of posts. Optional
+            community_id (int): ID of the community the post is in. Optional
+            community_name (str): Name of the community the post is in. Optional
+            saved_only (bool): Find posts only from saved posts. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            List of posts
+        """
+        form = {}
+        optional = {
+            "sort": sort,
+            "type": type,
+            "community_id": community_id,
+            "page": page,
+            "limit": limit,
+            "community_name": community_name,
+            "saved_only": saved_only
+            }
+        res = self._req.lemmyRequest("getPosts", instance=instance, form=form, optional=optional, auth=auth)
+        return res["posts"]
+        
+    def get(self, post_id:int=None, comment_id:int=None, instance:str=None, auth:bool=True):
+        """
+        Get a post by ID
+        
+        Args:
+            post_id (int): ID of the post. Optional
+            comment_id (int): Comment ID for comment view. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            Post response
+        """
+        form = {}
+        optional = {
+            "id": post_id,
+            "comment_id": comment_id,
+            }
+        res = self._req.lemmyRequest("getPost", instance=instance, form=form, optional=optional, auth=auth)
+        return res["post_view"]
+        
+    def create(self, community_id:int, title:str=None, body:str=None, remote_url:str=None, honeypot:str=None, nsfw=False, language_id:int=None, instance:str=None):
+        """
+        Create a post
+        
+        Args:
+            community_id (int): ID of the community the post is in. Optional
+            title (str): Title of the post. Optional.
+            body (str): Text contents of the post. Optional
+            remote_url (str): URL if link post. Optional.
+            nsfw (bool): NSFW post. Optional. Defaults to false.
+            language_id (int): Language ID
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Created post response
+        """
+        form = {}
+        optional={
+            "url": remote_url,
+            "community_id": community_id,
+            "name": title,
+            "body": body,
+            "language_id": language_id,
+            "nsfw": nsfw,
+            "honeypot": honeypot
+            }
+        res = self._req.lemmyRequest("createPost", instance=instance, form=form, optional=optional, auth=True)
+        return res["post_view"]
+        
+    def edit(self, post_id:int, title:str=None, body:str=None, remote_url:str=None, nsfw:bool=None, language_id:int=None, instance:str=None):
+        """
+        Edit a post
+        
+        Args:
+            post_id (int): ID of the post to edit
+            title (str): Title of the post. Optional.
+            body (str): Text contents of the post. Optional
+            remote_url (str): URL if link post. Optional.
+            nsfw (bool): NSFW post. Optional. Defaults to None.
+            language_id (int): Language ID
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Edited post response
+        """
+        form = {
+            "post_id": post_id,
+        }
+        optional={
+            "url": remote_url,
+            "nsfw": nsfw,
+            "language_id": language_id,
+            "name": title,
+            "body": body
+        }
+        res = self._req.lemmyRequest("editPost", instance=instance, form=form, optional=optional, auth=True)
+        return res["post_view"]
+        
+    def like(self, post_id:int, score:int=1, instance:str=None):
+        """
+        Like a post
+        
+        Args:
+            post_id (int): ID of the post
+            score (int)::1 for like, -1 for dislike, 0 to remove like. Clamped to 1/0/-1.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Liked post response
+        """
+        if(score > 1):
+            score = 1
+        if(score < -1):
+            score = -1
+        form = {
+            "post_id": post_id,
+            "score": score
+            }
+        res = self._req.lemmyRequest("likePost", instance=instance, form=form, auth=True)
+        return res
+    
+    def report(self, post_id:int, reason:str, instance:str=None):
+        """
+        Report a post
+        
+        Args:
+            post_id (int): ID of the post
+            reason (str): Reason for reporting the post
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Reported post response
+        """
+        form = {
+            "post_id": post_id,
+            "reason": reason
+            }
+        res = self._req.lemmyRequest("createPostReport", instance=instance, form=form, auth=True)
+        return res
+        
+    def delete(self, post_id:int, deleted:bool=True, instance:str=None):
+        """
+        Delete a post
+        
+        Args:
+            post_id (int): ID of the post
+            deleted (bool): If post is deleted. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Deleted post response
+        """
+        form = {
+            "post_id": post_id,
+            "deleted": deleted
+            }
+        res = self._req.lemmyRequest("deletePost", instance=instance, form=form, auth=True)
+        return res
+        
+    def feature(self, post_id:int, feature_type: PostFeatureType, featured:bool=True, instance:str=None):
+        """
+        Feature a post
+        
+        Args:
+            post_id (int): ID of the post
+            feature_type (PostFeatureType): Type of featured post. Currently Community and Local.
+            featured (bool): If post is featured or not. Optional. Defaults to True.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Featured post response
+        """
+        form = {
+            "post_id": post_id,
+            "featured": featured,
+            }
+        if(feature_type):
+            form["feature_type"] = feature_type.value
+        res = self._req.lemmyRequest("featurePost", instance=instance, form=form, auth=True)
+        return res
+        
+    def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=True, community_id:int=None, instance:str=None):
+        """
+        Get list of post reports
+        
+        Args:
+            page (int): Page number. Optional
+            limit (int): Limit for number of posts. Optional
+            unresolved_only (bool): If only unresolved posts should be shown. Optional
+            community_id (int): ID of the community to filter reports from. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of reported posts
+        """
+        form = {}
+        optional = {
+            "page": page,
+            "limit": limit,
+            "unresolved_only": unresolved_only,
+            "community_id": community_id,
+            }
+        res = self._req.lemmyRequest("listPostReports", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def lock(self, post_id:int, locked:bool=True, instance:str=None):
+        """
+        Lock a post
+        
+        Args:
+            post_id (int): ID of the post
+            locked (bool): If post is locked. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Locked post response
+        """
+        form = {
+            "post_id": post_id,
+            "locked": locked,
+        }
+        res = self._req.lemmyRequest("lockPost", instance=instance, form=form, auth=True)
+        return res
+        
+    def markAsRead(self, post_id:int, read:bool=True, instance:str=None):
+        """
+        Mark a post as read
+        
+        Args:
+            post_id (int): ID of the post
+            read (bool): If post is read. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Read post response
+        """
+        form = {
+            "post_id": post_id,
+            "read": read,
+        }
+        res = self._req.lemmyRequest("markPostAsRead", instance=instance, form=form, auth=True)
+        return res
+    
+    def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+        """
+        Resolve a post report
+        
+        Args:
+            report_id (int): ID of the post report
+            resolved (bool): If post report is resolved. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form = {
+            "report_id"  : report_id ,
+            "resolved"   : resolved  ,
+            }
+        res = self._req.lemmyRequest("resolvePostReport", instance=instance, form=form, auth=auth)
+        return
+        
+    def save(self, post_id:int, save:bool=True, instance:str=None):
+        """
+        Save a post
+        
+        Args:
+            post_id (int): ID of the post
+            save (bool): If post is saved. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form = {
+            "post_id"  : post_id ,
+            "save"   : save,
+            }
+        res = self._req.lemmyRequest("savePost", instance=instance, form=form, auth=auth)
+        return
+        
+    def getSiteMetadata(self, remote_url:str, instance:str=None, auth:bool=True):
+        """
+        Gets metadata for a site when linked by a post
+        
+        Args:
+            remote_url (str): URL of the site to get the metadata for
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form={
+            "url": remote_url,
+        }
+        res = self._req.lemmyRequest("getSiteMetadata", instance=instance, form=form, auth=auth)
+        return res
+        
+    def remove(self, post_id:int, mod_person_id:int, when_:str, removed:bool=True, reason:str=None, instance:str=None):
+        """
+        Remove a post as a moderator
+        
+        Args:
+            post_id (int): ID of the post to remove
+            mod_person_id (int): ID of the moderator removing the post
+            when_ (str): Timestamp of when post was removed
+            removed (bool): If post is removed. Optional. Defaults to True.
+            reason (str): Reason for post removal. Optional. 
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form = {
+            "post_id": post_id,
+            "mod_person_id": mod_person_id,
+            "when_": when_,
+            "removed": removed,
+            }
+        optional={
+            "reason":reason,
+            }
+        res = self._req.lemmyRequest("removePost", instance=instance, form=form, optional=optional, auth=True)
+        return res["post_view"]
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Post +(_req: Requestor) +
+
+
+
+ +Expand source code + +
class Post():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+        
+    def list(self, type:ListingType=None, sort:SortType=None, page:int=None, limit:int=None, community_id:int=None, community_name:str=None, saved_only:bool=None, instance:str=None, auth:bool=True):
+        """
+        Get a list of posts in a community
+        
+        Args:
+            type (ListingType): Type of post. Optional
+            sort (SortType): Sorting Mode. Optional
+            page (int): Page number. Optional
+            limit (int): Limit for number of posts. Optional
+            community_id (int): ID of the community the post is in. Optional
+            community_name (str): Name of the community the post is in. Optional
+            saved_only (bool): Find posts only from saved posts. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            List of posts
+        """
+        form = {}
+        optional = {
+            "sort": sort,
+            "type": type,
+            "community_id": community_id,
+            "page": page,
+            "limit": limit,
+            "community_name": community_name,
+            "saved_only": saved_only
+            }
+        res = self._req.lemmyRequest("getPosts", instance=instance, form=form, optional=optional, auth=auth)
+        return res["posts"]
+        
+    def get(self, post_id:int=None, comment_id:int=None, instance:str=None, auth:bool=True):
+        """
+        Get a post by ID
+        
+        Args:
+            post_id (int): ID of the post. Optional
+            comment_id (int): Comment ID for comment view. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (str): If true, authenticates using internal token from login. Optional. Default True
+        Returns:
+            Post response
+        """
+        form = {}
+        optional = {
+            "id": post_id,
+            "comment_id": comment_id,
+            }
+        res = self._req.lemmyRequest("getPost", instance=instance, form=form, optional=optional, auth=auth)
+        return res["post_view"]
+        
+    def create(self, community_id:int, title:str=None, body:str=None, remote_url:str=None, honeypot:str=None, nsfw=False, language_id:int=None, instance:str=None):
+        """
+        Create a post
+        
+        Args:
+            community_id (int): ID of the community the post is in. Optional
+            title (str): Title of the post. Optional.
+            body (str): Text contents of the post. Optional
+            remote_url (str): URL if link post. Optional.
+            nsfw (bool): NSFW post. Optional. Defaults to false.
+            language_id (int): Language ID
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Created post response
+        """
+        form = {}
+        optional={
+            "url": remote_url,
+            "community_id": community_id,
+            "name": title,
+            "body": body,
+            "language_id": language_id,
+            "nsfw": nsfw,
+            "honeypot": honeypot
+            }
+        res = self._req.lemmyRequest("createPost", instance=instance, form=form, optional=optional, auth=True)
+        return res["post_view"]
+        
+    def edit(self, post_id:int, title:str=None, body:str=None, remote_url:str=None, nsfw:bool=None, language_id:int=None, instance:str=None):
+        """
+        Edit a post
+        
+        Args:
+            post_id (int): ID of the post to edit
+            title (str): Title of the post. Optional.
+            body (str): Text contents of the post. Optional
+            remote_url (str): URL if link post. Optional.
+            nsfw (bool): NSFW post. Optional. Defaults to None.
+            language_id (int): Language ID
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Edited post response
+        """
+        form = {
+            "post_id": post_id,
+        }
+        optional={
+            "url": remote_url,
+            "nsfw": nsfw,
+            "language_id": language_id,
+            "name": title,
+            "body": body
+        }
+        res = self._req.lemmyRequest("editPost", instance=instance, form=form, optional=optional, auth=True)
+        return res["post_view"]
+        
+    def like(self, post_id:int, score:int=1, instance:str=None):
+        """
+        Like a post
+        
+        Args:
+            post_id (int): ID of the post
+            score (int)::1 for like, -1 for dislike, 0 to remove like. Clamped to 1/0/-1.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Liked post response
+        """
+        if(score > 1):
+            score = 1
+        if(score < -1):
+            score = -1
+        form = {
+            "post_id": post_id,
+            "score": score
+            }
+        res = self._req.lemmyRequest("likePost", instance=instance, form=form, auth=True)
+        return res
+    
+    def report(self, post_id:int, reason:str, instance:str=None):
+        """
+        Report a post
+        
+        Args:
+            post_id (int): ID of the post
+            reason (str): Reason for reporting the post
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Reported post response
+        """
+        form = {
+            "post_id": post_id,
+            "reason": reason
+            }
+        res = self._req.lemmyRequest("createPostReport", instance=instance, form=form, auth=True)
+        return res
+        
+    def delete(self, post_id:int, deleted:bool=True, instance:str=None):
+        """
+        Delete a post
+        
+        Args:
+            post_id (int): ID of the post
+            deleted (bool): If post is deleted. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Deleted post response
+        """
+        form = {
+            "post_id": post_id,
+            "deleted": deleted
+            }
+        res = self._req.lemmyRequest("deletePost", instance=instance, form=form, auth=True)
+        return res
+        
+    def feature(self, post_id:int, feature_type: PostFeatureType, featured:bool=True, instance:str=None):
+        """
+        Feature a post
+        
+        Args:
+            post_id (int): ID of the post
+            feature_type (PostFeatureType): Type of featured post. Currently Community and Local.
+            featured (bool): If post is featured or not. Optional. Defaults to True.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Featured post response
+        """
+        form = {
+            "post_id": post_id,
+            "featured": featured,
+            }
+        if(feature_type):
+            form["feature_type"] = feature_type.value
+        res = self._req.lemmyRequest("featurePost", instance=instance, form=form, auth=True)
+        return res
+        
+    def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=True, community_id:int=None, instance:str=None):
+        """
+        Get list of post reports
+        
+        Args:
+            page (int): Page number. Optional
+            limit (int): Limit for number of posts. Optional
+            unresolved_only (bool): If only unresolved posts should be shown. Optional
+            community_id (int): ID of the community to filter reports from. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of reported posts
+        """
+        form = {}
+        optional = {
+            "page": page,
+            "limit": limit,
+            "unresolved_only": unresolved_only,
+            "community_id": community_id,
+            }
+        res = self._req.lemmyRequest("listPostReports", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def lock(self, post_id:int, locked:bool=True, instance:str=None):
+        """
+        Lock a post
+        
+        Args:
+            post_id (int): ID of the post
+            locked (bool): If post is locked. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Locked post response
+        """
+        form = {
+            "post_id": post_id,
+            "locked": locked,
+        }
+        res = self._req.lemmyRequest("lockPost", instance=instance, form=form, auth=True)
+        return res
+        
+    def markAsRead(self, post_id:int, read:bool=True, instance:str=None):
+        """
+        Mark a post as read
+        
+        Args:
+            post_id (int): ID of the post
+            read (bool): If post is read. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Read post response
+        """
+        form = {
+            "post_id": post_id,
+            "read": read,
+        }
+        res = self._req.lemmyRequest("markPostAsRead", instance=instance, form=form, auth=True)
+        return res
+    
+    def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+        """
+        Resolve a post report
+        
+        Args:
+            report_id (int): ID of the post report
+            resolved (bool): If post report is resolved. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form = {
+            "report_id"  : report_id ,
+            "resolved"   : resolved  ,
+            }
+        res = self._req.lemmyRequest("resolvePostReport", instance=instance, form=form, auth=auth)
+        return
+        
+    def save(self, post_id:int, save:bool=True, instance:str=None):
+        """
+        Save a post
+        
+        Args:
+            post_id (int): ID of the post
+            save (bool): If post is saved. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form = {
+            "post_id"  : post_id ,
+            "save"   : save,
+            }
+        res = self._req.lemmyRequest("savePost", instance=instance, form=form, auth=auth)
+        return
+        
+    def getSiteMetadata(self, remote_url:str, instance:str=None, auth:bool=True):
+        """
+        Gets metadata for a site when linked by a post
+        
+        Args:
+            remote_url (str): URL of the site to get the metadata for
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form={
+            "url": remote_url,
+        }
+        res = self._req.lemmyRequest("getSiteMetadata", instance=instance, form=form, auth=auth)
+        return res
+        
+    def remove(self, post_id:int, mod_person_id:int, when_:str, removed:bool=True, reason:str=None, instance:str=None):
+        """
+        Remove a post as a moderator
+        
+        Args:
+            post_id (int): ID of the post to remove
+            mod_person_id (int): ID of the moderator removing the post
+            when_ (str): Timestamp of when post was removed
+            removed (bool): If post is removed. Optional. Defaults to True.
+            reason (str): Reason for post removal. Optional. 
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Post report resolved response
+        """
+        form = {
+            "post_id": post_id,
+            "mod_person_id": mod_person_id,
+            "when_": when_,
+            "removed": removed,
+            }
+        optional={
+            "reason":reason,
+            }
+        res = self._req.lemmyRequest("removePost", instance=instance, form=form, optional=optional, auth=True)
+        return res["post_view"]
+
+

Methods

+
+
+def create(self, community_id: int, title: str = None, body: str = None, remote_url: str = None, honeypot: str = None, nsfw=False, language_id: int = None, instance: str = None) +
+
+

Create a post

+

Args

+
+
community_id : int
+
ID of the community the post is in. Optional
+
title : str
+
Title of the post. Optional.
+
body : str
+
Text contents of the post. Optional
+
remote_url : str
+
URL if link post. Optional.
+
nsfw : bool
+
NSFW post. Optional. Defaults to false.
+
language_id : int
+
Language ID
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Created post response

+
+ +Expand source code + +
def create(self, community_id:int, title:str=None, body:str=None, remote_url:str=None, honeypot:str=None, nsfw=False, language_id:int=None, instance:str=None):
+    """
+    Create a post
+    
+    Args:
+        community_id (int): ID of the community the post is in. Optional
+        title (str): Title of the post. Optional.
+        body (str): Text contents of the post. Optional
+        remote_url (str): URL if link post. Optional.
+        nsfw (bool): NSFW post. Optional. Defaults to false.
+        language_id (int): Language ID
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Created post response
+    """
+    form = {}
+    optional={
+        "url": remote_url,
+        "community_id": community_id,
+        "name": title,
+        "body": body,
+        "language_id": language_id,
+        "nsfw": nsfw,
+        "honeypot": honeypot
+        }
+    res = self._req.lemmyRequest("createPost", instance=instance, form=form, optional=optional, auth=True)
+    return res["post_view"]
+
+
+
+def delete(self, post_id: int, deleted: bool = True, instance: str = None) +
+
+

Delete a post

+

Args

+
+
post_id : int
+
ID of the post
+
deleted : bool
+
If post is deleted. Optional. Defaults to true.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Deleted post response

+
+ +Expand source code + +
def delete(self, post_id:int, deleted:bool=True, instance:str=None):
+    """
+    Delete a post
+    
+    Args:
+        post_id (int): ID of the post
+        deleted (bool): If post is deleted. Optional. Defaults to true.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Deleted post response
+    """
+    form = {
+        "post_id": post_id,
+        "deleted": deleted
+        }
+    res = self._req.lemmyRequest("deletePost", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def edit(self, post_id: int, title: str = None, body: str = None, remote_url: str = None, nsfw: bool = None, language_id: int = None, instance: str = None) +
+
+

Edit a post

+

Args

+
+
post_id : int
+
ID of the post to edit
+
title : str
+
Title of the post. Optional.
+
body : str
+
Text contents of the post. Optional
+
remote_url : str
+
URL if link post. Optional.
+
nsfw : bool
+
NSFW post. Optional. Defaults to None.
+
language_id : int
+
Language ID
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Edited post response

+
+ +Expand source code + +
def edit(self, post_id:int, title:str=None, body:str=None, remote_url:str=None, nsfw:bool=None, language_id:int=None, instance:str=None):
+    """
+    Edit a post
+    
+    Args:
+        post_id (int): ID of the post to edit
+        title (str): Title of the post. Optional.
+        body (str): Text contents of the post. Optional
+        remote_url (str): URL if link post. Optional.
+        nsfw (bool): NSFW post. Optional. Defaults to None.
+        language_id (int): Language ID
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Edited post response
+    """
+    form = {
+        "post_id": post_id,
+    }
+    optional={
+        "url": remote_url,
+        "nsfw": nsfw,
+        "language_id": language_id,
+        "name": title,
+        "body": body
+    }
+    res = self._req.lemmyRequest("editPost", instance=instance, form=form, optional=optional, auth=True)
+    return res["post_view"]
+
+
+
+def feature(self, post_id: int, feature_type: PostFeatureType, featured: bool = True, instance: str = None) +
+
+

Feature a post

+

Args

+
+
post_id : int
+
ID of the post
+
feature_type : PostFeatureType
+
Type of featured post. Currently Community and Local.
+
featured : bool
+
If post is featured or not. Optional. Defaults to True.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Featured post response

+
+ +Expand source code + +
def feature(self, post_id:int, feature_type: PostFeatureType, featured:bool=True, instance:str=None):
+    """
+    Feature a post
+    
+    Args:
+        post_id (int): ID of the post
+        feature_type (PostFeatureType): Type of featured post. Currently Community and Local.
+        featured (bool): If post is featured or not. Optional. Defaults to True.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Featured post response
+    """
+    form = {
+        "post_id": post_id,
+        "featured": featured,
+        }
+    if(feature_type):
+        form["feature_type"] = feature_type.value
+    res = self._req.lemmyRequest("featurePost", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def get(self, post_id: int = None, comment_id: int = None, instance: str = None, auth: bool = True) +
+
+

Get a post by ID

+

Args

+
+
post_id : int
+
ID of the post. Optional
+
comment_id : int
+
Comment ID for comment view. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : str
+
If true, authenticates using internal token from login. Optional. Default True
+
+

Returns

+

Post response

+
+ +Expand source code + +
def get(self, post_id:int=None, comment_id:int=None, instance:str=None, auth:bool=True):
+    """
+    Get a post by ID
+    
+    Args:
+        post_id (int): ID of the post. Optional
+        comment_id (int): Comment ID for comment view. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (str): If true, authenticates using internal token from login. Optional. Default True
+    Returns:
+        Post response
+    """
+    form = {}
+    optional = {
+        "id": post_id,
+        "comment_id": comment_id,
+        }
+    res = self._req.lemmyRequest("getPost", instance=instance, form=form, optional=optional, auth=auth)
+    return res["post_view"]
+
+
+
+def getSiteMetadata(self, remote_url: str, instance: str = None, auth: bool = True) +
+
+

Gets metadata for a site when linked by a post

+

Args

+
+
remote_url : str
+
URL of the site to get the metadata for
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Post report resolved response

+
+ +Expand source code + +
def getSiteMetadata(self, remote_url:str, instance:str=None, auth:bool=True):
+    """
+    Gets metadata for a site when linked by a post
+    
+    Args:
+        remote_url (str): URL of the site to get the metadata for
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Post report resolved response
+    """
+    form={
+        "url": remote_url,
+    }
+    res = self._req.lemmyRequest("getSiteMetadata", instance=instance, form=form, auth=auth)
+    return res
+
+
+
+def like(self, post_id: int, score: int = 1, instance: str = None) +
+
+

Like a post

+

Args

+
+
post_id : int
+
ID of the post
+
score (int)::1 for like, -1 for dislike, 0 to remove like. Clamped to 1/0/-1.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Liked post response

+
+ +Expand source code + +
def like(self, post_id:int, score:int=1, instance:str=None):
+    """
+    Like a post
+    
+    Args:
+        post_id (int): ID of the post
+        score (int)::1 for like, -1 for dislike, 0 to remove like. Clamped to 1/0/-1.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Liked post response
+    """
+    if(score > 1):
+        score = 1
+    if(score < -1):
+        score = -1
+    form = {
+        "post_id": post_id,
+        "score": score
+        }
+    res = self._req.lemmyRequest("likePost", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def list(self, type: ListingType = None, sort: SortType = None, page: int = None, limit: int = None, community_id: int = None, community_name: str = None, saved_only: bool = None, instance: str = None, auth: bool = True) +
+
+

Get a list of posts in a community

+

Args

+
+
type : ListingType
+
Type of post. Optional
+
sort : SortType
+
Sorting Mode. Optional
+
page : int
+
Page number. Optional
+
limit : int
+
Limit for number of posts. Optional
+
community_id : int
+
ID of the community the post is in. Optional
+
community_name : str
+
Name of the community the post is in. Optional
+
saved_only : bool
+
Find posts only from saved posts. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : str
+
If true, authenticates using internal token from login. Optional. Default True
+
+

Returns

+

List of posts

+
+ +Expand source code + +
def list(self, type:ListingType=None, sort:SortType=None, page:int=None, limit:int=None, community_id:int=None, community_name:str=None, saved_only:bool=None, instance:str=None, auth:bool=True):
+    """
+    Get a list of posts in a community
+    
+    Args:
+        type (ListingType): Type of post. Optional
+        sort (SortType): Sorting Mode. Optional
+        page (int): Page number. Optional
+        limit (int): Limit for number of posts. Optional
+        community_id (int): ID of the community the post is in. Optional
+        community_name (str): Name of the community the post is in. Optional
+        saved_only (bool): Find posts only from saved posts. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (str): If true, authenticates using internal token from login. Optional. Default True
+    Returns:
+        List of posts
+    """
+    form = {}
+    optional = {
+        "sort": sort,
+        "type": type,
+        "community_id": community_id,
+        "page": page,
+        "limit": limit,
+        "community_name": community_name,
+        "saved_only": saved_only
+        }
+    res = self._req.lemmyRequest("getPosts", instance=instance, form=form, optional=optional, auth=auth)
+    return res["posts"]
+
+
+
+def listReports(self, page: int = None, limit: int = None, unresolved_only: bool = True, community_id: int = None, instance: str = None) +
+
+

Get list of post reports

+

Args

+
+
page : int
+
Page number. Optional
+
limit : int
+
Limit for number of posts. Optional
+
unresolved_only : bool
+
If only unresolved posts should be shown. Optional
+
community_id : int
+
ID of the community to filter reports from. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of reported posts

+
+ +Expand source code + +
def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=True, community_id:int=None, instance:str=None):
+    """
+    Get list of post reports
+    
+    Args:
+        page (int): Page number. Optional
+        limit (int): Limit for number of posts. Optional
+        unresolved_only (bool): If only unresolved posts should be shown. Optional
+        community_id (int): ID of the community to filter reports from. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of reported posts
+    """
+    form = {}
+    optional = {
+        "page": page,
+        "limit": limit,
+        "unresolved_only": unresolved_only,
+        "community_id": community_id,
+        }
+    res = self._req.lemmyRequest("listPostReports", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def lock(self, post_id: int, locked: bool = True, instance: str = None) +
+
+

Lock a post

+

Args

+
+
post_id : int
+
ID of the post
+
locked : bool
+
If post is locked. Optional. Defaults to true.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Locked post response

+
+ +Expand source code + +
def lock(self, post_id:int, locked:bool=True, instance:str=None):
+    """
+    Lock a post
+    
+    Args:
+        post_id (int): ID of the post
+        locked (bool): If post is locked. Optional. Defaults to true.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Locked post response
+    """
+    form = {
+        "post_id": post_id,
+        "locked": locked,
+    }
+    res = self._req.lemmyRequest("lockPost", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def markAsRead(self, post_id: int, read: bool = True, instance: str = None) +
+
+

Mark a post as read

+

Args

+
+
post_id : int
+
ID of the post
+
read : bool
+
If post is read. Optional. Defaults to true.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Read post response

+
+ +Expand source code + +
def markAsRead(self, post_id:int, read:bool=True, instance:str=None):
+    """
+    Mark a post as read
+    
+    Args:
+        post_id (int): ID of the post
+        read (bool): If post is read. Optional. Defaults to true.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Read post response
+    """
+    form = {
+        "post_id": post_id,
+        "read": read,
+    }
+    res = self._req.lemmyRequest("markPostAsRead", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def remove(self, post_id: int, mod_person_id: int, when_: str, removed: bool = True, reason: str = None, instance: str = None) +
+
+

Remove a post as a moderator

+

Args

+
+
post_id : int
+
ID of the post to remove
+
mod_person_id : int
+
ID of the moderator removing the post
+
when_ : str
+
Timestamp of when post was removed
+
removed : bool
+
If post is removed. Optional. Defaults to True.
+
reason : str
+
Reason for post removal. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Post report resolved response

+
+ +Expand source code + +
def remove(self, post_id:int, mod_person_id:int, when_:str, removed:bool=True, reason:str=None, instance:str=None):
+    """
+    Remove a post as a moderator
+    
+    Args:
+        post_id (int): ID of the post to remove
+        mod_person_id (int): ID of the moderator removing the post
+        when_ (str): Timestamp of when post was removed
+        removed (bool): If post is removed. Optional. Defaults to True.
+        reason (str): Reason for post removal. Optional. 
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Post report resolved response
+    """
+    form = {
+        "post_id": post_id,
+        "mod_person_id": mod_person_id,
+        "when_": when_,
+        "removed": removed,
+        }
+    optional={
+        "reason":reason,
+        }
+    res = self._req.lemmyRequest("removePost", instance=instance, form=form, optional=optional, auth=True)
+    return res["post_view"]
+
+
+
+def report(self, post_id: int, reason: str, instance: str = None) +
+
+

Report a post

+

Args

+
+
post_id : int
+
ID of the post
+
reason : str
+
Reason for reporting the post
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Reported post response

+
+ +Expand source code + +
def report(self, post_id:int, reason:str, instance:str=None):
+    """
+    Report a post
+    
+    Args:
+        post_id (int): ID of the post
+        reason (str): Reason for reporting the post
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Reported post response
+    """
+    form = {
+        "post_id": post_id,
+        "reason": reason
+        }
+    res = self._req.lemmyRequest("createPostReport", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def resolveReport(self, report_id: int, resolved: bool = True, instance: str = None) +
+
+

Resolve a post report

+

Args

+
+
report_id : int
+
ID of the post report
+
resolved : bool
+
If post report is resolved. Optional. Defaults to true.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Post report resolved response

+
+ +Expand source code + +
def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+    """
+    Resolve a post report
+    
+    Args:
+        report_id (int): ID of the post report
+        resolved (bool): If post report is resolved. Optional. Defaults to true.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Post report resolved response
+    """
+    form = {
+        "report_id"  : report_id ,
+        "resolved"   : resolved  ,
+        }
+    res = self._req.lemmyRequest("resolvePostReport", instance=instance, form=form, auth=auth)
+    return
+
+
+
+def save(self, post_id: int, save: bool = True, instance: str = None) +
+
+

Save a post

+

Args

+
+
post_id : int
+
ID of the post
+
save : bool
+
If post is saved. Optional. Defaults to true.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Post report resolved response

+
+ +Expand source code + +
def save(self, post_id:int, save:bool=True, instance:str=None):
+    """
+    Save a post
+    
+    Args:
+        post_id (int): ID of the post
+        save (bool): If post is saved. Optional. Defaults to true.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Post report resolved response
+    """
+    form = {
+        "post_id"  : post_id ,
+        "save"   : save,
+        }
+    res = self._req.lemmyRequest("savePost", instance=instance, form=form, auth=auth)
+    return
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/private_message.html b/docs/v0.1.6/private_message.html new file mode 100644 index 0000000..6a56dd3 --- /dev/null +++ b/docs/v0.1.6/private_message.html @@ -0,0 +1,733 @@ + + + + + + +jplaw.private_message API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.private_message

+
+
+

Private message class. Used to access functions for sending, reading, and reporting private messages.

+
+ +Expand source code + +
"""
+Private message class. Used to access functions for sending, reading, and reporting private messages.
+"""
+from jplaw.requestor import Requestor
+from jplaw.api_paths import *
+
+
+class PrivateMessage():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    
+    def list(self, unread_only:bool=None, page:int=None, limit:int=None, instance:str=None):
+        """
+        Get list of private messages 
+        
+        Args:
+            unread_only (bool): Filters private by unread. Optional.
+            page (int): Page number of private messages. Optional.
+            limit (int): Limit for number of private messages. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of private messages
+        """
+        form = {}
+        optional={
+            "unread_only": unread_only,
+            "page": page,
+            "limit": limit,
+            }
+        res = self._req.lemmyRequest("getPrivateMessages", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def create(self, content:str, recipient_id:int, instance:str=None):
+        """
+        Create and send a private message
+        
+        Args:
+            content (str): Contents of private message
+            recipient_id (int): User ID of recipient
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Sent private message response
+        """
+        form = {
+            "content": content,
+            "recipient_id": recipient_id,
+            }
+        res = self._req.lemmyRequest("createPrivateMessage", instance=instance, form=form, auth=True)
+        return res
+        
+    def report(self, private_message_id:int, reason:str, instance:str=None):
+        """
+        Report a private message
+        
+        Args:
+            private_message_id (int): ID of private message
+            reason (str): Reason for reporting the private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Sent private message response
+        """
+        form = {
+            "private_message_id": private_message_id,
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("createPrivateMessageReport", instance=instance, form=form, auth=True)
+        return res
+        
+    def edit(self, private_message_id:int, content:str, instance:str=None):
+        """
+        Edit a private message
+        
+        Args:
+            private_message_id (int): ID of private message
+            content (str): Contents of private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message response
+        """
+        form = {
+            "private_message_id": private_message_id,
+            "content": content,
+            }
+        res = self._req.lemmyRequest("editPrivateMessage", instance=instance, form=form, auth=True)
+        return res
+        
+    def delete(self, private_message_id:int, instance:str=None):
+        """
+        Delete a private message
+        
+        Args:
+            private_message_id (int): ID of private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message response
+        """
+        form = {
+            "private_message_id": private_message_id,
+            }
+        res = self._req.lemmyRequest("deletePrivateMessage", instance=instance, form=form, auth=True)
+        return res
+        
+    def markAsRead(self, private_message_id:int, instance:str=None):
+        """
+        Marks a private message as read
+        
+        Args:
+            private_message_id (int): ID of private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message response
+        """
+        form={
+            "private_message_id": private_message_id,
+            }
+        res = self._req.lemmyRequest("markPrivateMessageAsRead", instance=instance, form=form, auth=True)
+        return res
+        
+    def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=True, instance:str=None):
+        """
+        Gets list of private message reports
+        
+        Args:
+            page (int): Page number
+            limit (int): Limit for number of reports to get
+            unresolved_only (bool): Get only unresolved posts. Default true gets only unresolved reports. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of private message reports
+        """
+        form = {}
+        optional = {
+            "page": page,
+            "limit": limit,
+            "unresolved_only": unresolved_only,
+            }
+        res = self._req.lemmyRequest("listPrivateMessageReports", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+        """
+        Resolve a private message report
+        
+        Args:
+            report_id (int): Private message report ID
+            resolved (bool): If private message report is reolved. Default true resolves report. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message report resolved response
+        """
+        form = {
+            "report_id"  : report_id ,
+            "resolved"   : resolved  ,
+            }
+        res = self._req.lemmyRequest("resolvePrivateMessageReport", instance=instance, form=form, auth=True)
+        return res
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class PrivateMessage +(_req: Requestor) +
+
+
+
+ +Expand source code + +
class PrivateMessage():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    
+    def list(self, unread_only:bool=None, page:int=None, limit:int=None, instance:str=None):
+        """
+        Get list of private messages 
+        
+        Args:
+            unread_only (bool): Filters private by unread. Optional.
+            page (int): Page number of private messages. Optional.
+            limit (int): Limit for number of private messages. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of private messages
+        """
+        form = {}
+        optional={
+            "unread_only": unread_only,
+            "page": page,
+            "limit": limit,
+            }
+        res = self._req.lemmyRequest("getPrivateMessages", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def create(self, content:str, recipient_id:int, instance:str=None):
+        """
+        Create and send a private message
+        
+        Args:
+            content (str): Contents of private message
+            recipient_id (int): User ID of recipient
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Sent private message response
+        """
+        form = {
+            "content": content,
+            "recipient_id": recipient_id,
+            }
+        res = self._req.lemmyRequest("createPrivateMessage", instance=instance, form=form, auth=True)
+        return res
+        
+    def report(self, private_message_id:int, reason:str, instance:str=None):
+        """
+        Report a private message
+        
+        Args:
+            private_message_id (int): ID of private message
+            reason (str): Reason for reporting the private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Sent private message response
+        """
+        form = {
+            "private_message_id": private_message_id,
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("createPrivateMessageReport", instance=instance, form=form, auth=True)
+        return res
+        
+    def edit(self, private_message_id:int, content:str, instance:str=None):
+        """
+        Edit a private message
+        
+        Args:
+            private_message_id (int): ID of private message
+            content (str): Contents of private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message response
+        """
+        form = {
+            "private_message_id": private_message_id,
+            "content": content,
+            }
+        res = self._req.lemmyRequest("editPrivateMessage", instance=instance, form=form, auth=True)
+        return res
+        
+    def delete(self, private_message_id:int, instance:str=None):
+        """
+        Delete a private message
+        
+        Args:
+            private_message_id (int): ID of private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message response
+        """
+        form = {
+            "private_message_id": private_message_id,
+            }
+        res = self._req.lemmyRequest("deletePrivateMessage", instance=instance, form=form, auth=True)
+        return res
+        
+    def markAsRead(self, private_message_id:int, instance:str=None):
+        """
+        Marks a private message as read
+        
+        Args:
+            private_message_id (int): ID of private message
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message response
+        """
+        form={
+            "private_message_id": private_message_id,
+            }
+        res = self._req.lemmyRequest("markPrivateMessageAsRead", instance=instance, form=form, auth=True)
+        return res
+        
+    def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=True, instance:str=None):
+        """
+        Gets list of private message reports
+        
+        Args:
+            page (int): Page number
+            limit (int): Limit for number of reports to get
+            unresolved_only (bool): Get only unresolved posts. Default true gets only unresolved reports. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of private message reports
+        """
+        form = {}
+        optional = {
+            "page": page,
+            "limit": limit,
+            "unresolved_only": unresolved_only,
+            }
+        res = self._req.lemmyRequest("listPrivateMessageReports", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+        """
+        Resolve a private message report
+        
+        Args:
+            report_id (int): Private message report ID
+            resolved (bool): If private message report is reolved. Default true resolves report. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Private message report resolved response
+        """
+        form = {
+            "report_id"  : report_id ,
+            "resolved"   : resolved  ,
+            }
+        res = self._req.lemmyRequest("resolvePrivateMessageReport", instance=instance, form=form, auth=True)
+        return res
+
+

Methods

+
+
+def create(self, content: str, recipient_id: int, instance: str = None) +
+
+

Create and send a private message

+

Args

+
+
content : str
+
Contents of private message
+
recipient_id : int
+
User ID of recipient
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Sent private message response

+
+ +Expand source code + +
def create(self, content:str, recipient_id:int, instance:str=None):
+    """
+    Create and send a private message
+    
+    Args:
+        content (str): Contents of private message
+        recipient_id (int): User ID of recipient
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Sent private message response
+    """
+    form = {
+        "content": content,
+        "recipient_id": recipient_id,
+        }
+    res = self._req.lemmyRequest("createPrivateMessage", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def delete(self, private_message_id: int, instance: str = None) +
+
+

Delete a private message

+

Args

+
+
private_message_id : int
+
ID of private message
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Private message response

+
+ +Expand source code + +
def delete(self, private_message_id:int, instance:str=None):
+    """
+    Delete a private message
+    
+    Args:
+        private_message_id (int): ID of private message
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Private message response
+    """
+    form = {
+        "private_message_id": private_message_id,
+        }
+    res = self._req.lemmyRequest("deletePrivateMessage", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def edit(self, private_message_id: int, content: str, instance: str = None) +
+
+

Edit a private message

+

Args

+
+
private_message_id : int
+
ID of private message
+
content : str
+
Contents of private message
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Private message response

+
+ +Expand source code + +
def edit(self, private_message_id:int, content:str, instance:str=None):
+    """
+    Edit a private message
+    
+    Args:
+        private_message_id (int): ID of private message
+        content (str): Contents of private message
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Private message response
+    """
+    form = {
+        "private_message_id": private_message_id,
+        "content": content,
+        }
+    res = self._req.lemmyRequest("editPrivateMessage", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def list(self, unread_only: bool = None, page: int = None, limit: int = None, instance: str = None) +
+
+

Get list of private messages

+

Args

+
+
unread_only : bool
+
Filters private by unread. Optional.
+
page : int
+
Page number of private messages. Optional.
+
limit : int
+
Limit for number of private messages. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of private messages

+
+ +Expand source code + +
def list(self, unread_only:bool=None, page:int=None, limit:int=None, instance:str=None):
+    """
+    Get list of private messages 
+    
+    Args:
+        unread_only (bool): Filters private by unread. Optional.
+        page (int): Page number of private messages. Optional.
+        limit (int): Limit for number of private messages. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of private messages
+    """
+    form = {}
+    optional={
+        "unread_only": unread_only,
+        "page": page,
+        "limit": limit,
+        }
+    res = self._req.lemmyRequest("getPrivateMessages", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def listReports(self, page: int = None, limit: int = None, unresolved_only: bool = True, instance: str = None) +
+
+

Gets list of private message reports

+

Args

+
+
page : int
+
Page number
+
limit : int
+
Limit for number of reports to get
+
unresolved_only : bool
+
Get only unresolved posts. Default true gets only unresolved reports. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of private message reports

+
+ +Expand source code + +
def listReports(self, page:int=None, limit:int=None, unresolved_only:bool=True, instance:str=None):
+    """
+    Gets list of private message reports
+    
+    Args:
+        page (int): Page number
+        limit (int): Limit for number of reports to get
+        unresolved_only (bool): Get only unresolved posts. Default true gets only unresolved reports. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of private message reports
+    """
+    form = {}
+    optional = {
+        "page": page,
+        "limit": limit,
+        "unresolved_only": unresolved_only,
+        }
+    res = self._req.lemmyRequest("listPrivateMessageReports", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def markAsRead(self, private_message_id: int, instance: str = None) +
+
+

Marks a private message as read

+

Args

+
+
private_message_id : int
+
ID of private message
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Private message response

+
+ +Expand source code + +
def markAsRead(self, private_message_id:int, instance:str=None):
+    """
+    Marks a private message as read
+    
+    Args:
+        private_message_id (int): ID of private message
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Private message response
+    """
+    form={
+        "private_message_id": private_message_id,
+        }
+    res = self._req.lemmyRequest("markPrivateMessageAsRead", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def report(self, private_message_id: int, reason: str, instance: str = None) +
+
+

Report a private message

+

Args

+
+
private_message_id : int
+
ID of private message
+
reason : str
+
Reason for reporting the private message
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Sent private message response

+
+ +Expand source code + +
def report(self, private_message_id:int, reason:str, instance:str=None):
+    """
+    Report a private message
+    
+    Args:
+        private_message_id (int): ID of private message
+        reason (str): Reason for reporting the private message
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Sent private message response
+    """
+    form = {
+        "private_message_id": private_message_id,
+        "reason": reason,
+        }
+    res = self._req.lemmyRequest("createPrivateMessageReport", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def resolveReport(self, report_id: int, resolved: bool = True, instance: str = None) +
+
+

Resolve a private message report

+

Args

+
+
report_id : int
+
Private message report ID
+
resolved : bool
+
If private message report is reolved. Default true resolves report. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Private message report resolved response

+
+ +Expand source code + +
def resolveReport(self, report_id:int, resolved:bool=True, instance:str=None):
+    """
+    Resolve a private message report
+    
+    Args:
+        report_id (int): Private message report ID
+        resolved (bool): If private message report is reolved. Default true resolves report. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Private message report resolved response
+    """
+    form = {
+        "report_id"  : report_id ,
+        "resolved"   : resolved  ,
+        }
+    res = self._req.lemmyRequest("resolvePrivateMessageReport", instance=instance, form=form, auth=True)
+    return res
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/requestor.html b/docs/v0.1.6/requestor.html new file mode 100644 index 0000000..43ea968 --- /dev/null +++ b/docs/v0.1.6/requestor.html @@ -0,0 +1,749 @@ + + + + + + +jplaw.requestor API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.requestor

+
+
+

Requestor allows HTTP communication.

+
+ +Expand source code + +
"""
+Requestor allows HTTP communication.
+"""
+from enum import Enum
+import requests
+import json
+from typing import Dict, Any, TypeVar
+from jplaw.api_paths import *
+from jplaw.types.http_type import HttpType
+
+T = TypeVar("T")
+
+class Requestor:
+    def __init__(self, instance:str, username:str, password:str, headers: Dict[str, str]):
+        """
+        Make an HTTP requestor
+        
+        Args:
+            instance (str): URL of instance to log in to or use
+            username (str): username or email to log in with
+            password (str): password of user
+            headers (Dict[str,str]): Header data
+        Returns:
+            Requestor object
+        """
+        self.headers = headers
+        self.instance = instance
+        self.auth_token = None
+        if(username and password):
+            self.auth_token = self.login(username=username, password=password, instance=instance)
+            
+    def request(self, type_: HttpType, url: str, form: Dict[str, Any]) -> T:
+        """
+        Make an HTTP request
+        
+        Args:
+            type_ (HttpType): Type of request
+            url (str): full url of endpoint
+            form (Dict[str,Any]): dictionary with data to send
+        Returns:
+            json object of response
+        """
+        if type_ == HttpType.GET:
+            response = requests.get(url, params=form, headers=self.headers)
+        else:
+            headers = {
+                "Content-Type": "application/json",
+                **self.headers,
+            }
+            response = requests.request(type_.value, url, data=json.dumps(form), headers=headers)
+        if response.status_code != 200:
+            raise Exception(response.text)  # Adjust this according to how your API returns errors
+        
+        return response.json()
+    
+    def apiURL(self, path:str, instance:str=None):
+        """
+        Converts API path to full API URL
+        
+        Args:
+            path (str): Path in api (minus version number), starting with "/"
+            instance (str): instance to access. Default None uses logged in instance
+        Returns:
+            URL of api endpoint
+        """
+        url = instance or self.instance
+        return url.rstrip("/") + API_VERSION.rstrip("/") + path
+    
+    def lemmyRequest(self, function: str, instance: str = None, form: Dict[str, Any]={}, optional: Dict[str, Any]={}, auth:bool=True) -> T:
+        """
+        Make an api request specifically to a lemmy instance for a given api function
+        
+        Args:
+            type_ (HttpType): Type of request
+            function (str): API function
+            instance (str): instance to access. Default None uses logged in/default instance
+            form (Dict[str,Any]): dictionary with data to send
+            auth (bool): Whether or not to authenticate. Will use internal auth_token from login if available, otherwise doesn't authenticate
+            
+        Returns:
+            request response
+        """
+        form = self.AddListIfValue(optional=optional, form=form)
+        form = self.fixFormValues(form)
+        
+        #Only authorize if authorization enabled, token is available, and instance is not changed. If instance changed or logged out, disable auth. 
+        if(auth and (self.auth_token is not None) and ((instance is None) or (instance == self.instance))):
+            form["auth"] = self.auth_token
+        return self.request((API_PATH[function]["method"]), self.apiURL(instance=instance, path=(API_PATH[function]["path"])), form)
+    
+    def logout(self):
+        """
+        Logs out of instance
+        """
+        #TODO: send log out 
+        self.auth_token = None
+    
+    def login(self, username, password, instance=None):
+        """
+        Log into instance
+        Args:
+            username: username or email in instance
+            password: password for login
+            instance (str): instance to access. Default None uses logged in/default/constructor instance
+        Returns:
+            Access token
+        """
+        self.instance = instance or self.instance
+        form = { "username_or_email": username, "password": password }
+        res_data = self.lemmyRequest("login", form=form, instance=instance, auth=False)
+        return res_data["jwt"]
+    
+    def boolToStr(self, bool_val:bool):
+        """
+        Convert a boolean value to a lowercase string for request
+        
+        Args:
+            bool_val (bool): boolean value to convert to string
+        
+        Returns:
+            "true" if True, "false" if false, "none" if None.
+        """
+        if(bool_val is None):
+            return "none"
+        return str(bool_val).lower() if isinstance(bool_val, bool) else bool_val
+        
+    def fixFormValues(self, form: Dict[str, Any]):
+        """
+        Fix value types for requests (e.g. bool and Enum types)
+        
+        Args:
+            form (Dict[str, Any]): Dictionary of keys and items in form
+        
+        Returns:
+            Form with fixed values
+        """
+        for key, value in form.items():
+            if(isinstance(value, bool)):
+                form[key] = self.boolToStr(value)
+            if(isinstance(value, Enum)):
+                form[key] = value.value
+        return form
+    
+    def AddIfValue(self, name:str, value: Any, form: Dict[str, Any]):
+        """
+        Adds items to form if not None
+        Args:
+            name (str): Key of item to add
+            value (Any): Value of item to add to form
+            form (Dict[str, Any]): Dictionary to add optional arguments to if not none.
+        Returns:
+            Form with optional item.
+        """
+        if(value is not None):
+            form[name]=value
+        return form
+    
+    def AddListIfValue(self, optional: Dict[str, Any], form: Dict[str, Any]):
+        """
+        Adds items from optional list to form if not None
+        Args:
+            optional (Dict[str, Any]): Dictionary of options with string keys and value.
+            form (Dict[str, Any]): Dictionary to add optional arguments to if not none.
+        Returns:
+            Form with optional items.
+        """
+        if(optional is not None):
+            for key in optional:
+                if(optional[key] is not None):
+                    form[key]=optional[key]
+        return form
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Requestor +(instance: str, username: str, password: str, headers: Dict[str, str]) +
+
+

Make an HTTP requestor

+

Args

+
+
instance : str
+
URL of instance to log in to or use
+
username : str
+
username or email to log in with
+
password : str
+
password of user
+
headers : Dict[str,str]
+
Header data
+
+

Returns

+

Requestor object

+
+ +Expand source code + +
class Requestor:
+    def __init__(self, instance:str, username:str, password:str, headers: Dict[str, str]):
+        """
+        Make an HTTP requestor
+        
+        Args:
+            instance (str): URL of instance to log in to or use
+            username (str): username or email to log in with
+            password (str): password of user
+            headers (Dict[str,str]): Header data
+        Returns:
+            Requestor object
+        """
+        self.headers = headers
+        self.instance = instance
+        self.auth_token = None
+        if(username and password):
+            self.auth_token = self.login(username=username, password=password, instance=instance)
+            
+    def request(self, type_: HttpType, url: str, form: Dict[str, Any]) -> T:
+        """
+        Make an HTTP request
+        
+        Args:
+            type_ (HttpType): Type of request
+            url (str): full url of endpoint
+            form (Dict[str,Any]): dictionary with data to send
+        Returns:
+            json object of response
+        """
+        if type_ == HttpType.GET:
+            response = requests.get(url, params=form, headers=self.headers)
+        else:
+            headers = {
+                "Content-Type": "application/json",
+                **self.headers,
+            }
+            response = requests.request(type_.value, url, data=json.dumps(form), headers=headers)
+        if response.status_code != 200:
+            raise Exception(response.text)  # Adjust this according to how your API returns errors
+        
+        return response.json()
+    
+    def apiURL(self, path:str, instance:str=None):
+        """
+        Converts API path to full API URL
+        
+        Args:
+            path (str): Path in api (minus version number), starting with "/"
+            instance (str): instance to access. Default None uses logged in instance
+        Returns:
+            URL of api endpoint
+        """
+        url = instance or self.instance
+        return url.rstrip("/") + API_VERSION.rstrip("/") + path
+    
+    def lemmyRequest(self, function: str, instance: str = None, form: Dict[str, Any]={}, optional: Dict[str, Any]={}, auth:bool=True) -> T:
+        """
+        Make an api request specifically to a lemmy instance for a given api function
+        
+        Args:
+            type_ (HttpType): Type of request
+            function (str): API function
+            instance (str): instance to access. Default None uses logged in/default instance
+            form (Dict[str,Any]): dictionary with data to send
+            auth (bool): Whether or not to authenticate. Will use internal auth_token from login if available, otherwise doesn't authenticate
+            
+        Returns:
+            request response
+        """
+        form = self.AddListIfValue(optional=optional, form=form)
+        form = self.fixFormValues(form)
+        
+        #Only authorize if authorization enabled, token is available, and instance is not changed. If instance changed or logged out, disable auth. 
+        if(auth and (self.auth_token is not None) and ((instance is None) or (instance == self.instance))):
+            form["auth"] = self.auth_token
+        return self.request((API_PATH[function]["method"]), self.apiURL(instance=instance, path=(API_PATH[function]["path"])), form)
+    
+    def logout(self):
+        """
+        Logs out of instance
+        """
+        #TODO: send log out 
+        self.auth_token = None
+    
+    def login(self, username, password, instance=None):
+        """
+        Log into instance
+        Args:
+            username: username or email in instance
+            password: password for login
+            instance (str): instance to access. Default None uses logged in/default/constructor instance
+        Returns:
+            Access token
+        """
+        self.instance = instance or self.instance
+        form = { "username_or_email": username, "password": password }
+        res_data = self.lemmyRequest("login", form=form, instance=instance, auth=False)
+        return res_data["jwt"]
+    
+    def boolToStr(self, bool_val:bool):
+        """
+        Convert a boolean value to a lowercase string for request
+        
+        Args:
+            bool_val (bool): boolean value to convert to string
+        
+        Returns:
+            "true" if True, "false" if false, "none" if None.
+        """
+        if(bool_val is None):
+            return "none"
+        return str(bool_val).lower() if isinstance(bool_val, bool) else bool_val
+        
+    def fixFormValues(self, form: Dict[str, Any]):
+        """
+        Fix value types for requests (e.g. bool and Enum types)
+        
+        Args:
+            form (Dict[str, Any]): Dictionary of keys and items in form
+        
+        Returns:
+            Form with fixed values
+        """
+        for key, value in form.items():
+            if(isinstance(value, bool)):
+                form[key] = self.boolToStr(value)
+            if(isinstance(value, Enum)):
+                form[key] = value.value
+        return form
+    
+    def AddIfValue(self, name:str, value: Any, form: Dict[str, Any]):
+        """
+        Adds items to form if not None
+        Args:
+            name (str): Key of item to add
+            value (Any): Value of item to add to form
+            form (Dict[str, Any]): Dictionary to add optional arguments to if not none.
+        Returns:
+            Form with optional item.
+        """
+        if(value is not None):
+            form[name]=value
+        return form
+    
+    def AddListIfValue(self, optional: Dict[str, Any], form: Dict[str, Any]):
+        """
+        Adds items from optional list to form if not None
+        Args:
+            optional (Dict[str, Any]): Dictionary of options with string keys and value.
+            form (Dict[str, Any]): Dictionary to add optional arguments to if not none.
+        Returns:
+            Form with optional items.
+        """
+        if(optional is not None):
+            for key in optional:
+                if(optional[key] is not None):
+                    form[key]=optional[key]
+        return form
+
+

Methods

+
+
+def AddIfValue(self, name: str, value: Any, form: Dict[str, Any]) +
+
+

Adds items to form if not None

+

Args

+
+
name : str
+
Key of item to add
+
value : Any
+
Value of item to add to form
+
form : Dict[str, Any]
+
Dictionary to add optional arguments to if not none.
+
+

Returns

+

Form with optional item.

+
+ +Expand source code + +
def AddIfValue(self, name:str, value: Any, form: Dict[str, Any]):
+    """
+    Adds items to form if not None
+    Args:
+        name (str): Key of item to add
+        value (Any): Value of item to add to form
+        form (Dict[str, Any]): Dictionary to add optional arguments to if not none.
+    Returns:
+        Form with optional item.
+    """
+    if(value is not None):
+        form[name]=value
+    return form
+
+
+
+def AddListIfValue(self, optional: Dict[str, Any], form: Dict[str, Any]) +
+
+

Adds items from optional list to form if not None

+

Args

+
+
optional : Dict[str, Any]
+
Dictionary of options with string keys and value.
+
form : Dict[str, Any]
+
Dictionary to add optional arguments to if not none.
+
+

Returns

+

Form with optional items.

+
+ +Expand source code + +
def AddListIfValue(self, optional: Dict[str, Any], form: Dict[str, Any]):
+    """
+    Adds items from optional list to form if not None
+    Args:
+        optional (Dict[str, Any]): Dictionary of options with string keys and value.
+        form (Dict[str, Any]): Dictionary to add optional arguments to if not none.
+    Returns:
+        Form with optional items.
+    """
+    if(optional is not None):
+        for key in optional:
+            if(optional[key] is not None):
+                form[key]=optional[key]
+    return form
+
+
+
+def apiURL(self, path: str, instance: str = None) +
+
+

Converts API path to full API URL

+

Args

+
+
path : str
+
Path in api (minus version number), starting with "/"
+
instance : str
+
instance to access. Default None uses logged in instance
+
+

Returns

+

URL of api endpoint

+
+ +Expand source code + +
def apiURL(self, path:str, instance:str=None):
+    """
+    Converts API path to full API URL
+    
+    Args:
+        path (str): Path in api (minus version number), starting with "/"
+        instance (str): instance to access. Default None uses logged in instance
+    Returns:
+        URL of api endpoint
+    """
+    url = instance or self.instance
+    return url.rstrip("/") + API_VERSION.rstrip("/") + path
+
+
+
+def boolToStr(self, bool_val: bool) +
+
+

Convert a boolean value to a lowercase string for request

+

Args

+
+
bool_val : bool
+
boolean value to convert to string
+
+

Returns

+

"true" if True, "false" if false, "none" if None.

+
+ +Expand source code + +
def boolToStr(self, bool_val:bool):
+    """
+    Convert a boolean value to a lowercase string for request
+    
+    Args:
+        bool_val (bool): boolean value to convert to string
+    
+    Returns:
+        "true" if True, "false" if false, "none" if None.
+    """
+    if(bool_val is None):
+        return "none"
+    return str(bool_val).lower() if isinstance(bool_val, bool) else bool_val
+
+
+
+def fixFormValues(self, form: Dict[str, Any]) +
+
+

Fix value types for requests (e.g. bool and Enum types)

+

Args

+
+
form : Dict[str, Any]
+
Dictionary of keys and items in form
+
+

Returns

+

Form with fixed values

+
+ +Expand source code + +
def fixFormValues(self, form: Dict[str, Any]):
+    """
+    Fix value types for requests (e.g. bool and Enum types)
+    
+    Args:
+        form (Dict[str, Any]): Dictionary of keys and items in form
+    
+    Returns:
+        Form with fixed values
+    """
+    for key, value in form.items():
+        if(isinstance(value, bool)):
+            form[key] = self.boolToStr(value)
+        if(isinstance(value, Enum)):
+            form[key] = value.value
+    return form
+
+
+
+def lemmyRequest(self, function: str, instance: str = None, form: Dict[str, Any] = {}, optional: Dict[str, Any] = {}, auth: bool = True) ‑> ~T +
+
+

Make an api request specifically to a lemmy instance for a given api function

+

Args

+
+
type_ : HttpType
+
Type of request
+
function : str
+
API function
+
instance : str
+
instance to access. Default None uses logged in/default instance
+
form : Dict[str,Any]
+
dictionary with data to send
+
auth : bool
+
Whether or not to authenticate. Will use internal auth_token from login if available, otherwise doesn't authenticate
+
+

Returns

+

request response

+
+ +Expand source code + +
def lemmyRequest(self, function: str, instance: str = None, form: Dict[str, Any]={}, optional: Dict[str, Any]={}, auth:bool=True) -> T:
+    """
+    Make an api request specifically to a lemmy instance for a given api function
+    
+    Args:
+        type_ (HttpType): Type of request
+        function (str): API function
+        instance (str): instance to access. Default None uses logged in/default instance
+        form (Dict[str,Any]): dictionary with data to send
+        auth (bool): Whether or not to authenticate. Will use internal auth_token from login if available, otherwise doesn't authenticate
+        
+    Returns:
+        request response
+    """
+    form = self.AddListIfValue(optional=optional, form=form)
+    form = self.fixFormValues(form)
+    
+    #Only authorize if authorization enabled, token is available, and instance is not changed. If instance changed or logged out, disable auth. 
+    if(auth and (self.auth_token is not None) and ((instance is None) or (instance == self.instance))):
+        form["auth"] = self.auth_token
+    return self.request((API_PATH[function]["method"]), self.apiURL(instance=instance, path=(API_PATH[function]["path"])), form)
+
+
+
+def login(self, username, password, instance=None) +
+
+

Log into instance

+

Args

+
+
username
+
username or email in instance
+
password
+
password for login
+
instance : str
+
instance to access. Default None uses logged in/default/constructor instance
+
+

Returns

+

Access token

+
+ +Expand source code + +
def login(self, username, password, instance=None):
+    """
+    Log into instance
+    Args:
+        username: username or email in instance
+        password: password for login
+        instance (str): instance to access. Default None uses logged in/default/constructor instance
+    Returns:
+        Access token
+    """
+    self.instance = instance or self.instance
+    form = { "username_or_email": username, "password": password }
+    res_data = self.lemmyRequest("login", form=form, instance=instance, auth=False)
+    return res_data["jwt"]
+
+
+
+def logout(self) +
+
+

Logs out of instance

+
+ +Expand source code + +
def logout(self):
+    """
+    Logs out of instance
+    """
+    #TODO: send log out 
+    self.auth_token = None
+
+
+
+def request(self, type_: HttpType, url: str, form: Dict[str, Any]) ‑> ~T +
+
+

Make an HTTP request

+

Args

+
+
type_ : HttpType
+
Type of request
+
url : str
+
full url of endpoint
+
form : Dict[str,Any]
+
dictionary with data to send
+
+

Returns

+

json object of response

+
+ +Expand source code + +
def request(self, type_: HttpType, url: str, form: Dict[str, Any]) -> T:
+    """
+    Make an HTTP request
+    
+    Args:
+        type_ (HttpType): Type of request
+        url (str): full url of endpoint
+        form (Dict[str,Any]): dictionary with data to send
+    Returns:
+        json object of response
+    """
+    if type_ == HttpType.GET:
+        response = requests.get(url, params=form, headers=self.headers)
+    else:
+        headers = {
+            "Content-Type": "application/json",
+            **self.headers,
+        }
+        response = requests.request(type_.value, url, data=json.dumps(form), headers=headers)
+    if response.status_code != 200:
+        raise Exception(response.text)  # Adjust this according to how your API returns errors
+    
+    return response.json()
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/site.html b/docs/v0.1.6/site.html new file mode 100644 index 0000000..fe945a0 --- /dev/null +++ b/docs/v0.1.6/site.html @@ -0,0 +1,2154 @@ + + + + + + +jplaw.site API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.site

+
+
+

Site class. Designed to allow Lemmy.Site functions.

+
+ +Expand source code + +
"""
+Site class. Designed to allow Lemmy.Site functions.
+"""
+from .requestor import Requestor
+from .api_paths import *
+from typing import List
+from .types.modlog_action_type import ModlogActionType
+from .types.listing_type import ListingType
+from .types.registration_mode import RegistrationMode
+
+class Site():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    
+    def getSite(self, instance:str=None, auth:bool=True):
+        """
+        Get the site details
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether or not to authenticate. Optional. Defaults to True.
+            
+        Returns:
+            Instance details response
+        """
+        form = {}
+        res = self._req.lemmyRequest("getSite", instance=instance, form=form, auth=auth)
+        return res
+    
+    def create(self,    
+        name: str,
+        sidebar: str=None,
+        description: str=None,
+        icon: str=None,
+        banner: str=None,
+        enable_downvotes: bool=None,
+        enable_nsfw: bool=None,
+        community_creation_admin_only: bool=None,
+        require_email_verification: bool=None,
+        application_question: str=None,
+        private_instance: bool=None,
+        default_theme: str=None,
+        default_post_listing_type: ListingType=None,
+        legal_information: str=None,
+        application_email_admins: bool=None,
+        hide_modlog_mod_names: bool=None,
+        discussion_languages: List[int]=None,
+        slur_filter_regex: str=None,
+        actor_name_max_length: int=None,
+        rate_limit_message: int=None,
+        rate_limit_message_per_second: int=None,
+        rate_limit_post: int=None,
+        rate_limit_post_per_second: int=None,
+        rate_limit_register: int=None,
+        rate_limit_register_per_second: int=None,
+        rate_limit_image: int=None,
+        rate_limit_image_per_second: int=None,
+        rate_limit_comment: int=None,
+        rate_limit_comment_per_second: int=None,
+        rate_limit_search: int=None,
+        rate_limit_search_per_second: int=None,
+        federation_enabled: bool=None,
+        federation_debug: bool=None,
+        captcha_enabled: bool=None,
+        captcha_difficulty: str=None,
+        allowed_instances: List[str]=None,
+        blocked_instances: List[str]=None,
+        taglines: List[str]=None,
+        registration_mode: RegistrationMode=None,
+        instance:str=None):
+        """
+        Create the lemmy instance
+        
+        Args:
+            name (str): Name of the website                 
+            sidebar (str): Text of the sidebar of the website. Optional.
+            description (str): Description of the website. Optional.
+            icon (str): URL to icon for webstite. Optional.
+            banner (str): URL for banner of website. Optional.
+            enable_downvotes (bool): If true, downvotes are enabled. Optional.
+            enable_nsfw (bool): If true, NSFW content is allowed. Optional.
+            community_creation_admin_only (bool): If true, only adminstrators can create communities. Optional.
+            require_email_verification (bool): If true, email verification is required. Optional.
+            application_question (str): Question shown on application. Optional.
+            private_instance (bool): If true, instance is private. Optional.
+            default_theme (str): Default theme for the site. Optional.
+            default_post_listing_type (ListingType): Default listing type for posts. Optional.
+            legal_information (str): Legal information for the site. Optional.
+            application_email_admins (bool): If applications send an email to the admins. Optional.
+            hide_modlog_mod_names (bool): If true, moderator names are hidden in the modlog. Optional.
+            discussion_languages (List[int]): List of discussion languages in the instance. Optional.
+            slur_filter_regex (str): Regex to match for slurs or to block certain text. 
+            actor_name_max_length (int): Maximum name length for actors ???. Optional. 
+            rate_limit_message (int): Message rate limit. Optional.
+            rate_limit_message_per_second (int): Message per second rate limit. Optional.
+            rate_limit_post (int): Post rate limit. Optional.
+            rate_limit_post_per_second (int): Post per second rate limit. Optional.
+            rate_limit_register (int): Registration rate limit. Optional.
+            rate_limit_register_per_second (int): Registrations per second rate limit. Optional.
+            rate_limit_image (int): Image rate limit. Optional.
+            rate_limit_image_per_second (int): Image rate limit per second. Optional.
+            rate_limit_comment (int): Comment rate limit. Optional.
+            rate_limit_comment_per_second (int): Comment per second rate limit. Optional.
+            rate_limit_search (int): Search rate limit. Optional.
+            rate_limit_search_per_second (int): Search per second rate limit. Optional.
+            federation_enabled (bool): If federation is enabled. Optional.
+            federation_debug (bool): If federation debugging is enabled. Optional.
+            captcha_enabled (bool): If captcha is enabled. Optional.
+            captcha_difficulty (str): Difficulty of the captcha. Text: easy, medium or hard.
+            allowed_instances (List[str]): List of allowed instances. Optional.
+            blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+            taglines (List[str]: List of taglines shown at top of front page). Optional.
+            registration_mode (RegistrationMode): Mode of registration (Closed/Application/Open). Optional.
+            reports_email_admins (bool): if reporting emails the admins. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Create site response
+        """
+        form = {
+            "name"                              : name                              ,
+            }
+        optional = {
+            "sidebar"                           : sidebar                           ,
+            "description"                       : description                       ,
+            "icon"                              : icon                              ,
+            "banner"                            : banner                            ,
+            "enable_downvotes"                  : enable_downvotes                  ,
+            "enable_nsfw"                       : enable_nsfw                       ,
+            "community_creation_admin_only"     : community_creation_admin_only     ,
+            "require_email_verification"        : require_email_verification        ,
+            "application_question"              : application_question              ,
+            "private_instance"                  : private_instance                  ,
+            "default_theme"                     : default_theme                     ,
+            "default_post_listing_type"         : default_post_listing_type         ,
+            "legal_information"                 : legal_information                 ,
+            "application_email_admins"          : application_email_admins          ,
+            "hide_modlog_mod_names"             : hide_modlog_mod_names             ,
+            "discussion_languages"              : discussion_languages              ,
+            "slur_filter_regex"                 : slur_filter_regex                 ,
+            "actor_name_max_length"             : actor_name_max_length             ,
+            "rate_limit_message"                : rate_limit_message                ,
+            "rate_limit_message_per_second"     : rate_limit_message_per_second     ,
+            "rate_limit_post"                   : rate_limit_post                   ,
+            "rate_limit_post_per_second"        : rate_limit_post_per_second        ,
+            "rate_limit_register"               : rate_limit_register               ,
+            "rate_limit_register_per_second"    : rate_limit_register_per_second    ,
+            "rate_limit_image"                  : rate_limit_image                  ,
+            "rate_limit_image_per_second"       : rate_limit_image_per_second       ,
+            "rate_limit_comment"                : rate_limit_comment                ,
+            "rate_limit_comment_per_second"     : rate_limit_comment_per_second     ,
+            "rate_limit_search"                 : rate_limit_search                 ,
+            "rate_limit_search_per_second"      : rate_limit_search_per_second      ,
+            "federation_enabled"                : federation_enabled                ,
+            "federation_debug"                  : federation_debug                  ,
+            "captcha_enabled"                   : captcha_enabled                   ,
+            "captcha_difficulty"                : captcha_difficulty                ,
+            "allowed_instances"                 : allowed_instances                 ,
+            "blocked_instances"                 : blocked_instances                 ,
+            "taglines"                          : taglines                          ,
+            "registration_mode"                 : registration_mode                 ,
+            }
+        res = self._req.lemmyRequest("createSite", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def edit(self,         
+        name: str=None,
+        sidebar: str=None,
+        description: str=None,
+        icon: str=None,
+        banner: str=None,
+        enable_downvotes: bool=None,
+        enable_nsfw: bool=None,
+        community_creation_admin_only: bool=None,
+        require_email_verification: bool=None,
+        application_question: str=None,
+        private_instance: bool=None,
+        default_theme: str=None,
+        default_post_listing_type: ListingType=None,
+        legal_information: str=None,
+        application_email_admins: bool=None,
+        hide_modlog_mod_names: bool=None,
+        discussion_languages: List[int]=None,
+        slur_filter_regex: str=None,
+        actor_name_max_length: int=None,
+        rate_limit_message: int=None,
+        rate_limit_message_per_second: int=None,
+        rate_limit_post: int=None,
+        rate_limit_post_per_second: int=None,
+        rate_limit_register: int=None,
+        rate_limit_register_per_second: int=None,
+        rate_limit_image: int=None,
+        rate_limit_image_per_second: int=None,
+        rate_limit_comment: int=None,
+        rate_limit_comment_per_second: int=None,
+        rate_limit_search: int=None,
+        rate_limit_search_per_second: int=None,
+        federation_enabled: bool=None,
+        federation_debug: bool=None,
+        captcha_enabled: bool=None,
+        captcha_difficulty: str=None,
+        allowed_instances: List[str]=None,
+        blocked_instances: List[str]=None,
+        taglines: List[str]=None,
+        registration_mode: RegistrationMode=None,
+        reports_email_admins:bool=None,
+        instance:str=None):
+        """
+        Edit the site details. Optional arguments can be excluded to leave them as is.
+        
+        Args:
+            name (str): Name of the website. Optional            
+            sidebar (str): Text of the sidebar of the website. Optional.
+            description (str): Description of the website. Optional.
+            icon (str): URL to icon for webstite. Optional.
+            banner (str): URL for banner of website. Optional.
+            enable_downvotes (bool): If true, downvotes are enabled. Optional.
+            enable_nsfw (bool): If true, NSFW content is allowed. Optional.
+            community_creation_admin_only (bool): If true, only adminstrators can create communities. Optional.
+            require_email_verification (bool): If true, email verification is required. Optional.
+            application_question (str): Question shown on application. Optional.
+            private_instance (bool): If true, instance is private. Optional.
+            default_theme (str): Default theme for the site. Optional.
+            default_post_listing_type (ListingType): Default listing type for posts. Optional.
+            legal_information (str): Legal information for the site. Optional.
+            application_email_admins (bool): If applications send an email to the admins. Optional.
+            hide_modlog_mod_names (bool): If true, moderator names are hidden in the modlog. Optional.
+            discussion_languages (List[int]): List of discussion languages in the instance. Optional.
+            slur_filter_regex (str): Regex to match for slurs or to block certain text. 
+            actor_name_max_length (int): Maximum name length for actors ???. Optional. 
+            rate_limit_message (int): Message rate limit. Optional.
+            rate_limit_message_per_second (int): Message per second rate limit. Optional.
+            rate_limit_post (int): Post rate limit. Optional.
+            rate_limit_post_per_second (int): Post per second rate limit. Optional.
+            rate_limit_register (int): Registration rate limit. Optional.
+            rate_limit_register_per_second (int): Registrations per second rate limit. Optional.
+            rate_limit_image (int): Image rate limit. Optional.
+            rate_limit_image_per_second (int): Image rate limit per second. Optional.
+            rate_limit_comment (int): Comment rate limit. Optional.
+            rate_limit_comment_per_second (int): Comment per second rate limit. Optional.
+            rate_limit_search (int): Search rate limit. Optional.
+            rate_limit_search_per_second (int): Search per second rate limit. Optional.
+            federation_enabled (bool): If federation is enabled. Optional.
+            federation_debug (bool): If federation debugging is enabled. Optional.
+            captcha_enabled (bool): If captcha is enabled. Optional.
+            captcha_difficulty (str): Difficulty of the captcha. Text: easy, medium or hard.
+            allowed_instances (List[str]): List of allowed instances. Optional.
+            blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+            taglines (List[str]: List of taglines shown at top of front page). Optional.
+            registration_mode (RegistrationMode): Mode of registration (Closed/Application/Open). Optional.
+            reports_email_admins (bool): if reporting emails the admins. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Edit site response
+        """
+        form = {}
+        optional = {
+            "name"                              : name                              ,
+            "sidebar"                           : sidebar                           ,
+            "description"                       : description                       ,
+            "icon"                              : icon                              ,
+            "banner"                            : banner                            ,
+            "enable_downvotes"                  : enable_downvotes                  ,
+            "enable_nsfw"                       : enable_nsfw                       ,
+            "community_creation_admin_only"     : community_creation_admin_only     ,
+            "require_email_verification"        : require_email_verification        ,
+            "application_question"              : application_question              ,
+            "private_instance"                  : private_instance                  ,
+            "default_theme"                     : default_theme                     ,
+            "default_post_listing_type"         : default_post_listing_type         ,
+            "legal_information"                 : legal_information                 ,
+            "application_email_admins"          : application_email_admins          ,
+            "hide_modlog_mod_names"             : hide_modlog_mod_names             ,
+            "discussion_languages"              : discussion_languages              ,
+            "slur_filter_regex"                 : slur_filter_regex                 ,
+            "actor_name_max_length"             : actor_name_max_length             ,
+            "rate_limit_message"                : rate_limit_message                ,
+            "rate_limit_message_per_second"     : rate_limit_message_per_second     ,
+            "rate_limit_post"                   : rate_limit_post                   ,
+            "rate_limit_post_per_second"        : rate_limit_post_per_second        ,
+            "rate_limit_register"               : rate_limit_register               ,
+            "rate_limit_register_per_second"    : rate_limit_register_per_second    ,
+            "rate_limit_image"                  : rate_limit_image                  ,
+            "rate_limit_image_per_second"       : rate_limit_image_per_second       ,
+            "rate_limit_comment"                : rate_limit_comment                ,
+            "rate_limit_comment_per_second"     : rate_limit_comment_per_second     ,
+            "rate_limit_search"                 : rate_limit_search                 ,
+            "rate_limit_search_per_second"      : rate_limit_search_per_second      ,
+            "federation_enabled"                : federation_enabled                ,
+            "federation_debug"                  : federation_debug                  ,
+            "captcha_enabled"                   : captcha_enabled                   ,
+            "captcha_difficulty"                : captcha_difficulty                ,
+            "allowed_instances"                 : allowed_instances                 ,
+            "blocked_instances"                 : blocked_instances                 ,
+            "taglines"                          : taglines                          ,
+            "registration_mode"                 : registration_mode                 ,
+            "reports_email_admins"              : reports_email_admins              ,
+            }
+        res = self._req.lemmyRequest("editSite", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def getFederatedInstances(self, instance:str=None, auth:bool=True):
+        """
+        Get the list of federated instances from the site
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether or not to use authentication. Optional. Defaults to True.
+            
+        Returns:
+            Federated instances response
+        """
+        res = self._req.lemmyRequest("getFederatedInstances", instance=instance, auth=auth)
+        return res
+    
+    def addAdmin(self, person_id:int, added:bool=True, instance:str=None):
+        """
+        Add an administrator to the site
+        
+        Args:
+            person_id (int): ID of user to add as administrator
+            added (bool): If person is added as an administrator to the site. Optional. Defaults to True.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Administrator added response
+        """
+        form={
+            "person_id": person_id,
+            "added": added
+            }
+        res = self._req.lemmyRequest("addAdmin", instance=instance, form=form, auth=True)
+        return res
+        
+    def getUnreadRegistrationApplicationCount(self, instance:str=None):
+        """
+        Get the number of unread registration applications
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Unread registration application count response
+        """
+        form={}
+        res = self._req.lemmyRequest("getUnreadRegistrationApplicationCount", instance=instance, form=form, auth=True)
+        return res
+        
+    def listRegistrationApplications(self, unread_only:bool=None, page:int=None, limit:str=None, instance:str=None):
+        """
+        Get a list of registration applications
+        
+        Args:
+            unread_only (bool): Get only unread applications. Optional.
+            page (int): Page of applications to get. Optional.
+            limit (int): Limit for number of applications to get. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of registration applications 
+        """
+        form={}
+        optional={
+            "page": page,
+            "limit": limit,
+            "unread_only": unread_only
+            }
+        res = self._req.lemmyRequest("listRegistrationApplications", instance=instance, form=form, auth=True)
+        return res
+        
+    def approveRegistrationApplication(self, application_id:int, approve:bool=True, deny_reason:str=None, instance:str=None):
+        """
+        Approve a registration application
+        
+        Args:
+            application_id (int): ID of the application
+            approve (bool): If registration application has been approved. Optional. Defaults to True
+            dent_reason (str): Reason for denying the application, if denied. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Approved registration response
+        """
+        form={
+            "application_id": application_id,
+            "approve": approve,
+            }
+        optional={
+            "deny_reason": deny_reason
+            }
+        res = self._req.lemmyRequest("approveRegistrationApplication", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def getModlog(self, mod_person_id:int=None, community_id:int=None, page:int=None, limit:int=None, type_:ModlogActionType=None, other_person_id:int=None, instance:str=None):
+        """
+        Get the moderation log of the site
+        
+        Args:
+            mod_person_id (int): Filter by moderator id. Optional
+            community_id (int): Filter by community id. Optional
+            page (int): Page number to view. Optional
+            limit (int): Limit for number of results to get. Optional
+            type_ (ModlogActionType): Filter by type of moderator action. Optional
+            other_person_id (int): ID of the user who made the comment, post or community. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Moderator log response
+        """
+        form={}
+        optional={
+            "mod_person_id": mod_person_id,
+            "community_id": community_id,
+            "page": page,
+            "limit": limit,
+            "type_": type_,
+            "other_person_id": other_person_id,
+            }
+        res = self._req.lemmyRequest("getModlog", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def purgeComment(self, comment_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a comment from the site
+        
+        Args:
+            comment_id (int): ID of the comment to purge
+            reason (str): Reason for purging the comment. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged comment response
+        """
+        form={
+            "comment_id": comment_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgeComment", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def purgeCommunity(self, community_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a community from the site
+        
+        Args:
+            community_id (int): ID of the user to purge
+            reason (str): Reason for purging the community. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged community response
+        """
+        form={
+            "community_id": community_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgeCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def purgePost(self, post_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a post from the site
+        
+        Args:
+            post_id (int): ID of the post to purge
+            reason (str): Reason for purging the post. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged post response
+        """
+        form={
+            "post_id": post_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgePost", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def purgePerson(self, person_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a person from the site
+        
+        Args:
+            person_id (int): ID of the user to purge
+            reason (str): Reason for purging the person. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged person response
+        """
+        form={
+            "person_id": person_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgePerson", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def resolveObject(self, obj, instance:str=None):
+        """
+        Resolves object from another instance
+        
+        Args:
+            obj: Object to resolve from the remote instance
+            instance (str): URL of local instance to request the object from
+            
+        Returns:
+            Federated object
+        """
+        form={
+            "q": obj
+        }
+        res = self._req.lemmyRequest("resolveObject", instance=instance, form=form)
+        return res
+        
+    def search(self, term:str, instance:str=None):
+        """
+        Search for term
+        
+        Args:
+            term (str): Object to resolve from the remote instance
+            instance (str): URL of local instance. Default None uses logged in instance
+            
+        Returns:
+            Search results
+        """
+        form={
+            "q": term
+        }
+        res = self._req.request("search", instance=instance, form=form)
+        return res
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Site +(_req: Requestor) +
+
+
+
+ +Expand source code + +
class Site():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    
+    def getSite(self, instance:str=None, auth:bool=True):
+        """
+        Get the site details
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether or not to authenticate. Optional. Defaults to True.
+            
+        Returns:
+            Instance details response
+        """
+        form = {}
+        res = self._req.lemmyRequest("getSite", instance=instance, form=form, auth=auth)
+        return res
+    
+    def create(self,    
+        name: str,
+        sidebar: str=None,
+        description: str=None,
+        icon: str=None,
+        banner: str=None,
+        enable_downvotes: bool=None,
+        enable_nsfw: bool=None,
+        community_creation_admin_only: bool=None,
+        require_email_verification: bool=None,
+        application_question: str=None,
+        private_instance: bool=None,
+        default_theme: str=None,
+        default_post_listing_type: ListingType=None,
+        legal_information: str=None,
+        application_email_admins: bool=None,
+        hide_modlog_mod_names: bool=None,
+        discussion_languages: List[int]=None,
+        slur_filter_regex: str=None,
+        actor_name_max_length: int=None,
+        rate_limit_message: int=None,
+        rate_limit_message_per_second: int=None,
+        rate_limit_post: int=None,
+        rate_limit_post_per_second: int=None,
+        rate_limit_register: int=None,
+        rate_limit_register_per_second: int=None,
+        rate_limit_image: int=None,
+        rate_limit_image_per_second: int=None,
+        rate_limit_comment: int=None,
+        rate_limit_comment_per_second: int=None,
+        rate_limit_search: int=None,
+        rate_limit_search_per_second: int=None,
+        federation_enabled: bool=None,
+        federation_debug: bool=None,
+        captcha_enabled: bool=None,
+        captcha_difficulty: str=None,
+        allowed_instances: List[str]=None,
+        blocked_instances: List[str]=None,
+        taglines: List[str]=None,
+        registration_mode: RegistrationMode=None,
+        instance:str=None):
+        """
+        Create the lemmy instance
+        
+        Args:
+            name (str): Name of the website                 
+            sidebar (str): Text of the sidebar of the website. Optional.
+            description (str): Description of the website. Optional.
+            icon (str): URL to icon for webstite. Optional.
+            banner (str): URL for banner of website. Optional.
+            enable_downvotes (bool): If true, downvotes are enabled. Optional.
+            enable_nsfw (bool): If true, NSFW content is allowed. Optional.
+            community_creation_admin_only (bool): If true, only adminstrators can create communities. Optional.
+            require_email_verification (bool): If true, email verification is required. Optional.
+            application_question (str): Question shown on application. Optional.
+            private_instance (bool): If true, instance is private. Optional.
+            default_theme (str): Default theme for the site. Optional.
+            default_post_listing_type (ListingType): Default listing type for posts. Optional.
+            legal_information (str): Legal information for the site. Optional.
+            application_email_admins (bool): If applications send an email to the admins. Optional.
+            hide_modlog_mod_names (bool): If true, moderator names are hidden in the modlog. Optional.
+            discussion_languages (List[int]): List of discussion languages in the instance. Optional.
+            slur_filter_regex (str): Regex to match for slurs or to block certain text. 
+            actor_name_max_length (int): Maximum name length for actors ???. Optional. 
+            rate_limit_message (int): Message rate limit. Optional.
+            rate_limit_message_per_second (int): Message per second rate limit. Optional.
+            rate_limit_post (int): Post rate limit. Optional.
+            rate_limit_post_per_second (int): Post per second rate limit. Optional.
+            rate_limit_register (int): Registration rate limit. Optional.
+            rate_limit_register_per_second (int): Registrations per second rate limit. Optional.
+            rate_limit_image (int): Image rate limit. Optional.
+            rate_limit_image_per_second (int): Image rate limit per second. Optional.
+            rate_limit_comment (int): Comment rate limit. Optional.
+            rate_limit_comment_per_second (int): Comment per second rate limit. Optional.
+            rate_limit_search (int): Search rate limit. Optional.
+            rate_limit_search_per_second (int): Search per second rate limit. Optional.
+            federation_enabled (bool): If federation is enabled. Optional.
+            federation_debug (bool): If federation debugging is enabled. Optional.
+            captcha_enabled (bool): If captcha is enabled. Optional.
+            captcha_difficulty (str): Difficulty of the captcha. Text: easy, medium or hard.
+            allowed_instances (List[str]): List of allowed instances. Optional.
+            blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+            taglines (List[str]: List of taglines shown at top of front page). Optional.
+            registration_mode (RegistrationMode): Mode of registration (Closed/Application/Open). Optional.
+            reports_email_admins (bool): if reporting emails the admins. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Create site response
+        """
+        form = {
+            "name"                              : name                              ,
+            }
+        optional = {
+            "sidebar"                           : sidebar                           ,
+            "description"                       : description                       ,
+            "icon"                              : icon                              ,
+            "banner"                            : banner                            ,
+            "enable_downvotes"                  : enable_downvotes                  ,
+            "enable_nsfw"                       : enable_nsfw                       ,
+            "community_creation_admin_only"     : community_creation_admin_only     ,
+            "require_email_verification"        : require_email_verification        ,
+            "application_question"              : application_question              ,
+            "private_instance"                  : private_instance                  ,
+            "default_theme"                     : default_theme                     ,
+            "default_post_listing_type"         : default_post_listing_type         ,
+            "legal_information"                 : legal_information                 ,
+            "application_email_admins"          : application_email_admins          ,
+            "hide_modlog_mod_names"             : hide_modlog_mod_names             ,
+            "discussion_languages"              : discussion_languages              ,
+            "slur_filter_regex"                 : slur_filter_regex                 ,
+            "actor_name_max_length"             : actor_name_max_length             ,
+            "rate_limit_message"                : rate_limit_message                ,
+            "rate_limit_message_per_second"     : rate_limit_message_per_second     ,
+            "rate_limit_post"                   : rate_limit_post                   ,
+            "rate_limit_post_per_second"        : rate_limit_post_per_second        ,
+            "rate_limit_register"               : rate_limit_register               ,
+            "rate_limit_register_per_second"    : rate_limit_register_per_second    ,
+            "rate_limit_image"                  : rate_limit_image                  ,
+            "rate_limit_image_per_second"       : rate_limit_image_per_second       ,
+            "rate_limit_comment"                : rate_limit_comment                ,
+            "rate_limit_comment_per_second"     : rate_limit_comment_per_second     ,
+            "rate_limit_search"                 : rate_limit_search                 ,
+            "rate_limit_search_per_second"      : rate_limit_search_per_second      ,
+            "federation_enabled"                : federation_enabled                ,
+            "federation_debug"                  : federation_debug                  ,
+            "captcha_enabled"                   : captcha_enabled                   ,
+            "captcha_difficulty"                : captcha_difficulty                ,
+            "allowed_instances"                 : allowed_instances                 ,
+            "blocked_instances"                 : blocked_instances                 ,
+            "taglines"                          : taglines                          ,
+            "registration_mode"                 : registration_mode                 ,
+            }
+        res = self._req.lemmyRequest("createSite", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def edit(self,         
+        name: str=None,
+        sidebar: str=None,
+        description: str=None,
+        icon: str=None,
+        banner: str=None,
+        enable_downvotes: bool=None,
+        enable_nsfw: bool=None,
+        community_creation_admin_only: bool=None,
+        require_email_verification: bool=None,
+        application_question: str=None,
+        private_instance: bool=None,
+        default_theme: str=None,
+        default_post_listing_type: ListingType=None,
+        legal_information: str=None,
+        application_email_admins: bool=None,
+        hide_modlog_mod_names: bool=None,
+        discussion_languages: List[int]=None,
+        slur_filter_regex: str=None,
+        actor_name_max_length: int=None,
+        rate_limit_message: int=None,
+        rate_limit_message_per_second: int=None,
+        rate_limit_post: int=None,
+        rate_limit_post_per_second: int=None,
+        rate_limit_register: int=None,
+        rate_limit_register_per_second: int=None,
+        rate_limit_image: int=None,
+        rate_limit_image_per_second: int=None,
+        rate_limit_comment: int=None,
+        rate_limit_comment_per_second: int=None,
+        rate_limit_search: int=None,
+        rate_limit_search_per_second: int=None,
+        federation_enabled: bool=None,
+        federation_debug: bool=None,
+        captcha_enabled: bool=None,
+        captcha_difficulty: str=None,
+        allowed_instances: List[str]=None,
+        blocked_instances: List[str]=None,
+        taglines: List[str]=None,
+        registration_mode: RegistrationMode=None,
+        reports_email_admins:bool=None,
+        instance:str=None):
+        """
+        Edit the site details. Optional arguments can be excluded to leave them as is.
+        
+        Args:
+            name (str): Name of the website. Optional            
+            sidebar (str): Text of the sidebar of the website. Optional.
+            description (str): Description of the website. Optional.
+            icon (str): URL to icon for webstite. Optional.
+            banner (str): URL for banner of website. Optional.
+            enable_downvotes (bool): If true, downvotes are enabled. Optional.
+            enable_nsfw (bool): If true, NSFW content is allowed. Optional.
+            community_creation_admin_only (bool): If true, only adminstrators can create communities. Optional.
+            require_email_verification (bool): If true, email verification is required. Optional.
+            application_question (str): Question shown on application. Optional.
+            private_instance (bool): If true, instance is private. Optional.
+            default_theme (str): Default theme for the site. Optional.
+            default_post_listing_type (ListingType): Default listing type for posts. Optional.
+            legal_information (str): Legal information for the site. Optional.
+            application_email_admins (bool): If applications send an email to the admins. Optional.
+            hide_modlog_mod_names (bool): If true, moderator names are hidden in the modlog. Optional.
+            discussion_languages (List[int]): List of discussion languages in the instance. Optional.
+            slur_filter_regex (str): Regex to match for slurs or to block certain text. 
+            actor_name_max_length (int): Maximum name length for actors ???. Optional. 
+            rate_limit_message (int): Message rate limit. Optional.
+            rate_limit_message_per_second (int): Message per second rate limit. Optional.
+            rate_limit_post (int): Post rate limit. Optional.
+            rate_limit_post_per_second (int): Post per second rate limit. Optional.
+            rate_limit_register (int): Registration rate limit. Optional.
+            rate_limit_register_per_second (int): Registrations per second rate limit. Optional.
+            rate_limit_image (int): Image rate limit. Optional.
+            rate_limit_image_per_second (int): Image rate limit per second. Optional.
+            rate_limit_comment (int): Comment rate limit. Optional.
+            rate_limit_comment_per_second (int): Comment per second rate limit. Optional.
+            rate_limit_search (int): Search rate limit. Optional.
+            rate_limit_search_per_second (int): Search per second rate limit. Optional.
+            federation_enabled (bool): If federation is enabled. Optional.
+            federation_debug (bool): If federation debugging is enabled. Optional.
+            captcha_enabled (bool): If captcha is enabled. Optional.
+            captcha_difficulty (str): Difficulty of the captcha. Text: easy, medium or hard.
+            allowed_instances (List[str]): List of allowed instances. Optional.
+            blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+            taglines (List[str]: List of taglines shown at top of front page). Optional.
+            registration_mode (RegistrationMode): Mode of registration (Closed/Application/Open). Optional.
+            reports_email_admins (bool): if reporting emails the admins. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Edit site response
+        """
+        form = {}
+        optional = {
+            "name"                              : name                              ,
+            "sidebar"                           : sidebar                           ,
+            "description"                       : description                       ,
+            "icon"                              : icon                              ,
+            "banner"                            : banner                            ,
+            "enable_downvotes"                  : enable_downvotes                  ,
+            "enable_nsfw"                       : enable_nsfw                       ,
+            "community_creation_admin_only"     : community_creation_admin_only     ,
+            "require_email_verification"        : require_email_verification        ,
+            "application_question"              : application_question              ,
+            "private_instance"                  : private_instance                  ,
+            "default_theme"                     : default_theme                     ,
+            "default_post_listing_type"         : default_post_listing_type         ,
+            "legal_information"                 : legal_information                 ,
+            "application_email_admins"          : application_email_admins          ,
+            "hide_modlog_mod_names"             : hide_modlog_mod_names             ,
+            "discussion_languages"              : discussion_languages              ,
+            "slur_filter_regex"                 : slur_filter_regex                 ,
+            "actor_name_max_length"             : actor_name_max_length             ,
+            "rate_limit_message"                : rate_limit_message                ,
+            "rate_limit_message_per_second"     : rate_limit_message_per_second     ,
+            "rate_limit_post"                   : rate_limit_post                   ,
+            "rate_limit_post_per_second"        : rate_limit_post_per_second        ,
+            "rate_limit_register"               : rate_limit_register               ,
+            "rate_limit_register_per_second"    : rate_limit_register_per_second    ,
+            "rate_limit_image"                  : rate_limit_image                  ,
+            "rate_limit_image_per_second"       : rate_limit_image_per_second       ,
+            "rate_limit_comment"                : rate_limit_comment                ,
+            "rate_limit_comment_per_second"     : rate_limit_comment_per_second     ,
+            "rate_limit_search"                 : rate_limit_search                 ,
+            "rate_limit_search_per_second"      : rate_limit_search_per_second      ,
+            "federation_enabled"                : federation_enabled                ,
+            "federation_debug"                  : federation_debug                  ,
+            "captcha_enabled"                   : captcha_enabled                   ,
+            "captcha_difficulty"                : captcha_difficulty                ,
+            "allowed_instances"                 : allowed_instances                 ,
+            "blocked_instances"                 : blocked_instances                 ,
+            "taglines"                          : taglines                          ,
+            "registration_mode"                 : registration_mode                 ,
+            "reports_email_admins"              : reports_email_admins              ,
+            }
+        res = self._req.lemmyRequest("editSite", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def getFederatedInstances(self, instance:str=None, auth:bool=True):
+        """
+        Get the list of federated instances from the site
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): Whether or not to use authentication. Optional. Defaults to True.
+            
+        Returns:
+            Federated instances response
+        """
+        res = self._req.lemmyRequest("getFederatedInstances", instance=instance, auth=auth)
+        return res
+    
+    def addAdmin(self, person_id:int, added:bool=True, instance:str=None):
+        """
+        Add an administrator to the site
+        
+        Args:
+            person_id (int): ID of user to add as administrator
+            added (bool): If person is added as an administrator to the site. Optional. Defaults to True.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Administrator added response
+        """
+        form={
+            "person_id": person_id,
+            "added": added
+            }
+        res = self._req.lemmyRequest("addAdmin", instance=instance, form=form, auth=True)
+        return res
+        
+    def getUnreadRegistrationApplicationCount(self, instance:str=None):
+        """
+        Get the number of unread registration applications
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Unread registration application count response
+        """
+        form={}
+        res = self._req.lemmyRequest("getUnreadRegistrationApplicationCount", instance=instance, form=form, auth=True)
+        return res
+        
+    def listRegistrationApplications(self, unread_only:bool=None, page:int=None, limit:str=None, instance:str=None):
+        """
+        Get a list of registration applications
+        
+        Args:
+            unread_only (bool): Get only unread applications. Optional.
+            page (int): Page of applications to get. Optional.
+            limit (int): Limit for number of applications to get. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of registration applications 
+        """
+        form={}
+        optional={
+            "page": page,
+            "limit": limit,
+            "unread_only": unread_only
+            }
+        res = self._req.lemmyRequest("listRegistrationApplications", instance=instance, form=form, auth=True)
+        return res
+        
+    def approveRegistrationApplication(self, application_id:int, approve:bool=True, deny_reason:str=None, instance:str=None):
+        """
+        Approve a registration application
+        
+        Args:
+            application_id (int): ID of the application
+            approve (bool): If registration application has been approved. Optional. Defaults to True
+            dent_reason (str): Reason for denying the application, if denied. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Approved registration response
+        """
+        form={
+            "application_id": application_id,
+            "approve": approve,
+            }
+        optional={
+            "deny_reason": deny_reason
+            }
+        res = self._req.lemmyRequest("approveRegistrationApplication", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def getModlog(self, mod_person_id:int=None, community_id:int=None, page:int=None, limit:int=None, type_:ModlogActionType=None, other_person_id:int=None, instance:str=None):
+        """
+        Get the moderation log of the site
+        
+        Args:
+            mod_person_id (int): Filter by moderator id. Optional
+            community_id (int): Filter by community id. Optional
+            page (int): Page number to view. Optional
+            limit (int): Limit for number of results to get. Optional
+            type_ (ModlogActionType): Filter by type of moderator action. Optional
+            other_person_id (int): ID of the user who made the comment, post or community. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Moderator log response
+        """
+        form={}
+        optional={
+            "mod_person_id": mod_person_id,
+            "community_id": community_id,
+            "page": page,
+            "limit": limit,
+            "type_": type_,
+            "other_person_id": other_person_id,
+            }
+        res = self._req.lemmyRequest("getModlog", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def purgeComment(self, comment_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a comment from the site
+        
+        Args:
+            comment_id (int): ID of the comment to purge
+            reason (str): Reason for purging the comment. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged comment response
+        """
+        form={
+            "comment_id": comment_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgeComment", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def purgeCommunity(self, community_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a community from the site
+        
+        Args:
+            community_id (int): ID of the user to purge
+            reason (str): Reason for purging the community. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged community response
+        """
+        form={
+            "community_id": community_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgeCommunity", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def purgePost(self, post_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a post from the site
+        
+        Args:
+            post_id (int): ID of the post to purge
+            reason (str): Reason for purging the post. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged post response
+        """
+        form={
+            "post_id": post_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgePost", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def purgePerson(self, person_id:int, reason:str=None, instance:str=None):
+        """
+        Purge a person from the site
+        
+        Args:
+            person_id (int): ID of the user to purge
+            reason (str): Reason for purging the person. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Purged person response
+        """
+        form={
+            "person_id": person_id
+            }
+        optional={
+            "reason": reason,
+            }
+        res = self._req.lemmyRequest("purgePerson", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def resolveObject(self, obj, instance:str=None):
+        """
+        Resolves object from another instance
+        
+        Args:
+            obj: Object to resolve from the remote instance
+            instance (str): URL of local instance to request the object from
+            
+        Returns:
+            Federated object
+        """
+        form={
+            "q": obj
+        }
+        res = self._req.lemmyRequest("resolveObject", instance=instance, form=form)
+        return res
+        
+    def search(self, term:str, instance:str=None):
+        """
+        Search for term
+        
+        Args:
+            term (str): Object to resolve from the remote instance
+            instance (str): URL of local instance. Default None uses logged in instance
+            
+        Returns:
+            Search results
+        """
+        form={
+            "q": term
+        }
+        res = self._req.request("search", instance=instance, form=form)
+        return res
+
+

Methods

+
+
+def addAdmin(self, person_id: int, added: bool = True, instance: str = None) +
+
+

Add an administrator to the site

+

Args

+
+
person_id : int
+
ID of user to add as administrator
+
added : bool
+
If person is added as an administrator to the site. Optional. Defaults to True.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Administrator added response

+
+ +Expand source code + +
def addAdmin(self, person_id:int, added:bool=True, instance:str=None):
+    """
+    Add an administrator to the site
+    
+    Args:
+        person_id (int): ID of user to add as administrator
+        added (bool): If person is added as an administrator to the site. Optional. Defaults to True.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Administrator added response
+    """
+    form={
+        "person_id": person_id,
+        "added": added
+        }
+    res = self._req.lemmyRequest("addAdmin", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def approveRegistrationApplication(self, application_id: int, approve: bool = True, deny_reason: str = None, instance: str = None) +
+
+

Approve a registration application

+

Args

+
+
application_id : int
+
ID of the application
+
approve : bool
+
If registration application has been approved. Optional. Defaults to True
+
dent_reason : str
+
Reason for denying the application, if denied. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Approved registration response

+
+ +Expand source code + +
def approveRegistrationApplication(self, application_id:int, approve:bool=True, deny_reason:str=None, instance:str=None):
+    """
+    Approve a registration application
+    
+    Args:
+        application_id (int): ID of the application
+        approve (bool): If registration application has been approved. Optional. Defaults to True
+        dent_reason (str): Reason for denying the application, if denied. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Approved registration response
+    """
+    form={
+        "application_id": application_id,
+        "approve": approve,
+        }
+    optional={
+        "deny_reason": deny_reason
+        }
+    res = self._req.lemmyRequest("approveRegistrationApplication", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def create(self, name: str, sidebar: str = None, description: str = None, icon: str = None, banner: str = None, enable_downvotes: bool = None, enable_nsfw: bool = None, community_creation_admin_only: bool = None, require_email_verification: bool = None, application_question: str = None, private_instance: bool = None, default_theme: str = None, default_post_listing_type: ListingType = None, legal_information: str = None, application_email_admins: bool = None, hide_modlog_mod_names: bool = None, discussion_languages: List[int] = None, slur_filter_regex: str = None, actor_name_max_length: int = None, rate_limit_message: int = None, rate_limit_message_per_second: int = None, rate_limit_post: int = None, rate_limit_post_per_second: int = None, rate_limit_register: int = None, rate_limit_register_per_second: int = None, rate_limit_image: int = None, rate_limit_image_per_second: int = None, rate_limit_comment: int = None, rate_limit_comment_per_second: int = None, rate_limit_search: int = None, rate_limit_search_per_second: int = None, federation_enabled: bool = None, federation_debug: bool = None, captcha_enabled: bool = None, captcha_difficulty: str = None, allowed_instances: List[str] = None, blocked_instances: List[str] = None, taglines: List[str] = None, registration_mode: RegistrationMode = None, instance: str = None) +
+
+

Create the lemmy instance

+

Args

+
+
name : str
+
Name of the website +
+
sidebar : str
+
Text of the sidebar of the website. Optional.
+
description : str
+
Description of the website. Optional.
+
icon : str
+
URL to icon for webstite. Optional.
+
banner : str
+
URL for banner of website. Optional.
+
enable_downvotes : bool
+
If true, downvotes are enabled. Optional.
+
enable_nsfw : bool
+
If true, NSFW content is allowed. Optional.
+
community_creation_admin_only : bool
+
If true, only adminstrators can create communities. Optional.
+
require_email_verification : bool
+
If true, email verification is required. Optional.
+
application_question : str
+
Question shown on application. Optional.
+
private_instance : bool
+
If true, instance is private. Optional.
+
default_theme : str
+
Default theme for the site. Optional.
+
default_post_listing_type : ListingType
+
Default listing type for posts. Optional.
+
legal_information : str
+
Legal information for the site. Optional.
+
application_email_admins : bool
+
If applications send an email to the admins. Optional.
+
hide_modlog_mod_names : bool
+
If true, moderator names are hidden in the modlog. Optional.
+
discussion_languages : List[int]
+
List of discussion languages in the instance. Optional.
+
slur_filter_regex : str
+
Regex to match for slurs or to block certain text.
+
actor_name_max_length : int
+
Maximum name length for actors ???. Optional.
+
rate_limit_message : int
+
Message rate limit. Optional.
+
rate_limit_message_per_second : int
+
Message per second rate limit. Optional.
+
rate_limit_post : int
+
Post rate limit. Optional.
+
rate_limit_post_per_second : int
+
Post per second rate limit. Optional.
+
rate_limit_register : int
+
Registration rate limit. Optional.
+
rate_limit_register_per_second : int
+
Registrations per second rate limit. Optional.
+
rate_limit_image : int
+
Image rate limit. Optional.
+
rate_limit_image_per_second : int
+
Image rate limit per second. Optional.
+
rate_limit_comment : int
+
Comment rate limit. Optional.
+
rate_limit_comment_per_second : int
+
Comment per second rate limit. Optional.
+
rate_limit_search : int
+
Search rate limit. Optional.
+
rate_limit_search_per_second : int
+
Search per second rate limit. Optional.
+
federation_enabled : bool
+
If federation is enabled. Optional.
+
federation_debug : bool
+
If federation debugging is enabled. Optional.
+
captcha_enabled : bool
+
If captcha is enabled. Optional.
+
captcha_difficulty : str
+
Difficulty of the captcha. Text: easy, medium or hard.
+
allowed_instances : List[str]
+
List of allowed instances. Optional.
+
blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+
taglines (List[str]: List of taglines shown at top of front page). Optional.
+
registration_mode : RegistrationMode
+
Mode of registration (Closed/Application/Open). Optional.
+
reports_email_admins : bool
+
if reporting emails the admins. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Create site response

+
+ +Expand source code + +
def create(self,    
+    name: str,
+    sidebar: str=None,
+    description: str=None,
+    icon: str=None,
+    banner: str=None,
+    enable_downvotes: bool=None,
+    enable_nsfw: bool=None,
+    community_creation_admin_only: bool=None,
+    require_email_verification: bool=None,
+    application_question: str=None,
+    private_instance: bool=None,
+    default_theme: str=None,
+    default_post_listing_type: ListingType=None,
+    legal_information: str=None,
+    application_email_admins: bool=None,
+    hide_modlog_mod_names: bool=None,
+    discussion_languages: List[int]=None,
+    slur_filter_regex: str=None,
+    actor_name_max_length: int=None,
+    rate_limit_message: int=None,
+    rate_limit_message_per_second: int=None,
+    rate_limit_post: int=None,
+    rate_limit_post_per_second: int=None,
+    rate_limit_register: int=None,
+    rate_limit_register_per_second: int=None,
+    rate_limit_image: int=None,
+    rate_limit_image_per_second: int=None,
+    rate_limit_comment: int=None,
+    rate_limit_comment_per_second: int=None,
+    rate_limit_search: int=None,
+    rate_limit_search_per_second: int=None,
+    federation_enabled: bool=None,
+    federation_debug: bool=None,
+    captcha_enabled: bool=None,
+    captcha_difficulty: str=None,
+    allowed_instances: List[str]=None,
+    blocked_instances: List[str]=None,
+    taglines: List[str]=None,
+    registration_mode: RegistrationMode=None,
+    instance:str=None):
+    """
+    Create the lemmy instance
+    
+    Args:
+        name (str): Name of the website                 
+        sidebar (str): Text of the sidebar of the website. Optional.
+        description (str): Description of the website. Optional.
+        icon (str): URL to icon for webstite. Optional.
+        banner (str): URL for banner of website. Optional.
+        enable_downvotes (bool): If true, downvotes are enabled. Optional.
+        enable_nsfw (bool): If true, NSFW content is allowed. Optional.
+        community_creation_admin_only (bool): If true, only adminstrators can create communities. Optional.
+        require_email_verification (bool): If true, email verification is required. Optional.
+        application_question (str): Question shown on application. Optional.
+        private_instance (bool): If true, instance is private. Optional.
+        default_theme (str): Default theme for the site. Optional.
+        default_post_listing_type (ListingType): Default listing type for posts. Optional.
+        legal_information (str): Legal information for the site. Optional.
+        application_email_admins (bool): If applications send an email to the admins. Optional.
+        hide_modlog_mod_names (bool): If true, moderator names are hidden in the modlog. Optional.
+        discussion_languages (List[int]): List of discussion languages in the instance. Optional.
+        slur_filter_regex (str): Regex to match for slurs or to block certain text. 
+        actor_name_max_length (int): Maximum name length for actors ???. Optional. 
+        rate_limit_message (int): Message rate limit. Optional.
+        rate_limit_message_per_second (int): Message per second rate limit. Optional.
+        rate_limit_post (int): Post rate limit. Optional.
+        rate_limit_post_per_second (int): Post per second rate limit. Optional.
+        rate_limit_register (int): Registration rate limit. Optional.
+        rate_limit_register_per_second (int): Registrations per second rate limit. Optional.
+        rate_limit_image (int): Image rate limit. Optional.
+        rate_limit_image_per_second (int): Image rate limit per second. Optional.
+        rate_limit_comment (int): Comment rate limit. Optional.
+        rate_limit_comment_per_second (int): Comment per second rate limit. Optional.
+        rate_limit_search (int): Search rate limit. Optional.
+        rate_limit_search_per_second (int): Search per second rate limit. Optional.
+        federation_enabled (bool): If federation is enabled. Optional.
+        federation_debug (bool): If federation debugging is enabled. Optional.
+        captcha_enabled (bool): If captcha is enabled. Optional.
+        captcha_difficulty (str): Difficulty of the captcha. Text: easy, medium or hard.
+        allowed_instances (List[str]): List of allowed instances. Optional.
+        blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+        taglines (List[str]: List of taglines shown at top of front page). Optional.
+        registration_mode (RegistrationMode): Mode of registration (Closed/Application/Open). Optional.
+        reports_email_admins (bool): if reporting emails the admins. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Create site response
+    """
+    form = {
+        "name"                              : name                              ,
+        }
+    optional = {
+        "sidebar"                           : sidebar                           ,
+        "description"                       : description                       ,
+        "icon"                              : icon                              ,
+        "banner"                            : banner                            ,
+        "enable_downvotes"                  : enable_downvotes                  ,
+        "enable_nsfw"                       : enable_nsfw                       ,
+        "community_creation_admin_only"     : community_creation_admin_only     ,
+        "require_email_verification"        : require_email_verification        ,
+        "application_question"              : application_question              ,
+        "private_instance"                  : private_instance                  ,
+        "default_theme"                     : default_theme                     ,
+        "default_post_listing_type"         : default_post_listing_type         ,
+        "legal_information"                 : legal_information                 ,
+        "application_email_admins"          : application_email_admins          ,
+        "hide_modlog_mod_names"             : hide_modlog_mod_names             ,
+        "discussion_languages"              : discussion_languages              ,
+        "slur_filter_regex"                 : slur_filter_regex                 ,
+        "actor_name_max_length"             : actor_name_max_length             ,
+        "rate_limit_message"                : rate_limit_message                ,
+        "rate_limit_message_per_second"     : rate_limit_message_per_second     ,
+        "rate_limit_post"                   : rate_limit_post                   ,
+        "rate_limit_post_per_second"        : rate_limit_post_per_second        ,
+        "rate_limit_register"               : rate_limit_register               ,
+        "rate_limit_register_per_second"    : rate_limit_register_per_second    ,
+        "rate_limit_image"                  : rate_limit_image                  ,
+        "rate_limit_image_per_second"       : rate_limit_image_per_second       ,
+        "rate_limit_comment"                : rate_limit_comment                ,
+        "rate_limit_comment_per_second"     : rate_limit_comment_per_second     ,
+        "rate_limit_search"                 : rate_limit_search                 ,
+        "rate_limit_search_per_second"      : rate_limit_search_per_second      ,
+        "federation_enabled"                : federation_enabled                ,
+        "federation_debug"                  : federation_debug                  ,
+        "captcha_enabled"                   : captcha_enabled                   ,
+        "captcha_difficulty"                : captcha_difficulty                ,
+        "allowed_instances"                 : allowed_instances                 ,
+        "blocked_instances"                 : blocked_instances                 ,
+        "taglines"                          : taglines                          ,
+        "registration_mode"                 : registration_mode                 ,
+        }
+    res = self._req.lemmyRequest("createSite", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def edit(self, name: str = None, sidebar: str = None, description: str = None, icon: str = None, banner: str = None, enable_downvotes: bool = None, enable_nsfw: bool = None, community_creation_admin_only: bool = None, require_email_verification: bool = None, application_question: str = None, private_instance: bool = None, default_theme: str = None, default_post_listing_type: ListingType = None, legal_information: str = None, application_email_admins: bool = None, hide_modlog_mod_names: bool = None, discussion_languages: List[int] = None, slur_filter_regex: str = None, actor_name_max_length: int = None, rate_limit_message: int = None, rate_limit_message_per_second: int = None, rate_limit_post: int = None, rate_limit_post_per_second: int = None, rate_limit_register: int = None, rate_limit_register_per_second: int = None, rate_limit_image: int = None, rate_limit_image_per_second: int = None, rate_limit_comment: int = None, rate_limit_comment_per_second: int = None, rate_limit_search: int = None, rate_limit_search_per_second: int = None, federation_enabled: bool = None, federation_debug: bool = None, captcha_enabled: bool = None, captcha_difficulty: str = None, allowed_instances: List[str] = None, blocked_instances: List[str] = None, taglines: List[str] = None, registration_mode: RegistrationMode = None, reports_email_admins: bool = None, instance: str = None) +
+
+

Edit the site details. Optional arguments can be excluded to leave them as is.

+

Args

+
+
name : str
+
Name of the website. Optional +
+
sidebar : str
+
Text of the sidebar of the website. Optional.
+
description : str
+
Description of the website. Optional.
+
icon : str
+
URL to icon for webstite. Optional.
+
banner : str
+
URL for banner of website. Optional.
+
enable_downvotes : bool
+
If true, downvotes are enabled. Optional.
+
enable_nsfw : bool
+
If true, NSFW content is allowed. Optional.
+
community_creation_admin_only : bool
+
If true, only adminstrators can create communities. Optional.
+
require_email_verification : bool
+
If true, email verification is required. Optional.
+
application_question : str
+
Question shown on application. Optional.
+
private_instance : bool
+
If true, instance is private. Optional.
+
default_theme : str
+
Default theme for the site. Optional.
+
default_post_listing_type : ListingType
+
Default listing type for posts. Optional.
+
legal_information : str
+
Legal information for the site. Optional.
+
application_email_admins : bool
+
If applications send an email to the admins. Optional.
+
hide_modlog_mod_names : bool
+
If true, moderator names are hidden in the modlog. Optional.
+
discussion_languages : List[int]
+
List of discussion languages in the instance. Optional.
+
slur_filter_regex : str
+
Regex to match for slurs or to block certain text.
+
actor_name_max_length : int
+
Maximum name length for actors ???. Optional.
+
rate_limit_message : int
+
Message rate limit. Optional.
+
rate_limit_message_per_second : int
+
Message per second rate limit. Optional.
+
rate_limit_post : int
+
Post rate limit. Optional.
+
rate_limit_post_per_second : int
+
Post per second rate limit. Optional.
+
rate_limit_register : int
+
Registration rate limit. Optional.
+
rate_limit_register_per_second : int
+
Registrations per second rate limit. Optional.
+
rate_limit_image : int
+
Image rate limit. Optional.
+
rate_limit_image_per_second : int
+
Image rate limit per second. Optional.
+
rate_limit_comment : int
+
Comment rate limit. Optional.
+
rate_limit_comment_per_second : int
+
Comment per second rate limit. Optional.
+
rate_limit_search : int
+
Search rate limit. Optional.
+
rate_limit_search_per_second : int
+
Search per second rate limit. Optional.
+
federation_enabled : bool
+
If federation is enabled. Optional.
+
federation_debug : bool
+
If federation debugging is enabled. Optional.
+
captcha_enabled : bool
+
If captcha is enabled. Optional.
+
captcha_difficulty : str
+
Difficulty of the captcha. Text: easy, medium or hard.
+
allowed_instances : List[str]
+
List of allowed instances. Optional.
+
blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+
taglines (List[str]: List of taglines shown at top of front page). Optional.
+
registration_mode : RegistrationMode
+
Mode of registration (Closed/Application/Open). Optional.
+
reports_email_admins : bool
+
if reporting emails the admins. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Edit site response

+
+ +Expand source code + +
def edit(self,         
+    name: str=None,
+    sidebar: str=None,
+    description: str=None,
+    icon: str=None,
+    banner: str=None,
+    enable_downvotes: bool=None,
+    enable_nsfw: bool=None,
+    community_creation_admin_only: bool=None,
+    require_email_verification: bool=None,
+    application_question: str=None,
+    private_instance: bool=None,
+    default_theme: str=None,
+    default_post_listing_type: ListingType=None,
+    legal_information: str=None,
+    application_email_admins: bool=None,
+    hide_modlog_mod_names: bool=None,
+    discussion_languages: List[int]=None,
+    slur_filter_regex: str=None,
+    actor_name_max_length: int=None,
+    rate_limit_message: int=None,
+    rate_limit_message_per_second: int=None,
+    rate_limit_post: int=None,
+    rate_limit_post_per_second: int=None,
+    rate_limit_register: int=None,
+    rate_limit_register_per_second: int=None,
+    rate_limit_image: int=None,
+    rate_limit_image_per_second: int=None,
+    rate_limit_comment: int=None,
+    rate_limit_comment_per_second: int=None,
+    rate_limit_search: int=None,
+    rate_limit_search_per_second: int=None,
+    federation_enabled: bool=None,
+    federation_debug: bool=None,
+    captcha_enabled: bool=None,
+    captcha_difficulty: str=None,
+    allowed_instances: List[str]=None,
+    blocked_instances: List[str]=None,
+    taglines: List[str]=None,
+    registration_mode: RegistrationMode=None,
+    reports_email_admins:bool=None,
+    instance:str=None):
+    """
+    Edit the site details. Optional arguments can be excluded to leave them as is.
+    
+    Args:
+        name (str): Name of the website. Optional            
+        sidebar (str): Text of the sidebar of the website. Optional.
+        description (str): Description of the website. Optional.
+        icon (str): URL to icon for webstite. Optional.
+        banner (str): URL for banner of website. Optional.
+        enable_downvotes (bool): If true, downvotes are enabled. Optional.
+        enable_nsfw (bool): If true, NSFW content is allowed. Optional.
+        community_creation_admin_only (bool): If true, only adminstrators can create communities. Optional.
+        require_email_verification (bool): If true, email verification is required. Optional.
+        application_question (str): Question shown on application. Optional.
+        private_instance (bool): If true, instance is private. Optional.
+        default_theme (str): Default theme for the site. Optional.
+        default_post_listing_type (ListingType): Default listing type for posts. Optional.
+        legal_information (str): Legal information for the site. Optional.
+        application_email_admins (bool): If applications send an email to the admins. Optional.
+        hide_modlog_mod_names (bool): If true, moderator names are hidden in the modlog. Optional.
+        discussion_languages (List[int]): List of discussion languages in the instance. Optional.
+        slur_filter_regex (str): Regex to match for slurs or to block certain text. 
+        actor_name_max_length (int): Maximum name length for actors ???. Optional. 
+        rate_limit_message (int): Message rate limit. Optional.
+        rate_limit_message_per_second (int): Message per second rate limit. Optional.
+        rate_limit_post (int): Post rate limit. Optional.
+        rate_limit_post_per_second (int): Post per second rate limit. Optional.
+        rate_limit_register (int): Registration rate limit. Optional.
+        rate_limit_register_per_second (int): Registrations per second rate limit. Optional.
+        rate_limit_image (int): Image rate limit. Optional.
+        rate_limit_image_per_second (int): Image rate limit per second. Optional.
+        rate_limit_comment (int): Comment rate limit. Optional.
+        rate_limit_comment_per_second (int): Comment per second rate limit. Optional.
+        rate_limit_search (int): Search rate limit. Optional.
+        rate_limit_search_per_second (int): Search per second rate limit. Optional.
+        federation_enabled (bool): If federation is enabled. Optional.
+        federation_debug (bool): If federation debugging is enabled. Optional.
+        captcha_enabled (bool): If captcha is enabled. Optional.
+        captcha_difficulty (str): Difficulty of the captcha. Text: easy, medium or hard.
+        allowed_instances (List[str]): List of allowed instances. Optional.
+        blocked_instances (List[str]: List of blocked or defederated instances. Optional.
+        taglines (List[str]: List of taglines shown at top of front page). Optional.
+        registration_mode (RegistrationMode): Mode of registration (Closed/Application/Open). Optional.
+        reports_email_admins (bool): if reporting emails the admins. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Edit site response
+    """
+    form = {}
+    optional = {
+        "name"                              : name                              ,
+        "sidebar"                           : sidebar                           ,
+        "description"                       : description                       ,
+        "icon"                              : icon                              ,
+        "banner"                            : banner                            ,
+        "enable_downvotes"                  : enable_downvotes                  ,
+        "enable_nsfw"                       : enable_nsfw                       ,
+        "community_creation_admin_only"     : community_creation_admin_only     ,
+        "require_email_verification"        : require_email_verification        ,
+        "application_question"              : application_question              ,
+        "private_instance"                  : private_instance                  ,
+        "default_theme"                     : default_theme                     ,
+        "default_post_listing_type"         : default_post_listing_type         ,
+        "legal_information"                 : legal_information                 ,
+        "application_email_admins"          : application_email_admins          ,
+        "hide_modlog_mod_names"             : hide_modlog_mod_names             ,
+        "discussion_languages"              : discussion_languages              ,
+        "slur_filter_regex"                 : slur_filter_regex                 ,
+        "actor_name_max_length"             : actor_name_max_length             ,
+        "rate_limit_message"                : rate_limit_message                ,
+        "rate_limit_message_per_second"     : rate_limit_message_per_second     ,
+        "rate_limit_post"                   : rate_limit_post                   ,
+        "rate_limit_post_per_second"        : rate_limit_post_per_second        ,
+        "rate_limit_register"               : rate_limit_register               ,
+        "rate_limit_register_per_second"    : rate_limit_register_per_second    ,
+        "rate_limit_image"                  : rate_limit_image                  ,
+        "rate_limit_image_per_second"       : rate_limit_image_per_second       ,
+        "rate_limit_comment"                : rate_limit_comment                ,
+        "rate_limit_comment_per_second"     : rate_limit_comment_per_second     ,
+        "rate_limit_search"                 : rate_limit_search                 ,
+        "rate_limit_search_per_second"      : rate_limit_search_per_second      ,
+        "federation_enabled"                : federation_enabled                ,
+        "federation_debug"                  : federation_debug                  ,
+        "captcha_enabled"                   : captcha_enabled                   ,
+        "captcha_difficulty"                : captcha_difficulty                ,
+        "allowed_instances"                 : allowed_instances                 ,
+        "blocked_instances"                 : blocked_instances                 ,
+        "taglines"                          : taglines                          ,
+        "registration_mode"                 : registration_mode                 ,
+        "reports_email_admins"              : reports_email_admins              ,
+        }
+    res = self._req.lemmyRequest("editSite", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def getFederatedInstances(self, instance: str = None, auth: bool = True) +
+
+

Get the list of federated instances from the site

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : bool
+
Whether or not to use authentication. Optional. Defaults to True.
+
+

Returns

+

Federated instances response

+
+ +Expand source code + +
def getFederatedInstances(self, instance:str=None, auth:bool=True):
+    """
+    Get the list of federated instances from the site
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (bool): Whether or not to use authentication. Optional. Defaults to True.
+        
+    Returns:
+        Federated instances response
+    """
+    res = self._req.lemmyRequest("getFederatedInstances", instance=instance, auth=auth)
+    return res
+
+
+
+def getModlog(self, mod_person_id: int = None, community_id: int = None, page: int = None, limit: int = None, type_: ModlogActionType = None, other_person_id: int = None, instance: str = None) +
+
+

Get the moderation log of the site

+

Args

+
+
mod_person_id : int
+
Filter by moderator id. Optional
+
community_id : int
+
Filter by community id. Optional
+
page : int
+
Page number to view. Optional
+
limit : int
+
Limit for number of results to get. Optional
+
type_ : ModlogActionType
+
Filter by type of moderator action. Optional
+
other_person_id : int
+
ID of the user who made the comment, post or community. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Moderator log response

+
+ +Expand source code + +
def getModlog(self, mod_person_id:int=None, community_id:int=None, page:int=None, limit:int=None, type_:ModlogActionType=None, other_person_id:int=None, instance:str=None):
+    """
+    Get the moderation log of the site
+    
+    Args:
+        mod_person_id (int): Filter by moderator id. Optional
+        community_id (int): Filter by community id. Optional
+        page (int): Page number to view. Optional
+        limit (int): Limit for number of results to get. Optional
+        type_ (ModlogActionType): Filter by type of moderator action. Optional
+        other_person_id (int): ID of the user who made the comment, post or community. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Moderator log response
+    """
+    form={}
+    optional={
+        "mod_person_id": mod_person_id,
+        "community_id": community_id,
+        "page": page,
+        "limit": limit,
+        "type_": type_,
+        "other_person_id": other_person_id,
+        }
+    res = self._req.lemmyRequest("getModlog", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def getSite(self, instance: str = None, auth: bool = True) +
+
+

Get the site details

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : bool
+
Whether or not to authenticate. Optional. Defaults to True.
+
+

Returns

+

Instance details response

+
+ +Expand source code + +
def getSite(self, instance:str=None, auth:bool=True):
+    """
+    Get the site details
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (bool): Whether or not to authenticate. Optional. Defaults to True.
+        
+    Returns:
+        Instance details response
+    """
+    form = {}
+    res = self._req.lemmyRequest("getSite", instance=instance, form=form, auth=auth)
+    return res
+
+
+
+def getUnreadRegistrationApplicationCount(self, instance: str = None) +
+
+

Get the number of unread registration applications

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Unread registration application count response

+
+ +Expand source code + +
def getUnreadRegistrationApplicationCount(self, instance:str=None):
+    """
+    Get the number of unread registration applications
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Unread registration application count response
+    """
+    form={}
+    res = self._req.lemmyRequest("getUnreadRegistrationApplicationCount", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def listRegistrationApplications(self, unread_only: bool = None, page: int = None, limit: str = None, instance: str = None) +
+
+

Get a list of registration applications

+

Args

+
+
unread_only : bool
+
Get only unread applications. Optional.
+
page : int
+
Page of applications to get. Optional.
+
limit : int
+
Limit for number of applications to get. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of registration applications

+
+ +Expand source code + +
def listRegistrationApplications(self, unread_only:bool=None, page:int=None, limit:str=None, instance:str=None):
+    """
+    Get a list of registration applications
+    
+    Args:
+        unread_only (bool): Get only unread applications. Optional.
+        page (int): Page of applications to get. Optional.
+        limit (int): Limit for number of applications to get. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of registration applications 
+    """
+    form={}
+    optional={
+        "page": page,
+        "limit": limit,
+        "unread_only": unread_only
+        }
+    res = self._req.lemmyRequest("listRegistrationApplications", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def purgeComment(self, comment_id: int, reason: str = None, instance: str = None) +
+
+

Purge a comment from the site

+

Args

+
+
comment_id : int
+
ID of the comment to purge
+
reason : str
+
Reason for purging the comment. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Purged comment response

+
+ +Expand source code + +
def purgeComment(self, comment_id:int, reason:str=None, instance:str=None):
+    """
+    Purge a comment from the site
+    
+    Args:
+        comment_id (int): ID of the comment to purge
+        reason (str): Reason for purging the comment. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Purged comment response
+    """
+    form={
+        "comment_id": comment_id
+        }
+    optional={
+        "reason": reason,
+        }
+    res = self._req.lemmyRequest("purgeComment", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def purgeCommunity(self, community_id: int, reason: str = None, instance: str = None) +
+
+

Purge a community from the site

+

Args

+
+
community_id : int
+
ID of the user to purge
+
reason : str
+
Reason for purging the community. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Purged community response

+
+ +Expand source code + +
def purgeCommunity(self, community_id:int, reason:str=None, instance:str=None):
+    """
+    Purge a community from the site
+    
+    Args:
+        community_id (int): ID of the user to purge
+        reason (str): Reason for purging the community. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Purged community response
+    """
+    form={
+        "community_id": community_id
+        }
+    optional={
+        "reason": reason,
+        }
+    res = self._req.lemmyRequest("purgeCommunity", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def purgePerson(self, person_id: int, reason: str = None, instance: str = None) +
+
+

Purge a person from the site

+

Args

+
+
person_id : int
+
ID of the user to purge
+
reason : str
+
Reason for purging the person. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Purged person response

+
+ +Expand source code + +
def purgePerson(self, person_id:int, reason:str=None, instance:str=None):
+    """
+    Purge a person from the site
+    
+    Args:
+        person_id (int): ID of the user to purge
+        reason (str): Reason for purging the person. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Purged person response
+    """
+    form={
+        "person_id": person_id
+        }
+    optional={
+        "reason": reason,
+        }
+    res = self._req.lemmyRequest("purgePerson", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def purgePost(self, post_id: int, reason: str = None, instance: str = None) +
+
+

Purge a post from the site

+

Args

+
+
post_id : int
+
ID of the post to purge
+
reason : str
+
Reason for purging the post. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Purged post response

+
+ +Expand source code + +
def purgePost(self, post_id:int, reason:str=None, instance:str=None):
+    """
+    Purge a post from the site
+    
+    Args:
+        post_id (int): ID of the post to purge
+        reason (str): Reason for purging the post. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Purged post response
+    """
+    form={
+        "post_id": post_id
+        }
+    optional={
+        "reason": reason,
+        }
+    res = self._req.lemmyRequest("purgePost", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def resolveObject(self, obj, instance: str = None) +
+
+

Resolves object from another instance

+

Args

+
+
obj
+
Object to resolve from the remote instance
+
instance : str
+
URL of local instance to request the object from
+
+

Returns

+

Federated object

+
+ +Expand source code + +
def resolveObject(self, obj, instance:str=None):
+    """
+    Resolves object from another instance
+    
+    Args:
+        obj: Object to resolve from the remote instance
+        instance (str): URL of local instance to request the object from
+        
+    Returns:
+        Federated object
+    """
+    form={
+        "q": obj
+    }
+    res = self._req.lemmyRequest("resolveObject", instance=instance, form=form)
+    return res
+
+
+
+def search(self, term: str, instance: str = None) +
+
+

Search for term

+

Args

+
+
term : str
+
Object to resolve from the remote instance
+
instance : str
+
URL of local instance. Default None uses logged in instance
+
+

Returns

+

Search results

+
+ +Expand source code + +
def search(self, term:str, instance:str=None):
+    """
+    Search for term
+    
+    Args:
+        term (str): Object to resolve from the remote instance
+        instance (str): URL of local instance. Default None uses logged in instance
+        
+    Returns:
+        Search results
+    """
+    form={
+        "q": term
+    }
+    res = self._req.request("search", instance=instance, form=form)
+    return res
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/comment_sort_type.html b/docs/v0.1.6/types/comment_sort_type.html new file mode 100644 index 0000000..222e869 --- /dev/null +++ b/docs/v0.1.6/types/comment_sort_type.html @@ -0,0 +1,120 @@ + + + + + + +jplaw.types.comment_sort_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.comment_sort_type

+
+
+
+ +Expand source code + +
from enum import Enum
+class CommentSortType(Enum):
+    Hot = "Hot"
+    Top = "Top"
+    New = "New"
+    Old = "Old"
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class CommentSortType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class CommentSortType(Enum):
+    Hot = "Hot"
+    Top = "Top"
+    New = "New"
+    Old = "Old"
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var Hot
+
+
+
+
var New
+
+
+
+
var Old
+
+
+
+
var Top
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/http_type.html b/docs/v0.1.6/types/http_type.html new file mode 100644 index 0000000..318253c --- /dev/null +++ b/docs/v0.1.6/types/http_type.html @@ -0,0 +1,120 @@ + + + + + + +jplaw.types.http_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.http_type

+
+
+
+ +Expand source code + +
from enum import Enum
+class HttpType(Enum):
+    GET = "GET"
+    POST = "POST"
+    PUT = "PUT"
+    DELETE = "DELETE"
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class HttpType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class HttpType(Enum):
+    GET = "GET"
+    POST = "POST"
+    PUT = "PUT"
+    DELETE = "DELETE"
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var DELETE
+
+
+
+
var GET
+
+
+
+
var POST
+
+
+
+
var PUT
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/index.html b/docs/v0.1.6/types/index.html new file mode 100644 index 0000000..5b08e1d --- /dev/null +++ b/docs/v0.1.6/types/index.html @@ -0,0 +1,124 @@ + + + + + + +jplaw.types API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types

+
+
+

The jplaw.types submodule is used for Enums and data types used in jplaw.

+
+ +Expand source code + +
"""
+    The jplaw.types submodule is used for Enums and data types used in jplaw.
+"""
+__version__ = "0.1.6"
+__package__ = "jplaw.types"
+from .comment_sort_type import CommentSortType
+from .http_type import HttpType
+from .listing_type import ListingType
+from .modlog_action_type import ModlogActionType
+from .post_feature_type import PostFeatureType
+from .search_type import SearchType
+from .sort_type import SortType
+from .subscribed_type import SubscribedType
+
+
+
+

Sub-modules

+
+
jplaw.types.comment_sort_type
+
+
+
+
jplaw.types.http_type
+
+
+
+
jplaw.types.listing_type
+
+
+
+
jplaw.types.modlog_action_type
+
+
+
+
jplaw.types.post_feature_type
+
+
+
+
jplaw.types.registration_mode
+
+
+
+
jplaw.types.search_type
+
+
+
+
jplaw.types.sort_type
+
+
+
+
jplaw.types.subscribed_type
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/listing_type.html b/docs/v0.1.6/types/listing_type.html new file mode 100644 index 0000000..02af0a6 --- /dev/null +++ b/docs/v0.1.6/types/listing_type.html @@ -0,0 +1,113 @@ + + + + + + +jplaw.types.listing_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.listing_type

+
+
+
+ +Expand source code + +
from enum import Enum
+class ListingType(Enum):
+    All = "All"
+    Local = "Local"
+    Subscribed = "Subscribed"
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class ListingType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class ListingType(Enum):
+    All = "All"
+    Local = "Local"
+    Subscribed = "Subscribed"
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var All
+
+
+
+
var Local
+
+
+
+
var Subscribed
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/modlog_action_type.html b/docs/v0.1.6/types/modlog_action_type.html new file mode 100644 index 0000000..d9b0935 --- /dev/null +++ b/docs/v0.1.6/types/modlog_action_type.html @@ -0,0 +1,204 @@ + + + + + + +jplaw.types.modlog_action_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.modlog_action_type

+
+
+
+ +Expand source code + +
from enum import Enum
+class ModlogActionType(Enum):
+    All                     = "All"                 
+    ModRemovePost           = "ModRemovePost"       
+    ModLockPost             = "ModLockPost"         
+    ModFeaturePost          = "ModFeaturePost"      
+    ModRemoveComment        = "ModRemoveComment"    
+    ModRemoveCommunity      = "ModRemoveCommunity"  
+    ModBanFromCommunity     = "ModBanFromCommunity" 
+    ModAddCommunity         = "ModAddCommunity"     
+    ModTransferCommunity    = "ModTransferCommunity"
+    ModAdd                  = "ModAdd"              
+    ModBan                  = "ModBan"              
+    ModHideCommunity        = "ModHideCommunity"    
+    AdminPurgePerson        = "AdminPurgePerson"    
+    AdminPurgeCommunity     = "AdminPurgeCommunity" 
+    AdminPurgePost          = "AdminPurgePost"      
+    AdminPurgeComment       = "AdminPurgeComment"   
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class ModlogActionType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class ModlogActionType(Enum):
+    All                     = "All"                 
+    ModRemovePost           = "ModRemovePost"       
+    ModLockPost             = "ModLockPost"         
+    ModFeaturePost          = "ModFeaturePost"      
+    ModRemoveComment        = "ModRemoveComment"    
+    ModRemoveCommunity      = "ModRemoveCommunity"  
+    ModBanFromCommunity     = "ModBanFromCommunity" 
+    ModAddCommunity         = "ModAddCommunity"     
+    ModTransferCommunity    = "ModTransferCommunity"
+    ModAdd                  = "ModAdd"              
+    ModBan                  = "ModBan"              
+    ModHideCommunity        = "ModHideCommunity"    
+    AdminPurgePerson        = "AdminPurgePerson"    
+    AdminPurgeCommunity     = "AdminPurgeCommunity" 
+    AdminPurgePost          = "AdminPurgePost"      
+    AdminPurgeComment       = "AdminPurgeComment"   
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var AdminPurgeComment
+
+
+
+
var AdminPurgeCommunity
+
+
+
+
var AdminPurgePerson
+
+
+
+
var AdminPurgePost
+
+
+
+
var All
+
+
+
+
var ModAdd
+
+
+
+
var ModAddCommunity
+
+
+
+
var ModBan
+
+
+
+
var ModBanFromCommunity
+
+
+
+
var ModFeaturePost
+
+
+
+
var ModHideCommunity
+
+
+
+
var ModLockPost
+
+
+
+
var ModRemoveComment
+
+
+
+
var ModRemoveCommunity
+
+
+
+
var ModRemovePost
+
+
+
+
var ModTransferCommunity
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/post_feature_type.html b/docs/v0.1.6/types/post_feature_type.html new file mode 100644 index 0000000..40e0c07 --- /dev/null +++ b/docs/v0.1.6/types/post_feature_type.html @@ -0,0 +1,107 @@ + + + + + + +jplaw.types.post_feature_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.post_feature_type

+
+
+
+ +Expand source code + +
from enum import Enum
+
+class PostFeatureType(Enum):
+    Local = "Local"
+    Community = "Community"
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class PostFeatureType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class PostFeatureType(Enum):
+    Local = "Local"
+    Community = "Community"
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var Community
+
+
+
+
var Local
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/registration_mode.html b/docs/v0.1.6/types/registration_mode.html new file mode 100644 index 0000000..f4236f9 --- /dev/null +++ b/docs/v0.1.6/types/registration_mode.html @@ -0,0 +1,114 @@ + + + + + + +jplaw.types.registration_mode API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.registration_mode

+
+
+
+ +Expand source code + +
from enum import Enum
+
+class RegistrationMode(Enum):
+    Closed = "Closed"
+    RequireApplication = "RequireApplication"
+    Open = "Open"
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class RegistrationMode +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class RegistrationMode(Enum):
+    Closed = "Closed"
+    RequireApplication = "RequireApplication"
+    Open = "Open"
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var Closed
+
+
+
+
var Open
+
+
+
+
var RequireApplication
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/search_type.html b/docs/v0.1.6/types/search_type.html new file mode 100644 index 0000000..cb77d4d --- /dev/null +++ b/docs/v0.1.6/types/search_type.html @@ -0,0 +1,141 @@ + + + + + + +jplaw.types.search_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.search_type

+
+
+
+ +Expand source code + +
from enum import Enum
+class SearchType(Enum):
+    All           =     "All"           
+    Comments      =     "Comments"      
+    Posts         =     "Posts"         
+    Communities   =     "Communities"   
+    Users         =     "Users"         
+    Url           =     "Url"           
+
+  
+  
+  
+  
+  
+  
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class SearchType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class SearchType(Enum):
+    All           =     "All"           
+    Comments      =     "Comments"      
+    Posts         =     "Posts"         
+    Communities   =     "Communities"   
+    Users         =     "Users"         
+    Url           =     "Url"           
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var All
+
+
+
+
var Comments
+
+
+
+
var Communities
+
+
+
+
var Posts
+
+
+
+
var Url
+
+
+
+
var Users
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/sort_type.html b/docs/v0.1.6/types/sort_type.html new file mode 100644 index 0000000..d89bd0e --- /dev/null +++ b/docs/v0.1.6/types/sort_type.html @@ -0,0 +1,211 @@ + + + + + + +jplaw.types.sort_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.sort_type

+
+
+
+ +Expand source code + +
from enum import Enum
+class SortType(Enum):
+    Active=         "Active"
+    Hot=            "Hot"
+    New=            "New"
+    Old=            "Old"
+    MostComments=   "MostComments"
+    NewComments=    "NewComments"
+    TopHour=        "TopHour"
+    TopSixHour=     "TopSixHour"
+    TopTwelveHour=  "TopTwelveHour"
+    TopDay=         "TopDay"
+    TopWeek=        "TopWeek"
+    TopMonth=       "TopMonth"
+    TopThreeMonths= "TopThreeMonths"
+    TopSixMonths=   "TopSixMonths"
+    TopNineMonths=  "TopNineMonths"
+    TopYear=        "TopYear"
+    TopAll=         "TopAll"
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class SortType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class SortType(Enum):
+    Active=         "Active"
+    Hot=            "Hot"
+    New=            "New"
+    Old=            "Old"
+    MostComments=   "MostComments"
+    NewComments=    "NewComments"
+    TopHour=        "TopHour"
+    TopSixHour=     "TopSixHour"
+    TopTwelveHour=  "TopTwelveHour"
+    TopDay=         "TopDay"
+    TopWeek=        "TopWeek"
+    TopMonth=       "TopMonth"
+    TopThreeMonths= "TopThreeMonths"
+    TopSixMonths=   "TopSixMonths"
+    TopNineMonths=  "TopNineMonths"
+    TopYear=        "TopYear"
+    TopAll=         "TopAll"
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var Active
+
+
+
+
var Hot
+
+
+
+
var MostComments
+
+
+
+
var New
+
+
+
+
var NewComments
+
+
+
+
var Old
+
+
+
+
var TopAll
+
+
+
+
var TopDay
+
+
+
+
var TopHour
+
+
+
+
var TopMonth
+
+
+
+
var TopNineMonths
+
+
+
+
var TopSixHour
+
+
+
+
var TopSixMonths
+
+
+
+
var TopThreeMonths
+
+
+
+
var TopTwelveHour
+
+
+
+
var TopWeek
+
+
+
+
var TopYear
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/types/subscribed_type.html b/docs/v0.1.6/types/subscribed_type.html new file mode 100644 index 0000000..3fe2eb5 --- /dev/null +++ b/docs/v0.1.6/types/subscribed_type.html @@ -0,0 +1,120 @@ + + + + + + +jplaw.types.subscribed_type API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.types.subscribed_type

+
+
+
+ +Expand source code + +
from enum import Enum
+class SubscribedType(Enum):
+    Subscribed      = "Subscribed"
+    NotSubscribed   = "NotSubscribed"
+    Pending         = "Pending"
+
+  
+  
+  
+  
+  
+  
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class SubscribedType +(value, names=None, *, module=None, qualname=None, type=None, start=1) +
+
+

An enumeration.

+
+ +Expand source code + +
class SubscribedType(Enum):
+    Subscribed      = "Subscribed"
+    NotSubscribed   = "NotSubscribed"
+    Pending         = "Pending"
+
+

Ancestors

+
    +
  • enum.Enum
  • +
+

Class variables

+
+
var NotSubscribed
+
+
+
+
var Pending
+
+
+
+
var Subscribed
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/v0.1.6/user.html b/docs/v0.1.6/user.html new file mode 100644 index 0000000..cf8c865 --- /dev/null +++ b/docs/v0.1.6/user.html @@ -0,0 +1,1913 @@ + + + + + + +jplaw.user API documentation + + + + + + + + + + + +
+
+
+

Module jplaw.user

+
+
+

User class. Designed to allow Lemmy.User functions.

+
+ +Expand source code + +
"""
+User class. Designed to allow Lemmy.User functions.
+"""
+from .requestor import Requestor
+from .api_paths import *
+from typing import List
+from .types.listing_type import ListingType
+from .types.sort_type import SortType
+
+class User():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    def leaveAdmin(self, instance:str=None):
+        """
+        Leave the administrator team of a site
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Removed community response
+        """
+        form = {}
+        res = self._req.lemmyRequest("leaveAdmin", instance=instance, form=form, auth=True)
+    def register(self, 
+        username:str, 
+        password:str, 
+        password_verify:str, 
+        show_nsfw:bool, 
+        email:str=None, 
+        captcha_uuid:str=None, 
+        captcha_answer:str=None, 
+        honeypot:str=None, 
+        answer:str=None, 
+        instance:str=None):
+        """
+        Register at an instance
+        
+        Args:
+            username (str): Username to use for account
+            password (str): Password for account
+            password_verify (str): Password repeated for verification
+            show_nsfw (bool): If NSFW posts should be shown
+            email (str): Email address associated with the account. Optional
+            captcha_uuid (str): UUID of the captcha. Optional. Required if site requires captcha.
+            captcha_answer (str): Answer to the captcha. Optional. Required if site requires captcha.
+            honeypot (str): Honeypot field. Used for detecting bots which autofill all fields. Do not use unless trying to explicitly trigger honeypot
+            answer (str): Answer to sign up question
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Removed community response
+        """
+        form={
+            "username": username,
+            "password": password,
+            "password_verify": password_verify,
+            "show_nsfw": show_nsfw
+            }
+        optional = {       
+            "email"          :email          ,
+            "captcha_uuid"   :captcha_uuid   ,
+            "captcha_uuid"   :captcha_uuid   ,
+            "limit"          :limit          ,
+            "honeypot"       :honeypot       ,
+            "answer"         :answer         ,
+            }
+        res = self._req.lemmyRequest("register", instance=instance, form=form, optional=optional, auth=False)
+        return res
+    def getDetails(self, person_id:str=None, username:str=None, sort:SortType=None, page:int=None, limit:int=None, community_id:int=None, saved_only:bool=None, instance:str=None, auth:bool=True):
+        """
+        Get details of a user
+        
+        Args:
+            person_id (int): User ID of the person to get the details of. Optional.
+            username (str): Username of the user to get the details of. Optional
+            sort (SortType): Sort order of user list. Optional
+            page (int): Page number to get.
+            limit (int): Limit for number of users to return
+            community_id (int): Community to filter by for user
+            saved_only (bool): Show only saved objects
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): If true, authenticate using login. Defaults to True.
+            
+        Returns:
+            List of items which follow the filters given
+        """
+        form={}
+        optional={
+            "sort"          :   sort              ,
+            "person_id"     :   person_id         ,
+            "username"      :   username          ,
+            "page"          :   page              ,
+            "limit"         :   limit             ,
+            "community_id"  :   community_id      ,
+            "saved_only"    :   saved_only        ,
+            }
+        res = self._req.lemmyRequest("getPersonDetails", instance=instance, form=form, optional=optional, auth=auth)
+        return res
+    
+    def markMentionAsRead(self, person_mention_id:int, read:bool=True, instance:str=None):
+        """
+        Mark a mention as read or unread
+        
+        Args:
+            person_mention_id (int): ID of the mention
+            read (bool): If true, marks mention as read. False marks unread. Defaults to True. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of items which follow the filters given
+        """
+        form={
+            "person_mention_id": person_mention_id,
+            "read": read
+            }
+        res = self._req.lemmyRequest("markPersonMentionAsRead", instance=instance, form=form, auth=True)
+        return res
+    
+    def getMentions(self, sort:SortType=None, page:int=None, limit:int=None, unread_only:bool=True, instance:str=None):
+        """
+        Get the list of mentions
+        
+        Args:
+            sort (SortType): Sort order of mention list. Optional
+            page (int): Page number to get. Optional.
+            limit (int): Limit for number of mentions to return. Optional.
+            unread_only (bool): Show only unread mentions. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of mentions
+        """
+        form={}
+        optional = {
+            "sort"           :  sort           ,
+            "page"           :  page           ,
+            "limit"          :  limit          ,
+            "unread_only"    :  unread_only    ,
+            }
+        res = self._req.lemmyRequest("getPersonMentions", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def getReplies(self, sort:SortType=None, page:int=None, limit:int=None, unread_only:bool=True):
+        """
+        Get the list of replies
+        
+        Args:
+            sort (SortType): Sort order of reply list. Optional
+            page (int): Page number to get. Optional.
+            limit (int): Limit for number of replies to return. Optional.
+            unread_only (bool): Show only unread replies. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of replies
+        """
+        form={}
+        optional = {
+            "sort"           :  sort           ,
+            "page"           :  page           ,
+            "limit"          :  limit          ,
+            "unread_only"    :  unread_only    ,
+            }
+        res = self._req.lemmyRequest("getReplies", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def ban(self, person_id:int, ban:bool, remove_data:bool=None, reason:str=None, expires:int=None, instance:str=None):
+        """
+        Ban a user from the instance
+        
+        Args:
+            person_id (int): User ID of the person to ban
+            ban (bool): If the user is banned from the instance.
+            remove_data (bool): Remove the data of the user. Optional.
+            expires (int): Unix Timestamp of ban expiration (seconds). Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Banned user 
+        """
+        form={
+            "person_id"     :person_id,
+            "ban"           :ban
+            }
+        optional = {
+            "remove_data"    :remove_data   ,
+            "reason"         :reason        ,
+            "expires"        :expires
+            }
+        res = self._req.lemmyRequest("banPerson", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def getBanned(self, instance:str=None):
+        """
+        Get the list of banned users
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of banned users
+        """
+        form={}
+        res = self._req.lemmyRequest(HttpType.GET, "getBannedPersons", instance=instance, form=form, auth=True)
+        return res
+     
+    def block(self, person_id:int, block:bool, instance:str=None):
+        """"
+        Block or unblock a user
+        
+        Args:
+            person_id (int): ID of the user to block
+            block (bool): True to block user. False to unblock user. 
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Blocked user response
+        """
+        form={
+            "person_id": person_id,
+            "block": block
+            }
+        res = self._req.lemmyRequest("blockPerson", instance=instance, form=form, auth=True)
+        return res
+    
+    def getCaptcha(self, instance:str=None): 
+        """
+        Get a new captcha from an instance
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Captcha
+        """
+        form={}
+        res = self._req.lemmyRequest("getCaptcha", instance=instance, form=form, auth=True)
+        return res
+    
+    def deleteAccount(self, password:str, instance:str=None): 
+        """
+        Delete an account
+        
+        Args:
+            password (str): password to verify account deletion
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Deleted account response
+        """
+        form={
+            "password": password
+            }
+        res = self._req.lemmyRequest("deleteAccount", instance=instance, form=form, auth=True)
+        return res
+    
+    def passwordReset(self, email:str, instance:str=None): 
+        """
+        Reset an account password associated with an email
+        
+        Args:
+            email (str): Email address an account is associated with
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Pasword reset response
+        """
+        form={
+            "email": email
+            }
+        res = self._req.lemmyRequest("passwordReset", instance=instance, form=form, auth=False)
+        return res
+        
+    def passwordChangeAfterReset(self, token:str, password:str, password_verify:str, instance:str=None):
+        """
+        Change a password after reset request
+        
+        Args:
+            token (str): Reset token sent to email address
+            password (str): New password
+            password_verify (str): New password repeated for verification
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Password reset response
+        """
+        form={
+            "token": token,
+            "password": password,
+            "password_verify": password_verify
+            }
+        res = self._req.lemmyRequest("passwordChangeAfterReset", instance=instance, form=form, auth=False)
+        return res
+        
+    def markAllAsRead(self, instance:str=None):
+        """
+        Mark all as read
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Mark read response
+        """
+        form={}
+        res = self._req.lemmyRequest("markAllAsRead", instance=instance, form=form, auth=True)
+        return res
+        
+    def saveUserSettings(self,
+        show_nsfw: bool=None,
+        show_scores: bool=None,
+        theme: str=None,
+        default_sort_type: SortType=None,
+        default_listing_type: ListingType=None,
+        interface_language: str=None,
+        avatar: str=None,
+        banner: str=None,
+        display_name: str=None,
+        email: str=None,
+        bio: str=None,
+        matrix_user_id: str=None,
+        show_avatars: bool=None,
+        send_notifications_to_email: bool=None,
+        bot_account: bool=None,
+        show_bot_accounts: bool=None,
+        show_read_posts: bool=None, 
+        show_new_post_notifs: bool=None, 
+        discussion_languages: List[int]=None, 
+        generate_totp_2fa: bool=None, 
+        open_links_in_new_tab: bool=None,
+        instance:str=None):
+        """
+        Save user settings to account
+        
+        Args:
+            show_nsfw (bool): If NSFW posts and communities should be shown. Optional
+            show_scores (bool) If scores should be shown. Optional
+            theme (str): Site theme. Optional
+            default_sort_type (SortType): Sort type for the site. Optional
+            default_listing_type (ListingType): Default listing type. Allows viewing Local or All communities. Optional
+            interface_language (str): Interface language string. Optional
+            avatar (str): URL of avatar. Optional
+            banner (str): URL of user banner. Optional
+            display_name (str): DIsplay name of the user. Optional
+            email (str): Email address associated with the account. Optional
+            bio (str): User Bio/Description. Optional
+            matrix_user_id (str): Matrix user ID. Optional
+            show_avatars (bool): If user avatars should be shown next to names. Optional 
+            send_notifications_to_email (bool): If email notifications should be sent to the user. Optional
+            bot_account (bool): If this is a bot account. Optional
+            show_bot_accounts (bool): If bot accounts should be hidden. Optional 
+            show_read_posts (bool): If read posts should be shown or hidden . Optional
+            show_new_post_notifs (bool): If new posts should send a notification. Optional
+            discussion_languages (List[int]): List of langages to show. Using undefined may cause no posts to show. Optional
+            generate_totp_2fa (bool): Use TOTP 2FA. Optional
+            open_links_in_new_tab (bool): Open links in new tab. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            User settings saved response
+        """ 
+        form = {}
+        optional = {
+            "show_nsfw"                     : show_nsfw                  ,
+            "show_scores"                   : show_scores                ,
+            "theme"                         : theme                      ,
+            "default_sort_type"             : default_sort_type          ,
+            "default_listing_type"          : default_listing_type       ,
+            "interface_language"            : interface_language         ,
+            "avatar"                        : avatar                     ,
+            "banner"                        : banner                     ,
+            "display_name"                  : display_name               ,
+            "email"                         : email                      ,
+            "bio"                           : bio                        ,
+            "matrix_user_id"                : matrix_user_id             ,
+            "show_avatars"                  : show_avatars               ,
+            "send_notifications_to_email"   : send_notifications_to_email,
+            "bot_account"                   : bot_account                ,
+            "show_bot_accounts"             : show_bot_accounts          ,
+            "show_read_posts"               : show_read_posts            ,
+            "show_new_post_notifs"          : show_new_post_notifs       ,
+            "discussion_languages"          : discussion_languages       ,
+            "generate_totp_2fa"             : generate_totp_2fa          ,
+            "open_links_in_new_tab"         : open_links_in_new_tab
+            }
+        res = self._req.lemmyRequest("saveUserSettings", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def changePassword(self, 
+        new_password: str,
+        new_password_verify: str,
+        old_password: str,
+        instance:str=None):
+        """
+        Change password
+        
+        Args:
+            new_password (str): New password
+            new_password_verify (str): New password repeated for verification
+            old_password (str): Old password to verify identity
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Password changed response
+        """
+        form = {
+            "new_password": new_password,
+            "new_password_verify" : new_password_verify,
+            "old_password": old_password
+        }
+        res = self._req.lemmyRequest("changePassword", instance=instance, form=form, auth=True)
+        return res
+        
+    def getReportCount(self,community_id:int=None, instance:str=None):
+        """
+        Get the report count
+        
+        Args:
+            community_id (int): ID of the community. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Report count response
+        """
+        form={}
+        optional={
+            "community_id": community_id
+            }
+        res = self._req.lemmyRequest("getReportCount", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def getUnreadCount(self, instance:str=None):
+        """
+        Get the unread count
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Unread count response
+        """
+        form={}
+        res = self._req.lemmyRequest("getUnreadCount", instance=instance, form=form, auth=True)
+        return res
+        
+    def verifyEmail(self, instance:str=None, token:str=None):
+        """
+        Verify an email address
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            token (str): Authentication token from email
+        Returns:
+            Password changed response
+        """
+        form={ "token": token }
+        res = self._req.lemmyRequest("verifyEmail", instance=instance, form=form, auth=False)
+        return res
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class User +(_req: Requestor) +
+
+
+
+ +Expand source code + +
class User():
+    def __init__(self, _req: Requestor):
+        self._req = _req
+    def leaveAdmin(self, instance:str=None):
+        """
+        Leave the administrator team of a site
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Removed community response
+        """
+        form = {}
+        res = self._req.lemmyRequest("leaveAdmin", instance=instance, form=form, auth=True)
+    def register(self, 
+        username:str, 
+        password:str, 
+        password_verify:str, 
+        show_nsfw:bool, 
+        email:str=None, 
+        captcha_uuid:str=None, 
+        captcha_answer:str=None, 
+        honeypot:str=None, 
+        answer:str=None, 
+        instance:str=None):
+        """
+        Register at an instance
+        
+        Args:
+            username (str): Username to use for account
+            password (str): Password for account
+            password_verify (str): Password repeated for verification
+            show_nsfw (bool): If NSFW posts should be shown
+            email (str): Email address associated with the account. Optional
+            captcha_uuid (str): UUID of the captcha. Optional. Required if site requires captcha.
+            captcha_answer (str): Answer to the captcha. Optional. Required if site requires captcha.
+            honeypot (str): Honeypot field. Used for detecting bots which autofill all fields. Do not use unless trying to explicitly trigger honeypot
+            answer (str): Answer to sign up question
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Removed community response
+        """
+        form={
+            "username": username,
+            "password": password,
+            "password_verify": password_verify,
+            "show_nsfw": show_nsfw
+            }
+        optional = {       
+            "email"          :email          ,
+            "captcha_uuid"   :captcha_uuid   ,
+            "captcha_uuid"   :captcha_uuid   ,
+            "limit"          :limit          ,
+            "honeypot"       :honeypot       ,
+            "answer"         :answer         ,
+            }
+        res = self._req.lemmyRequest("register", instance=instance, form=form, optional=optional, auth=False)
+        return res
+    def getDetails(self, person_id:str=None, username:str=None, sort:SortType=None, page:int=None, limit:int=None, community_id:int=None, saved_only:bool=None, instance:str=None, auth:bool=True):
+        """
+        Get details of a user
+        
+        Args:
+            person_id (int): User ID of the person to get the details of. Optional.
+            username (str): Username of the user to get the details of. Optional
+            sort (SortType): Sort order of user list. Optional
+            page (int): Page number to get.
+            limit (int): Limit for number of users to return
+            community_id (int): Community to filter by for user
+            saved_only (bool): Show only saved objects
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            auth (bool): If true, authenticate using login. Defaults to True.
+            
+        Returns:
+            List of items which follow the filters given
+        """
+        form={}
+        optional={
+            "sort"          :   sort              ,
+            "person_id"     :   person_id         ,
+            "username"      :   username          ,
+            "page"          :   page              ,
+            "limit"         :   limit             ,
+            "community_id"  :   community_id      ,
+            "saved_only"    :   saved_only        ,
+            }
+        res = self._req.lemmyRequest("getPersonDetails", instance=instance, form=form, optional=optional, auth=auth)
+        return res
+    
+    def markMentionAsRead(self, person_mention_id:int, read:bool=True, instance:str=None):
+        """
+        Mark a mention as read or unread
+        
+        Args:
+            person_mention_id (int): ID of the mention
+            read (bool): If true, marks mention as read. False marks unread. Defaults to True. Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of items which follow the filters given
+        """
+        form={
+            "person_mention_id": person_mention_id,
+            "read": read
+            }
+        res = self._req.lemmyRequest("markPersonMentionAsRead", instance=instance, form=form, auth=True)
+        return res
+    
+    def getMentions(self, sort:SortType=None, page:int=None, limit:int=None, unread_only:bool=True, instance:str=None):
+        """
+        Get the list of mentions
+        
+        Args:
+            sort (SortType): Sort order of mention list. Optional
+            page (int): Page number to get. Optional.
+            limit (int): Limit for number of mentions to return. Optional.
+            unread_only (bool): Show only unread mentions. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of mentions
+        """
+        form={}
+        optional = {
+            "sort"           :  sort           ,
+            "page"           :  page           ,
+            "limit"          :  limit          ,
+            "unread_only"    :  unread_only    ,
+            }
+        res = self._req.lemmyRequest("getPersonMentions", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def getReplies(self, sort:SortType=None, page:int=None, limit:int=None, unread_only:bool=True):
+        """
+        Get the list of replies
+        
+        Args:
+            sort (SortType): Sort order of reply list. Optional
+            page (int): Page number to get. Optional.
+            limit (int): Limit for number of replies to return. Optional.
+            unread_only (bool): Show only unread replies. Optional. Defaults to true.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of replies
+        """
+        form={}
+        optional = {
+            "sort"           :  sort           ,
+            "page"           :  page           ,
+            "limit"          :  limit          ,
+            "unread_only"    :  unread_only    ,
+            }
+        res = self._req.lemmyRequest("getReplies", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def ban(self, person_id:int, ban:bool, remove_data:bool=None, reason:str=None, expires:int=None, instance:str=None):
+        """
+        Ban a user from the instance
+        
+        Args:
+            person_id (int): User ID of the person to ban
+            ban (bool): If the user is banned from the instance.
+            remove_data (bool): Remove the data of the user. Optional.
+            expires (int): Unix Timestamp of ban expiration (seconds). Optional.
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Banned user 
+        """
+        form={
+            "person_id"     :person_id,
+            "ban"           :ban
+            }
+        optional = {
+            "remove_data"    :remove_data   ,
+            "reason"         :reason        ,
+            "expires"        :expires
+            }
+        res = self._req.lemmyRequest("banPerson", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    
+    def getBanned(self, instance:str=None):
+        """
+        Get the list of banned users
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            List of banned users
+        """
+        form={}
+        res = self._req.lemmyRequest(HttpType.GET, "getBannedPersons", instance=instance, form=form, auth=True)
+        return res
+     
+    def block(self, person_id:int, block:bool, instance:str=None):
+        """"
+        Block or unblock a user
+        
+        Args:
+            person_id (int): ID of the user to block
+            block (bool): True to block user. False to unblock user. 
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Blocked user response
+        """
+        form={
+            "person_id": person_id,
+            "block": block
+            }
+        res = self._req.lemmyRequest("blockPerson", instance=instance, form=form, auth=True)
+        return res
+    
+    def getCaptcha(self, instance:str=None): 
+        """
+        Get a new captcha from an instance
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Captcha
+        """
+        form={}
+        res = self._req.lemmyRequest("getCaptcha", instance=instance, form=form, auth=True)
+        return res
+    
+    def deleteAccount(self, password:str, instance:str=None): 
+        """
+        Delete an account
+        
+        Args:
+            password (str): password to verify account deletion
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Deleted account response
+        """
+        form={
+            "password": password
+            }
+        res = self._req.lemmyRequest("deleteAccount", instance=instance, form=form, auth=True)
+        return res
+    
+    def passwordReset(self, email:str, instance:str=None): 
+        """
+        Reset an account password associated with an email
+        
+        Args:
+            email (str): Email address an account is associated with
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Pasword reset response
+        """
+        form={
+            "email": email
+            }
+        res = self._req.lemmyRequest("passwordReset", instance=instance, form=form, auth=False)
+        return res
+        
+    def passwordChangeAfterReset(self, token:str, password:str, password_verify:str, instance:str=None):
+        """
+        Change a password after reset request
+        
+        Args:
+            token (str): Reset token sent to email address
+            password (str): New password
+            password_verify (str): New password repeated for verification
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Password reset response
+        """
+        form={
+            "token": token,
+            "password": password,
+            "password_verify": password_verify
+            }
+        res = self._req.lemmyRequest("passwordChangeAfterReset", instance=instance, form=form, auth=False)
+        return res
+        
+    def markAllAsRead(self, instance:str=None):
+        """
+        Mark all as read
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Mark read response
+        """
+        form={}
+        res = self._req.lemmyRequest("markAllAsRead", instance=instance, form=form, auth=True)
+        return res
+        
+    def saveUserSettings(self,
+        show_nsfw: bool=None,
+        show_scores: bool=None,
+        theme: str=None,
+        default_sort_type: SortType=None,
+        default_listing_type: ListingType=None,
+        interface_language: str=None,
+        avatar: str=None,
+        banner: str=None,
+        display_name: str=None,
+        email: str=None,
+        bio: str=None,
+        matrix_user_id: str=None,
+        show_avatars: bool=None,
+        send_notifications_to_email: bool=None,
+        bot_account: bool=None,
+        show_bot_accounts: bool=None,
+        show_read_posts: bool=None, 
+        show_new_post_notifs: bool=None, 
+        discussion_languages: List[int]=None, 
+        generate_totp_2fa: bool=None, 
+        open_links_in_new_tab: bool=None,
+        instance:str=None):
+        """
+        Save user settings to account
+        
+        Args:
+            show_nsfw (bool): If NSFW posts and communities should be shown. Optional
+            show_scores (bool) If scores should be shown. Optional
+            theme (str): Site theme. Optional
+            default_sort_type (SortType): Sort type for the site. Optional
+            default_listing_type (ListingType): Default listing type. Allows viewing Local or All communities. Optional
+            interface_language (str): Interface language string. Optional
+            avatar (str): URL of avatar. Optional
+            banner (str): URL of user banner. Optional
+            display_name (str): DIsplay name of the user. Optional
+            email (str): Email address associated with the account. Optional
+            bio (str): User Bio/Description. Optional
+            matrix_user_id (str): Matrix user ID. Optional
+            show_avatars (bool): If user avatars should be shown next to names. Optional 
+            send_notifications_to_email (bool): If email notifications should be sent to the user. Optional
+            bot_account (bool): If this is a bot account. Optional
+            show_bot_accounts (bool): If bot accounts should be hidden. Optional 
+            show_read_posts (bool): If read posts should be shown or hidden . Optional
+            show_new_post_notifs (bool): If new posts should send a notification. Optional
+            discussion_languages (List[int]): List of langages to show. Using undefined may cause no posts to show. Optional
+            generate_totp_2fa (bool): Use TOTP 2FA. Optional
+            open_links_in_new_tab (bool): Open links in new tab. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            User settings saved response
+        """ 
+        form = {}
+        optional = {
+            "show_nsfw"                     : show_nsfw                  ,
+            "show_scores"                   : show_scores                ,
+            "theme"                         : theme                      ,
+            "default_sort_type"             : default_sort_type          ,
+            "default_listing_type"          : default_listing_type       ,
+            "interface_language"            : interface_language         ,
+            "avatar"                        : avatar                     ,
+            "banner"                        : banner                     ,
+            "display_name"                  : display_name               ,
+            "email"                         : email                      ,
+            "bio"                           : bio                        ,
+            "matrix_user_id"                : matrix_user_id             ,
+            "show_avatars"                  : show_avatars               ,
+            "send_notifications_to_email"   : send_notifications_to_email,
+            "bot_account"                   : bot_account                ,
+            "show_bot_accounts"             : show_bot_accounts          ,
+            "show_read_posts"               : show_read_posts            ,
+            "show_new_post_notifs"          : show_new_post_notifs       ,
+            "discussion_languages"          : discussion_languages       ,
+            "generate_totp_2fa"             : generate_totp_2fa          ,
+            "open_links_in_new_tab"         : open_links_in_new_tab
+            }
+        res = self._req.lemmyRequest("saveUserSettings", instance=instance, form=form, optional=optional, auth=True)
+        return res
+    def changePassword(self, 
+        new_password: str,
+        new_password_verify: str,
+        old_password: str,
+        instance:str=None):
+        """
+        Change password
+        
+        Args:
+            new_password (str): New password
+            new_password_verify (str): New password repeated for verification
+            old_password (str): Old password to verify identity
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Password changed response
+        """
+        form = {
+            "new_password": new_password,
+            "new_password_verify" : new_password_verify,
+            "old_password": old_password
+        }
+        res = self._req.lemmyRequest("changePassword", instance=instance, form=form, auth=True)
+        return res
+        
+    def getReportCount(self,community_id:int=None, instance:str=None):
+        """
+        Get the report count
+        
+        Args:
+            community_id (int): ID of the community. Optional
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Report count response
+        """
+        form={}
+        optional={
+            "community_id": community_id
+            }
+        res = self._req.lemmyRequest("getReportCount", instance=instance, form=form, optional=optional, auth=True)
+        return res
+        
+    def getUnreadCount(self, instance:str=None):
+        """
+        Get the unread count
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            
+        Returns:
+            Unread count response
+        """
+        form={}
+        res = self._req.lemmyRequest("getUnreadCount", instance=instance, form=form, auth=True)
+        return res
+        
+    def verifyEmail(self, instance:str=None, token:str=None):
+        """
+        Verify an email address
+        
+        Args:
+            instance (str): URL of local instance. Optional. Default None uses logged in instance
+            token (str): Authentication token from email
+        Returns:
+            Password changed response
+        """
+        form={ "token": token }
+        res = self._req.lemmyRequest("verifyEmail", instance=instance, form=form, auth=False)
+        return res
+
+

Methods

+
+
+def ban(self, person_id: int, ban: bool, remove_data: bool = None, reason: str = None, expires: int = None, instance: str = None) +
+
+

Ban a user from the instance

+

Args

+
+
person_id : int
+
User ID of the person to ban
+
ban : bool
+
If the user is banned from the instance.
+
remove_data : bool
+
Remove the data of the user. Optional.
+
expires : int
+
Unix Timestamp of ban expiration (seconds). Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Banned user

+
+ +Expand source code + +
def ban(self, person_id:int, ban:bool, remove_data:bool=None, reason:str=None, expires:int=None, instance:str=None):
+    """
+    Ban a user from the instance
+    
+    Args:
+        person_id (int): User ID of the person to ban
+        ban (bool): If the user is banned from the instance.
+        remove_data (bool): Remove the data of the user. Optional.
+        expires (int): Unix Timestamp of ban expiration (seconds). Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Banned user 
+    """
+    form={
+        "person_id"     :person_id,
+        "ban"           :ban
+        }
+    optional = {
+        "remove_data"    :remove_data   ,
+        "reason"         :reason        ,
+        "expires"        :expires
+        }
+    res = self._req.lemmyRequest("banPerson", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def block(self, person_id: int, block: bool, instance: str = None) +
+
+

" +Block or unblock a user

+

Args

+
+
person_id : int
+
ID of the user to block
+
block : bool
+
True to block user. False to unblock user.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Blocked user response

+
+ +Expand source code + +
def block(self, person_id:int, block:bool, instance:str=None):
+    """"
+    Block or unblock a user
+    
+    Args:
+        person_id (int): ID of the user to block
+        block (bool): True to block user. False to unblock user. 
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Blocked user response
+    """
+    form={
+        "person_id": person_id,
+        "block": block
+        }
+    res = self._req.lemmyRequest("blockPerson", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def changePassword(self, new_password: str, new_password_verify: str, old_password: str, instance: str = None) +
+
+

Change password

+

Args

+
+
new_password : str
+
New password
+
new_password_verify : str
+
New password repeated for verification
+
old_password : str
+
Old password to verify identity
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Password changed response

+
+ +Expand source code + +
def changePassword(self, 
+    new_password: str,
+    new_password_verify: str,
+    old_password: str,
+    instance:str=None):
+    """
+    Change password
+    
+    Args:
+        new_password (str): New password
+        new_password_verify (str): New password repeated for verification
+        old_password (str): Old password to verify identity
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Password changed response
+    """
+    form = {
+        "new_password": new_password,
+        "new_password_verify" : new_password_verify,
+        "old_password": old_password
+    }
+    res = self._req.lemmyRequest("changePassword", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def deleteAccount(self, password: str, instance: str = None) +
+
+

Delete an account

+

Args

+
+
password : str
+
password to verify account deletion
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Deleted account response

+
+ +Expand source code + +
def deleteAccount(self, password:str, instance:str=None): 
+    """
+    Delete an account
+    
+    Args:
+        password (str): password to verify account deletion
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Deleted account response
+    """
+    form={
+        "password": password
+        }
+    res = self._req.lemmyRequest("deleteAccount", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def getBanned(self, instance: str = None) +
+
+

Get the list of banned users

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of banned users

+
+ +Expand source code + +
def getBanned(self, instance:str=None):
+    """
+    Get the list of banned users
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of banned users
+    """
+    form={}
+    res = self._req.lemmyRequest(HttpType.GET, "getBannedPersons", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def getCaptcha(self, instance: str = None) +
+
+

Get a new captcha from an instance

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Captcha

+
+ +Expand source code + +
def getCaptcha(self, instance:str=None): 
+    """
+    Get a new captcha from an instance
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Captcha
+    """
+    form={}
+    res = self._req.lemmyRequest("getCaptcha", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def getDetails(self, person_id: str = None, username: str = None, sort: SortType = None, page: int = None, limit: int = None, community_id: int = None, saved_only: bool = None, instance: str = None, auth: bool = True) +
+
+

Get details of a user

+

Args

+
+
person_id : int
+
User ID of the person to get the details of. Optional.
+
username : str
+
Username of the user to get the details of. Optional
+
sort : SortType
+
Sort order of user list. Optional
+
page : int
+
Page number to get.
+
limit : int
+
Limit for number of users to return
+
community_id : int
+
Community to filter by for user
+
saved_only : bool
+
Show only saved objects
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
auth : bool
+
If true, authenticate using login. Defaults to True.
+
+

Returns

+

List of items which follow the filters given

+
+ +Expand source code + +
def getDetails(self, person_id:str=None, username:str=None, sort:SortType=None, page:int=None, limit:int=None, community_id:int=None, saved_only:bool=None, instance:str=None, auth:bool=True):
+    """
+    Get details of a user
+    
+    Args:
+        person_id (int): User ID of the person to get the details of. Optional.
+        username (str): Username of the user to get the details of. Optional
+        sort (SortType): Sort order of user list. Optional
+        page (int): Page number to get.
+        limit (int): Limit for number of users to return
+        community_id (int): Community to filter by for user
+        saved_only (bool): Show only saved objects
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        auth (bool): If true, authenticate using login. Defaults to True.
+        
+    Returns:
+        List of items which follow the filters given
+    """
+    form={}
+    optional={
+        "sort"          :   sort              ,
+        "person_id"     :   person_id         ,
+        "username"      :   username          ,
+        "page"          :   page              ,
+        "limit"         :   limit             ,
+        "community_id"  :   community_id      ,
+        "saved_only"    :   saved_only        ,
+        }
+    res = self._req.lemmyRequest("getPersonDetails", instance=instance, form=form, optional=optional, auth=auth)
+    return res
+
+
+
+def getMentions(self, sort: SortType = None, page: int = None, limit: int = None, unread_only: bool = True, instance: str = None) +
+
+

Get the list of mentions

+

Args

+
+
sort : SortType
+
Sort order of mention list. Optional
+
page : int
+
Page number to get. Optional.
+
limit : int
+
Limit for number of mentions to return. Optional.
+
unread_only : bool
+
Show only unread mentions. Optional. Defaults to true.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of mentions

+
+ +Expand source code + +
def getMentions(self, sort:SortType=None, page:int=None, limit:int=None, unread_only:bool=True, instance:str=None):
+    """
+    Get the list of mentions
+    
+    Args:
+        sort (SortType): Sort order of mention list. Optional
+        page (int): Page number to get. Optional.
+        limit (int): Limit for number of mentions to return. Optional.
+        unread_only (bool): Show only unread mentions. Optional. Defaults to true.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of mentions
+    """
+    form={}
+    optional = {
+        "sort"           :  sort           ,
+        "page"           :  page           ,
+        "limit"          :  limit          ,
+        "unread_only"    :  unread_only    ,
+        }
+    res = self._req.lemmyRequest("getPersonMentions", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def getReplies(self, sort: SortType = None, page: int = None, limit: int = None, unread_only: bool = True) +
+
+

Get the list of replies

+

Args

+
+
sort : SortType
+
Sort order of reply list. Optional
+
page : int
+
Page number to get. Optional.
+
limit : int
+
Limit for number of replies to return. Optional.
+
unread_only : bool
+
Show only unread replies. Optional. Defaults to true.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of replies

+
+ +Expand source code + +
def getReplies(self, sort:SortType=None, page:int=None, limit:int=None, unread_only:bool=True):
+    """
+    Get the list of replies
+    
+    Args:
+        sort (SortType): Sort order of reply list. Optional
+        page (int): Page number to get. Optional.
+        limit (int): Limit for number of replies to return. Optional.
+        unread_only (bool): Show only unread replies. Optional. Defaults to true.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of replies
+    """
+    form={}
+    optional = {
+        "sort"           :  sort           ,
+        "page"           :  page           ,
+        "limit"          :  limit          ,
+        "unread_only"    :  unread_only    ,
+        }
+    res = self._req.lemmyRequest("getReplies", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def getReportCount(self, community_id: int = None, instance: str = None) +
+
+

Get the report count

+

Args

+
+
community_id : int
+
ID of the community. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Report count response

+
+ +Expand source code + +
def getReportCount(self,community_id:int=None, instance:str=None):
+    """
+    Get the report count
+    
+    Args:
+        community_id (int): ID of the community. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Report count response
+    """
+    form={}
+    optional={
+        "community_id": community_id
+        }
+    res = self._req.lemmyRequest("getReportCount", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def getUnreadCount(self, instance: str = None) +
+
+

Get the unread count

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Unread count response

+
+ +Expand source code + +
def getUnreadCount(self, instance:str=None):
+    """
+    Get the unread count
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Unread count response
+    """
+    form={}
+    res = self._req.lemmyRequest("getUnreadCount", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def leaveAdmin(self, instance: str = None) +
+
+

Leave the administrator team of a site

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Removed community response

+
+ +Expand source code + +
def leaveAdmin(self, instance:str=None):
+    """
+    Leave the administrator team of a site
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Removed community response
+    """
+    form = {}
+    res = self._req.lemmyRequest("leaveAdmin", instance=instance, form=form, auth=True)
+
+
+
+def markAllAsRead(self, instance: str = None) +
+
+

Mark all as read

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Mark read response

+
+ +Expand source code + +
def markAllAsRead(self, instance:str=None):
+    """
+    Mark all as read
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Mark read response
+    """
+    form={}
+    res = self._req.lemmyRequest("markAllAsRead", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def markMentionAsRead(self, person_mention_id: int, read: bool = True, instance: str = None) +
+
+

Mark a mention as read or unread

+

Args

+
+
person_mention_id : int
+
ID of the mention
+
read : bool
+
If true, marks mention as read. False marks unread. Defaults to True. Optional.
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

List of items which follow the filters given

+
+ +Expand source code + +
def markMentionAsRead(self, person_mention_id:int, read:bool=True, instance:str=None):
+    """
+    Mark a mention as read or unread
+    
+    Args:
+        person_mention_id (int): ID of the mention
+        read (bool): If true, marks mention as read. False marks unread. Defaults to True. Optional.
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        List of items which follow the filters given
+    """
+    form={
+        "person_mention_id": person_mention_id,
+        "read": read
+        }
+    res = self._req.lemmyRequest("markPersonMentionAsRead", instance=instance, form=form, auth=True)
+    return res
+
+
+
+def passwordChangeAfterReset(self, token: str, password: str, password_verify: str, instance: str = None) +
+
+

Change a password after reset request

+

Args

+
+
token : str
+
Reset token sent to email address
+
password : str
+
New password
+
password_verify : str
+
New password repeated for verification
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Password reset response

+
+ +Expand source code + +
def passwordChangeAfterReset(self, token:str, password:str, password_verify:str, instance:str=None):
+    """
+    Change a password after reset request
+    
+    Args:
+        token (str): Reset token sent to email address
+        password (str): New password
+        password_verify (str): New password repeated for verification
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Password reset response
+    """
+    form={
+        "token": token,
+        "password": password,
+        "password_verify": password_verify
+        }
+    res = self._req.lemmyRequest("passwordChangeAfterReset", instance=instance, form=form, auth=False)
+    return res
+
+
+
+def passwordReset(self, email: str, instance: str = None) +
+
+

Reset an account password associated with an email

+

Args

+
+
email : str
+
Email address an account is associated with
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Pasword reset response

+
+ +Expand source code + +
def passwordReset(self, email:str, instance:str=None): 
+    """
+    Reset an account password associated with an email
+    
+    Args:
+        email (str): Email address an account is associated with
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Pasword reset response
+    """
+    form={
+        "email": email
+        }
+    res = self._req.lemmyRequest("passwordReset", instance=instance, form=form, auth=False)
+    return res
+
+
+
+def register(self, username: str, password: str, password_verify: str, show_nsfw: bool, email: str = None, captcha_uuid: str = None, captcha_answer: str = None, honeypot: str = None, answer: str = None, instance: str = None) +
+
+

Register at an instance

+

Args

+
+
username : str
+
Username to use for account
+
password : str
+
Password for account
+
password_verify : str
+
Password repeated for verification
+
show_nsfw : bool
+
If NSFW posts should be shown
+
email : str
+
Email address associated with the account. Optional
+
captcha_uuid : str
+
UUID of the captcha. Optional. Required if site requires captcha.
+
captcha_answer : str
+
Answer to the captcha. Optional. Required if site requires captcha.
+
honeypot : str
+
Honeypot field. Used for detecting bots which autofill all fields. Do not use unless trying to explicitly trigger honeypot
+
answer : str
+
Answer to sign up question
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

Removed community response

+
+ +Expand source code + +
def register(self, 
+    username:str, 
+    password:str, 
+    password_verify:str, 
+    show_nsfw:bool, 
+    email:str=None, 
+    captcha_uuid:str=None, 
+    captcha_answer:str=None, 
+    honeypot:str=None, 
+    answer:str=None, 
+    instance:str=None):
+    """
+    Register at an instance
+    
+    Args:
+        username (str): Username to use for account
+        password (str): Password for account
+        password_verify (str): Password repeated for verification
+        show_nsfw (bool): If NSFW posts should be shown
+        email (str): Email address associated with the account. Optional
+        captcha_uuid (str): UUID of the captcha. Optional. Required if site requires captcha.
+        captcha_answer (str): Answer to the captcha. Optional. Required if site requires captcha.
+        honeypot (str): Honeypot field. Used for detecting bots which autofill all fields. Do not use unless trying to explicitly trigger honeypot
+        answer (str): Answer to sign up question
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        Removed community response
+    """
+    form={
+        "username": username,
+        "password": password,
+        "password_verify": password_verify,
+        "show_nsfw": show_nsfw
+        }
+    optional = {       
+        "email"          :email          ,
+        "captcha_uuid"   :captcha_uuid   ,
+        "captcha_uuid"   :captcha_uuid   ,
+        "limit"          :limit          ,
+        "honeypot"       :honeypot       ,
+        "answer"         :answer         ,
+        }
+    res = self._req.lemmyRequest("register", instance=instance, form=form, optional=optional, auth=False)
+    return res
+
+
+
+def saveUserSettings(self, show_nsfw: bool = None, show_scores: bool = None, theme: str = None, default_sort_type: SortType = None, default_listing_type: ListingType = None, interface_language: str = None, avatar: str = None, banner: str = None, display_name: str = None, email: str = None, bio: str = None, matrix_user_id: str = None, show_avatars: bool = None, send_notifications_to_email: bool = None, bot_account: bool = None, show_bot_accounts: bool = None, show_read_posts: bool = None, show_new_post_notifs: bool = None, discussion_languages: List[int] = None, generate_totp_2fa: bool = None, open_links_in_new_tab: bool = None, instance: str = None) +
+
+

Save user settings to account

+

Args

+
+
show_nsfw : bool
+
If NSFW posts and communities should be shown. Optional
+
show_scores (bool) If scores should be shown. Optional
+
theme : str
+
Site theme. Optional
+
default_sort_type : SortType
+
Sort type for the site. Optional
+
default_listing_type : ListingType
+
Default listing type. Allows viewing Local or All communities. Optional
+
interface_language : str
+
Interface language string. Optional
+
avatar : str
+
URL of avatar. Optional
+
banner : str
+
URL of user banner. Optional
+
display_name : str
+
DIsplay name of the user. Optional
+
email : str
+
Email address associated with the account. Optional
+
bio : str
+
User Bio/Description. Optional
+
matrix_user_id : str
+
Matrix user ID. Optional
+
show_avatars : bool
+
If user avatars should be shown next to names. Optional
+
send_notifications_to_email : bool
+
If email notifications should be sent to the user. Optional
+
bot_account : bool
+
If this is a bot account. Optional
+
show_bot_accounts : bool
+
If bot accounts should be hidden. Optional
+
show_read_posts : bool
+
If read posts should be shown or hidden . Optional
+
show_new_post_notifs : bool
+
If new posts should send a notification. Optional
+
discussion_languages : List[int]
+
List of langages to show. Using undefined may cause no posts to show. Optional
+
generate_totp_2fa : bool
+
Use TOTP 2FA. Optional
+
open_links_in_new_tab : bool
+
Open links in new tab. Optional
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
+

Returns

+

User settings saved response

+
+ +Expand source code + +
def saveUserSettings(self,
+    show_nsfw: bool=None,
+    show_scores: bool=None,
+    theme: str=None,
+    default_sort_type: SortType=None,
+    default_listing_type: ListingType=None,
+    interface_language: str=None,
+    avatar: str=None,
+    banner: str=None,
+    display_name: str=None,
+    email: str=None,
+    bio: str=None,
+    matrix_user_id: str=None,
+    show_avatars: bool=None,
+    send_notifications_to_email: bool=None,
+    bot_account: bool=None,
+    show_bot_accounts: bool=None,
+    show_read_posts: bool=None, 
+    show_new_post_notifs: bool=None, 
+    discussion_languages: List[int]=None, 
+    generate_totp_2fa: bool=None, 
+    open_links_in_new_tab: bool=None,
+    instance:str=None):
+    """
+    Save user settings to account
+    
+    Args:
+        show_nsfw (bool): If NSFW posts and communities should be shown. Optional
+        show_scores (bool) If scores should be shown. Optional
+        theme (str): Site theme. Optional
+        default_sort_type (SortType): Sort type for the site. Optional
+        default_listing_type (ListingType): Default listing type. Allows viewing Local or All communities. Optional
+        interface_language (str): Interface language string. Optional
+        avatar (str): URL of avatar. Optional
+        banner (str): URL of user banner. Optional
+        display_name (str): DIsplay name of the user. Optional
+        email (str): Email address associated with the account. Optional
+        bio (str): User Bio/Description. Optional
+        matrix_user_id (str): Matrix user ID. Optional
+        show_avatars (bool): If user avatars should be shown next to names. Optional 
+        send_notifications_to_email (bool): If email notifications should be sent to the user. Optional
+        bot_account (bool): If this is a bot account. Optional
+        show_bot_accounts (bool): If bot accounts should be hidden. Optional 
+        show_read_posts (bool): If read posts should be shown or hidden . Optional
+        show_new_post_notifs (bool): If new posts should send a notification. Optional
+        discussion_languages (List[int]): List of langages to show. Using undefined may cause no posts to show. Optional
+        generate_totp_2fa (bool): Use TOTP 2FA. Optional
+        open_links_in_new_tab (bool): Open links in new tab. Optional
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        
+    Returns:
+        User settings saved response
+    """ 
+    form = {}
+    optional = {
+        "show_nsfw"                     : show_nsfw                  ,
+        "show_scores"                   : show_scores                ,
+        "theme"                         : theme                      ,
+        "default_sort_type"             : default_sort_type          ,
+        "default_listing_type"          : default_listing_type       ,
+        "interface_language"            : interface_language         ,
+        "avatar"                        : avatar                     ,
+        "banner"                        : banner                     ,
+        "display_name"                  : display_name               ,
+        "email"                         : email                      ,
+        "bio"                           : bio                        ,
+        "matrix_user_id"                : matrix_user_id             ,
+        "show_avatars"                  : show_avatars               ,
+        "send_notifications_to_email"   : send_notifications_to_email,
+        "bot_account"                   : bot_account                ,
+        "show_bot_accounts"             : show_bot_accounts          ,
+        "show_read_posts"               : show_read_posts            ,
+        "show_new_post_notifs"          : show_new_post_notifs       ,
+        "discussion_languages"          : discussion_languages       ,
+        "generate_totp_2fa"             : generate_totp_2fa          ,
+        "open_links_in_new_tab"         : open_links_in_new_tab
+        }
+    res = self._req.lemmyRequest("saveUserSettings", instance=instance, form=form, optional=optional, auth=True)
+    return res
+
+
+
+def verifyEmail(self, instance: str = None, token: str = None) +
+
+

Verify an email address

+

Args

+
+
instance : str
+
URL of local instance. Optional. Default None uses logged in instance
+
token : str
+
Authentication token from email
+
+

Returns

+

Password changed response

+
+ +Expand source code + +
def verifyEmail(self, instance:str=None, token:str=None):
+    """
+    Verify an email address
+    
+    Args:
+        instance (str): URL of local instance. Optional. Default None uses logged in instance
+        token (str): Authentication token from email
+    Returns:
+        Password changed response
+    """
+    form={ "token": token }
+    res = self._req.lemmyRequest("verifyEmail", instance=instance, form=form, auth=False)
+    return res
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file