liblastfm 0.6.0 → 0.6.1
raw patch · 9 files changed
+19/−22 lines, 9 filesdep ~http-clientPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: http-client
API changes (from Hackage documentation)
- Lastfm.Request: https :: Request f a
- Lastfm.Request: json :: Request JSON a
+ Lastfm.Request: json :: Request 'JSON a
- Lastfm.Request: xml :: Request XML a
+ Lastfm.Request: xml :: Request 'XML a
Files
- CHANGELOG.markdown +5/−0
- LICENSE +1/−1
- example/liblastfm-examples.cabal +1/−1
- example/sort-friends.hs +0/−3
- liblastfm.cabal +3/−3
- src/Lastfm/Internal.hs +1/−1
- src/Lastfm/Request.hs +1/−5
- src/Lastfm/Response.hs +4/−6
- test/spec/Lastfm/ResponseSpec.hs +3/−2
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.6.1+=====++ * Set default schema to 'https' (issue #27 fixed).+ 0.6.0 =====
LICENSE view
@@ -1,4 +1,4 @@-Copyright (C) 2012-2014 Matvey Aksenov, Dmitry Malikov+Copyright (C) 2012-2018 Matvey Aksenov, Dmitry Malikov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in
example/liblastfm-examples.cabal view
@@ -1,5 +1,5 @@ name: liblastfm-examples-version: 0.6.0+version: 0.6.1 synopsis: Liblastfm examples license: MIT license-file: LICENSE
example/sort-friends.hs view
@@ -61,9 +61,6 @@ where score = folded.key "comparison".key "result".key "score"._String -forConcurrently :: [a] -> (a -> IO b) -> IO [b]-forConcurrently = flip mapConcurrently- pretty :: [(Text, Score)] -> IO () pretty = mapM_ (\(n,s) -> Text.putStrLn $ n <> ": " <> s) . take 5 . sortBy (flip compare `on` snd)
liblastfm.cabal view
@@ -1,5 +1,5 @@ name: liblastfm-version: 0.6.0+version: 0.6.1 synopsis: Lastfm API interface license: MIT license-file: LICENSE@@ -30,7 +30,7 @@ source-repository this type: git location: https://github.com/supki/liblastfm- tag: 0.6.0+ tag: 0.6.1 flag test-api@@ -48,7 +48,7 @@ , cereal , containers >= 0.5 , cryptonite >= 0.7- , http-client >= 0.4.19+ , http-client >= 0.5 , http-client-tls >= 0.2 , network-uri , profunctors
src/Lastfm/Internal.hs view
@@ -132,5 +132,5 @@ q <- bimap T.decodeUtf8 T.decodeUtf8 <$> get return R { _host = h, _method = m, _query = q } -bimap :: (Ord s, Ord t) => (s -> t) -> (a -> b) -> Map s a -> Map t b+bimap :: Ord t => (s -> t) -> (a -> b) -> Map s a -> Map t b bimap f g = M.mapKeys f . M.map g
src/Lastfm/Request.hs view
@@ -7,7 +7,7 @@ ( -- * Request Request, R, Ready, Sign, Format(..) -- * Request major parameters- , api, https, post, get, json, xml, APIKey, apiKey, SessionKey, sessionKey+ , api, post, get, json, xml, APIKey, apiKey, SessionKey, sessionKey -- * Request minor parameters , Token, token, Callback, callback , Artist, artist, artists, Album, album, MBID, mbid@@ -76,10 +76,6 @@ -- Primarily used in API call wrappers, not intended for usage by library user api :: Text -> Request f a api = add "method"---- | Change API scheme to https ('http' is the default one)-https :: Request f a-https = wrap $ \r -> r { _host = "https://ws.audioscrobbler.com/2.0/" } -- | Change html _method to GET --
src/Lastfm/Response.hs view
@@ -104,7 +104,7 @@ base :: R f base = R- { _host = "http://ws.audioscrobbler.com/2.0/"+ { _host = "https://ws.audioscrobbler.com/2.0/" , _method = "GET" , _query = mempty }@@ -228,16 +228,14 @@ -- | Send the 'R' and parse the 'Response' with the supplied parser lastfmWith- :: Supported f r- => Connection+ :: Connection -> (Lazy.ByteString -> Either LastfmError a) -> R f -> IO (Either LastfmError a) lastfmWith (Connection man) p r = do- req <- Http.parseUrl (render r)+ req <- Http.parseUrlThrow (render r) let req' = req- { Http.method = _method r- , Http.responseTimeout = Just 10000000+ { Http.method = _method r } p . Http.responseBody <$> Http.httpLbs req' man `catch`
test/spec/Lastfm/ResponseSpec.hs view
@@ -38,8 +38,9 @@ tryLastfmError = try it "catches 'HttpException'" $ do- val <- tryLastfmError (throwIO ResponseTimeout) :: IO (Either LastfmError ())- val `shouldHave` _Left._LastfmHttpError.only ResponseTimeout+ let ex = InvalidUrlException "foo" "bar"+ val <- tryLastfmError (throwIO ex) :: IO (Either LastfmError ())+ val `shouldHave` _Left._LastfmHttpError.only ex it "does not catch other exceptions" $ tryLastfmError (throwIO DivideByZero) `shouldThrow` _DivideByZero