module Web.Tweet.API.Internal where
import Data.Void
import Text.Megaparsec.Error
import Web.Tweet.API
import Web.Tweet.Types
import Web.Tweet.Utils
type Filter = Timeline -> Timeline
showProfile :: String -> Int -> Bool -> FilePath -> IO String
showProfile sn count color = fmap (showTweets color) . getProfile sn count
showBest :: String -> Int -> Bool -> FilePath -> IO String
showBest sn n color = fmap (showTweets color . pure . take n . hits) . getAll sn Nothing
showBest' :: String -> Int -> Bool -> FilePath -> IO String
showBest' sn n color = fmap (showTweets color . pure . take n . hits') . getAll sn Nothing
showTimeline :: Int -> Bool -> FilePath -> IO String
showTimeline count color = fmap (showTweets color) . getTimeline count
showFilteredTL :: [Filter] -> String -> Int -> Bool -> FilePath -> IO String
showFilteredTL filters sn count color = fmap (showTweets color . fmap (foldr (.) id filters)) . getProfile sn count
showTweets :: Bool -> Either (ParseError Char Void) Timeline -> String
showTweets color = either show id . fmap (if color then displayTimelineColor else displayTimeline)
showFavorites :: Int -> String -> Bool -> FilePath -> IO String
showFavorites count sn color = fmap (showTweets color) . getFavorites count sn