tweet-hs-1.0.2.3: Command-line tool for twitter
Safe HaskellNone
LanguageHaskell2010

Web.Tweet

Description

Various utilities to tweet using the twitter api

Make sure you have a file credentials file (default the executable looks for is $HOME/.cred.toml) with the following info:

api-key = API_KEY

api-sec = API_SECRET

tok = OAUTH_TOKEN

tok-sec = TOKEN_SECRET

Synopsis

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.toml"

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"

reply :: String -> [String] -> Maybe Int -> FilePath -> IO () Source #

Reply with a single tweet. Works the same as thread but doesn't take the fourth argument.

reply "Idk what that means" ["friend1"] (Just 189943500) ".cred"

Data type for a tweet

data Tweet Source #

Data type for our request: consists of the status text, whether to trium u information in the response, the handles to mention, and optionally the id of the status to reply to.

Constructors

Tweet 

data TweetEntity Source #

Data type for tweets as they are returned

Instances

Instances details
Eq TweetEntity Source # 
Instance details

Defined in Web.Tweet.Types

type Timeline = [TweetEntity] Source #

Stores data like (name, text, favoriteCount, retweetCount)

type Config = (OAuth, Credential) Source #

Contains an OAuth and a Credential; encapsulates everything needed to sign a request.

status :: Lens' Tweet String Source #

Lens for Tweet accessing the status field.

handles :: Lens' Tweet [String] Source #

Lens for Tweet accessing the handles field.

replyID :: Lens' Tweet (Maybe Int) Source #

Lens for Tweet accessing the _replyID field.

text :: Lens' TweetEntity String Source #

Lens for TweetEntity accessing the _text field.

name :: Lens' TweetEntity String Source #

Lens for TweetEntity accessing the _name field.

tweetId :: Lens' TweetEntity Int Source #

Lens for TweetEntity accessing the _tweetId field.

quoted :: Lens' TweetEntity (Maybe TweetEntity) Source #

Lens for TweetEntity accessing the _quoted field.

retweets :: Lens' TweetEntity Int Source #

Lens for TweetEntity accessing the _retweets field.

favorites :: Lens' TweetEntity Int Source #

Lens for TweetEntity accessing the _favorites field.

Various API calls

showProfile :: String -> Int -> Bool -> FilePath -> IO String Source #

Show a user profile given screen name, how many tweets to return, and whether to print them in color.

showBest :: String -> Int -> Bool -> FilePath -> IO String Source #

Show the most successful tweets by a given user, given their screen name.

showBest' :: String -> Int -> Bool -> FilePath -> IO String Source #

Show the most successful tweets by a given user, given their screen name. Additionally filter out replies.

showTimeline :: Int -> Bool -> FilePath -> IO String Source #

Display user timeline

showTweets :: Bool -> Either (ParseErrorBundle String Void) Timeline -> String Source #

Display user timeline in color, as appropriate

showFavorites :: Int -> String -> Bool -> FilePath -> IO String Source #

Display a user's favorites

Functions to sign API requests

signRequest :: FilePath -> Request -> IO Request Source #

Sign a request using your OAuth dev token, as stored in a config file. Uses the IO monad because signatures require a timestamp

oAuthMem Source #

Arguments

:: ByteString

API key

-> ByteString

API secret

-> OAuth 

Create an OAuth api key from two ByteStrings.

credentialMem Source #

Arguments

:: ByteString

Token

-> ByteString

Token secret

-> Credential 

Functions to generate a URL string from a Tweet

urlString :: Tweet -> String Source #

Convert a tweet to a percent-encoded url for querying an API

Timeline filters

filterReplies :: Timeline -> Timeline Source #

Filter out replies

filterRTs :: Timeline -> Timeline Source #

Filter out retweets

filterQuotes :: Timeline -> Timeline Source #

Filter out quotes

Helper function to print a bird