Safe Haskell | None |
---|---|
Language | Haskell98 |
- type TW m = ReaderT TWEnv m
- data TWToken = TWToken {}
- data TWInfo = TWInfo {}
- setCredential :: OAuth -> Credential -> TWInfo -> TWInfo
- runTW :: (MonadBaseControl IO m, MonadIO m) => TWInfo -> TW (ResourceT m) a -> m a
- runTWManager :: MonadBaseControl IO m => TWInfo -> Manager -> TW (ResourceT m) a -> ResourceT m a
- getProxy :: Monad m => TW m (Maybe Proxy)
- getManager :: Monad m => TW m Manager
- signOAuthTW :: MonadIO m => Request -> TW m Request
- twitterOAuth :: OAuth
Documentation
setCredential :: OAuth -> Credential -> TWInfo -> TWInfo Source
set OAuth keys and Credentials to TWInfo.
>>>
let proxy = Proxy "localhost" 8080
>>>
let twinfo = def { twProxy = Just proxy }
>>>
let oauth = twitterOAuth { oauthConsumerKey = "consumer_key", oauthConsumerSecret = "consumer_secret" }
>>>
let credential = Credential [("oauth_token","...")]
>>>
let twinfo2 = setCredential oauth credential twinfo
>>>
oauthConsumerKey . twOAuth . twToken $ twinfo2
"consumer_key">>>
twProxy twinfo2 == Just proxy
True
runTW :: (MonadBaseControl IO m, MonadIO m) => TWInfo -> TW (ResourceT m) a -> m a Source
create a new http-conduit manager and run TW monad.
>>>
runTW def getProxy
Nothing>>>
runTW def $ asks (twCredential . twToken . twInfo)
Credential {unCredential = []}
runTWManager :: MonadBaseControl IO m => TWInfo -> Manager -> TW (ResourceT m) a -> ResourceT m a Source
getManager :: Monad m => TW m Manager Source