-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library for interfacing with Reddit's API -- @package reddit @version 0.2.0.0 module Reddit.Types.SubredditSettings data SubredditSettings SubredditSettings :: Text -> Text -> Text -> ContentOptions -> Integer -> Maybe Text -> Maybe Text -> Bool -> Bool -> Bool -> Bool -> Text -> Integer -> Integer -> WikiEditMode -> SpamFilterStrength -> SpamFilterStrength -> SpamFilterStrength -> Bool -> SubredditType -> SubredditSettings sidebarText :: SubredditSettings -> Text descriptionText :: SubredditSettings -> Text title :: SubredditSettings -> Text linkType :: SubredditSettings -> ContentOptions hideScoreMins :: SubredditSettings -> Integer submitLinkLabel :: SubredditSettings -> Maybe Text submitTextLabel :: SubredditSettings -> Maybe Text domainCSS :: SubredditSettings -> Bool domainSidebar :: SubredditSettings -> Bool showMedia :: SubredditSettings -> Bool over18 :: SubredditSettings -> Bool language :: SubredditSettings -> Text wikiEditKarma :: SubredditSettings -> Integer wikiEditAge :: SubredditSettings -> Integer wikiEditMode :: SubredditSettings -> WikiEditMode spamComments :: SubredditSettings -> SpamFilterStrength spamSelfposts :: SubredditSettings -> SpamFilterStrength spamLinks :: SubredditSettings -> SpamFilterStrength publicTrafficStats :: SubredditSettings -> Bool subredditType :: SubredditSettings -> SubredditType data ContentOptions Any :: ContentOptions Link :: ContentOptions Self :: ContentOptions data SpamFilterStrength FilterLow :: SpamFilterStrength FilterHigh :: SpamFilterStrength FilterAll :: SpamFilterStrength data SubredditType Public :: SubredditType Private :: SubredditType Restricted :: SubredditType GoldRestricted :: SubredditType Archived :: SubredditType data WikiEditMode Anyone :: WikiEditMode ApprovedOnly :: WikiEditMode ModOnly :: WikiEditMode instance Show SubredditType instance Read SubredditType instance Eq SubredditType instance Show ContentOptions instance Read ContentOptions instance Eq ContentOptions instance Show SpamFilterStrength instance Read SpamFilterStrength instance Eq SpamFilterStrength instance Show WikiEditMode instance Read WikiEditMode instance Eq WikiEditMode instance Show SubredditSettings instance Read SubredditSettings instance Eq SubredditSettings instance Default WikiEditMode instance ToQuery WikiEditMode instance ToJSON WikiEditMode instance FromJSON WikiEditMode instance ToQuery SpamFilterStrength instance ToJSON SpamFilterStrength instance FromJSON SpamFilterStrength instance Default ContentOptions instance ToQuery ContentOptions instance ToJSON ContentOptions instance FromJSON ContentOptions instance ToQuery SubredditType instance Default SubredditType instance ToJSON SubredditType instance FromJSON SubredditType instance ToJSON SubredditSettings instance FromJSON SubredditSettings module Reddit.Types.SearchOptions data Order Relevance :: Order New :: Order Hot :: Order Top :: Order MostComments :: Order instance Show Order instance Read Order instance Eq Order instance ToQuery Order module Reddit.Types.Thing class Thing a fullName :: Thing a => a -> Text module Reddit.Types.User newtype Username Username :: Text -> Username newtype UserID UserID :: Text -> UserID data User User :: Text -> Username -> UTCTime -> Integer -> Integer -> Maybe Bool -> Maybe Bool -> Bool -> Maybe Bool -> Bool -> Bool -> Maybe Bool -> User userID :: User -> Text userName :: User -> Username userCreated :: User -> UTCTime linkKarma :: User -> Integer commentKarma :: User -> Integer hasMail :: User -> Maybe Bool hasModMail :: User -> Maybe Bool isFriend :: User -> Bool userIsOver18 :: User -> Maybe Bool isMod :: User -> Bool hasGold :: User -> Bool hasVerifiedEmail :: User -> Maybe Bool newtype UserList UserList :: [Relationship] -> UserList data Relationship Relationship :: Username -> UserID -> UTCTime -> Maybe Text -> Relationship relationUsername :: Relationship -> Username relationUserID :: Relationship -> UserID relationSince :: Relationship -> UTCTime relationNote :: Relationship -> Maybe Text userPrefix :: Text instance Show Username instance Read Username instance Ord Username instance Show UserID instance Read UserID instance Eq UserID instance Ord UserID instance Show User instance Eq User instance Show Relationship instance Read Relationship instance Eq Relationship instance Show UserList instance Read UserList instance Eq UserList instance FromJSON Relationship instance FromJSON UserList instance FromJSON User instance ToQuery UserID instance Thing UserID instance FromJSON UserID instance ToQuery Username instance FromJSON Username instance Eq Username module Reddit.Types.Moderation newtype BanID BanID :: Text -> BanID data Ban Ban :: Username -> UserID -> Text -> UTCTime -> Ban username :: Ban -> Username userID :: Ban -> UserID note :: Ban -> Text since :: Ban -> UTCTime banPrefix :: Text instance Show BanID instance Read BanID instance Eq BanID instance Ord BanID instance Show Ban instance Read Ban instance Eq Ban instance FromJSON Ban instance Thing BanID instance ToQuery BanID instance FromJSON BanID module Reddit.Types.Wiki newtype RevisionID RevisionID :: Text -> RevisionID data WikiPage WikiPage :: Maybe Text -> Text -> UTCTime -> Username -> Bool -> WikiPage contentHTML :: WikiPage -> Maybe Text contentMarkdown :: WikiPage -> Text revisionDate :: WikiPage -> UTCTime revisedBy :: WikiPage -> Username canRevise :: WikiPage -> Bool instance Show RevisionID instance Read RevisionID instance Eq RevisionID instance Show WikiPage instance Read WikiPage instance Eq WikiPage instance FromJSON WikiPage module Reddit.Types.Subreddit newtype SubredditName R :: Text -> SubredditName newtype SubredditID SubredditID :: Text -> SubredditID data Subreddit Subreddit :: SubredditID -> SubredditName -> Text -> Integer -> Maybe Bool -> Subreddit subredditID :: Subreddit -> SubredditID name :: Subreddit -> SubredditName title :: Subreddit -> Text subscribers :: Subreddit -> Integer userIsBanned :: Subreddit -> Maybe Bool subredditPrefix :: Text instance Show SubredditName instance Read SubredditName instance Show SubredditID instance Read SubredditID instance Eq SubredditID instance Ord SubredditID instance Show Subreddit instance Eq Subreddit instance Thing Subreddit instance FromJSON Subreddit instance ToQuery SubredditID instance Thing SubredditID instance FromJSON SubredditID instance FromJSON SubredditName instance ToQuery SubredditName instance Ord SubredditName instance Eq SubredditName module Reddit.Types.Options data PaginationOption a Before :: a -> PaginationOption a After :: a -> PaginationOption a data Options a Options :: Maybe (PaginationOption a) -> Maybe Int -> Options a pagination :: Options a -> Maybe (PaginationOption a) limit :: Options a -> Maybe Int before :: Options a -> Maybe a after :: Options a -> Maybe a instance Show a => Show (PaginationOption a) instance Read a => Read (PaginationOption a) instance Eq a => Eq (PaginationOption a) instance Show a => Show (Options a) instance Read a => Read (Options a) instance Eq a => Eq (Options a) instance Default (Options a) module Reddit.Types.Listing data ListingType Hot :: ListingType New :: ListingType Rising :: ListingType Controversial :: ListingType Top :: ListingType data Listing t a Listing :: Maybe t -> Maybe t -> [a] -> Listing t a before :: Listing t a -> Maybe t after :: Listing t a -> Maybe t contents :: Listing t a -> [a] instance Show ListingType instance Read ListingType instance Eq ListingType instance (Show t, Show a) => Show (Listing t a) instance (Read t, Read a) => Read (Listing t a) instance (Eq t, Eq a) => Eq (Listing t a) instance (FromJSON t, FromJSON a) => FromJSON (Listing t a) instance Ord t => Monoid (Listing t a) instance Functor (Listing t) instance ToQuery ListingType module Reddit.Types.Flair data Flair Flair :: Username -> Maybe Text -> Maybe Text -> Flair user :: Flair -> Username text :: Flair -> Maybe Text cssClass :: Flair -> Maybe Text data FList FList :: [Flair] -> (Maybe UserID) -> (Maybe UserID) -> FList type FlairListing = Listing UserID Flair flistToListing :: FList -> FlairListing instance Show Flair instance Read Flair instance Eq Flair instance Show FList instance Read FList instance Eq FList instance FromJSON FList instance FromJSON Flair module Reddit.Types.Error data RedditError RedditError :: Object -> RedditError FailError :: Text -> RedditError InvalidResponseError :: RedditError CaptchaError :: Text -> RedditError CredentialsError :: RedditError RateLimitError :: Integer -> Text -> RedditError NoSubredditSpecified :: RedditError NoURLSpecified :: RedditError NoName :: RedditError NoText :: Text -> RedditError AlreadySubmitted :: RedditError CommentDeleted :: RedditError LinkDeleted :: RedditError BadSubredditName :: RedditError TooManyRequests :: RedditError instance Show RedditError instance Eq RedditError instance ErrorReceivable RedditError instance FromJSON RedditError module Reddit.Types.Reddit type Reddit a = RedditT IO a newtype RedditT m a RedditT :: (FreeT (RedditF m) m a) -> RedditT m a data RedditF m a FailWith :: APIError RedditError -> RedditF m a Nest :: RedditT m b -> (Either (APIError RedditError) b -> a) -> RedditF m a NestResuming :: RedditT m b -> (Either (APIError RedditError, Maybe (RedditT m b)) b -> a) -> RedditF m a ReceiveRoute :: Route -> (b -> a) -> RedditF m a RunRoute :: Route -> (b -> a) -> RedditF m a WithBaseURL :: Text -> RedditT m b -> (b -> a) -> RedditF m a runRoute :: (FromJSON a, Monad m) => Route -> RedditT m a receiveRoute :: (Receivable a, Monad m) => Route -> RedditT m a nest :: Monad m => RedditT m a -> RedditT m (Either (APIError RedditError) a) failWith :: Monad m => APIError RedditError -> RedditT m a withBaseURL :: Monad m => Text -> RedditT m a -> RedditT m a newtype Modhash Modhash :: Text -> Modhash data LoginDetails LoginDetails :: Modhash -> CookieJar -> LoginDetails newtype POSTWrapped a POSTWrapped :: a -> POSTWrapped a type ShouldRateLimit = Bool data RateLimits RateLimits :: ShouldRateLimit -> Maybe RateLimitInfo -> RateLimits should :: RateLimits -> ShouldRateLimit info :: RateLimits -> Maybe RateLimitInfo data RateLimitInfo RateLimitInfo :: Integer -> Integer -> UTCTime -> RateLimitInfo used :: RateLimitInfo -> Integer remaining :: RateLimitInfo -> Integer resetTime :: RateLimitInfo -> UTCTime headersToRateLimitInfo :: ResponseHeaders -> UTCTime -> Maybe RateLimitInfo builder :: Builder mainBaseURL :: Text loginBaseURL :: Text addHeader :: Maybe ByteString -> Request -> Request addAPIType :: Route -> Route instance Monad m => Functor (RedditT m) instance Monad m => Applicative (RedditT m) instance Monad m => Monad (RedditT m) instance Show Modhash instance Read Modhash instance Eq Modhash instance Show LoginDetails instance Eq LoginDetails instance Show a => Show (POSTWrapped a) instance Read a => Read (POSTWrapped a) instance Eq a => Eq (POSTWrapped a) instance Show RateLimitInfo instance Read RateLimitInfo instance Eq RateLimitInfo instance Show RateLimits instance Read RateLimits instance Eq RateLimits instance Functor POSTWrapped instance Receivable LoginDetails instance FromJSON Modhash instance MonadIO m => MonadIO (RedditT m) instance MonadTrans RedditT instance Functor (RedditF m) module Reddit.Login -- | Make a login request with the given username and password. login :: Monad m => Text -> Text -> RedditT m LoginDetails -- | Contains actions for handling flair on a subreddit-wise basis. module Reddit.Actions.Flair -- | Get the flair list for a subreddit. Requires moderator privileges on -- the subreddit. getFlairList :: Monad m => SubredditName -> RedditT m FlairListing -- | Get the flair list for a subreddit (with Options). Requires -- moderator privileges on the subreddit. getFlairList' :: Monad m => Options UserID -> SubredditName -> RedditT m FlairListing -- | Add link flair to the subreddit-wide template for a subreddit that you -- moderate. Requires moderator privileges on the subreddit. addLinkFlair :: Monad m => SubredditName -> Text -> Text -> Bool -> RedditT m () flairCSV :: Monad m => SubredditName -> [(Username, Text, Text)] -> RedditT m Value module Reddit.Types.Captcha newtype CaptchaID CaptchaID :: Text -> CaptchaID withCaptcha :: Route -> (CaptchaID, Text) -> Route instance Read CaptchaID instance Show CaptchaID instance Eq CaptchaID instance Ord CaptchaID instance FromJSON (POSTWrapped CaptchaID) instance FromJSON CaptchaID -- | Contains Captcha-related actions. Reddit sometimes requests Captchas -- in order to prevent spambots, and you can use this module to get more -- info on them. Unfortunately the library doesn't yet support answering -- Captchas on a widespread scale, and you have to use slightly modified -- variants of other functions to convince Reddit that you aren't a -- robot. module Reddit.Actions.Captcha -- | Find out if the account currently logged in requires a captcha to be -- submitted for certain requests (like sending a private message or -- submitting a post). needsCaptcha :: Monad m => RedditT m Bool -- | Returns the ID of a captcha to be completed (the image for which can -- be found at http://reddit.com/captcha/$CAPTCHA_ID) newCaptcha :: Monad m => RedditT m CaptchaID module Reddit.Types.Post newtype PostID PostID :: Text -> PostID data Post Post :: PostID -> Text -> Text -> Username -> Integer -> UTCTime -> PostContent -> Maybe Bool -> Maybe Text -> Maybe Text -> Text -> Integer -> Bool -> SubredditName -> SubredditID -> Post postID :: Post -> PostID title :: Post -> Text permalink :: Post -> Text author :: Post -> Username score :: Post -> Integer created :: Post -> UTCTime content :: Post -> PostContent liked :: Post -> Maybe Bool flairText :: Post -> Maybe Text flairClass :: Post -> Maybe Text domain :: Post -> Text gilded :: Post -> Integer nsfw :: Post -> Bool subreddit :: Post -> SubredditName subredditID :: Post -> SubredditID data PostContent SelfPost :: Text -> Text -> PostContent Link :: Text -> PostContent TitleOnly :: PostContent buildContent :: Bool -> Maybe Text -> Maybe Text -> Maybe Text -> PostContent type PostListing = Listing PostID Post postPrefix :: Text instance Show PostID instance Read PostID instance Eq PostID instance Ord PostID instance Show PostContent instance Read PostContent instance Eq PostContent instance Show Post instance Read Post instance Eq Post instance ToQuery PostID instance Thing PostID instance Thing Post instance FromJSON Post instance FromJSON (POSTWrapped PostID) instance FromJSON PostID module Reddit.Types.Comment newtype CommentID CommentID :: Text -> CommentID data CommentReference Reference :: Integer -> [CommentID] -> CommentReference Actual :: Comment -> CommentReference -- | isReference c returns is true if c is an actual -- comment, false otherwise isActual :: CommentReference -> Bool -- | isReference c returns is true if c is a reference, -- false otherwise isReference :: CommentReference -> Bool data Comment Comment :: CommentID -> Maybe Integer -> SubredditID -> SubredditName -> Integer -> Bool -> Username -> Maybe Text -> Maybe Text -> Text -> Text -> Listing CommentID CommentReference -> UTCTime -> Maybe UTCTime -> PostID -> Maybe CommentID -> Comment commentID :: Comment -> CommentID score :: Comment -> Maybe Integer subredditID :: Comment -> SubredditID subreddit :: Comment -> SubredditName gilded :: Comment -> Integer saved :: Comment -> Bool author :: Comment -> Username authorFlairCSSClass :: Comment -> Maybe Text authorFlairText :: Comment -> Maybe Text body :: Comment -> Text bodyHTML :: Comment -> Text replies :: Comment -> Listing CommentID CommentReference created :: Comment -> UTCTime edited :: Comment -> Maybe UTCTime parentLink :: Comment -> PostID inReplyTo :: Comment -> Maybe CommentID treeSubComments :: CommentReference -> [CommentReference] isDeleted :: Comment -> Bool data PostComments PostComments :: Post -> [CommentReference] -> PostComments type CommentListing = Listing CommentID Comment commentPrefix :: Text instance Show CommentID instance Read CommentID instance Eq CommentID instance Ord CommentID instance Show Comment instance Read Comment instance Eq Comment instance Show CommentReference instance Read CommentReference instance Eq CommentReference instance Show PostComments instance Read PostComments instance Eq PostComments instance FromJSON PostComments instance FromJSON (POSTWrapped Comment) instance FromJSON Comment instance Thing Comment instance FromJSON (POSTWrapped [CommentReference]) instance FromJSON CommentReference instance FromJSON (POSTWrapped CommentID) instance ToQuery CommentID instance Thing CommentID instance FromJSON CommentID module Reddit.Actions.Search search :: Monad m => Maybe SubredditName -> Options PostID -> Order -> Text -> RedditT m PostListing luceneSearch :: Monad m => Maybe SubredditName -> Options PostID -> Order -> Text -> RedditT m PostListing cloudSearch :: Monad m => Maybe SubredditName -> Options PostID -> Order -> Text -> RedditT m PostListing module Reddit.Types.Message data Message Message :: MessageKind -> Bool -> Username -> Maybe Username -> Text -> Text -> Text -> Listing MessageKind Message -> Message messageID :: Message -> MessageKind new :: Message -> Bool to :: Message -> Username from :: Message -> Maybe Username subject :: Message -> Text body :: Message -> Text bodyHTML :: Message -> Text replies :: Message -> Listing MessageKind Message isPrivateMessage :: Message -> Bool isCommentReply :: Message -> Bool data MessageID MessageID :: Text -> MessageID messagePrefix :: Text data MessageKind CommentMessage :: CommentID -> MessageKind PrivateMessage :: MessageID -> MessageKind instance Show MessageID instance Read MessageID instance Eq MessageID instance Ord MessageID instance Show MessageKind instance Read MessageKind instance Eq MessageKind instance Ord MessageKind instance Show Message instance Read Message instance Eq Message instance ToQuery MessageKind instance Thing MessageKind instance FromJSON MessageKind instance FromJSON (POSTWrapped MessageID) instance ToQuery MessageID instance Thing MessageID instance FromJSON MessageID instance ToQuery Message instance Thing Message instance FromJSON Message -- | Contains message-related actions, like retrieving your own inbox and -- sending other users private messages. module Reddit.Actions.Message -- | Get the message inbox for the current user. getInbox :: Monad m => RedditT m (Listing MessageKind Message) -- | Don't use this for watching for new messages, Reddit's ordering on | -- inbox messages is odd and not likely to work how you expect. getInbox' :: Monad m => Bool -> Options MessageKind -> RedditT m (Listing MessageKind Message) -- | Get any unread messages for the current user. getUnread :: Monad m => RedditT m (Listing MessageKind Message) -- | Get unread messages for the current user, with options. getUnread' :: Monad m => Bool -> Options MessageKind -> RedditT m (Listing MessageKind Message) -- | Mark a message as read. markRead :: (ToQuery a, Thing a, Monad m) => a -> RedditT m () -- | Send a private message to another user. sendMessage :: Monad m => Username -> Text -> Text -> RedditT m () -- | Send a private message (with a captcha). sendMessageWithCaptcha :: Monad m => Username -> Text -> Text -> CaptchaID -> Text -> RedditT m () -- | Reply to a message replyMessage :: (Monad m, Thing a) => a -> Text -> RedditT m MessageID -- | Contains subreddit wiki-related actions. module Reddit.Actions.Wiki -- | Get the specified wiki page on a particular subreddit. Requires -- permission to view the specified wiki page. getWikiPage :: Monad m => SubredditName -> Text -> RedditT m WikiPage -- | Edit the specified wiki page on a particular subreddit. Requires -- permission to edit the specified wiki page. editWikiPage :: Monad m => SubredditName -> Text -> Text -> Text -> RedditT m () -- | Contains comment-related actions, like editing comments and performing -- moderator actions on posts. module Reddit.Actions.Comment -- | Get a CommentListing for the most recent comments on the site -- overall. This maps to http://reddit.com/r/$SUBREDDIT/comments, -- or http://reddit.com/comments if the subreddit is not -- specified. Note that none of the comments returned will have any child -- comments. getNewComments :: Monad m => Maybe SubredditName -> RedditT m CommentListing -- | Get a CommentListing for the most recent comments with the -- specified Options and SubredditName. Note that none of -- the comments returned will have any child comments. If the -- Options is def, then this function is identical to -- getNewComments. getNewComments' :: Monad m => Options CommentID -> Maybe SubredditName -> RedditT m CommentListing -- | Expand children comments that weren't fetched on initial load. -- Equivalent to the web UI's "load more comments" button. getMoreChildren :: Monad m => PostID -> [CommentID] -> RedditT m [CommentReference] -- | Given a CommentID, getCommentInfo will return the full -- details for that comment. getCommentInfo :: Monad m => CommentID -> RedditT m Comment -- | Given a list of CommentIDs, getCommentsInfo will return -- another list containing the full details for all the comments. Note -- that Reddit's API imposes a limitation of 100 comments per request, so -- this function will fail immediately if given a list of more than 100 -- IDs. getCommentsInfo :: Monad m => [CommentID] -> RedditT m CommentListing -- | Edit a comment. editComment :: Monad m => CommentID -> Text -> RedditT m Comment -- | Deletes one of your own comments. Note that this is different from -- removing a comment as a moderator action. deleteComment :: Monad m => CommentID -> RedditT m () -- | Removes a comment (as a moderator action). Note that this is different -- from deleting a comment. removeComment :: Monad m => CommentID -> RedditT m () module Reddit.Actions.Moderation -- | Get a list of existing bans on a subreddit. User must be a moderator -- of the subreddit. bans :: Monad m => Options BanID -> SubredditName -> RedditT m (Listing BanID Ban) -- | Check to see if a user is banned from a subreddit. Logged-in user must -- be a moderator of the subreddit lookupBan :: Monad m => Username -> SubredditName -> RedditT m (Maybe Ban) -- | Contains user-related actions, like finding friends or retrieving a -- user's comments or information. module Reddit.Actions.User -- | Get the information Reddit exposes on user behind the specified -- username getUserInfo :: Monad m => Username -> RedditT m User -- | Get information of the currently-logged-in user. aboutMe :: Monad m => RedditT m User -- | Get the listing of comments authored by the specified user. getUserComments :: Monad m => Username -> RedditT m CommentListing -- | Get the listing of comments authored by the specified user, with -- Options. getUserComments' :: Monad m => Options CommentID -> Username -> RedditT m CommentListing -- | Get the listing of posts authored by the specified user. getUserPosts :: Monad m => Username -> RedditT m PostListing -- | Get the listing of posts authored by the specified user, with Options. getUserPosts' :: Monad m => Options PostID -> Username -> RedditT m PostListing -- | Check whether the specified username is still available or has been -- taken. isUsernameAvailable :: Monad m => Username -> RedditT m Bool -- | Get users blocked by the currently-logged-in user. getBlockedUsers :: Monad m => RedditT m [Relationship] -- | Get friends of the currently-logged-in user. getFriends :: Monad m => RedditT m [Relationship] -- | Check if a user has chosen (or been assign) user flair on a particular -- subreddit. Requires moderator privileges on the specified subreddit. lookupUserFlair :: Monad m => SubredditName -> Username -> RedditT m Flair -- | Set a user's flair on the specified subreddit. Requires moderator -- privileges on the specified subreddit. setUserFlair :: Monad m => SubredditName -> Username -> Text -> Text -> RedditT m () module Reddit.Types newtype CaptchaID CaptchaID :: Text -> CaptchaID data Comment newtype CommentID CommentID :: Text -> CommentID type CommentListing = Listing CommentID Comment data Listing t a Listing :: Maybe t -> Maybe t -> [a] -> Listing t a before :: Listing t a -> Maybe t after :: Listing t a -> Maybe t contents :: Listing t a -> [a] data LoginDetails data Message data MessageID MessageID :: Text -> MessageID data MessageKind CommentMessage :: CommentID -> MessageKind PrivateMessage :: MessageID -> MessageKind data Modhash data Options a Options :: Maybe (PaginationOption a) -> Maybe Int -> Options a pagination :: Options a -> Maybe (PaginationOption a) limit :: Options a -> Maybe Int data PaginationOption a Before :: a -> PaginationOption a After :: a -> PaginationOption a data Post data PostContent SelfPost :: Text -> Text -> PostContent Link :: Text -> PostContent TitleOnly :: PostContent newtype PostID PostID :: Text -> PostID type PostListing = Listing PostID Post type Reddit a = RedditT IO a data RedditError RedditError :: Object -> RedditError FailError :: Text -> RedditError InvalidResponseError :: RedditError CaptchaError :: Text -> RedditError CredentialsError :: RedditError RateLimitError :: Integer -> Text -> RedditError NoSubredditSpecified :: RedditError NoURLSpecified :: RedditError NoName :: RedditError NoText :: Text -> RedditError AlreadySubmitted :: RedditError CommentDeleted :: RedditError LinkDeleted :: RedditError BadSubredditName :: RedditError TooManyRequests :: RedditError data RedditT m a data Subreddit newtype SubredditName R :: Text -> SubredditName class Thing a data User newtype Username Username :: Text -> Username -- | Contains post-related actions, like submitting a post, getting -- information for an existing post, and performing moderator actions on -- posts. module Reddit.Actions.Post -- | Get a PostListing for the Hot posts on the site overall. -- This maps to http://reddit.com. getPosts :: Monad m => RedditT m PostListing -- | Get a PostListing for a specified listing. getPosts' :: Monad m => Options PostID -> ListingType -> Maybe SubredditName -> RedditT m PostListing -- | Get a post and all its comments. getPostComments :: Monad m => PostID -> RedditT m PostComments -- | Get a post and a specific sub-tree of comments. getPostSubComments :: Monad m => PostID -> CommentID -> RedditT m PostComments -- | Get the comments for a post. Ignore the actual post itself. getComments :: Monad m => PostID -> RedditT m [CommentReference] -- | Given a PostID, getPostInfo will return the full details -- for that post. getPostInfo :: Monad m => PostID -> RedditT m Post -- | Given a list of PostIDs, getPostsInfo will return -- another list containing the full details for all the posts. Note that -- Reddit's API imposes a limitation of 100 posts per request, so this -- function will fail immediately if given a list of more than 100 IDs. getPostsInfo :: Monad m => [PostID] -> RedditT m PostListing -- | Submit a new link to Reddit. submitLink :: Monad m => SubredditName -> Text -> Text -> RedditT m PostID -- | Submit a new link to Reddit (answering a Captcha to prove we aren't a -- robot). submitLinkWithCaptcha :: Monad m => SubredditName -> Text -> Text -> CaptchaID -> Text -> RedditT m PostID -- | Submit a new selfpost to Reddit. submitSelfPost :: Monad m => SubredditName -> Text -> Text -> RedditT m PostID -- | Submit a new selfpost to Reddit (answering a Captcha to prove we -- aren't a robot). submitSelfPostWithCaptcha :: Monad m => SubredditName -> Text -> Text -> CaptchaID -> Text -> RedditT m PostID -- | Set the state of inbox replies for the specified thread. setInboxReplies :: Monad m => Bool -> PostID -> RedditT m () -- | Save a post. savePost :: Monad m => PostID -> RedditT m () -- | Remove a saved post from your "saved posts" list. unsavePost :: Monad m => PostID -> RedditT m () -- | Edit the text of a self-post. editPost :: Monad m => PostID -> Text -> RedditT m () -- | Deletes one of your own posts. Note that this is different from -- removing a post as a moderator action. deletePost :: Monad m => PostID -> RedditT m () -- | Set the link flair for a post you've submitted (or any post on a -- subreddit that you moderate). setPostFlair :: Monad m => SubredditName -> PostID -> Text -> Text -> RedditT m () -- | Removes a post (as a moderator action). Note that this is different -- from deleting a post. removePost :: Monad m => PostID -> RedditT m () -- | Mark a post as spam as a moderator action. markPostSpam :: Monad m => PostID -> RedditT m () -- | Sticky a post on the subreddit on which it's posted. stickyPost :: Monad m => PostID -> Maybe Integer -> RedditT m () -- | Unsticky a post from the subreddit on which it's posted. unstickyPost :: Monad m => PostID -> Maybe Integer -> RedditT m () -- | Set the state of contest for the specified thread as a moderator -- action. setContestMode :: Monad m => Bool -> PostID -> RedditT m () -- | Contains actions for interacting with a Subreddit as a whole. module Reddit.Actions.Subreddit -- | Get the info for a specific subreddit. This info includes things like -- sidebar contents, description and ID. getSubredditInfo :: Monad m => SubredditName -> RedditT m Subreddit -- | Get the settings for a subreddit that you moderate. getSubredditSettings :: Monad m => SubredditName -> RedditT m SubredditSettings -- | Modify the settings for a subreddit that you moderate. setSubredditSettings :: Monad m => SubredditID -> SubredditSettings -> RedditT m () -- | Contains actions which are applicable to both Posts and Comments, like -- replying, deleting and reporting. module Reddit.Actions.Thing -- | Reply to a something (a post / comment / message) reply :: (Monad m, Thing a) => a -> Text -> RedditT m CommentID -- | Delete something you created. Note that this is different to removing -- a post / comment as a moderator action. Deleting something you don't -- own won't error (but naturally won't delete anything either). delete :: (Monad m, Thing a) => a -> RedditT m () -- | Report something. report :: (Monad m, Thing a) => a -> Text -> RedditT m () -- | Contains actions for voting on posts and comments. There are functions -- for upvoting (upvotePost, upvoteComment), downvoting -- (downvotePost, downVoteComment) as well as removing -- votes that have already been cast (unvotePost, -- unvoteComment). -- -- Please note that automated voting (i.e. by a bot, as opposed to being -- specifically ordered to by a person) is strictly against the Reddit -- rules, and is a very effective way of getting your bot shadowbanned. module Reddit.Actions.Voting -- | Upvote a post. upvotePost :: Monad m => PostID -> RedditT m () -- | Downvote a post. downvotePost :: Monad m => PostID -> RedditT m () -- | Remove a vote from a post. unvotePost :: Monad m => PostID -> RedditT m () -- | Upvote a comment. upvoteComment :: Monad m => CommentID -> RedditT m () -- | Downvote a comment. downvoteComment :: Monad m => CommentID -> RedditT m () -- | Remove a previously-cast vote from a comment. unvoteComment :: Monad m => CommentID -> RedditT m () -- | All the actions that the library can perform. module Reddit.Actions -- | This module should be most of what you need to operate the library. It -- exports functionality for running built RedditT actions, as -- well as re-exporting a few helpful types from around the library. Not -- every type is exported, however, due to clashing record fields. It's -- recommended to import modules from Reddit.Types.* qualified -- so that you can use all the record fields without having to deal with -- ambiguous functions. module Reddit -- | Run a Reddit action (or a RedditT transformer action). -- This uses the default logged-in settings for RedditOptions: -- rate limiting enabled, default manager, login via username and -- password, and the default user-agent. You should change the user agent -- if you're making anything more complex than a basic script, since -- Reddit's API policy says that you should have a uniquely identifiable -- user agent. runReddit :: MonadIO m => Text -> Text -> RedditT m a -> m (Either (APIError RedditError) a) -- | Run a Reddit action (or a RedditT transformer action). -- This uses the default logged-out settings, so you won't be able to do -- anything that requires authentication (like checking messages or -- making a post). At the moment, authentication isn't statically -- checked, so it'll return a runtime error if you try to do anything you -- don't have permissions for. runRedditAnon :: MonadIO m => RedditT m a -> m (Either (APIError RedditError) a) -- | Run a Reddit or RedditT action with custom settings. You -- probably won't need this function for most things, but it's handy if -- you want to persist a connection over multiple Reddit sessions -- or use a custom user agent string. runRedditWith :: MonadIO m => RedditOptions -> RedditT m a -> m (Either (APIError RedditError) a) -- | Run a Reddit or RedditT action with custom settings. You -- probably won't need this function for most things, but it's handy if -- you want to persist a connection over multiple Reddit sessions -- or use a custom user agent string. runResumeRedditWith :: MonadIO m => RedditOptions -> RedditT m a -> m (Either (APIError RedditError, Maybe (RedditT m a)) a) interpretIO :: MonadIO m => RedditState -> RedditT m a -> m (Either (APIError RedditError, Maybe (RedditT m a)) a) -- | Options for how we should run the Reddit action. -- --