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
- bshow :: Show a => a -> ByteString
- defaultAPIAction :: APIAction a
- joinPathSegments :: Foldable t => t PathSegment -> ByteString
- writeUA :: UserAgent -> ByteString
- emptyPaginator :: forall t a. Paginable a => Paginator t a
- paginatorToFormData :: (Thing t, Paginable a) => Paginator t a -> WithData
- apiRequestLimit :: Num n => n
- mkTextForm :: [(Text, Text)] -> Form
- mkTextFormData :: [(Text, Text)] -> WithData
- submissionIDFromURL :: MonadThrow m => Text -> m SubmissionID
- subAPIPath :: SubredditName -> PathSegment -> [PathSegment]
- subAboutPath :: SubredditName -> PathSegment -> [PathSegment]
- textObject :: [Pair] -> Text
- textEncode :: ToJSON a => a -> Text
- joinPerms :: (Foldable t, Ord a, Enum a, Bounded a, ToHttpApiData a) => t a -> Text
- splitPath :: ByteString -> [ByteString]
- splitURL :: MonadThrow m => URL -> m (ByteString, [PathSegment])
- catchEmptyListing :: MonadReddit m => m a -> m a
Documentation
bshow :: Show a => a -> ByteString Source #
defaultAPIAction :: APIAction a Source #
Default settings for an APIAction
- a GET request with no path, form
data, or query string, and which requires authentication headers
joinPathSegments :: Foldable t => t PathSegment -> ByteString Source #
Join a collection of PathSegment
s, with a leading slash
emptyPaginator :: forall t a. Paginable a => Paginator t a Source #
An empty, default Paginator
. Includes the default PaginateOptions
for
the type a
apiRequestLimit :: Num n => n Source #
mkTextFormData :: [(Text, Text)] -> WithData Source #
Convert (Text, Text)
pairs into a URL-encoded Form
submissionIDFromURL :: MonadThrow m => Text -> m SubmissionID Source #
Parse a SubmissionID
from a Reddit URL
subAPIPath :: SubredditName -> PathSegment -> [PathSegment] Source #
Get the API path for a subreddit given its SubredditName
subAboutPath :: SubredditName -> PathSegment -> [PathSegment] Source #
Get the "about" path for a subreddit given its SubredditName
joinPerms :: (Foldable t, Ord a, Enum a, Bounded a, ToHttpApiData a) => t a -> Text Source #
Turn a container of permissions into a string Reddit uses to configure permissions for different roles. Included permissions are prefixed with "+", omitted ones with "-"
Can be used with ModPermission
s and LivePermission
s
splitPath :: ByteString -> [ByteString] Source #
Split a URL path
splitURL :: MonadThrow m => URL -> m (ByteString, [PathSegment]) Source #
Get the host and path segments from a URL
catchEmptyListing :: MonadReddit m => m a -> m a Source #
HACK
For some reason, if a subreddit does not exist, Reddit returns an
empty Listing
instead of returning 404