liblastfm-0.4.0.0: Lastfm API interface

Safe HaskellNone

Network.Lastfm.Response

Contents

Description

Request sending and Response parsing

Synopsis

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

newtype Secret Source

Application secret

Constructors

Secret Text 

sign :: Secret -> Request f Sign -> Request f ReadySource

Sign the Request with the Secret so it's ready to be sent

Get response

class Supported f r | f -> r, r -> fSource

Supported provides parsing for the chosen Format

JSON is parsed to Value type from aeson, while XML is parsed to Document from xml-conduit

data Format Source

Response format: either JSON or XML

Constructors

JSON 
XML 

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

Constructors

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

Instances

Eq LastfmError

Admittedly, this isn't the best Eq instance ever but not having Eq HttpException does not leave much a choice

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' LastfmError ByteString in disguise

_LastfmEncodedError :: (Choice p, Applicative m, AsLastfmError e) => p (Int, Text) (m (Int, Text)) -> p e (m e)Source

This is a Prism' LastfmError (Int, String) in disguise

_LastfmHttpError :: (Choice p, Applicative m, AsLastfmError e) => p HttpException (m HttpException) -> p e (m e)Source

This is a Prism' LastfmError HttpException in disguise

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

finalize :: Supported f r => Request f Ready -> R fSource

Get the R from the Request