Copyright | (c) 2021 Rory Tyler Hayford |
---|---|
License | BSD-3-Clause |
Maintainer | rory.hayford@protonmail.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- getComments :: (MonadReddit m, Foldable t) => ItemOpts Comment -> t CommentID -> m (Seq Comment)
- getComment :: MonadReddit m => CommentID -> m Comment
- withReplies :: MonadReddit m => ItemOpts a -> Comment -> m Comment
- loadMoreComments :: forall m. MonadReddit m => Maybe Word -> ItemOpts Comment -> SubmissionID -> MoreComments -> m (Seq ChildComment)
- loadMoreCommentsDef :: MonadReddit m => SubmissionID -> MoreComments -> m (Seq ChildComment)
- unsaveComment :: MonadReddit m => CommentID -> m ()
- saveComment :: MonadReddit m => CommentID -> m ()
- deleteComment :: MonadReddit m => CommentID -> m ()
- editComment :: MonadReddit m => CommentID -> Body -> m Comment
- replyToComment :: MonadReddit m => CommentID -> Body -> m Comment
- getNewComments :: MonadReddit m => Maybe SubredditName -> Paginator CommentID Comment -> m (Listing CommentID Comment)
- setCommentReplies :: MonadReddit m => Bool -> CommentID -> m ()
- upvoteComment :: MonadReddit m => CommentID -> m ()
- downvoteComment :: MonadReddit m => CommentID -> m ()
- unvoteComment :: MonadReddit m => CommentID -> m ()
- reportComment :: MonadReddit m => Report -> CommentID -> m ()
- data MoreComments = MoreComments (Seq CommentID) Integer
- data ChildComment
- data Comment = Comment CommentID Username Body Body (Seq ChildComment) (Maybe Integer) (Maybe Integer) (Maybe Integer) UTCTime (Maybe UTCTime) SubredditName SubredditID Int (Maybe Bool) SubmissionID (Maybe URL) (Maybe Username) URL (Seq ItemReport) (Seq ItemReport) (Maybe Integer) (Maybe Distinction) Bool Bool
- newtype CommentID = CommentID Text
Reading comments
getComments :: (MonadReddit m, Foldable t) => ItemOpts Comment -> t CommentID -> m (Seq Comment) Source #
getComment :: MonadReddit m => CommentID -> m Comment Source #
withReplies :: MonadReddit m => ItemOpts a -> Comment -> m Comment Source #
Update a Comment
to include its ChildComment
s, returning the updated
Comment
. This will probably be necessary if the original Comment
was obtained
by getting a Username
's or Subreddit
's comments, etc...
loadMoreComments :: forall m. MonadReddit m => Maybe Word -> ItemOpts Comment -> SubmissionID -> MoreComments -> m (Seq ChildComment) Source #
Transform MoreComments
, loading the actual comments they refer to, up to
the limit passed in (pass Nothing
for no limit). If CommentID
s still remain
from the original MoreComments
, they will be returned in a new MoreComments
inserted into the resulting sequence of ChildComment
s, along with an updated
count
loadMoreCommentsDef :: MonadReddit m => SubmissionID -> MoreComments -> m (Seq ChildComment) Source #
A version of loadMoreComments
with default parameters for the limit
(Nothing
) and options (defaultItemOpts
)
unsaveComment :: MonadReddit m => CommentID -> m () Source #
Unsave a comment
saveComment :: MonadReddit m => CommentID -> m () Source #
Save a comment
Creating, editing, and deleting
deleteComment :: MonadReddit m => CommentID -> m () Source #
Delete a comment that the currently authenticated user has authored, given its
CommentID
editComment :: MonadReddit m => CommentID -> Body -> m Comment Source #
replyToComment :: MonadReddit m => CommentID -> Body -> m Comment Source #
getNewComments :: MonadReddit m => Maybe SubredditName -> Paginator CommentID Comment -> m (Listing CommentID Comment) Source #
Get new Comment
s, either for the site as a whole or for a single subreddit,
given its SubredditName
setCommentReplies :: MonadReddit m => Bool -> CommentID -> m () Source #
Enable/disable inbox replies for a comment
Voting
Note: According to Reddit's API rules:
votes must be cast by humans. That is, API clients proxying a human's action one-for-one are OK, but bots deciding how to vote on content or amplifying a human's vote are not. See the reddit rules for more details on what constitutes vote cheating.
upvoteComment :: MonadReddit m => CommentID -> m () Source #
Upvote a comment.
downvoteComment :: MonadReddit m => CommentID -> m () Source #
Downvote a comment.
unvoteComment :: MonadReddit m => CommentID -> m () Source #
Remove an existing vote on a comment.
reportComment :: MonadReddit m => Report -> CommentID -> m () Source #
Report a comment to the subreddit's mods
Types
data MoreComments Source #
A link to load more children Comment
s
Instances
data ChildComment Source #
Represents a comments on a submission or replies to a comment, which can
be actual Comment
s, or a list of children corresponding to "load more"
or "continue this thread" links on Reddit's UI
Instances
A Reddit comment
Comment CommentID Username Body Body (Seq ChildComment) (Maybe Integer) (Maybe Integer) (Maybe Integer) UTCTime (Maybe UTCTime) SubredditName SubredditID Int (Maybe Bool) SubmissionID (Maybe URL) (Maybe Username) URL (Seq ItemReport) (Seq ItemReport) (Maybe Integer) (Maybe Distinction) Bool Bool |
Instances
A Comment
ID
Instances
Eq CommentID Source # | |
Ord CommentID Source # | |
Defined in Network.Reddit.Types.Comment | |
Show CommentID Source # | |
Generic CommentID Source # | |
FromJSON CommentID Source # | |
ToHttpApiData CommentID Source # | |
Defined in Network.Reddit.Types.Comment toUrlPiece :: CommentID -> Text # toEncodedUrlPiece :: CommentID -> Builder # toHeader :: CommentID -> ByteString # toQueryParam :: CommentID -> Text # | |
Thing CommentID Source # | |
type Rep CommentID Source # | |
Defined in Network.Reddit.Types.Comment |