tweet-hs 1.0.1.5 → 1.0.1.6
raw patch · 4 files changed
+38/−1 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Web.Tweet: showFavorites :: Int -> String -> Bool -> FilePath -> IO String
+ Web.Tweet.API: favoriteTweetList :: String -> FilePath -> IO (Either (ParseError Char Void) Timeline)
+ Web.Tweet.API: favoriteTweetListMem :: String -> Config -> IO (Either (ParseError Char Void) Timeline)
+ Web.Tweet.API: favoriteTweetListRaw :: String -> FilePath -> IO ByteString
+ Web.Tweet.API: favoriteTweetListRawMem :: String -> Config -> IO ByteString
+ Web.Tweet.API: getFavorites :: Int -> String -> FilePath -> IO (Either (ParseError Char Void) Timeline)
+ Web.Tweet.Exec: List :: Maybe Int -> String -> Command
Files
- src/Web/Tweet/API.hs +20/−0
- src/Web/Tweet/API/Internal.hs +4/−0
- src/Web/Tweet/Exec.hs +13/−0
- tweet-hs.cabal +1/−1
src/Web/Tweet/API.hs view
@@ -127,6 +127,10 @@ getDMsRaw count = getRequest ("https://api.twitter.com/1.1/direct_messages.json" ++ requestString) where requestString = "?count=" ++ (show count) +-- | Get a user's favorites+getFavorites :: Int -> String -> FilePath -> IO (Either (ParseError Char Void) Timeline)+getFavorites count = fmap (fmap (take count)) . (fmap (getTweets . BSL.toStrict)) .* favoriteTweetListRaw+ -- | Get a timeline getTimeline :: Int -> FilePath -> IO (Either (ParseError Char Void) Timeline) getTimeline = (fmap (getTweets . BSL.toStrict)) .* getTimelineRaw@@ -170,6 +174,14 @@ favoriteTweetMem = (fmap void) . favoriteTweetRawMem -- | Favorite a tweet and returned the (parsed) response+favoriteTweetList :: String -> FilePath -> IO (Either (ParseError Char Void) Timeline)+favoriteTweetList = fmap (getTweets . BSL.toStrict) .* favoriteTweetListRaw++-- | Favorite a tweet and returned the (parsed) response+favoriteTweetListMem :: String -> Config -> IO (Either (ParseError Char Void) Timeline)+favoriteTweetListMem = fmap (getTweets . BSL.toStrict) .* favoriteTweetListRawMem++-- | Favorite a tweet and returned the (parsed) response favoriteTweetResponse :: Integer -> FilePath -> IO (Either (ParseError Char Void) Timeline) favoriteTweetResponse = fmap (getTweets . BSL.toStrict) .* favoriteTweetRaw @@ -252,6 +264,14 @@ -- | Retweet a tweet and returned the (parsed) response retweetTweetResponseMem :: Integer -> Config -> IO (Either (ParseError Char Void) Timeline) retweetTweetResponseMem = fmap (getTweets . BSL.toStrict) .* retweetTweetRawMem++-- | Get a lisr of favorited tweets by screen name; return bytestring response+favoriteTweetListRaw :: String -> FilePath -> IO BSL.ByteString+favoriteTweetListRaw sn = getRequest ("https://api.twitter.com/1.1/favorites/list.json?screen_name=" ++ sn)++-- | Get a lisr of favorited tweets by screen name; return bytestring response+favoriteTweetListRawMem :: String -> Config -> IO BSL.ByteString+favoriteTweetListRawMem sn = getRequestMem ("https://api.twitter.com/1.1/favorites/list.json?screen_name=" ++ sn) -- | Favorite a tweet given its id; return bytestring response favoriteTweetRaw :: Integer -> FilePath -> IO BSL.ByteString
src/Web/Tweet/API/Internal.hs view
@@ -27,3 +27,7 @@ -- | Display user timeline in color, as appropriate showTweets :: Bool -> Either (ParseError Char Void) Timeline -> String showTweets color = (either show id) . (fmap (if color then displayTimelineColor else displayTimeline))++-- | Display a user's favorites+showFavorites :: Int -> String -> Bool -> FilePath -> IO String+showFavorites count sn color = (fmap (showTweets color)) . getFavorites count sn
src/Web/Tweet/Exec.hs view
@@ -29,6 +29,7 @@ | Unfav { twId :: Integer } | Retweet { twId :: Integer } | Unretweet { twId :: Integer }+ | List { count :: Maybe Int , screenName' :: String } | Follow { screenName' :: String } | Unfollow { screenName' :: String } | Block { screenName' :: String }@@ -82,6 +83,7 @@ selectCommand (Profile maybeNum n) c file = putStrLn =<< showProfile (fromMaybe mempty n) (fromMaybe 11 maybeNum) c file selectCommand (Sort n maybeNum False) c file = putStrLn =<< showBest' n (fromMaybe 11 maybeNum) c file selectCommand (Sort n maybeNum True) c file = putStrLn =<< showBest n (fromMaybe 11 maybeNum) c file+selectCommand (List maybeNum n) c file = putStrLn =<< showFavorites (fromMaybe 11 maybeNum) n c file selectCommand (Markov n) _ file = do raw <- getMarkov n Nothing file appendFile (n ++ ".txt") (unlines raw)@@ -138,6 +140,7 @@ <> command "rt" (info rt (progDesc "Retweet a tweet")) <> command "follow" (info fol (progDesc "Follow a user")) <> command "unfollow" (info unfol (progDesc "Unfollow a user"))+ <> command "list" (info list (progDesc "List a user's favorites")) <> command "dump" (info dump (progDesc "Dump tweets (for debugging)")) <> command "block" (info blockParser (progDesc "Block a user")) <> command "unblock" (info unblockParser (progDesc "Unblock a user"))@@ -187,6 +190,16 @@ -- | Parser for the unfollow subcommand unfol :: Parser Command unfol = Unfollow <$> user++-- | Parser for the list subcommand+list :: Parser Command+list = List+ <$> (optional $ read <$> strOption+ (long "count"+ <> short 'n'+ <> metavar "NUM"+ <> help "Number of tweetInputs to fetch, default 12"))+ <*> user -- | Parser for the unfollow subcommand muteParser :: Parser Command
tweet-hs.cabal view
@@ -1,5 +1,5 @@ name: tweet-hs-version: 1.0.1.5+version: 1.0.1.6 synopsis: Command-line tool for twitter description: a Command Line Interface Tweeter homepage: https://github.com/vmchale/command-line-tweeter#readme