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
- getMultireddit :: MonadReddit m => MultiPath -> m Multireddit
- addToMultireddit :: MonadReddit m => MultiPath -> SubredditName -> m ()
- removeFromMultireddit :: MonadReddit m => MultiPath -> SubredditName -> m ()
- deleteMultireddit :: MonadReddit m => MultiPath -> m ()
- copyMultireddit :: MonadReddit m => MultiPath -> MultiName -> m Multireddit
- createMultireddit :: MonadReddit m => NewMulti -> MultiPath -> m Multireddit
- updateMultireddit :: MonadReddit m => MultiUpdate -> MultiPath -> m Multireddit
- listFilters :: MonadReddit m => SubredditName -> m Multireddit
- addFilter :: MonadReddit m => SubredditName -> SubredditName -> m ()
- removeFilter :: MonadReddit m => SubredditName -> SubredditName -> m ()
- clearFilters :: MonadReddit m => SubredditName -> m ()
- type MultiUpdate = NewMultiF Maybe
- type NewMulti = NewMultiF Identity
- data NewMultiF f = NewMultiF (HKD f Body) (HKD f Text) (HKD f (Seq SubredditName)) (HKD f MultiVisibility) (Maybe RGBText)
- data MultiVisibility
- data MultiPath = MultiPath Username MultiName
- data MultiName
- data Multireddit = Multireddit MultiName Text (Seq SubredditName) UTCTime Body Body (Maybe RGBText) MultiPath MultiVisibility (Maybe MultiPath) Bool (Maybe Bool)
- mkMultiName :: MonadThrow m => Text -> m MultiName
- multiUpdate :: Multireddit -> MultiUpdate
- defaultMultiUpdate :: MultiUpdate
Actions
getMultireddit :: MonadReddit m => MultiPath -> m Multireddit Source #
Get a Multireddit
by its path
addToMultireddit :: MonadReddit m => MultiPath -> SubredditName -> m () Source #
Add the given subreddit to the existing multireddit
removeFromMultireddit :: MonadReddit m => MultiPath -> SubredditName -> m () Source #
Remove a single subreddit from the existing multireddit
deleteMultireddit :: MonadReddit m => MultiPath -> m () Source #
Delete an existing multireddit
copyMultireddit :: MonadReddit m => MultiPath -> MultiName -> m Multireddit Source #
Copy an existing Multireddit
, returning the new one
createMultireddit :: MonadReddit m => NewMulti -> MultiPath -> m Multireddit Source #
Create a new Multireddit
. Will throw a 409 ErrorWithStatus
if the
proposed multireddit already exists. The new multireddit will be created at
the provided MultiPath
parameter
updateMultireddit :: MonadReddit m => MultiUpdate -> MultiPath -> m Multireddit Source #
Update an existings multireddit, returning the same Multireddit
with the
updates applied
Filters
These filters only work on the special subreddits "all" and
"mod". When a filter subreddit is added, it will no longer appear
in Listing
s for the special subreddit. All of the actions will
throw ErrorWithStatus
exceptions if a non-special subreddit is
provided as the first argument. Filters are provided as types of
Multireddit
s
listFilters :: MonadReddit m => SubredditName -> m Multireddit Source #
List all of the filters configured for the special subreddit. If no filters
have been applied, this will throw an ErrorWithStatus
exception
:: MonadReddit m | |
=> SubredditName | The special sub |
-> SubredditName | The sub to filter |
-> m () |
Add a subreddit to filter from the special subreddit
:: MonadReddit m | |
=> SubredditName | The special sub |
-> SubredditName | The sub to remove from the filter |
-> m () |
Remove a filtered subreddit from the special subreddit. This action will succeed even if the filtered subreddit is not in the special subreddit filter
clearFilters :: MonadReddit m => SubredditName -> m () Source #
Remove all of the filters for the special subreddit
Types
type MultiUpdate = NewMultiF Maybe Source #
An update to a multireddit, where all fields are optional. If a field is not provided, it is omitted during JSON encoding
Can represent either a new multireddit when parameterized by Identity
, or
a multireddit update when parameterized by Maybe
. In both cases, keyColor
is an optional field
NewMultiF (HKD f Body) (HKD f Text) (HKD f (Seq SubredditName)) (HKD f MultiVisibility) (Maybe RGBText) |
Instances
data MultiVisibility Source #
The configured visibility level for a Multireddit
Instances
The path to a Multireddit
, of the form /user/USERNAME/m/MULTINAME
Instances
Eq MultiPath Source # | |
Show MultiPath Source # | |
Generic MultiPath Source # | |
FromJSON MultiPath Source # | |
ToHttpApiData MultiPath Source # | |
Defined in Network.Reddit.Types.Multireddit toUrlPiece :: MultiPath -> Text # toEncodedUrlPiece :: MultiPath -> Builder # toHeader :: MultiPath -> ByteString # toQueryParam :: MultiPath -> Text # | |
type Rep MultiPath Source # | |
Defined in Network.Reddit.Types.Multireddit type Rep MultiPath = D1 ('MetaData "MultiPath" "Network.Reddit.Types.Multireddit" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "MultiPath" 'PrefixI 'True) (S1 ('MetaSel ('Just "username") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Username) :*: S1 ('MetaSel ('Just "multiname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 MultiName))) |
The name of a Multireddit
, which may only contain alphanumeric characters
Instances
Eq MultiName Source # | |
Show MultiName Source # | |
Generic MultiName Source # | |
FromJSON MultiName Source # | |
ToHttpApiData MultiName Source # | |
Defined in Network.Reddit.Types.Multireddit toUrlPiece :: MultiName -> Text # toEncodedUrlPiece :: MultiName -> Builder # toHeader :: MultiName -> ByteString # toQueryParam :: MultiName -> Text # | |
type Rep MultiName Source # | |
Defined in Network.Reddit.Types.Multireddit |
data Multireddit Source #
An aggregation of individual Subreddit
s
Multireddit MultiName Text (Seq SubredditName) UTCTime Body Body (Maybe RGBText) MultiPath MultiVisibility (Maybe MultiPath) Bool (Maybe Bool) |
Instances
mkMultiName :: MonadThrow m => Text -> m MultiName Source #
Smart constructor for MultiName
s, which may only contain alphanumeric
characters
multiUpdate :: Multireddit -> MultiUpdate Source #
Convert a Multireddit
to a MultiUpdate
defaultMultiUpdate :: MultiUpdate Source #
A MultiUpdate
with all Nothing
fields, for convenience