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

Network.Reddit.Utils

Description

 
Synopsis

Documentation

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 PathSegments, with a leading slash

writeUA :: UserAgent -> ByteString Source #

Convert a UserAgent to its textual value

emptyPaginator :: forall t a. Paginable a => Paginator t a Source #

An empty, default Paginator. Includes the default PaginateOptions for the type a

mkTextForm :: [(Text, Text)] -> Form Source #

Make a form from [(Text, Text)] pairs

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

textObject :: [Pair] -> Text Source #

Encode a list of Pairs to strict Text

textEncode :: ToJSON a => a -> Text Source #

Encode a ToJSON instance to strict Text

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 ModPermissions and LivePermissions

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