Continuing my quest to perform a dropbox query I am using http-conduit to try and perform a POST request, but I am not sure how to construct the Manager object.
Here is what I got so far (and the problematic line):
data DropboxConfig = DropboxConfig { appKey :: String, appSecret :: String}
main = do
let appKey = "asdfasdfasdfs"
let appSecret = ";lkj;lkjlkjlkj"
let config = DropboxConfig {appKey = appKey, appSecret = appSecret}
let qs = buildQueryString config
let req = def {method = methodPost, queryString = qs}
resp <- http req (newManager) --!Does Not work
putStrLn $ unpack resp
buildQueryString :: DropboxConfig -> ByteString
buildQueryString config = pack $ "oauth_consumer_key="++(appKey config)++
"&oauth_signature_method=HMAC-SHA1"++
"&oauth_timestamp=137131200" ++
"&oauth_nonce=4572616e48616d6d65724c61686176" ++
"&oauth_signature=wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D
Here is the error I am getting:
Couldn't match expected type `http-conduit-1.3.0.1:Network.HTTP.Conduit.Manager.Manager'
with actual type `http-conduit-1.3.0.1:Network.HTTP.Conduit.Manager.ManagerSettings
-> IO http-conduit-1.3.0.1:Network.HTTP.Conduit.Manager.Manager'
The type signature says it all, really:
This is an IO action, so you’ll have to bind it using
<-as always. It also requiresManagerSettings, so you’ll need to provide that. Something like this should do it, I think (not too familiar with the library, just following the types):Though, it might be a better idea to use
withManagerso you don’t have to worry about closing it yourself.