hs-twitter 0.2.7 → 0.2.8
raw patch · 3 files changed
+43/−7 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Web.Twitter.Monad: fromSource :: String -> TM a -> TM a
+ Web.Twitter.Monad: getSource :: TM (Maybe String)
+ Web.Twitter.Monad: tmSource :: TMEnv -> Maybe String
- Web.Twitter.Monad: TMEnv :: Maybe AuthUser -> URLString -> Maybe Int -> Maybe Int -> Bool -> [(String, String)] -> TMEnv
+ Web.Twitter.Monad: TMEnv :: Maybe AuthUser -> URLString -> Maybe Int -> Maybe Int -> Bool -> [(String, String)] -> Maybe String -> TMEnv
- Web.Twitter.Monad: decodeStrict :: (JSON a) => String -> Result a
+ Web.Twitter.Monad: decodeStrict :: JSON a => String -> Result a
- Web.Twitter.Monad: readResult :: (JSON a) => String -> String -> TM a
+ Web.Twitter.Monad: readResult :: JSON a => String -> String -> TM a
- Web.Twitter.Types.Import: getJ :: (JSON a) => String -> JM a
+ Web.Twitter.Types.Import: getJ :: JSON a => String -> JM a
- Web.Twitter.Types.Import: getMbJ :: (JSON a) => String -> JM (Maybe a)
+ Web.Twitter.Types.Import: getMbJ :: JSON a => String -> JM (Maybe a)
- Web.Twitter.Types.Import: js :: (JSON a) => a -> JSValue
+ Web.Twitter.Types.Import: js :: JSON a => a -> JSValue
Files
- CHANGES +14/−0
- Web/Twitter/Monad.hs +26/−5
- hs-twitter.cabal +3/−2
CHANGES view
@@ -1,3 +1,17 @@+Version 0.2.8 - released 2009-05-27; changes from 0.2.7 + * remove default passing of 'source=hs-twitter' argument to + all API actions. The default argument list is now empty. + If you want to configure the 'source=' argument, now use + + Web.Twitter.Monad.fromSource :: String -> TM a -> TM a + Web.Twitter.Monad.getSource :: String -> TM (Maybe String) + + (Passing in source= to the search APIs causes problems.) + +Version 0.2.6/0.2.7 - released 2009-05-20; changes from 0.2.4 + * Added social graph API additions (getUserFollowers / getUserFollowing ) + * support for default arguments via Web.Twitter.Monad.getDefArgs / withDefaultArgs + Version 0.2.5 - released 2009-02-05; changes from 0.2.4 * Fix bug in percent-encoding UTF-8 content.
Web/Twitter/Monad.hs view
@@ -24,6 +24,7 @@ , withAuth , withBase , withDefaultArgs + , fromSource , getEnv , getUser @@ -33,6 +34,7 @@ , getBase , getPostFlag , getDefArgs + , getSource , runTwitter , runTM @@ -103,9 +105,11 @@ restCall :: String -> [(String,String)] -> TM String restCall u args = do - mbc <- getCount - mbp <- getPage - d_args <- getDefArgs + mbc <- getCount + mbp <- getPage + d_args0 <- getDefArgs + mbSrc <- getSource + let d_args = maybe d_args0 (\ x -> ("source",x):d_args0) mbSrc let q = maybe id (\ x -> (("count="++show x):)) mbc $ maybe id (\ x -> (("page="++show x):)) mbp $ (map (\ (x,y) -> x ++ '=':encodeString y) (args++d_args)) @@ -123,7 +127,9 @@ postCall u hs bod args = do mbc <- getCount mbp <- getPage - d_args <- getDefArgs + d_args0 <- getDefArgs + mbSrc <- getSource + let d_args = maybe d_args0 (\ x -> ("source",x):d_args0) mbSrc let q = maybe id (\ x -> (("count="++show x):)) mbc $ maybe id (\ x -> (("page="++show x):)) mbp $ (map (\ (x,y) -> x ++ '=':encodeString y) (args++d_args)) @@ -150,6 +156,7 @@ , tmPage :: Maybe Int , tmPost :: Bool , tmDefaultArgs :: [(String, String)] + , tmSource :: Maybe String } nullEnv :: TMEnv @@ -159,7 +166,8 @@ , tmCount = Nothing , tmPage = Nothing , tmPost = False - , tmDefaultArgs = [("source", "<a href=\"http://haskell.forkIO.com/twitter\">hs-twitter</a>")] + , tmDefaultArgs = [] + , tmSource = Nothing -- could be: Just "hs-twitter" } newtype TM a = TM {unTM :: TMEnv -> IO a} @@ -188,6 +196,13 @@ withDefaultArgs :: [(String,String)] -> TM a -> TM a withDefaultArgs as t = withEnv (\ e -> e{tmDefaultArgs=as}) t +-- | @fromSource "foo" action@ indicates that @foo@ is the source +-- of the twitter. Not all Twitter API actions currently like being +-- passed a @source=@ argument (e.g., search actions), so you may have +-- to be selective about where you apply this action.. +fromSource :: String -> TM a -> TM a +fromSource src t = withEnv (\ e -> e{tmSource=Just src}) t + withPageCount :: Maybe Int -> Maybe Int -> TM a -> TM a withPageCount mbP mbC k = withEnv (\e -> e{tmPage=mbP,tmCount=mbC}) k @@ -216,8 +231,14 @@ getPageCount :: TM (Maybe Int, Maybe Int) getPageCount = TM $ \ env -> return (tmCount env, tmPage env) +-- | @getDefArgs@ returns the /default/ arguments to pass to all +-- Twitter API actions. The /default-default/ is the empty list. +-- See also 'getSource' / 'fromSource'. getDefArgs :: TM [(String,String)] getDefArgs = TM $ \ env -> return (tmDefaultArgs env) + +getSource :: TM (Maybe String) +getSource = TM $ \ env -> return (tmSource env) getBase :: TM URLString getBase = TM $ \ env -> return (tmBase env)
hs-twitter.cabal view
@@ -1,5 +1,5 @@ name: hs-twitter -version: 0.2.7 +version: 0.2.8 synopsis: Haskell binding to the Twitter API description: The hs-twitter API binding lets you access twitter.com's @@ -7,7 +7,8 @@ . Implements the full API, see <http://apiwiki.twitter.com/REST+API+Documentation> . - For more info on use, please visit <http://haskell.forkIO.com/twitter> + For more info on use, please visit <http://haskell.forkIO.com/twitter> , + the @CHANGES@ file in the distribution contains change info for the package. category: Web license: BSD3