Safe Haskell | None |
---|
Request sending and Response parsing
- newtype Secret = Secret Text
- sign :: Secret -> Request f Sign -> Request f Ready
- class Supported f r | f -> r, r -> f
- data Format
- lastfm :: Supported f r => Request f Ready -> IO (Either LastfmError r)
- lastfm_ :: Supported f r => Request f Ready -> IO (Either LastfmError ())
- data LastfmError
- _LastfmBadResponse :: (Choice p, Applicative m, AsLastfmError e) => p ByteString (m ByteString) -> p e (m e)
- _LastfmEncodedError :: (Choice p, Applicative m, AsLastfmError e) => p (Int, Text) (m (Int, Text)) -> p e (m e)
- _LastfmHttpError :: (Choice p, Applicative m, AsLastfmError e) => p HttpException (m HttpException) -> p e (m e)
- lastfmWith :: Supported f r => (ByteString -> Either LastfmError a) -> R f -> IO (Either LastfmError a)
- finalize :: Supported f r => Request f Ready -> R f
Compute request signature
The signature is required for every authenticated API request. Basically, every such request appends the md5 footprint of its arguments to the query as described at http://www.last.fm/api/authspec#8
Application secret
Get response
lastfm :: Supported f r => Request f Ready -> IO (Either LastfmError r)Source
Send the Request
and parse the Response
lastfm_ :: Supported f r => Request f Ready -> IO (Either LastfmError ())Source
Send the Request
without parsing the Response
Errors
data LastfmError Source
Different ways last.fm response can be unusable
LastfmBadResponse ByteString | last.fm thinks it responded with something legible, but it really isn't |
LastfmEncodedError Int Text | last.fm error code and message string |
LastfmHttpError HttpException | wrapped http-conduit exception |
Eq LastfmError | Admittedly, this isn't the best |
Show LastfmError | |
Typeable LastfmError | |
Exception LastfmError |
_LastfmBadResponse :: (Choice p, Applicative m, AsLastfmError e) => p ByteString (m ByteString) -> p e (m e)Source
This is a Prism'
in disguise
LastfmError
ByteString
_LastfmEncodedError :: (Choice p, Applicative m, AsLastfmError e) => p (Int, Text) (m (Int, Text)) -> p e (m e)Source
This is a Prism'
in disguise
LastfmError
(Int
, String
)
_LastfmHttpError :: (Choice p, Applicative m, AsLastfmError e) => p HttpException (m HttpException) -> p e (m e)Source
This is a Prism'
in disguise
LastfmError
HttpException
Internal
lastfmWith :: Supported f r => (ByteString -> Either LastfmError a) -> R f -> IO (Either LastfmError a)Source
Send the R
and parse the Response
with the supplied parser