| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Contents
Description
This module should be most of what you need to operate the library.
It exports functionality for running built RedditT actions, as well
as re-exporting a few helpful types from around the library. Not every
type is exported, however, due to clashing record fields. It's recommended
to import modules from Reddit.Types.* qualified so that you can use all
the record fields without having to deal with ambiguous functions.
- runReddit :: MonadIO m => Text -> Text -> RedditT m a -> m (Either (APIError RedditError) a)
- runRedditAnon :: MonadIO m => RedditT m a -> m (Either (APIError RedditError) a)
- runRedditWith :: MonadIO m => RedditOptions -> RedditT m a -> m (Either (APIError RedditError) a)
- data RedditOptions = RedditOptions {}
- data LoginMethod
- data APIError a :: * -> *
- module Reddit.Actions
- module Reddit.Types
- module Reddit.Types.Error
- module Reddit.Types.Reddit
Documentation
runReddit :: MonadIO m => Text -> Text -> RedditT m a -> m (Either (APIError RedditError) a) Source
Run a Reddit action (or a RedditT transformer action). This uses the default logged-in settings
for RedditOptions: rate limiting enabled, default manager, login via username and password, and
the default user-agent. You should change the user agent if you're making anything more complex than
a basic script, since Reddit's API policy says that you should have a uniquely identifiable user agent.
runRedditAnon :: MonadIO m => RedditT m a -> m (Either (APIError RedditError) a) Source
Run a Reddit action (or a RedditT transformer action). This uses the default logged-out settings, so
you won't be able to do anything that requires authentication (like checking messages or making a post).
At the moment, authentication isn't statically checked, so it'll return a runtime error if you try to do
anything you don't have permissions for.
runRedditWith :: MonadIO m => RedditOptions -> RedditT m a -> m (Either (APIError RedditError) a) Source
data RedditOptions Source
Options for how we should run the Reddit action.
rateLimitingEnabled:Trueif the connection should be automatically rate-limited and should pause when we hit the limit,Falseotherwise.connectionManager:if the connection should use theJustxManagerx,Nothingif we should create a new one for the connection.loginMethod: The method we should use for authentication, described inLoginMethod.customUserAgent:if the connection should use the user agentJust"string""string",if it should use the default agent.Nothing
Constructors
| RedditOptions | |
Fields | |
Instances
data LoginMethod Source
Should we log in to Reddit? If so, should we use a stored set of credentials or get a new fresh set?
Constructors
| Anonymous | Don't login, instead use an anonymous account |
| Credentials Text Text | Login using the specified username and password |
| StoredDetails LoginDetails | Login using a stored set of credentials. Usually the best way to get
these is to do |
Instances
Re-exports
data APIError a :: * -> *
Error type for the API, where a is the type that should be returned when
something goes wrong on the other end - i.e. any error that isn't directly related
to this library.
Constructors
| APIError a | A type that represents any error that happens on the API end.
Define your own custom type with a |
| HTTPError HttpException | Something went wrong when we tried to do a HTTP operation. |
| InvalidURLError | You're trying to create an invalid URL somewhere - check your
|
| ParseError String | Failed when parsing the response, and it wasn't an error on their end. |
| EmptyError | Empty error to serve as a zero element for Monoid. |
module Reddit.Actions
module Reddit.Types
module Reddit.Types.Error
module Reddit.Types.Reddit