Error err -> Left $ "couldn't parse response from Dropbox: " err handleJsonBody :: JSON a => ByteString -> Either ErrorMessage a handleJsonBody = handleJsonBodyT id - GetAccountInfo - |Information about a user account.Finding integrated cloud services into an iOS application some time ago was something quite rare. Result a readJsonField a as = maybe ( fail $ "missing field \"" a "\"" ) return ( lookup a as ) >= readJSON handleJsonBodyT :: JSON a => ( a -> b ) -> ByteString -> Either ErrorMessage b handleJsonBodyT tf body = case JSON. Result a readJsonFieldD a as d = readJsonFieldT a as d id readJsonField :: JSON a => String -> -> JSON. Ok d readJsonFieldD :: JSON a => String -> -> a -> JSON. Result b readJsonFieldT a as d t = case lookup a as of Just jv -> do v JSON. lookup name enc of Just value -> return value Nothing -> Left $ "missing parameter \"" name "\"" - dbTimeFormat = "%a, %d %b %Y %H:%M:%S %z" dbFormatTime = formatTime defaultTimeLocale dbTimeFormat dbParseTime = parseTime defaultTimeLocale dbTimeFormat - JSON parse helpers readJsonFieldT :: JSON a => String -> -> b -> ( a -> b ) -> JSON. Dropbox developer metadata code#authFinish mgr config ( RequestToken rtKey rtSecret ) = do result Left $ "couldn't understand response from Dropbox: " err Right value -> Right value handler code reason body = Left $ "server returned " show code ": " show reason ": " show body parseResponse :: String -> Either String ( AccessToken, String ) parseResponse s = do enc String -> Either String String requireKey enc name = case URLEncoded. > Config -> Maybe URL - ^The callback URL (optional) -> IO ( Either ErrorMessage ( RequestToken, URL ) ) authStart mgr config callback = do result Left $ "couldn't understand response from Dropbox: " err Right requestToken ( RequestToken requestTokenKey _ ) -> do let authorizeUrl = " webHost "/" apiVersion "/oauth/authorize?locale=" urlEncode locale "
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |