]> gitweb.michael.orlitzky.com - dead/halcyon.git/blobdiff - src/Twitter/Http.hs
Rewrite CommandLine to use cmdargs and integrate the command-line and RC file options.
[dead/halcyon.git] / src / Twitter / Http.hs
index 6d055b90f0da7444568670f39586ab6fbc790a87..be10b8697a5be241a23b22ca0e8b5b197ab54013 100644 (file)
@@ -1,4 +1,8 @@
-module Twitter.Http
+module Twitter.Http (
+  get_user_new_statuses,
+  get_user_timeline,
+  http_get
+  )
 where
 
 import qualified Data.ByteString.Lazy as B
@@ -13,7 +17,7 @@ import Web.Authenticate.OAuth (
   newOAuth,
   signOAuth)
 
-import Configuration
+import Configuration (Cfg(..))
 
 -- |The API URL of username's timeline.
 --
@@ -32,27 +36,16 @@ user_timeline_url username =
            "&include_rts=true&",
            "count=10" ]
 
-status_url :: Integer -> String
-status_url status_id =
-  concat [ "https://api.twitter.com/",
-           "1.1/",
-           "statuses/",
-           "show.json?id=",
-           (show status_id) ]
 
 -- | Given username's last status id, constructs the API URL for
 --   username's new statuses. Essentially, 'user_timeline_url' with a
 --   "since_id" parameter tacked on.
 user_new_statuses_url :: String -> Integer -> String
 user_new_statuses_url username last_status_id =
-  concat [ user_timeline_url username,
-           "&since_id=" ++ (show last_status_id) ]
-
-
-get_status :: Cfg -> Integer -> IO B.ByteString
-get_status cfg status_id = do
-  let uri = status_url status_id
-  http_get cfg uri
+  url ++ "&since_id=" ++ since_id
+  where
+    url = user_timeline_url username
+    since_id = show last_status_id
 
 
 -- | Return's username's timeline.