Safe Haskell | None |
---|---|
Language | Haskell2010 |
Various utilities to tweet using the twitter api
Make sure you have a file credentials file (default the executable looks for is `.cred`) with the following info:
api-key: API_KEY api-sec: API_SECRE tok: OAUTH_TOKEN tok-sec: TOKEN_SECRET
- basicTweet :: String -> FilePath -> IO Int
- tweetData :: Tweet -> FilePath -> IO Int
- thread :: String -> [String] -> Maybe Int -> Int -> FilePath -> IO ()
- data Tweet = Tweet {}
- trimUser :: Lens' Tweet Bool
- status :: Lens' Tweet String
- replyID :: Lens' Tweet (Maybe Int)
- handles :: Lens' Tweet [String]
- signRequest :: FilePath -> Request -> IO Request
- urlString :: Tweet -> String
Functions to tweet
basicTweet :: String -> FilePath -> IO Int Source #
Tweet a string given a path to credentials; return the id of the status.
basicTweet "On the airplane." ".cred"
tweetData :: Tweet -> FilePath -> IO Int Source #
tweet, given a Tweet
and path to credentials. Return id of posted tweet.
thread :: String -> [String] -> Maybe Int -> Int -> FilePath -> IO () Source #
thread tweets together nicely. Takes a string, a list of handles to reply to, plus the ID of the status you're replying to.
If you need to thread tweets without replying, pass a Nothing
as the third argument.
thread "Hi I'm back in New York!" ["friend1","friend2"] Nothing 1 ".cred"
Data type for a tweet
Data type for our request: consists of the status text, whether to trium user information in the response, the handles to mention, and optionally the id of the status to reply to.
Functions to sign API requests
signRequest :: FilePath -> Request -> IO Request Source #
Sign a request using your OAuth dev token. Uses the IO monad because signatures require a timestamp