| Copyright | (c) 2021 Rory Tyler Hayford |
|---|---|
| License | BSD-3-Clause |
| Maintainer | rory.hayford@protonmail.com |
| Stability | experimental |
| Portability | GHC |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Reddit.Item
Synopsis
- delete :: MonadReddit m => ItemID -> m ()
- reply :: MonadReddit m => ItemID -> Body -> m Comment
- edit :: MonadReddit m => ItemID -> Body -> m Item
- vote :: MonadReddit m => Vote -> ItemID -> m ()
- report :: MonadReddit m => Report -> ItemID -> m ()
- save :: MonadReddit m => ItemID -> m ()
- unsave :: MonadReddit m => ItemID -> m ()
- award :: MonadReddit m => Award -> ItemID -> m AwardingsSummary
- gild :: MonadReddit m => ItemID -> m AwardingsSummary
- setInboxReplies :: MonadReddit m => Bool -> ItemID -> m ()
- getGildedItems :: MonadReddit m => SubredditName -> Paginator ItemID Item -> m (Listing ItemID Item)
- data AwardingsSummary = AwardingsSummary (Seq Awarding) (HashMap AwardID Integer) Integer
- data Award = Award AwardID Bool (Maybe Body)
- newtype AwardID where
- mkAward :: AwardID -> Award
- data Report
- data Vote
- data Item
- data ItemID
- mkReport :: MonadThrow m => Text -> m Report
Actions
vote :: MonadReddit m => Vote -> ItemID -> m () Source #
Submit a vote. Be careful! Reddit views bot-based vote manipulation as a serious violation
report :: MonadReddit m => Report -> ItemID -> m () Source #
Report an item, which brings it to the attention of the subreddit moderators
save :: MonadReddit m => ItemID -> m () Source #
Save an item
unsave :: MonadReddit m => ItemID -> m () Source #
Unsave an item
award :: MonadReddit m => Award -> ItemID -> m AwardingsSummary Source #
Grant an award to the author of an Item. See the docs for Award for
information about the available options when awarding as well as mkAward
to use defaults.
To grant a common award, such as gold, see the bundled pattern synonyms of
AwardID. If you wish to anonymously gild an item without a message, see the
gild action in this module, provided for convenience
gild :: MonadReddit m => ItemID -> m AwardingsSummary Source #
Gild an item anonymously, without a message. To grant other types of
awards to items, or to gild non-anonymously/with a message, see award
setInboxReplies :: MonadReddit m => Bool -> ItemID -> m () Source #
Enable or disable inbox replies for an item given its ItemID
getGildedItems :: MonadReddit m => SubredditName -> Paginator ItemID Item -> m (Listing ItemID Item) Source #
Get a Listing of Items that have been gilded
Types
data AwardingsSummary Source #
A summary of your Awardings, returned after you have awarded an item
Instances
Options for awarding an item
Instances
| Eq Award Source # | |
| Show Award Source # | |
| Generic Award Source # | |
| ToForm Award Source # | |
Defined in Network.Reddit.Types.Award | |
| type Rep Award Source # | |
Defined in Network.Reddit.Types.Award type Rep Award = D1 ('MetaData "Award" "Network.Reddit.Types.Award" "heddit-0.2-6CPbqZeiNUj1PM6nX368ZU" 'False) (C1 ('MetaCons "Award" 'PrefixI 'True) (S1 ('MetaSel ('Just "awardID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 AwardID) :*: (S1 ('MetaSel ('Just "isAnonymous") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Body))))) | |
The ID for an award, which users can grant each other. If you want to create
a new AwardID, see the bundled pattern synonyms for this type, which include
various common awards. Also see "doc/awards.org" in this repository for a list
of awards and their IDs.
Note: Most newer awards are composed of a UUID identifier and an "award_" prefix. If you construct this type directly, you should omit the prefix, which will be added for you when making API requests
Bundled Patterns
| pattern Ternion :: AwardID | |
| pattern Argentium :: AwardID | |
| pattern Platinum :: AwardID | |
| pattern Gold :: AwardID | |
| pattern Silver :: AwardID |
Instances
| Eq AwardID Source # | |
| Show AwardID Source # | |
| Generic AwardID Source # | |
| Hashable AwardID Source # | |
Defined in Network.Reddit.Types.Award | |
| FromJSON AwardID Source # | |
| FromJSONKey AwardID Source # | |
Defined in Network.Reddit.Types.Award Methods | |
| ToHttpApiData AwardID Source # | |
Defined in Network.Reddit.Types.Award Methods toUrlPiece :: AwardID -> Text # toEncodedUrlPiece :: AwardID -> Builder # toHeader :: AwardID -> ByteString # toQueryParam :: AwardID -> Text # | |
| type Rep AwardID Source # | |
Defined in Network.Reddit.Types.Award | |
The reason for issuing a report. The length of the contained text must be <= 100 characters
Instances
| Eq Report Source # | |
| Show Report Source # | |
| Generic Report Source # | |
| ToHttpApiData Report Source # | |
Defined in Network.Reddit.Types.Item Methods toUrlPiece :: Report -> Text # toEncodedUrlPiece :: Report -> Builder # toHeader :: Report -> ByteString # toQueryParam :: Report -> Text # | |
| type Rep Report Source # | |
Defined in Network.Reddit.Types.Item | |
The direction in which to vote
Instances
| Eq Vote Source # | |
| Ord Vote Source # | |
| Show Vote Source # | |
| Generic Vote Source # | |
| type Rep Vote Source # | |
Defined in Network.Reddit.Types.Item type Rep Vote = D1 ('MetaData "Vote" "Network.Reddit.Types.Item" "heddit-0.2-6CPbqZeiNUj1PM6nX368ZU" 'False) (C1 ('MetaCons "Downvote" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Unvote" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Upvote" 'PrefixI 'False) (U1 :: Type -> Type))) | |
Certain endpoints will return either Comments or a Submissions, or both
Constructors
| CommentItem Comment | |
| SubmissionItem Submission |
Instances
Wraps either a CommentID or a SubmissionID. This is required to use
Items with Paginators
Constructors
| CommentItemID CommentID | |
| SubmissionItemID SubmissionID |
Instances
| Eq ItemID Source # | |
| Show ItemID Source # | |
| Generic ItemID Source # | |
| FromJSON ItemID Source # | |
| Thing ItemID Source # | |
| type Rep ItemID Source # | |
Defined in Network.Reddit.Types.Item type Rep ItemID = D1 ('MetaData "ItemID" "Network.Reddit.Types.Item" "heddit-0.2-6CPbqZeiNUj1PM6nX368ZU" 'False) (C1 ('MetaCons "CommentItemID" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CommentID)) :+: C1 ('MetaCons "SubmissionItemID" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SubmissionID))) | |