heddit-0.2: Reddit API bindings
Copyright(c) 2021 Rory Tyler Hayford
LicenseBSD-3-Clause
Maintainerrory.hayford@protonmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Network.Reddit.Item

Contents

Description

Actions with operate on Items, which can be either Comments or Submissions

Synopsis

Actions

delete :: MonadReddit m => ItemID -> m () Source #

Delete an Item

reply :: MonadReddit m => ItemID -> Body -> m Comment Source #

Leave a comment in reply to an Item, which can be markdown-formatted. This will return the newly created Comment upon success

edit :: MonadReddit m => ItemID -> Body -> m Item Source #

Edit some item, given its ItemID. The return value will be wrapped in an Item constructor, since it can be either a Comment or Submission

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

Instances details
Eq AwardingsSummary Source # 
Instance details

Defined in Network.Reddit.Types.Award

Show AwardingsSummary Source # 
Instance details

Defined in Network.Reddit.Types.Award

Generic AwardingsSummary Source # 
Instance details

Defined in Network.Reddit.Types.Award

Associated Types

type Rep AwardingsSummary :: Type -> Type #

FromJSON AwardingsSummary Source # 
Instance details

Defined in Network.Reddit.Types.Award

type Rep AwardingsSummary Source # 
Instance details

Defined in Network.Reddit.Types.Award

type Rep AwardingsSummary = D1 ('MetaData "AwardingsSummary" "Network.Reddit.Types.Award" "heddit-0.2-6CPbqZeiNUj1PM6nX368ZU" 'False) (C1 ('MetaCons "AwardingsSummary" 'PrefixI 'True) (S1 ('MetaSel ('Just "allAwardings") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Seq Awarding)) :*: (S1 ('MetaSel ('Just "gildings") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (HashMap AwardID Integer)) :*: S1 ('MetaSel ('Just "coins") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer))))

data Award Source #

Options for awarding an item

Constructors

Award AwardID Bool (Maybe Body) 

Instances

Instances details
Eq Award Source # 
Instance details

Defined in Network.Reddit.Types.Award

Methods

(==) :: Award -> Award -> Bool #

(/=) :: Award -> Award -> Bool #

Show Award Source # 
Instance details

Defined in Network.Reddit.Types.Award

Methods

showsPrec :: Int -> Award -> ShowS #

show :: Award -> String #

showList :: [Award] -> ShowS #

Generic Award Source # 
Instance details

Defined in Network.Reddit.Types.Award

Associated Types

type Rep Award :: Type -> Type #

Methods

from :: Award -> Rep Award x #

to :: Rep Award x -> Award #

ToForm Award Source # 
Instance details

Defined in Network.Reddit.Types.Award

Methods

toForm :: Award -> Form #

type Rep Award Source # 
Instance details

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)))))

newtype AwardID Source #

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

Constructors

AwardID Text 

Bundled Patterns

pattern Ternion :: AwardID 
pattern Argentium :: AwardID 
pattern Platinum :: AwardID 
pattern Gold :: AwardID 
pattern Silver :: AwardID 

Instances

Instances details
Eq AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

Methods

(==) :: AwardID -> AwardID -> Bool #

(/=) :: AwardID -> AwardID -> Bool #

Show AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

Generic AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

Associated Types

type Rep AwardID :: Type -> Type #

Methods

from :: AwardID -> Rep AwardID x #

to :: Rep AwardID x -> AwardID #

Hashable AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

Methods

hashWithSalt :: Int -> AwardID -> Int #

hash :: AwardID -> Int #

FromJSON AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

FromJSONKey AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

ToHttpApiData AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

type Rep AwardID Source # 
Instance details

Defined in Network.Reddit.Types.Award

type Rep AwardID = D1 ('MetaData "AwardID" "Network.Reddit.Types.Award" "heddit-0.2-6CPbqZeiNUj1PM6nX368ZU" 'True) (C1 ('MetaCons "AwardID" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

mkAward :: AwardID -> Award Source #

Create a new anonymous Awarding without a message, given an AwardID

data Report Source #

The reason for issuing a report. The length of the contained text must be <= 100 characters

Instances

Instances details
Eq Report Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

(==) :: Report -> Report -> Bool #

(/=) :: Report -> Report -> Bool #

Show Report Source # 
Instance details

Defined in Network.Reddit.Types.Item

Generic Report Source # 
Instance details

Defined in Network.Reddit.Types.Item

Associated Types

type Rep Report :: Type -> Type #

Methods

from :: Report -> Rep Report x #

to :: Rep Report x -> Report #

ToHttpApiData Report Source # 
Instance details

Defined in Network.Reddit.Types.Item

type Rep Report Source # 
Instance details

Defined in Network.Reddit.Types.Item

type Rep Report = D1 ('MetaData "Report" "Network.Reddit.Types.Item" "heddit-0.2-6CPbqZeiNUj1PM6nX368ZU" 'True) (C1 ('MetaCons "Report" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Vote Source #

The direction in which to vote

Constructors

Downvote 
Unvote 
Upvote 

Instances

Instances details
Eq Vote Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

(==) :: Vote -> Vote -> Bool #

(/=) :: Vote -> Vote -> Bool #

Ord Vote Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

compare :: Vote -> Vote -> Ordering #

(<) :: Vote -> Vote -> Bool #

(<=) :: Vote -> Vote -> Bool #

(>) :: Vote -> Vote -> Bool #

(>=) :: Vote -> Vote -> Bool #

max :: Vote -> Vote -> Vote #

min :: Vote -> Vote -> Vote #

Show Vote Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

showsPrec :: Int -> Vote -> ShowS #

show :: Vote -> String #

showList :: [Vote] -> ShowS #

Generic Vote Source # 
Instance details

Defined in Network.Reddit.Types.Item

Associated Types

type Rep Vote :: Type -> Type #

Methods

from :: Vote -> Rep Vote x #

to :: Rep Vote x -> Vote #

type Rep Vote Source # 
Instance details

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)))

data Item Source #

Certain endpoints will return either Comments or a Submissions, or both

Instances

Instances details
Eq Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

(==) :: Item -> Item -> Bool #

(/=) :: Item -> Item -> Bool #

Show Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

showsPrec :: Int -> Item -> ShowS #

show :: Item -> String #

showList :: [Item] -> ShowS #

Generic Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

Associated Types

type Rep Item :: Type -> Type #

Methods

from :: Item -> Rep Item x #

to :: Rep Item x -> Item #

FromJSON Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

Paginable Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

FromJSON (PostedItem Item) Source # 
Instance details

Defined in Network.Reddit.Types.Item

type Rep Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

type Rep Item = D1 ('MetaData "Item" "Network.Reddit.Types.Item" "heddit-0.2-6CPbqZeiNUj1PM6nX368ZU" 'False) (C1 ('MetaCons "CommentItem" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Comment)) :+: C1 ('MetaCons "SubmissionItem" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Submission)))
type PaginateOptions Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

type PaginateThing Item Source # 
Instance details

Defined in Network.Reddit.Types.Item

data ItemID Source #

Wraps either a CommentID or a SubmissionID. This is required to use Items with Paginators

Instances

Instances details
Eq ItemID Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

(==) :: ItemID -> ItemID -> Bool #

(/=) :: ItemID -> ItemID -> Bool #

Show ItemID Source # 
Instance details

Defined in Network.Reddit.Types.Item

Generic ItemID Source # 
Instance details

Defined in Network.Reddit.Types.Item

Associated Types

type Rep ItemID :: Type -> Type #

Methods

from :: ItemID -> Rep ItemID x #

to :: Rep ItemID x -> ItemID #

FromJSON ItemID Source # 
Instance details

Defined in Network.Reddit.Types.Item

Thing ItemID Source # 
Instance details

Defined in Network.Reddit.Types.Item

Methods

fullname :: ItemID -> Text Source #

type Rep ItemID Source # 
Instance details

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)))

mkReport :: MonadThrow m => Text -> m Report Source #

Smart constructor for Reports, which may be no longer than 100 characters in length