liblastfm 0.1.1.2 → 0.2.0.0
raw patch · 33 files changed
+346/−348 lines, 33 filesdep +contravariantdep +voidPVP ok
version bump matches the API change (PVP)
Dependencies added: contravariant, void
API changes (from Hackage documentation)
- Network.Lastfm.Album: instance ArtistAlbumOrMBID (Artist -> Album -> APIKey -> Ready)
- Network.Lastfm.Album: instance ArtistAlbumOrMBID (MBID -> APIKey -> Ready)
- Network.Lastfm.Artist: instance ArtistOrMBID Artist
- Network.Lastfm.Artist: instance ArtistOrMBID MBID
- Network.Lastfm.Internal: Send :: Auth
- Network.Lastfm.Internal: Sign :: Auth
- Network.Lastfm.Internal: class Coercing t
- Network.Lastfm.Internal: data Auth
- Network.Lastfm.Internal: instance Applicative (Request f a)
- Network.Lastfm.Internal: instance Coercing (R f)
- Network.Lastfm.Internal: instance Coercing (Request f)
- Network.Lastfm.Internal: instance Functor (Request f a)
- Network.Lastfm.Internal: instance Serialize (R f a t)
- Network.Lastfm.Request: Send :: Auth
- Network.Lastfm.Request: Sign :: Auth
- Network.Lastfm.Request: data Auth
+ Network.Lastfm.Album: instance ArtistAlbumOrMBID r (Artist -> Album -> APIKey -> r)
+ Network.Lastfm.Album: instance ArtistAlbumOrMBID r (MBID -> APIKey -> r)
+ Network.Lastfm.Artist: instance ArtistOrMBID r Artist
+ Network.Lastfm.Artist: instance ArtistOrMBID r MBID
+ Network.Lastfm.Internal: data Sign
+ Network.Lastfm.Internal: instance Applicative (Request f)
+ Network.Lastfm.Internal: instance Contravariant (Request f)
+ Network.Lastfm.Internal: instance Foldable (Request f)
+ Network.Lastfm.Internal: instance Functor (Request f)
+ Network.Lastfm.Internal: instance Serialize (R f)
+ Network.Lastfm.Internal: instance Traversable (Request f)
+ Network.Lastfm.Request: data Sign
- Network.Lastfm.Album: addTags :: Request f Sign (Artist -> Album -> [Tag] -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Album: addTags :: Request f (Artist -> Album -> [Tag] -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Album: class ArtistAlbumOrMBID a
+ Network.Lastfm.Album: class ArtistAlbumOrMBID r a | a -> r
- Network.Lastfm.Album: getBuyLinks :: ArtistAlbumOrMBID t => Request f Send (Country -> t)
+ Network.Lastfm.Album: getBuyLinks :: ArtistAlbumOrMBID Ready a => Request f (Country -> a)
- Network.Lastfm.Album: getInfo :: ArtistAlbumOrMBID t => Request f Send t
+ Network.Lastfm.Album: getInfo :: ArtistAlbumOrMBID Ready a => Request f a
- Network.Lastfm.Album: getShouts :: ArtistAlbumOrMBID t => Request f Send t
+ Network.Lastfm.Album: getShouts :: ArtistAlbumOrMBID Ready a => Request f a
- Network.Lastfm.Album: getTags :: ArtistAlbumOrMBID t => Request f a t
+ Network.Lastfm.Album: getTags :: ArtistAlbumOrMBID r a => Request f a
- Network.Lastfm.Album: getTopTags :: ArtistAlbumOrMBID t => Request f Send t
+ Network.Lastfm.Album: getTopTags :: ArtistAlbumOrMBID Ready a => Request f a
- Network.Lastfm.Album: removeTag :: Request f Sign (Artist -> Album -> Tag -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Album: removeTag :: Request f (Artist -> Album -> Tag -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Album: search :: Request f Send (Album -> APIKey -> Ready)
+ Network.Lastfm.Album: search :: Request f (Album -> APIKey -> Ready)
- Network.Lastfm.Album: share :: Request f Sign (Album -> Artist -> Recipient -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Album: share :: Request f (Album -> Artist -> Recipient -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Artist: addTags :: Request f Sign (Artist -> [Tag] -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Artist: addTags :: Request f (Artist -> [Tag] -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Artist: class ArtistOrMBID a
+ Network.Lastfm.Artist: class ArtistOrMBID r a
- Network.Lastfm.Artist: getCorrection :: Request f Send (Artist -> APIKey -> Ready)
+ Network.Lastfm.Artist: getCorrection :: Request f (Artist -> APIKey -> Ready)
- Network.Lastfm.Artist: getEvents :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getEvents :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getInfo :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getInfo :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getPastEvents :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getPastEvents :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getPodcast :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getPodcast :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getShouts :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getShouts :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getSimilar :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getSimilar :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getTags :: ArtistOrMBID t => Request f a (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getTags :: ArtistOrMBID r a => Request f (a -> APIKey -> r)
- Network.Lastfm.Artist: getTopAlbums :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getTopAlbums :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getTopFans :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getTopFans :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getTopTags :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getTopTags :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: getTopTracks :: ArtistOrMBID t => Request f Send (t -> APIKey -> Ready)
+ Network.Lastfm.Artist: getTopTracks :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready)
- Network.Lastfm.Artist: removeTag :: Request f Sign (Artist -> Tag -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Artist: removeTag :: Request f (Artist -> Tag -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Artist: search :: Request f Send (Artist -> APIKey -> Ready)
+ Network.Lastfm.Artist: search :: Request f (Artist -> APIKey -> Ready)
- Network.Lastfm.Artist: share :: Request f Sign (Artist -> Recipient -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Artist: share :: Request f (Artist -> Recipient -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Artist: shout :: Request f Sign (Artist -> Message -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Artist: shout :: Request f (Artist -> Message -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Authentication: getMobileSession :: Request f Sign (Username -> Password -> APIKey -> Ready)
+ Network.Lastfm.Authentication: getMobileSession :: Request f (Username -> Password -> APIKey -> Sign)
- Network.Lastfm.Authentication: getSession :: Request f Sign (Token -> APIKey -> Ready)
+ Network.Lastfm.Authentication: getSession :: Request f (Token -> APIKey -> Sign)
- Network.Lastfm.Authentication: getToken :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Authentication: getToken :: Request f (APIKey -> Ready)
- Network.Lastfm.Authentication: link :: Request f a t -> String
+ Network.Lastfm.Authentication: link :: Request f a -> String
- Network.Lastfm.Chart: getHypedArtists :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Chart: getHypedArtists :: Request f (APIKey -> Ready)
- Network.Lastfm.Chart: getHypedTracks :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Chart: getHypedTracks :: Request f (APIKey -> Ready)
- Network.Lastfm.Chart: getLovedTracks :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Chart: getLovedTracks :: Request f (APIKey -> Ready)
- Network.Lastfm.Chart: getTopArtists :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Chart: getTopArtists :: Request f (APIKey -> Ready)
- Network.Lastfm.Chart: getTopTags :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Chart: getTopTags :: Request f (APIKey -> Ready)
- Network.Lastfm.Chart: getTopTracks :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Chart: getTopTracks :: Request f (APIKey -> Ready)
- Network.Lastfm.Event: attend :: Request f Sign (Event -> Status -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Event: attend :: Request f (Event -> Status -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Event: getAttendees :: Request f Send (Event -> APIKey -> Ready)
+ Network.Lastfm.Event: getAttendees :: Request f (Event -> APIKey -> Ready)
- Network.Lastfm.Event: getInfo :: Request f Send (Event -> APIKey -> Ready)
+ Network.Lastfm.Event: getInfo :: Request f (Event -> APIKey -> Ready)
- Network.Lastfm.Event: getShouts :: Request f Send (Event -> APIKey -> Ready)
+ Network.Lastfm.Event: getShouts :: Request f (Event -> APIKey -> Ready)
- Network.Lastfm.Event: share :: Request f Sign (Event -> Recipient -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Event: share :: Request f (Event -> Recipient -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Event: shout :: Request f Sign (Event -> Message -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Event: shout :: Request f (Event -> Message -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Geo: getEvents :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Geo: getEvents :: Request f (APIKey -> Ready)
- Network.Lastfm.Geo: getMetroArtistChart :: Request f Send (Metro -> Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getMetroArtistChart :: Request f (Metro -> Country -> APIKey -> Ready)
- Network.Lastfm.Geo: getMetroHypeArtistChart :: Request f Send (Metro -> Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getMetroHypeArtistChart :: Request f (Metro -> Country -> APIKey -> Ready)
- Network.Lastfm.Geo: getMetroHypeTrackChart :: Request f Send (Metro -> Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getMetroHypeTrackChart :: Request f (Metro -> Country -> APIKey -> Ready)
- Network.Lastfm.Geo: getMetroTrackChart :: Request f Send (Metro -> Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getMetroTrackChart :: Request f (Metro -> Country -> APIKey -> Ready)
- Network.Lastfm.Geo: getMetroUniqueArtistChart :: Request f Send (Metro -> Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getMetroUniqueArtistChart :: Request f (Metro -> Country -> APIKey -> Ready)
- Network.Lastfm.Geo: getMetroUniqueTrackChart :: Request f Send (Metro -> Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getMetroUniqueTrackChart :: Request f (Metro -> Country -> APIKey -> Ready)
- Network.Lastfm.Geo: getMetroWeeklyChartlist :: Request f Send (Metro -> APIKey -> Ready)
+ Network.Lastfm.Geo: getMetroWeeklyChartlist :: Request f (Metro -> APIKey -> Ready)
- Network.Lastfm.Geo: getMetros :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Geo: getMetros :: Request f (APIKey -> Ready)
- Network.Lastfm.Geo: getTopArtists :: Request f Send (Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getTopArtists :: Request f (Country -> APIKey -> Ready)
- Network.Lastfm.Geo: getTopTracks :: Request f Send (Country -> APIKey -> Ready)
+ Network.Lastfm.Geo: getTopTracks :: Request f (Country -> APIKey -> Ready)
- Network.Lastfm.Group: getHype :: Request f Send (Group -> APIKey -> Ready)
+ Network.Lastfm.Group: getHype :: Request f (Group -> APIKey -> Ready)
- Network.Lastfm.Group: getMembers :: Request f Send (Group -> APIKey -> Ready)
+ Network.Lastfm.Group: getMembers :: Request f (Group -> APIKey -> Ready)
- Network.Lastfm.Group: getWeeklyAlbumChart :: Request f Send (Group -> APIKey -> Ready)
+ Network.Lastfm.Group: getWeeklyAlbumChart :: Request f (Group -> APIKey -> Ready)
- Network.Lastfm.Group: getWeeklyArtistChart :: Request f Send (Group -> APIKey -> Ready)
+ Network.Lastfm.Group: getWeeklyArtistChart :: Request f (Group -> APIKey -> Ready)
- Network.Lastfm.Group: getWeeklyChartList :: Request f Send (Group -> APIKey -> Ready)
+ Network.Lastfm.Group: getWeeklyChartList :: Request f (Group -> APIKey -> Ready)
- Network.Lastfm.Group: getWeeklyTrackChart :: Request f Send (Group -> APIKey -> Ready)
+ Network.Lastfm.Group: getWeeklyTrackChart :: Request f (Group -> APIKey -> Ready)
- Network.Lastfm.Internal: R :: {-# UNPACK #-} !Text -> {-# UNPACK #-} !ByteString -> !(Map Text Text) -> R t
+ Network.Lastfm.Internal: R :: {-# UNPACK #-} !Text -> {-# UNPACK #-} !ByteString -> !(Map Text Text) -> R
- Network.Lastfm.Internal: Request :: Dual (Endo (R f a t)) -> Request f a t
+ Network.Lastfm.Internal: Request :: Const (Dual (Endo (R f))) a -> Request f a
- Network.Lastfm.Internal: _host :: R t -> {-# UNPACK #-} !Text
+ Network.Lastfm.Internal: _host :: R -> {-# UNPACK #-} !Text
- Network.Lastfm.Internal: _method :: R t -> {-# UNPACK #-} !ByteString
+ Network.Lastfm.Internal: _method :: R -> {-# UNPACK #-} !ByteString
- Network.Lastfm.Internal: _query :: R t -> !(Map Text Text)
+ Network.Lastfm.Internal: _query :: R -> !(Map Text Text)
- Network.Lastfm.Internal: coerce :: Coercing t => t (a :: Auth) b -> t c d
+ Network.Lastfm.Internal: coerce :: (Contravariant f, Functor f) => f a -> f b
- Network.Lastfm.Internal: data R (f :: Format) (a :: Auth) t
+ Network.Lastfm.Internal: data R (f :: Format)
- Network.Lastfm.Internal: host :: Functor f => (Text -> f Text) -> R h a t -> f (R h a t)
+ Network.Lastfm.Internal: host :: Functor f => (Text -> f Text) -> R h -> f (R h)
- Network.Lastfm.Internal: method :: Functor f => (ByteString -> f ByteString) -> R h a t -> f (R h a t)
+ Network.Lastfm.Internal: method :: Functor f => (ByteString -> f ByteString) -> R h -> f (R h)
- Network.Lastfm.Internal: newtype Request f a t
+ Network.Lastfm.Internal: newtype Request f a
- Network.Lastfm.Internal: query :: Functor f => (Map Text Text -> f (Map Text Text)) -> R h a t -> f (R h a t)
+ Network.Lastfm.Internal: query :: Functor f => (Map Text Text -> f (Map Text Text)) -> R h -> f (R h)
- Network.Lastfm.Internal: render :: R f a t -> String
+ Network.Lastfm.Internal: render :: R f -> String
- Network.Lastfm.Internal: unRequest :: Request f a t -> Dual (Endo (R f a t))
+ Network.Lastfm.Internal: unRequest :: Request f a -> Const (Dual (Endo (R f))) a
- Network.Lastfm.Internal: unwrap :: Request f a t -> R f a t -> R f a t
+ Network.Lastfm.Internal: unwrap :: Request f a -> R f -> R f
- Network.Lastfm.Internal: wrap :: (R f a t -> R f a t) -> Request f a t
+ Network.Lastfm.Internal: wrap :: (R f -> R f) -> Request f a
- Network.Lastfm.Library: addAlbum :: Request f Sign (Artist -> Album -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Library: addAlbum :: Request f (Artist -> Album -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Library: addArtist :: Request f Sign (Artist -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Library: addArtist :: Request f (Artist -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Library: addTrack :: Request f Sign (Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Library: addTrack :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Library: getAlbums :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.Library: getAlbums :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.Library: getArtists :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.Library: getArtists :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.Library: getTracks :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.Library: getTracks :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.Library: removeAlbum :: Request f Sign (Artist -> Album -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Library: removeAlbum :: Request f (Artist -> Album -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Library: removeArtist :: Request f Sign (Artist -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Library: removeArtist :: Request f (Artist -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Library: removeScrobble :: Request f Sign (Artist -> Track -> Timestamp -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Library: removeScrobble :: Request f (Artist -> Track -> Timestamp -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Library: removeTrack :: Request f Sign (Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Library: removeTrack :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Playlist: addTrack :: Request f Sign (Playlist -> Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Playlist: addTrack :: Request f (Playlist -> Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Playlist: create :: Request f Sign (APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Playlist: create :: Request f (APIKey -> SessionKey -> Sign)
- Network.Lastfm.Radio: getPlaylist :: Request f Sign (Multiplier -> Bitrate -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Radio: getPlaylist :: Request f (Multiplier -> Bitrate -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Radio: search :: Request f Send (Name -> APIKey -> Ready)
+ Network.Lastfm.Radio: search :: Request f (Name -> APIKey -> Ready)
- Network.Lastfm.Radio: tune :: Request f Sign (Station -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Radio: tune :: Request f (Station -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Request: album :: Text -> Request f a Album
+ Network.Lastfm.Request: album :: Text -> Request f Album
- Network.Lastfm.Request: albumArtist :: Text -> Request f a AlbumArtist
+ Network.Lastfm.Request: albumArtist :: Text -> Request f AlbumArtist
- Network.Lastfm.Request: api :: Text -> Request f a t
+ Network.Lastfm.Request: api :: Text -> Request f a
- Network.Lastfm.Request: apiKey :: Text -> Request f a APIKey
+ Network.Lastfm.Request: apiKey :: Text -> Request f APIKey
- Network.Lastfm.Request: artist :: Text -> Request f a Artist
+ Network.Lastfm.Request: artist :: Text -> Request f Artist
- Network.Lastfm.Request: artists :: [Text] -> Request f a [Artist]
+ Network.Lastfm.Request: artists :: [Text] -> Request f [Artist]
- Network.Lastfm.Request: autocorrect :: Bool -> Request f a Autocorrect
+ Network.Lastfm.Request: autocorrect :: Bool -> Request f Autocorrect
- Network.Lastfm.Request: bitrate :: Bitrate -> Request f a Bitrate
+ Network.Lastfm.Request: bitrate :: Bitrate -> Request f Bitrate
- Network.Lastfm.Request: buyLinks :: Bool -> Request f a BuyLinks
+ Network.Lastfm.Request: buyLinks :: Bool -> Request f BuyLinks
- Network.Lastfm.Request: callback :: Text -> Request f a Callback
+ Network.Lastfm.Request: callback :: Text -> Request f Callback
- Network.Lastfm.Request: chosenByUser :: Bool -> Request f a ChosenByUser
+ Network.Lastfm.Request: chosenByUser :: Bool -> Request f ChosenByUser
- Network.Lastfm.Request: class Targeted t
+ Network.Lastfm.Request: class Targeted a
- Network.Lastfm.Request: comparison :: Targeted t => Int64 -> Request f a t -> Request f a t
+ Network.Lastfm.Request: comparison :: Targeted a => Int64 -> Request f a -> Request f a
- Network.Lastfm.Request: context :: Text -> Request f a Context
+ Network.Lastfm.Request: context :: Text -> Request f Context
- Network.Lastfm.Request: country :: Text -> Request f a Country
+ Network.Lastfm.Request: country :: Text -> Request f Country
- Network.Lastfm.Request: data R (f :: Format) (a :: Auth) t
+ Network.Lastfm.Request: data R (f :: Format)
- Network.Lastfm.Request: data Request f a t
+ Network.Lastfm.Request: data Request f a
- Network.Lastfm.Request: description :: Text -> Request f a Description
+ Network.Lastfm.Request: description :: Text -> Request f Description
- Network.Lastfm.Request: discovery :: Bool -> Request f a Discovery
+ Network.Lastfm.Request: discovery :: Bool -> Request f Discovery
- Network.Lastfm.Request: distance :: Int64 -> Request f a Distance
+ Network.Lastfm.Request: distance :: Int64 -> Request f Distance
- Network.Lastfm.Request: duration :: Int64 -> Request f a Duration
+ Network.Lastfm.Request: duration :: Int64 -> Request f Duration
- Network.Lastfm.Request: end :: Int64 -> Request f a End
+ Network.Lastfm.Request: end :: Int64 -> Request f End
- Network.Lastfm.Request: endTimestamp :: Int64 -> Request f a EndTimestamp
+ Network.Lastfm.Request: endTimestamp :: Int64 -> Request f EndTimestamp
- Network.Lastfm.Request: event :: Int64 -> Request f a Event
+ Network.Lastfm.Request: event :: Int64 -> Request f Event
- Network.Lastfm.Request: festivalsonly :: Bool -> Request f a Festivals
+ Network.Lastfm.Request: festivalsonly :: Bool -> Request f Festivals
- Network.Lastfm.Request: fingerprint :: Int64 -> Request f a Fingerprint
+ Network.Lastfm.Request: fingerprint :: Int64 -> Request f Fingerprint
- Network.Lastfm.Request: from :: Int64 -> Request f a From
+ Network.Lastfm.Request: from :: Int64 -> Request f From
- Network.Lastfm.Request: get :: Request f a t
+ Network.Lastfm.Request: get :: Request f a
- Network.Lastfm.Request: group :: Text -> Request f a Group
+ Network.Lastfm.Request: group :: Text -> Request f Group
- Network.Lastfm.Request: json :: Request JSON a t
+ Network.Lastfm.Request: json :: Request JSON a
- Network.Lastfm.Request: language :: Text -> Request f a Language
+ Network.Lastfm.Request: language :: Text -> Request f Language
- Network.Lastfm.Request: latitude :: Text -> Request f a Latitude
+ Network.Lastfm.Request: latitude :: Text -> Request f Latitude
- Network.Lastfm.Request: limit :: Int64 -> Request f a Limit
+ Network.Lastfm.Request: limit :: Int64 -> Request f Limit
- Network.Lastfm.Request: location :: Text -> Request f a Location
+ Network.Lastfm.Request: location :: Text -> Request f Location
- Network.Lastfm.Request: longitude :: Text -> Request f a Longitude
+ Network.Lastfm.Request: longitude :: Text -> Request f Longitude
- Network.Lastfm.Request: mbid :: Text -> Request f a MBID
+ Network.Lastfm.Request: mbid :: Text -> Request f MBID
- Network.Lastfm.Request: message :: Text -> Request f a Message
+ Network.Lastfm.Request: message :: Text -> Request f Message
- Network.Lastfm.Request: metro :: Text -> Request f a Metro
+ Network.Lastfm.Request: metro :: Text -> Request f Metro
- Network.Lastfm.Request: multiplier :: Multiplier -> Request f a Multiplier
+ Network.Lastfm.Request: multiplier :: Multiplier -> Request f Multiplier
- Network.Lastfm.Request: name :: Text -> Request f a Name
+ Network.Lastfm.Request: name :: Text -> Request f Name
- Network.Lastfm.Request: page :: Int64 -> Request f a Page
+ Network.Lastfm.Request: page :: Int64 -> Request f Page
- Network.Lastfm.Request: password :: Text -> Request f a Password
+ Network.Lastfm.Request: password :: Text -> Request f Password
- Network.Lastfm.Request: playlist :: Int64 -> Request f a Playlist
+ Network.Lastfm.Request: playlist :: Int64 -> Request f Playlist
- Network.Lastfm.Request: post :: Request f a t
+ Network.Lastfm.Request: post :: Request f a
- Network.Lastfm.Request: public :: Bool -> Request f a Public
+ Network.Lastfm.Request: public :: Bool -> Request f Public
- Network.Lastfm.Request: recentTracks :: Bool -> Request f a RecentTracks
+ Network.Lastfm.Request: recentTracks :: Bool -> Request f RecentTracks
- Network.Lastfm.Request: recipient :: Text -> Request f a Recipient
+ Network.Lastfm.Request: recipient :: Text -> Request f Recipient
- Network.Lastfm.Request: rtp :: Bool -> Request f a RTP
+ Network.Lastfm.Request: rtp :: Bool -> Request f RTP
- Network.Lastfm.Request: sessionKey :: Text -> Request f Sign SessionKey
+ Network.Lastfm.Request: sessionKey :: Text -> Request f SessionKey
- Network.Lastfm.Request: start :: Int64 -> Request f a Start
+ Network.Lastfm.Request: start :: Int64 -> Request f Start
- Network.Lastfm.Request: startTimestamp :: Int64 -> Request f a StartTimestamp
+ Network.Lastfm.Request: startTimestamp :: Int64 -> Request f StartTimestamp
- Network.Lastfm.Request: station :: Text -> Request f a Station
+ Network.Lastfm.Request: station :: Text -> Request f Station
- Network.Lastfm.Request: status :: Status -> Request f a Status
+ Network.Lastfm.Request: status :: Status -> Request f Status
- Network.Lastfm.Request: streamId :: Int64 -> Request f a StreamId
+ Network.Lastfm.Request: streamId :: Int64 -> Request f StreamId
- Network.Lastfm.Request: tag :: Text -> Request f a Tag
+ Network.Lastfm.Request: tag :: Text -> Request f Tag
- Network.Lastfm.Request: taggingType :: Text -> Request f a TaggingType
+ Network.Lastfm.Request: taggingType :: Text -> Request f TaggingType
- Network.Lastfm.Request: tags :: [Text] -> Request f a [Tag]
+ Network.Lastfm.Request: tags :: [Text] -> Request f [Tag]
- Network.Lastfm.Request: timestamp :: Int64 -> Request f a Timestamp
+ Network.Lastfm.Request: timestamp :: Int64 -> Request f Timestamp
- Network.Lastfm.Request: title :: Text -> Request f a Title
+ Network.Lastfm.Request: title :: Text -> Request f Title
- Network.Lastfm.Request: to :: Int64 -> Request f a To
+ Network.Lastfm.Request: to :: Int64 -> Request f To
- Network.Lastfm.Request: token :: Text -> Request f a Token
+ Network.Lastfm.Request: token :: Text -> Request f Token
- Network.Lastfm.Request: track :: Text -> Request f a Track
+ Network.Lastfm.Request: track :: Text -> Request f Track
- Network.Lastfm.Request: trackNumber :: Int64 -> Request f a TrackNumber
+ Network.Lastfm.Request: trackNumber :: Int64 -> Request f TrackNumber
- Network.Lastfm.Request: useRecs :: Bool -> Request f a UseRecs
+ Network.Lastfm.Request: useRecs :: Bool -> Request f UseRecs
- Network.Lastfm.Request: user :: Text -> Request f a User
+ Network.Lastfm.Request: user :: Text -> Request f User
- Network.Lastfm.Request: username :: Text -> Request f a Username
+ Network.Lastfm.Request: username :: Text -> Request f Username
- Network.Lastfm.Request: venue :: Int64 -> Request f a Venue
+ Network.Lastfm.Request: venue :: Int64 -> Request f Venue
- Network.Lastfm.Request: venueName :: Text -> Request f a VenueName
+ Network.Lastfm.Request: venueName :: Text -> Request f VenueName
- Network.Lastfm.Request: xml :: Request XML a t
+ Network.Lastfm.Request: xml :: Request XML a
- Network.Lastfm.Response: finalize :: Supported f => Request f Send Ready -> R f Send Ready
+ Network.Lastfm.Response: finalize :: Supported f => Request f Ready -> R f
- Network.Lastfm.Response: lastfm :: Supported f => Request f Send Ready -> IO (Response f)
+ Network.Lastfm.Response: lastfm :: Supported f => Request f Ready -> IO (Response f)
- Network.Lastfm.Response: lastfm' :: Supported f => R f Send Ready -> IO (Response f)
+ Network.Lastfm.Response: lastfm' :: Supported f => R f -> IO (Response f)
- Network.Lastfm.Response: sign :: Secret -> Request f Sign Ready -> Request f Send Ready
+ Network.Lastfm.Response: sign :: Secret -> Request f Sign -> Request f Ready
- Network.Lastfm.Tag: getInfo :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: getInfo :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tag: getSimilar :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: getSimilar :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tag: getTopAlbums :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: getTopAlbums :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tag: getTopArtists :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: getTopArtists :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tag: getTopTags :: Request f Send (APIKey -> Ready)
+ Network.Lastfm.Tag: getTopTags :: Request f (APIKey -> Ready)
- Network.Lastfm.Tag: getTopTracks :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: getTopTracks :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tag: getWeeklyArtistChart :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: getWeeklyArtistChart :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tag: getWeeklyChartList :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: getWeeklyChartList :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tag: search :: Request f Send (Tag -> APIKey -> Ready)
+ Network.Lastfm.Tag: search :: Request f (Tag -> APIKey -> Ready)
- Network.Lastfm.Tasteometer: compare :: (Targeted u, Targeted v) => Request f Send u -> Request f Send v -> Request f Send (APIKey -> Ready)
+ Network.Lastfm.Tasteometer: compare :: (Targeted u, Targeted v) => Request f u -> Request f v -> Request f (APIKey -> Ready)
- Network.Lastfm.Track: addTags :: Request f Sign (Artist -> Track -> [Tag] -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: addTags :: Request f (Artist -> Track -> [Tag] -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: ban :: Request f Sign (Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: ban :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: getBuyLinks :: ArtistTrackOrMBID t => Request f Send (Country -> t)
+ Network.Lastfm.Track: getBuyLinks :: ArtistTrackOrMBID t => Request f (Country -> t)
- Network.Lastfm.Track: getCorrection :: Request f Send (Artist -> Track -> APIKey -> Ready)
+ Network.Lastfm.Track: getCorrection :: Request f (Artist -> Track -> APIKey -> Ready)
- Network.Lastfm.Track: getFingerprintMetadata :: Request f Send (Fingerprint -> APIKey -> Ready)
+ Network.Lastfm.Track: getFingerprintMetadata :: Request f (Fingerprint -> APIKey -> Ready)
- Network.Lastfm.Track: getInfo :: ArtistTrackOrMBID t => Request f Send t
+ Network.Lastfm.Track: getInfo :: ArtistTrackOrMBID t => Request f t
- Network.Lastfm.Track: getShouts :: ArtistTrackOrMBID t => Request f Send t
+ Network.Lastfm.Track: getShouts :: ArtistTrackOrMBID t => Request f t
- Network.Lastfm.Track: getSimilar :: ArtistTrackOrMBID t => Request f Send t
+ Network.Lastfm.Track: getSimilar :: ArtistTrackOrMBID t => Request f t
- Network.Lastfm.Track: getTags :: ArtistTrackOrMBID t => Request f Send t
+ Network.Lastfm.Track: getTags :: ArtistTrackOrMBID t => Request f t
- Network.Lastfm.Track: getTopFans :: ArtistTrackOrMBID t => Request f Send t
+ Network.Lastfm.Track: getTopFans :: ArtistTrackOrMBID t => Request f t
- Network.Lastfm.Track: getTopTags :: ArtistTrackOrMBID t => Request f Send t
+ Network.Lastfm.Track: getTopTags :: ArtistTrackOrMBID t => Request f t
- Network.Lastfm.Track: love :: Request f Sign (Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: love :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: removeTag :: Request f Sign (Artist -> Track -> Tag -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: removeTag :: Request f (Artist -> Track -> Tag -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: scrobble :: Request f Sign (Artist -> Track -> Timestamp -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: scrobble :: Request f (Artist -> Track -> Timestamp -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: search :: Request f Send (Track -> APIKey -> Ready)
+ Network.Lastfm.Track: search :: Request f (Track -> APIKey -> Ready)
- Network.Lastfm.Track: share :: Request f Sign (Artist -> Track -> Recipient -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: share :: Request f (Artist -> Track -> Recipient -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: unban :: Request f Sign (Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: unban :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: unlove :: Request f Sign (Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: unlove :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Track: updateNowPlaying :: Request f Sign (Artist -> Track -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.Track: updateNowPlaying :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.User: getArtistTracks :: Request f Send (User -> Artist -> APIKey -> Ready)
+ Network.Lastfm.User: getArtistTracks :: Request f (User -> Artist -> APIKey -> Ready)
- Network.Lastfm.User: getBannedTracks :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getBannedTracks :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getEvents :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getEvents :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getFriends :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getFriends :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getInfo :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getInfo :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getLovedTracks :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getLovedTracks :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getNeighbours :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getNeighbours :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getNewReleases :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getNewReleases :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getPastEvents :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getPastEvents :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getPersonalTags :: Request f Send (User -> Tag -> TaggingType -> APIKey -> Ready)
+ Network.Lastfm.User: getPersonalTags :: Request f (User -> Tag -> TaggingType -> APIKey -> Ready)
- Network.Lastfm.User: getPlaylists :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getPlaylists :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getRecentStations :: Request f Sign (User -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.User: getRecentStations :: Request f (User -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.User: getRecentTracks :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getRecentTracks :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getRecommendedArtists :: Request f Sign (APIKey -> SessionKey -> Ready)
+ Network.Lastfm.User: getRecommendedArtists :: Request f (APIKey -> SessionKey -> Sign)
- Network.Lastfm.User: getRecommendedEvents :: Request f Sign (APIKey -> SessionKey -> Ready)
+ Network.Lastfm.User: getRecommendedEvents :: Request f (APIKey -> SessionKey -> Sign)
- Network.Lastfm.User: getShouts :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getShouts :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getTopAlbums :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getTopAlbums :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getTopArtists :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getTopArtists :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getTopTags :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getTopTags :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getTopTracks :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getTopTracks :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getWeeklyAlbumChart :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getWeeklyAlbumChart :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getWeeklyArtistChart :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getWeeklyArtistChart :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getWeeklyChartList :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getWeeklyChartList :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: getWeeklyTrackChart :: Request f Send (User -> APIKey -> Ready)
+ Network.Lastfm.User: getWeeklyTrackChart :: Request f (User -> APIKey -> Ready)
- Network.Lastfm.User: shout :: Request f Sign (User -> Message -> APIKey -> SessionKey -> Ready)
+ Network.Lastfm.User: shout :: Request f (User -> Message -> APIKey -> SessionKey -> Sign)
- Network.Lastfm.Venue: getEvents :: Request f Send (Venue -> APIKey -> Ready)
+ Network.Lastfm.Venue: getEvents :: Request f (Venue -> APIKey -> Ready)
- Network.Lastfm.Venue: getPastEvents :: Request f Send (Venue -> APIKey -> Ready)
+ Network.Lastfm.Venue: getPastEvents :: Request f (Venue -> APIKey -> Ready)
- Network.Lastfm.Venue: search :: Request f Send (VenueName -> APIKey -> Ready)
+ Network.Lastfm.Venue: search :: Request f (VenueName -> APIKey -> Ready)
Files
- liblastfm.cabal +5/−2
- src/Network/Lastfm/Album.hs +16/−14
- src/Network/Lastfm/Artist.hs +24/−22
- src/Network/Lastfm/Authentication.hs +4/−5
- src/Network/Lastfm/Chart.hs +6/−7
- src/Network/Lastfm/Event.hs +6/−7
- src/Network/Lastfm/Geo.hs +11/−12
- src/Network/Lastfm/Group.hs +6/−7
- src/Network/Lastfm/Internal.hs +60/−55
- src/Network/Lastfm/Library.hs +10/−11
- src/Network/Lastfm/Playlist.hs +2/−3
- src/Network/Lastfm/Radio.hs +3/−4
- src/Network/Lastfm/Request.hs +83/−85
- src/Network/Lastfm/Response.hs +14/−15
- src/Network/Lastfm/Tag.hs +9/−10
- src/Network/Lastfm/Tasteometer.hs +1/−2
- src/Network/Lastfm/Track.hs +22/−23
- src/Network/Lastfm/User.hs +25/−26
- src/Network/Lastfm/Venue.hs +3/−4
- tests/Album.hs +7/−7
- tests/Artist.hs +2/−2
- tests/Chart.hs +1/−1
- tests/Common.hs +1/−1
- tests/Event.hs +2/−2
- tests/Geo.hs +2/−2
- tests/Group.hs +1/−1
- tests/Library.hs +2/−2
- tests/Playlist.hs +1/−1
- tests/Tag.hs +1/−1
- tests/Tasteometer.hs +1/−1
- tests/Track.hs +8/−8
- tests/User.hs +6/−4
- tests/Venue.hs +1/−1
liblastfm.cabal view
@@ -1,5 +1,5 @@ name: liblastfm-version: 0.1.1.2+version: 0.2.0.0 synopsis: Lastfm API interface license: MIT license-file: LICENSE@@ -8,10 +8,11 @@ category: Network APIs description: Provides interface to Lastfm REST API, supports XML and JSON formats.-cabal-version: >= 1.9.2+cabal-version: >= 1.10 build-type: Simple library+ default-language: Haskell2010 build-depends: base >= 3 && < 5, bytestring, containers >= 0.5,@@ -22,6 +23,8 @@ pureMD5, crypto-api, network,+ contravariant,+ void, aeson hs-source-dirs: src exposed-modules: Network.Lastfm
src/Network/Lastfm/Album.hs view
@@ -1,7 +1,9 @@ {-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm album API -- -- This module is intended to be imported qualified:@@ -20,17 +22,17 @@ import Network.Lastfm.Request --- | Unify ('Artist' → 'Album' → …) and ('MBID' → …)-class ArtistAlbumOrMBID a+-- | Unify ('Artist' -> 'Album' -> …) and ('MBID' -> …)+class ArtistAlbumOrMBID r a | a -> r -instance ArtistAlbumOrMBID (MBID → APIKey → Ready)-instance ArtistAlbumOrMBID (Artist → Album → APIKey → Ready)+instance ArtistAlbumOrMBID r (MBID -> APIKey -> r)+instance ArtistAlbumOrMBID r (Artist -> Album -> APIKey -> r) -- | Tag an album using a list of user supplied tags. -- -- <http://www.last.fm/api/show/album.addTags>-addTags ∷ Request f Sign (Artist → Album → [Tag] → APIKey → SessionKey → Ready)+addTags :: Request f (Artist -> Album -> [Tag] -> APIKey -> SessionKey -> Sign) addTags = api "album.addTags" <* post {-# INLINE addTags #-} @@ -41,7 +43,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/album.getBuylinks>-getBuyLinks ∷ ArtistAlbumOrMBID t ⇒ Request f Send (Country → t)+getBuyLinks :: ArtistAlbumOrMBID Ready a => Request f (Country -> a) getBuyLinks = api "album.getBuyLinks" {-# INLINE getBuyLinks #-} @@ -52,7 +54,7 @@ -- Optional: 'autocorrect', 'username', 'language' -- -- <http://www.last.fm/api/show/album.getInfo>-getInfo ∷ ArtistAlbumOrMBID t ⇒ Request f Send t+getInfo :: ArtistAlbumOrMBID Ready a => Request f a getInfo = api "album.getInfo" {-# INLINE getInfo #-} @@ -62,7 +64,7 @@ -- Optional: 'autocorrect', 'limit', 'page' -- -- <http://www.last.fm/api/show/album.getShouts>-getShouts ∷ ArtistAlbumOrMBID t ⇒ Request f Send t+getShouts :: ArtistAlbumOrMBID Ready a => Request f a getShouts = api "album.getShouts" {-# INLINE getShouts #-} @@ -72,7 +74,7 @@ -- Optional: 'autocorrect', 'user' -- -- <http://www.last.fm/api/show/album.getTags>-getTags ∷ ArtistAlbumOrMBID t ⇒ Request f a t+getTags :: ArtistAlbumOrMBID r a => Request f a getTags = api "album.getTags" {-# INLINE getTags #-} @@ -82,7 +84,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/album.getTopTags>-getTopTags ∷ ArtistAlbumOrMBID t ⇒ Request f Send t+getTopTags :: ArtistAlbumOrMBID Ready a => Request f a getTopTags = api "album.getTopTags" {-# INLINE getTopTags #-} @@ -90,7 +92,7 @@ -- | Remove a user's tag from an album. -- -- <http://www.last.fm/api/show/album.removeTag>-removeTag ∷ Request f Sign (Artist → Album → Tag → APIKey → SessionKey → Ready)+removeTag :: Request f (Artist -> Album -> Tag -> APIKey -> SessionKey -> Sign) removeTag = api "album.removeTag" <* post {-# INLINE removeTag #-} @@ -100,7 +102,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/album.search>-search ∷ Request f Send (Album → APIKey → Ready)+search :: Request f (Album -> APIKey -> Ready) search = api "album.search" {-# INLINE search #-} @@ -110,6 +112,6 @@ -- Optional: 'public', 'message', 'recipient' -- -- <http://www.last.fm/api/show/album.share>-share ∷ Request f Sign (Album → Artist → Recipient → APIKey → SessionKey → Ready)+share :: Request f (Album -> Artist -> Recipient -> APIKey -> SessionKey -> Sign) share = api "album.share" <* post {-# INLINE share #-}
src/Network/Lastfm/Artist.hs view
@@ -1,6 +1,8 @@ {-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm artist API -- -- This module is intended to be imported qualified:@@ -21,17 +23,17 @@ import Network.Lastfm.Request --- | Unify ('Artist' → …) and ('MBID' → …)-class ArtistOrMBID a+-- | Unify ('Artist' -> …) and ('MBID' -> …)+class ArtistOrMBID r a -instance ArtistOrMBID MBID-instance ArtistOrMBID Artist+instance ArtistOrMBID r MBID+instance ArtistOrMBID r Artist -- | Tag an artist with one or more user supplied tags. -- -- <http://www.last.fm/api/show/artist.addTags>-addTags ∷ Request f Sign (Artist → [Tag] → APIKey → SessionKey → Ready)+addTags :: Request f (Artist -> [Tag] -> APIKey -> SessionKey -> Sign) addTags = api "artist.addTags" <* post {-# INLINE addTags #-} @@ -40,7 +42,7 @@ -- supplied artist has a correction to a canonical artist -- -- <http://www.last.fm/api/show/artist.getCorrection>-getCorrection ∷ Request f Send (Artist → APIKey → Ready)+getCorrection :: Request f (Artist -> APIKey -> Ready) getCorrection = api "artist.getCorrection" {-# INLINE getCorrection #-} @@ -51,7 +53,7 @@ -- Optional: 'autocorrect', 'limit', 'pages', 'festivalsonly' -- -- <http://www.last.fm/api/show/artist.getEvents>-getEvents ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getEvents :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getEvents = api "artist.getEvents" {-# INLINE getEvents #-} @@ -61,7 +63,7 @@ -- Optional: 'language', 'autocorrect', 'username' -- -- <http://www.last.fm/api/show/artist.getInfo>-getInfo ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getInfo :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getInfo = api "artist.getInfo" {-# INLINE getInfo #-} @@ -71,7 +73,7 @@ -- Optional: 'page', 'autocorrect', 'limit' -- -- <http://www.last.fm/api/show/artist.getPastEvents>-getPastEvents ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getPastEvents :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getPastEvents = api "artist.getPastEvents" {-# INLINE getPastEvents #-} @@ -81,7 +83,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/artist.getPodcast>-getPodcast ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getPodcast :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getPodcast = api "artist.getPodcast" {-# INLINE getPodcast #-} @@ -91,7 +93,7 @@ -- Optional:'autocorrect', 'limit', 'page' -- -- <http://www.last.fm/api/show/artist.getShouts>-getShouts ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getShouts :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getShouts = api "artist.getShouts" {-# INLINE getShouts #-} @@ -101,7 +103,7 @@ -- Optional: 'limit', 'autocorrect' -- -- <http://www.last.fm/api/show/artist.getSimilar>-getSimilar ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getSimilar :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getSimilar = api "artist.getSimilar" {-# INLINE getSimilar #-} @@ -115,7 +117,7 @@ -- Optional: 'user', 'autocorrect' -- -- <http://www.last.fm/api/show/artist.getTags>-getTags ∷ ArtistOrMBID t ⇒ Request f a (t → APIKey → Ready)+getTags :: ArtistOrMBID r a => Request f (a -> APIKey -> r) getTags = api "artist.getTags" {-# INLINE getTags #-} @@ -125,7 +127,7 @@ -- Optional: 'autocorrect', 'page', 'limit' -- -- <http://www.last.fm/api/show/artist.getTopAlbums>-getTopAlbums ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getTopAlbums :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getTopAlbums = api "artist.getTopAlbums" {-# INLINE getTopAlbums #-} @@ -135,7 +137,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/artist.getTopFans>-getTopFans ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getTopFans :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getTopFans = api "artist.getTopFans" {-# INLINE getTopFans #-} @@ -145,7 +147,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/artist.getTopTags>-getTopTags ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getTopTags :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getTopTags = api "artist.getTopTags" {-# INLINE getTopTags #-} @@ -155,7 +157,7 @@ -- Optional: 'autocorrect', 'page', 'limit' -- -- <http://www.last.fm/api/show/artist.getTopTracks>-getTopTracks ∷ ArtistOrMBID t ⇒ Request f Send (t → APIKey → Ready)+getTopTracks :: ArtistOrMBID Ready a => Request f (a -> APIKey -> Ready) getTopTracks = api "artist.getTopTracks" {-# INLINE getTopTracks #-} @@ -163,7 +165,7 @@ -- | Remove a user's tag from an artist. -- -- <http://www.last.fm/api/show/artist.removeTag>-removeTag ∷ Request f Sign (Artist → Tag → APIKey → SessionKey → Ready)+removeTag :: Request f (Artist -> Tag -> APIKey -> SessionKey -> Sign) removeTag = api "artist.removeTag" <* post {-# INLINE removeTag #-} @@ -173,7 +175,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/artist.search>-search ∷ Request f Send (Artist → APIKey → Ready)+search :: Request f (Artist -> APIKey -> Ready) search = api "artist.search" {-# INLINE search #-} @@ -183,7 +185,7 @@ -- Optional: 'message', 'public' -- -- <http://www.last.fm/api/show/artist.share>-share ∷ Request f Sign (Artist → Recipient → APIKey → SessionKey → Ready)+share :: Request f (Artist -> Recipient -> APIKey -> SessionKey -> Sign) share = api "artist.share" <* post {-# INLINE share #-} @@ -191,6 +193,6 @@ -- | Shout in this artist's shoutbox -- -- <http://www.last.fm/api/show/artist.shout>-shout ∷ Request f Sign (Artist → Message → APIKey → SessionKey → Ready)+shout :: Request f (Artist -> Message -> APIKey -> SessionKey -> Sign) shout = api "artist.shout" <* post {-# INLINE shout #-}
src/Network/Lastfm/Authentication.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm authentication procedure helpers -- -- Basically, lastfm provides 3 ways to authenticate user:@@ -26,25 +25,25 @@ -- | Get authorization token-getToken ∷ Request f Send (APIKey → Ready)+getToken :: Request f (APIKey -> Ready) getToken = api "auth.getToken" {-# INLINE getToken #-} -- | Get session key-getMobileSession ∷ Request f Sign (Username → Password → APIKey → Ready)+getMobileSession :: Request f (Username -> Password -> APIKey -> Sign) getMobileSession = api "auth.getMobileSession" {-# INLINE getMobileSession #-} -- | Get session key-getSession ∷ Request f Sign (Token → APIKey → Ready)+getSession :: Request f (Token -> APIKey -> Sign) getSession = api "auth.getSession" {-# INLINE getSession #-} -- | Construct link user should follow to approve application-link ∷ Request f a t → String+link :: Request f a -> String link q = render . unwrap q $ R { _host = "http://www.last.fm/api/auth/" , _method = mempty
src/Network/Lastfm/Chart.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm chart API -- -- This module is intended to be imported qualified:@@ -21,7 +20,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/chart.getHypedArtists>-getHypedArtists ∷ Request f Send (APIKey → Ready)+getHypedArtists :: Request f (APIKey -> Ready) getHypedArtists = api "chart.getHypedArtists" {-# INLINE getHypedArtists #-} @@ -31,7 +30,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/chart.getHypedTracks>-getHypedTracks ∷ Request f Send (APIKey → Ready)+getHypedTracks :: Request f (APIKey -> Ready) getHypedTracks = api "chart.getHypedTracks" {-# INLINE getHypedTracks #-} @@ -41,7 +40,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/chart.getLovedTracks>-getLovedTracks ∷ Request f Send (APIKey → Ready)+getLovedTracks :: Request f (APIKey -> Ready) getLovedTracks = api "chart.getLovedTracks" {-# INLINE getLovedTracks #-} @@ -51,7 +50,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/chart.getTopArtists>-getTopArtists ∷ Request f Send (APIKey → Ready)+getTopArtists :: Request f (APIKey -> Ready) getTopArtists = api "chart.getTopArtists" {-# INLINE getTopArtists #-} @@ -61,7 +60,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/chart.getTopTags>-getTopTags ∷ Request f Send (APIKey → Ready)+getTopTags :: Request f (APIKey -> Ready) getTopTags = api "chart.getTopTags" {-# INLINE getTopTags #-} @@ -71,6 +70,6 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/chart.getTopTracks>-getTopTracks ∷ Request f Send (APIKey → Ready)+getTopTracks :: Request f (APIKey -> Ready) getTopTracks = api "chart.getTopTracks" {-# INLINE getTopTracks #-}
src/Network/Lastfm/Event.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm event API -- -- This module is intended to be imported qualified:@@ -20,7 +19,7 @@ -- | Set a user's attendance status for an event. -- -- <http://www.last.fm/api/show/event.attend>-attend ∷ Request f Sign (Event → Status → APIKey → SessionKey → Ready)+attend :: Request f (Event -> Status -> APIKey -> SessionKey -> Sign) attend = api "event.attend" <* post {-# INLINE attend #-} @@ -30,7 +29,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/event.getAttendees>-getAttendees ∷ Request f Send (Event → APIKey → Ready)+getAttendees :: Request f (Event -> APIKey -> Ready) getAttendees = api "event.getAttendees" {-# INLINE getAttendees #-} @@ -38,7 +37,7 @@ -- | Get the metadata for an event on Last.fm. Includes attendance and lineup information. -- -- <http://www.last.fm/api/show/event.getInfo>-getInfo ∷ Request f Send (Event → APIKey → Ready)+getInfo :: Request f (Event -> APIKey -> Ready) getInfo = api "event.getInfo" {-# INLINE getInfo #-} @@ -48,7 +47,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/event.getShouts>-getShouts ∷ Request f Send (Event → APIKey → Ready)+getShouts :: Request f (Event -> APIKey -> Ready) getShouts = api "event.getShouts" {-# INLINE getShouts #-} @@ -58,7 +57,7 @@ -- Optional: 'public', 'message' -- -- <http://www.last.fm/api/show/event.share>-share ∷ Request f Sign (Event → Recipient → APIKey → SessionKey → Ready)+share :: Request f (Event -> Recipient -> APIKey -> SessionKey -> Sign) share = api "event.share" <* post {-# INLINE share #-} @@ -66,6 +65,6 @@ -- | Shout in this event's shoutbox -- -- <http://www.last.fm/api/show/event.shout>-shout ∷ Request f Sign (Event → Message → APIKey → SessionKey → Ready)+shout :: Request f (Event -> Message -> APIKey -> SessionKey -> Sign) shout = api "event.shout" <* post {-# INLINE shout #-}
src/Network/Lastfm/Geo.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm geo API -- -- This module is intended to be imported qualified:@@ -23,7 +22,7 @@ -- Optional: 'longitude', 'latitude', 'location', 'distance', 'page', 'tag', 'festivalsonly', 'limit' -- -- <http://www.last.fm/api/show/geo.getEvents>-getEvents ∷ Request f Send (APIKey → Ready)+getEvents :: Request f (APIKey -> Ready) getEvents = api "geo.getEvents" {-# INLINE getEvents #-} @@ -33,7 +32,7 @@ -- Optional: 'start', 'end', 'page', 'limit' -- -- <http://www.last.fm/api/show/geo.getMetroArtistChart>-getMetroArtistChart ∷ Request f Send (Metro → Country → APIKey → Ready)+getMetroArtistChart :: Request f (Metro -> Country -> APIKey -> Ready) getMetroArtistChart = api "geo.getMetroArtistChart" {-# INLINE getMetroArtistChart #-} @@ -43,7 +42,7 @@ -- Optional: 'start', 'end', 'page', 'limit' -- -- <http://www.last.fm/api/show/geo.getMetroHypeArtistChart>-getMetroHypeArtistChart ∷ Request f Send (Metro → Country → APIKey → Ready)+getMetroHypeArtistChart :: Request f (Metro -> Country -> APIKey -> Ready) getMetroHypeArtistChart = api "geo.getMetroHypeArtistChart" {-# INLINE getMetroHypeArtistChart #-} @@ -53,7 +52,7 @@ -- Optional: 'start', 'end', 'page', 'limit' -- -- <http://www.last.fm/api/show/geo.getMetroHypeTrackChart>-getMetroHypeTrackChart ∷ Request f Send (Metro → Country → APIKey → Ready)+getMetroHypeTrackChart :: Request f (Metro -> Country -> APIKey -> Ready) getMetroHypeTrackChart = api "geo.getMetroHypeTrackChart" {-# INLINE getMetroHypeTrackChart #-} @@ -63,7 +62,7 @@ -- Optional: 'start', 'end', 'page', 'limit' -- -- <http://www.last.fm/api/show/geo.getMetroTrackChart>-getMetroTrackChart ∷ Request f Send (Metro → Country → APIKey → Ready)+getMetroTrackChart :: Request f (Metro -> Country -> APIKey -> Ready) getMetroTrackChart = api "geo.getMetroTrackChart" {-# INLINE getMetroTrackChart #-} @@ -73,7 +72,7 @@ -- Optional: 'start', 'end', 'page', 'limit' -- -- <http://www.last.fm/api/show/geo.getMetroUniqueArtistChart>-getMetroUniqueArtistChart ∷ Request f Send (Metro → Country → APIKey → Ready)+getMetroUniqueArtistChart :: Request f (Metro -> Country -> APIKey -> Ready) getMetroUniqueArtistChart = api "geo.getMetroUniqueArtistChart" {-# INLINE getMetroUniqueArtistChart #-} @@ -83,7 +82,7 @@ -- Optional: 'start', 'end', 'page', 'limit' -- -- <http://www.last.fm/api/show/geo.getMetroUniqueTrackChart>-getMetroUniqueTrackChart ∷ Request f Send (Metro → Country → APIKey → Ready)+getMetroUniqueTrackChart :: Request f (Metro -> Country -> APIKey -> Ready) getMetroUniqueTrackChart = api "geo.getMetroUniqueTrackChart" {-# INLINE getMetroUniqueTrackChart #-} @@ -92,7 +91,7 @@ -- expressed as date ranges which can be sent to the chart services. -- -- <http://www.last.fm/api/show/geo.getMetroWeeklyChartlist>-getMetroWeeklyChartlist ∷ Request f Send (Metro → APIKey → Ready)+getMetroWeeklyChartlist :: Request f (Metro -> APIKey -> Ready) getMetroWeeklyChartlist = api "geo.getMetroWeeklyChartlist" {-# INLINE getMetroWeeklyChartlist #-} @@ -102,7 +101,7 @@ -- Optional: 'country' -- -- <http://www.last.fm/api/show/geo.getMetros>-getMetros ∷ Request f Send (APIKey → Ready)+getMetros :: Request f (APIKey -> Ready) getMetros = api "geo.getMetros" {-# INLINE getMetros #-} @@ -112,7 +111,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/geo.getTopArtists>-getTopArtists ∷ Request f Send (Country → APIKey → Ready)+getTopArtists :: Request f (Country -> APIKey -> Ready) getTopArtists = api "geo.getTopArtists" {-# INLINE getTopArtists #-} @@ -122,6 +121,6 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/geo.getTopTracks>-getTopTracks ∷ Request f Send (Country → APIKey → Ready)+getTopTracks :: Request f (Country -> APIKey -> Ready) getTopTracks = api "geo.getTopTracks" {-# INLINE getTopTracks #-}
src/Network/Lastfm/Group.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm group API -- -- This module is intended to be imported qualified:@@ -18,7 +17,7 @@ -- | Get the hype list for a group -- -- <http://www.last.fm/api/show/group.getHype>-getHype ∷ Request f Send (Group → APIKey → Ready)+getHype :: Request f (Group -> APIKey -> Ready) getHype = api "group.getHype" {-# INLINE getHype #-} @@ -28,7 +27,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/group.getMembers>-getMembers ∷ Request f Send (Group → APIKey → Ready)+getMembers :: Request f (Group -> APIKey -> Ready) getMembers = api "group.getMembers" {-# INLINE getMembers #-} @@ -39,7 +38,7 @@ -- Optional: 'from', 'to' -- -- <http://www.last.fm/api/show/group.getWeeklyAlbumChart>-getWeeklyAlbumChart ∷ Request f Send (Group → APIKey → Ready)+getWeeklyAlbumChart :: Request f (Group -> APIKey -> Ready) getWeeklyAlbumChart = api "group.getWeeklyAlbumChart" {-# INLINE getWeeklyAlbumChart #-} @@ -50,7 +49,7 @@ -- Optional: 'from', 'to' -- -- <http://www.last.fm/api/show/group.getWeeklyArtistChart>-getWeeklyArtistChart ∷ Request f Send (Group → APIKey → Ready)+getWeeklyArtistChart :: Request f (Group -> APIKey -> Ready) getWeeklyArtistChart = api "group.getWeeklyArtistChart" {-# INLINE getWeeklyArtistChart #-} @@ -59,7 +58,7 @@ -- date ranges which can be sent to the chart services. -- -- <http://www.last.fm/api/show/group.getWeeklyChartList>-getWeeklyChartList ∷ Request f Send (Group → APIKey → Ready)+getWeeklyChartList :: Request f (Group -> APIKey -> Ready) getWeeklyChartList = api "group.getWeeklyChartList" {-# INLINE getWeeklyChartList #-} @@ -70,6 +69,6 @@ -- Optional: 'from', 'to' -- -- <http://www.last.fm/api/show/group.getWeeklyTrackChart>-getWeeklyTrackChart ∷ Request f Send (Group → APIKey → Ready)+getWeeklyTrackChart :: Request f (Group -> APIKey -> Ready) getWeeklyTrackChart = api "group.getWeeklyTrackChart" {-# INLINE getWeeklyTrackChart #-}
src/Network/Lastfm/Internal.hs view
@@ -1,61 +1,50 @@ {-# LANGUAGE DataKinds #-}-{-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE KindSignatures #-}-{-# LANGUAGE UnicodeSyntax #-} -- | liblastfm internals -- -- You shouldn't need to import this module unless you are doing something interesting. module Network.Lastfm.Internal- ( Request(..), Format(..), Auth(..), Ready- , R(..), wrap, unwrap, Coercing(..), render+ ( Request(..), Format(..), Ready, Sign+ , R(..), wrap, unwrap, render, coerce -- * Lenses , host, method, query ) where import Control.Applicative+import Data.Foldable (Foldable(..)) import Data.Monoid+import Data.Traversable (Traversable(..)) -import Data.Serialize (Serialize(..)) import Data.ByteString (ByteString)+import Data.Functor.Contravariant (Contravariant(..)) import Data.Map.Strict (Map) import qualified Data.Map.Strict as M+import Data.Serialize (Serialize(..)) import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Encoding as T+import Data.Void (absurd) import Network.URI (escapeURIChar, isUnreserved) --- | Coerce requests changing their phantom parameters.--- Used to ensure right flow of working with liblastfm. If you use it on your worn, then--- you will break abstraction-class Coercing t where- coerce ∷ t (a ∷ Auth) b → t c d-- -- | Lastfm API request data type -- -- low-level representation-data R (f ∷ Format) (a ∷ Auth) t = R- { _host ∷ {-# UNPACK #-} !Text- , _method ∷ {-# UNPACK #-} !ByteString- , _query ∷ !(Map Text Text)+data R (f :: Format) = R+ { _host :: {-# UNPACK #-} !Text+ , _method :: {-# UNPACK #-} !ByteString+ , _query :: !(Map Text Text) } -- | Response format: either JSON or XML data Format = JSON | XML --- | Authentication method-data Auth =- Send -- ^ Public API. Doesn't require anything special besides API key- | Sign -- ^ Private API. Requires Session key and Secret as well as API key---- | Indicates that request is ready for sending+-- | Request that is ready to be sent data Ready -instance Coercing (R f) where- coerce R { _host = h, _method = m, _query = q } = R { _host = h, _method = m, _query = q }- {-# INLINE coerce #-}+-- | Request that requires signing procedure+data Sign -- | Lastfm API request data type@@ -64,72 +53,88 @@ -- that you may send this request already or 'Sign', when request signature -- isn't computed yet ----- @f@ is response format. liblastfm currently supports JSON or XML-newtype Request f a t = Request { unRequest ∷ Dual (Endo (R f a t)) }--instance Coercing (Request f) where- coerce q = wrap $ coerce . unwrap q . coerce- {-# INLINE coerce #-}+-- @f@ is response format. liblastfm currently supports 'JSON' or 'XML'+newtype Request f a = Request { unRequest :: Const (Dual (Endo (R f))) a } -instance Functor (Request f a) where- fmap _ = coerce+instance Functor (Request f) where+ fmap f (Request x) = Request (fmap f x) {-# INLINE fmap #-} -instance Applicative (Request f a) where- pure _ = wrap id- f <*> x = let Request g = coerce f- Request y = coerce x- in Request $ g <> y+instance Contravariant (Request f) where+ contramap f (Request x) = Request (contramap f x)+ {-# INLINE contramap #-}++instance Applicative (Request f) where+ pure x = Request (pure x)+ Request f <*> Request x = Request (f <*> x) {-# INLINE (<*>) #-} +instance Foldable (Request f) where+ foldMap _ (Request _) = mempty -- not sure why this instance isn't in base+ {-# INLINE foldMap #-} +instance Traversable (Request f) where+ traverse _ (Request (Const x)) = pure (Request (Const x)) -- and that+ {-# INLINE traverse #-}+++-- | Copypaste from "Control.Lens.Internal.Getter"+coerce :: (Contravariant f, Functor f) => f a -> f b+coerce = fmap absurd . contramap absurd+{-# INLINE coerce #-}++ -- | Construct String from request for networking-render ∷ R f a t → String+render :: R f -> String render R { _host = h, _query = q } = T.unpack $ mconcat [h, "?", argie q] where- argie = T.intercalate "&" . M.foldrWithKey (\k v m → T.concat [escape k, "=", escape v] : m) []+ argie = T.intercalate "&" . M.foldrWithKey (\k v m -> T.concat [escape k, "=", escape v] : m) [] escape = T.concatMap (T.pack . escapeURIChar isUnreserved) -- | Wrapping to interesting 'Monoid' ('R' -> 'R') instance-wrap ∷ (R f a t → R f a t) → Request f a t-wrap = Request . Dual . Endo+wrap :: (R f -> R f) -> Request f a+wrap = Request . Const . Dual . Endo {-# INLINE wrap #-} -- | Unwrapping from interesting 'Monoid' ('R' -> 'R') instance-unwrap ∷ Request f a t → R f a t → R f a t-unwrap = appEndo . getDual . unRequest+unwrap :: Request f a -> R f -> R f+unwrap = appEndo . getDual . getConst . unRequest {-# INLINE unwrap #-} -- Miscellaneous instances -instance Serialize (R f a t) where+instance Serialize (R f) where put r = do put $ T.encodeUtf8 (_host r) put $ _method r put $ mapmap T.encodeUtf8 T.encodeUtf8 (_query r) get = do- h ← T.decodeUtf8 <$> get- m ← get- q ← mapmap T.decodeUtf8 T.decodeUtf8 <$> get+ h <- T.decodeUtf8 <$> get+ m <- get+ q <- mapmap T.decodeUtf8 T.decodeUtf8 <$> get return R { _host = h, _method = m, _query = q } -mapmap ∷ (Ord s, Ord t) ⇒ (s → t) → (a → b) → Map s a → Map t b+mapmap :: (Ord s, Ord t) => (s -> t) -> (a -> b) -> Map s a -> Map t b mapmap f g = M.mapKeys f . M.map g+{-# INLINE mapmap #-} --- | Request _host lens-host :: Functor f => (Text -> f Text) -> R h a t -> f (R h a t)+-- | 'Request' '_host'+host :: Functor f => (Text -> f Text) -> R h -> f (R h) host f r@R { _host = h } = (\h' -> r { _host = h' }) <$> f h+{-# INLINE host #-} --- | Request http _method lens-method :: Functor f => (ByteString -> f ByteString) -> R h a t -> f (R h a t)+-- | 'Request' HTTP '_method'+method :: Functor f => (ByteString -> f ByteString) -> R h -> f (R h) method f r@R { _method = m } = (\m' -> r { _method = m' }) <$> f m+{-# INLINE method #-} --- | Request _query string lens-query :: Functor f => (Map Text Text -> f (Map Text Text)) -> R h a t -> f (R h a t)+-- | 'Request' '_query' string+query :: Functor f => (Map Text Text -> f (Map Text Text)) -> R h -> f (R h) query f r@R { _query = q } = (\q' -> r { _query = q' }) <$> f q+{-# INLINE query #-}
src/Network/Lastfm/Library.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm library API -- -- This module is intended to be imported qualified:@@ -22,7 +21,7 @@ -- | Add an album or collection of albums to a user's Last.fm library -- -- <http://www.last.fm/api/show/library.addAlbum>-addAlbum ∷ Request f Sign (Artist → Album → APIKey → SessionKey → Ready)+addAlbum :: Request f (Artist -> Album -> APIKey -> SessionKey -> Sign) addAlbum = api "library.addAlbum" <* post {-# INLINE addAlbum #-} @@ -30,7 +29,7 @@ -- | Add an artist to a user's Last.fm library -- -- <http://www.last.fm/api/show/library.addArtist>-addArtist ∷ Request f Sign (Artist → APIKey → SessionKey → Ready)+addArtist :: Request f (Artist -> APIKey -> SessionKey -> Sign) addArtist = api "library.addArtist" <* post {-# INLINE addArtist #-} @@ -38,7 +37,7 @@ -- | Add a track to a user's Last.fm library -- -- <http://www.last.fm/api/show/library.addTrack>-addTrack ∷ Request f Sign (Artist → Track → APIKey → SessionKey → Ready)+addTrack :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign) addTrack = api "library.addTrack" <* post {-# INLINE addTrack #-} @@ -48,7 +47,7 @@ -- Optional: 'artist', 'limit', 'page' -- -- <http://www.last.fm/api/show/library.getAlbums>-getAlbums ∷ Request f Send (User → APIKey → Ready)+getAlbums :: Request f (User -> APIKey -> Ready) getAlbums = api "library.getAlbums" {-# INLINE getAlbums #-} @@ -58,7 +57,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/library.getArtists>-getArtists ∷ Request f Send (User → APIKey → Ready)+getArtists :: Request f (User -> APIKey -> Ready) getArtists = api "library.getArtists" {-# INLINE getArtists #-} @@ -68,7 +67,7 @@ -- Optional: 'artist', 'album', 'page', 'limit' -- -- <http://www.last.fm/api/show/library.getTracks>-getTracks ∷ Request f Send (User → APIKey → Ready)+getTracks :: Request f (User -> APIKey -> Ready) getTracks = api "library.getTracks" {-# INLINE getTracks #-} @@ -76,7 +75,7 @@ -- | Remove an album from a user's Last.fm library -- -- <http://www.last.fm/api/show/library.removeAlbum>-removeAlbum ∷ Request f Sign (Artist → Album → APIKey → SessionKey → Ready)+removeAlbum :: Request f (Artist -> Album -> APIKey -> SessionKey -> Sign) removeAlbum = api "library.removeAlbum" <* post {-# INLINE removeAlbum #-} @@ -84,7 +83,7 @@ -- | Remove an artist from a user's Last.fm library -- -- <http://www.last.fm/api/show/library.removeArtist>-removeArtist ∷ Request f Sign (Artist → APIKey → SessionKey → Ready)+removeArtist :: Request f (Artist -> APIKey -> SessionKey -> Sign) removeArtist = api "library.removeArtist" <* post {-# INLINE removeArtist #-} @@ -92,7 +91,7 @@ -- | Remove a scrobble from a user's Last.fm library -- -- <http://www.last.fm/api/show/library.removeScrobble>-removeScrobble ∷ Request f Sign (Artist → Track → Timestamp → APIKey → SessionKey → Ready)+removeScrobble :: Request f (Artist -> Track -> Timestamp -> APIKey -> SessionKey -> Sign) removeScrobble = api "library.removeScrobble" <* post {-# INLINE removeScrobble #-} @@ -100,6 +99,6 @@ -- | Remove a track from a user's Last.fm library -- -- <http://www.last.fm/api/show/library.removeTrack>-removeTrack ∷ Request f Sign (Artist → Track → APIKey → SessionKey → Ready)+removeTrack :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign) removeTrack = api "library.removeTrack" <* post {-# INLINE removeTrack #-}
src/Network/Lastfm/Playlist.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm playlist API -- -- This module is intended to be imported qualified:@@ -20,7 +19,7 @@ -- | Add a track to a Last.fm user's playlist -- -- <http://www.last.fm/api/show/playlist.addTrack>-addTrack ∷ Request f Sign (Playlist → Artist → Track → APIKey → SessionKey → Ready)+addTrack :: Request f (Playlist -> Artist -> Track -> APIKey -> SessionKey -> Sign) addTrack = api "playlist.addTrack" <* post {-# INLINE addTrack #-} @@ -30,6 +29,6 @@ -- Optional: 'title', 'description' -- -- <http://www.last.fm/api/show/playlist.create>-create ∷ Request f Sign (APIKey → SessionKey → Ready)+create :: Request f (APIKey -> SessionKey -> Sign) create = api "playlist.create" <* post {-# INLINE create #-}
src/Network/Lastfm/Radio.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm radio API -- -- This module is intended to be imported qualified:@@ -22,7 +21,7 @@ -- Optional: 'discovery', 'rtp', 'buyLinks' -- -- <http://www.last.fm/api/show/radio.getPlaylist>-getPlaylist ∷ Request f Sign (Multiplier → Bitrate → APIKey → SessionKey → Ready)+getPlaylist :: Request f (Multiplier -> Bitrate -> APIKey -> SessionKey -> Sign) getPlaylist = api "radio.getPlaylist" {-# INLINE getPlaylist #-} @@ -31,7 +30,7 @@ -- it is most likely to represent. -- -- <http://www.last.fm/api/show/radio.search>-search ∷ Request f Send (Name → APIKey → Ready)+search :: Request f (Name -> APIKey -> Ready) search = api "radio.search" {-# INLINE search #-} @@ -41,6 +40,6 @@ -- Optional: 'language' -- -- <http://www.last.fm/api/show/radio.tune>-tune ∷ Request f Sign (Station → APIKey → SessionKey → Ready)+tune :: Request f (Station -> APIKey -> SessionKey -> Sign) tune = api "radio.tune" <* post {-# INLINE tune #-}
src/Network/Lastfm/Request.hs view
@@ -1,14 +1,12 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Request construction module Network.Lastfm.Request ( -- * Request- Request, R, Auth(..), Format(..)+ Request, R, Ready, Sign, Format(..) -- * Request major parameters- , api, post, get, json, xml, Ready, 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@@ -44,11 +42,11 @@ class Argument a where- add ∷ Text → a → Request f b t- add k v = wrap $ \r@R { _query = q } → r { _query = M.insert k (toText v) q }+ add :: Text -> a -> Request f b+ add k v = wrap $ \r@R { _query = q } -> r { _query = M.insert k (toText v) q } {-# INLINE add #-} - toText ∷ a → Text+ toText :: a -> Text instance Argument Text where toText = id@@ -62,7 +60,7 @@ toText = T.pack . show {-# INLINE toText #-} -instance Argument a ⇒ Argument [a] where+instance Argument a => Argument [a] where toText = T.intercalate "," . map toText {-# INLINE toText #-} @@ -76,29 +74,29 @@ -- | Change request API method -- -- Primarily used in API call wrappers, not intended for usage by library user-api ∷ Text → Request f a t+api :: Text -> Request f a api = add "method" {-# INLINE api #-} -- | Change html _method to GET -- -- Primarily used in API call wrappers, not intended for usage by library user-get ∷ Request f a t-get = wrap $ \r → r { _method = "GET" }+get :: Request f a+get = wrap $ \r -> r { _method = "GET" } {-# INLINE get #-} -- | Change html _method to POST -- -- Primarily used in API call wrappers, not intended for usage by library user-post ∷ Request f a t-post = wrap $ \r → r { _method = "POST" }+post :: Request f a+post = wrap $ \r -> r { _method = "POST" } {-# INLINE post #-} -- | Change API response format to JSON -- -- This is a little helper. It's actually enough -- to specialize Format manually-json ∷ Request JSON a t+json :: Request JSON a json = wrap id {-# INLINE json #-} @@ -106,27 +104,27 @@ -- -- This is a little helper. It's actually enough -- to specialize Format manually-xml ∷ Request XML a t+xml :: Request XML a xml = wrap id {-# INLINE xml #-} -- | Change request API key-apiKey ∷ Text → Request f a APIKey+apiKey :: Text -> Request f APIKey apiKey = add "api_key" {-# INLINE apiKey #-} -- | Change request session key-sessionKey ∷ Text → Request f Sign SessionKey+sessionKey :: Text -> Request f SessionKey sessionKey = add "sk" {-# INLINE sessionKey #-} -- | Add token parameter-token ∷ Text → Request f a Token+token :: Text -> Request f Token token = add "token" {-# INLINE token #-} -- | Add callback link parameter-callback ∷ Text → Request f a Callback+callback :: Text -> Request f Callback callback = add "cb" {-# INLINE callback #-} @@ -188,295 +186,295 @@ -- | Add artist parameter-artist ∷ Text → Request f a Artist+artist :: Text -> Request f Artist artist = add "artist" {-# INLINE artist #-} -- | Add artist parameter-artists ∷ [Text] → Request f a [Artist]+artists :: [Text] -> Request f [Artist] artists = add "artists" {-# INLINE artists #-} -- | Add artist parameter-album ∷ Text → Request f a Album+album :: Text -> Request f Album album = add "album" {-# INLINE album #-} -- | Add MBID parameter-mbid ∷ Text → Request f a MBID+mbid :: Text -> Request f MBID mbid = add "mbid" {-# INLINE mbid #-} -- | Add country parameter-country ∷ Text → Request f a Country+country :: Text -> Request f Country country = add "country" {-# INLINE country #-} -- | Add language parameter-language ∷ Text → Request f a Language+language :: Text -> Request f Language language = add "lang" {-# INLINE language #-} -- | Add tags parameter-tags ∷ [Text] → Request f a [Tag]+tags :: [Text] -> Request f [Tag] tags = add "tags" {-# INLINE tags #-} -- | Add tag parameter-tag ∷ Text → Request f a Tag+tag :: Text -> Request f Tag tag = add "tag" {-# INLINE tag #-} -- | Add autocorrect parameter-autocorrect ∷ Bool → Request f a Autocorrect+autocorrect :: Bool -> Request f Autocorrect autocorrect = add "tags" {-# INLINE autocorrect #-} -- | Add page parameter-page ∷ Int64 → Request f a Page+page :: Int64 -> Request f Page page = add "page" {-# INLINE page #-} -- | Add limit parameter-limit ∷ Int64 → Request f a Limit+limit :: Int64 -> Request f Limit limit = add "limit" {-# INLINE limit #-} -- | Add message parameter-message ∷ Text → Request f a Message+message :: Text -> Request f Message message = add "message" {-# INLINE message #-} -- | Add public parameter-public ∷ Bool → Request f a Public+public :: Bool -> Request f Public public = add "public" {-# INLINE public #-} -- | Add recipient parameter-recipient ∷ Text → Request f a Recipient+recipient :: Text -> Request f Recipient recipient = add "recipient" {-# INLINE recipient #-} -- | Add username parameter-username ∷ Text → Request f a Username+username :: Text -> Request f Username username = add "username" {-# INLINE username #-} -- | Add user parameter-user ∷ Text → Request f a User+user :: Text -> Request f User user = add "user" {-# INLINE user #-} -- | Add password parameter-password ∷ Text → Request f a Password+password :: Text -> Request f Password password = add "password" {-# INLINE password #-} -- | Add status parameter-status ∷ Status → Request f a Status+status :: Status -> Request f Status status = add "status" . T.pack . \s -> case s of- Attending → "0"- Maybe → "1"- _ → "2"+ Attending -> "0"+ Maybe -> "1"+ _ -> "2" {-# INLINE status #-} -- | Add event parameter-event ∷ Int64 → Request f a Event+event :: Int64 -> Request f Event event = add "event" {-# INLINE event #-} -- | Add festivalsonly parameter-festivalsonly ∷ Bool → Request f a Festivals+festivalsonly :: Bool -> Request f Festivals festivalsonly = add "festivalsonly" {-# INLINE festivalsonly #-} -- | Add longitude parameter-longitude ∷ Text → Request f a Longitude+longitude :: Text -> Request f Longitude longitude = add "longitude" {-# INLINE longitude #-} -- | Add latitude parameter-latitude ∷ Text → Request f a Latitude+latitude :: Text -> Request f Latitude latitude = add "latitude" {-# INLINE latitude #-} -- | Add location parameter-location ∷ Text → Request f a Location+location :: Text -> Request f Location location = add "location" {-# INLINE location #-} -- | Add distance parameter-distance ∷ Int64 → Request f a Distance+distance :: Int64 -> Request f Distance distance = add "distance" {-# INLINE distance #-} -- | Add venue parameter-venue ∷ Int64 → Request f a Venue+venue :: Int64 -> Request f Venue venue = add "venue" {-# INLINE venue #-} -- | Add venue parameter-venueName ∷ Text → Request f a VenueName+venueName :: Text -> Request f VenueName venueName = add "venue" {-# INLINE venueName #-} -- | Add metro parameter-metro ∷ Text → Request f a Metro+metro :: Text -> Request f Metro metro = add "metro" {-# INLINE metro #-} -- | Add start parameter-start ∷ Int64 → Request f a Start+start :: Int64 -> Request f Start start = add "start" {-# INLINE start #-} -- | Add end parameter-end ∷ Int64 → Request f a End+end :: Int64 -> Request f End end = add "end" {-# INLINE end #-} -- | Add startTimestamp parameter-startTimestamp ∷ Int64 → Request f a StartTimestamp+startTimestamp :: Int64 -> Request f StartTimestamp startTimestamp = add "startTimestamp" {-# INLINE startTimestamp #-} -- | Add endTimestamp parameter-endTimestamp ∷ Int64 → Request f a EndTimestamp+endTimestamp :: Int64 -> Request f EndTimestamp endTimestamp = add "endTimestamp" {-# INLINE endTimestamp #-} -- | Add from parameter-from ∷ Int64 → Request f a From+from :: Int64 -> Request f From from = add "from" {-# INLINE from #-} -- | Add to parameter-to ∷ Int64 → Request f a To+to :: Int64 -> Request f To to = add "to" {-# INLINE to #-} -- | Add track parameter-track ∷ Text → Request f a Track+track :: Text -> Request f Track track = add "track" {-# INLINE track #-} -- | Add timestamp parameter-timestamp ∷ Int64 → Request f a Timestamp+timestamp :: Int64 -> Request f Timestamp timestamp = add "timestamp" {-# INLINE timestamp #-} -- | Add playlistID parameter-playlist ∷ Int64 → Request f a Playlist+playlist :: Int64 -> Request f Playlist playlist = add "playlistID" {-# INLINE playlist #-} -- | Add title parameter-title ∷ Text → Request f a Title+title :: Text -> Request f Title title = add "title" {-# INLINE title #-} -- | Add description parameter-description ∷ Text → Request f a Description+description :: Text -> Request f Description description = add "description" {-# INLINE description #-} -- | Add fingerprint parameter-fingerprint ∷ Int64 → Request f a Fingerprint+fingerprint :: Int64 -> Request f Fingerprint fingerprint = add "fingerprintid" {-# INLINE fingerprint #-} -- | Add albumArtist parameter-albumArtist ∷ Text → Request f a AlbumArtist+albumArtist :: Text -> Request f AlbumArtist albumArtist = add "albumArtist" {-# INLINE albumArtist #-} -- | Add context parameter-context ∷ Text → Request f a Context+context :: Text -> Request f Context context = add "context" {-# INLINE context #-} -- | Add streamId parameter-streamId ∷ Int64 → Request f a StreamId+streamId :: Int64 -> Request f StreamId streamId = add "streamId" {-# INLINE streamId #-} -- | Add duration parameter-duration ∷ Int64 → Request f a Duration+duration :: Int64 -> Request f Duration duration = add "duration" {-# INLINE duration #-} -- | Add trackNumber parameter-trackNumber ∷ Int64 → Request f a TrackNumber+trackNumber :: Int64 -> Request f TrackNumber trackNumber = add "trackNumber" {-# INLINE trackNumber #-} -- | Add chosenByUser parameter-chosenByUser ∷ Bool → Request f a ChosenByUser+chosenByUser :: Bool -> Request f ChosenByUser chosenByUser = add "chosenByUser" {-# INLINE chosenByUser #-} -- | Add taggingType parameter-taggingType ∷ Text → Request f a TaggingType+taggingType :: Text -> Request f TaggingType taggingType = add "taggingtype" {-# INLINE taggingType #-} -- | Add recentTracks parameter-recentTracks ∷ Bool → Request f a RecentTracks+recentTracks :: Bool -> Request f RecentTracks recentTracks = add "recentTracks" {-# INLINE recentTracks #-} -- | Add useRecs parameter-useRecs ∷ Bool → Request f a UseRecs+useRecs :: Bool -> Request f UseRecs useRecs = add "useRecs" {-# INLINE useRecs #-} -- | Add group parameter-group ∷ Text → Request f a Group+group :: Text -> Request f Group group = add "group" {-# INLINE group #-} -- | Add multiplier parameter-multiplier ∷ Multiplier → Request f a Multiplier+multiplier :: Multiplier -> Request f Multiplier multiplier m = case m of- M1 → add "speed_multiplier" (T.pack "1.0")- M2 → add "speed_multiplier" (T.pack "2.0")+ M1 -> add "speed_multiplier" (T.pack "1.0")+ M2 -> add "speed_multiplier" (T.pack "2.0") {-# INLINE multiplier #-} -- | Add bitrate parameter-bitrate ∷ Bitrate → Request f a Bitrate+bitrate :: Bitrate -> Request f Bitrate bitrate b = case b of- B64 → add "bitrate" (64 ∷ Int64)- B128 → add "bitrate" (128 ∷ Int64)+ B64 -> add "bitrate" (64 :: Int64)+ B128 -> add "bitrate" (128 :: Int64) {-# INLINE bitrate #-} -- | Add name parameter-name ∷ Text → Request f a Name+name :: Text -> Request f Name name = add "name" {-# INLINE name #-} -- | Add station parameter-station ∷ Text → Request f a Station+station :: Text -> Request f Station station = add "station" {-# INLINE station #-} -- | Add group parameter-discovery ∷ Bool → Request f a Discovery+discovery :: Bool -> Request f Discovery discovery = add "discovery" {-# INLINE discovery #-} -- | Add rtp parameter-rtp ∷ Bool → Request f a RTP+rtp :: Bool -> Request f RTP rtp = add "rtp" {-# INLINE rtp #-} -- | Add buyLinks parameter-buyLinks ∷ Bool → Request f a BuyLinks+buyLinks :: Bool -> Request f BuyLinks buyLinks = add "buyLinks" {-# INLINE buyLinks #-} -class Targeted t where- target ∷ Request f a t → Text+class Targeted a where+ target :: Request f a -> Text instance Targeted [Artist] where target _ = "artists"@@ -487,7 +485,7 @@ {-# INLINE target #-} -- | Add comparison parameter-comparison ∷ Targeted t ⇒ Int64 → Request f a t → Request f a t+comparison :: Targeted a => Int64 -> Request f a -> Request f a comparison n t = let z = target t in add ("type" <> toText n) z <*> add ("value" <> toText n) (_query (unwrap t (R mempty mempty mempty)) M.! z) {-# INLINE comparison #-}
src/Network/Lastfm/Response.hs view
@@ -4,7 +4,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Request sending and Response parsing module Network.Lastfm.Response ( -- * Sign Request@@ -45,20 +44,20 @@ -- described at <http://www.last.fm/api/authspec#8> -class Supported (f ∷ Format) where+class Supported (f :: Format) where type Response f- parse ∷ R f a t → Lazy.ByteString → C.ResponseHeaders → Response f- base ∷ R f a t+ parse :: R f -> Lazy.ByteString -> C.ResponseHeaders -> Response f+ base :: R f instance Supported JSON where type Response JSON = Maybe Value parse _ b hs = do- v ← decode b+ v <- decode b case parseMaybe ((.: "error") <=< parseJSON) v of- Just (_ ∷ Int) →+ Just (_ :: Int) -> throw (C.StatusCodeException C.status400 (("Response", Strict.concat $ Lazy.toChunks b) : hs) (C.createCookieJar []))- _ → return v+ _ -> return v base = R { _host = "https://ws.audioscrobbler.com/2.0/" , _method = "GET"@@ -82,33 +81,33 @@ -- | Sign 'Request' with 'Secret'-sign ∷ Secret → Request f Sign Ready → Request f Send Ready+sign :: Secret -> Request f Sign -> Request f Ready sign (Secret s) = coerce . (<* signature) where- signature = wrap $ \r@R { _query = q } →+ signature = wrap $ \r@R { _query = q } -> r { _query = M.insert "api_sig" (signer (foldr M.delete q ["format", "callback"])) q } signer = T.pack . show . (hash' :: Strict.ByteString -> MD5Digest) .- T.encodeUtf8 . M.foldrWithKey(\k v xs → k <> v <> xs) s+ T.encodeUtf8 . M.foldrWithKey(\k v xs -> k <> v <> xs) s -- | Send Request and parse Response-lastfm ∷ Supported f ⇒ Request f Send Ready → IO (Response f)+lastfm :: Supported f => Request f Ready -> IO (Response f) lastfm = lastfm' . finalize -- | Get R from Request -- -- That's rarely needed unless you want low-level requests manipulation-finalize ∷ Supported f ⇒ Request f Send Ready → R f Send Ready+finalize :: Supported f => Request f Ready -> R f finalize = ($ base) . unwrap -- | Send R and parse Response -- -- That's rarely needed unless you want low-level requests manipulation-lastfm' ∷ Supported f ⇒ R f Send Ready → IO (Response f)+lastfm' :: Supported f => R f -> IO (Response f) lastfm' request =- C.withManager $ \m → C.parseUrl (render request) >>= \url → do- t ← C.httpLbs (url { C.method = _method request, C.responseTimeout = Just 10000000 }) m+ C.withManager $ \m -> C.parseUrl (render request) >>= \url -> do+ t <- C.httpLbs (url { C.method = _method request, C.responseTimeout = Just 10000000 }) m return $ parse request (C.responseBody t) (C.responseHeaders t)
src/Network/Lastfm/Tag.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm tag API -- -- This module is intended to be imported qualified:@@ -21,7 +20,7 @@ -- Optional: language -- -- <http://www.last.fm/api/show/tag.getInfo>-getInfo ∷ Request f Send (Tag → APIKey → Ready)+getInfo :: Request f (Tag -> APIKey -> Ready) getInfo = api "tag.getInfo" {-# INLINE getInfo #-} @@ -29,7 +28,7 @@ -- | Search for tags similar to this one. Returns tags ranked by similarity, based on listening data. -- -- <http://www.last.fm/api/show/tag.getSimilar>-getSimilar ∷ Request f Send (Tag → APIKey → Ready)+getSimilar :: Request f (Tag -> APIKey -> Ready) getSimilar = api "tag.getSimilar" {-# INLINE getSimilar #-} @@ -39,7 +38,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/tag.getTopAlbums>-getTopAlbums ∷ Request f Send (Tag → APIKey → Ready)+getTopAlbums :: Request f (Tag -> APIKey -> Ready) getTopAlbums = api "tag.getTopAlbums" {-# INLINE getTopAlbums #-} @@ -49,7 +48,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/tag.getTopArtists>-getTopArtists ∷ Request f Send (Tag → APIKey → Ready)+getTopArtists :: Request f (Tag -> APIKey -> Ready) getTopArtists = api "tag.getTopArtists" {-# INLINE getTopArtists #-} @@ -57,7 +56,7 @@ -- | Fetches the top global tags on Last.fm, sorted by popularity (number of times used) -- -- <http://www.last.fm/api/show/tag.getTopTags>-getTopTags ∷ Request f Send (APIKey → Ready)+getTopTags :: Request f (APIKey -> Ready) getTopTags = api "tag.getTopTags" {-# INLINE getTopTags #-} @@ -67,7 +66,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/tag.getTopTracks>-getTopTracks ∷ Request f Send (Tag → APIKey → Ready)+getTopTracks :: Request f (Tag -> APIKey -> Ready) getTopTracks = api "tag.getTopTracks" {-# INLINE getTopTracks #-} @@ -78,7 +77,7 @@ -- Optional: 'from', 'to', 'limit' -- -- <http://www.last.fm/api/show/tag.getWeeklyArtistChart>-getWeeklyArtistChart ∷ Request f Send (Tag → APIKey → Ready)+getWeeklyArtistChart :: Request f (Tag -> APIKey -> Ready) getWeeklyArtistChart = api "tag.getWeeklyArtistChart" {-# INLINE getWeeklyArtistChart #-} @@ -87,7 +86,7 @@ -- date ranges which can be sent to the chart services. -- -- <http://www.last.fm/api/show/tag.getWeeklyChartList>-getWeeklyChartList ∷ Request f Send (Tag → APIKey → Ready)+getWeeklyChartList :: Request f (Tag -> APIKey -> Ready) getWeeklyChartList = api "tag.getWeeklyChartList" {-# INLINE getWeeklyChartList #-} @@ -97,6 +96,6 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/tag.search>-search ∷ Request f Send (Tag → APIKey → Ready)+search :: Request f (Tag -> APIKey -> Ready) search = api "tag.search" {-# INLINE search #-}
src/Network/Lastfm/Tasteometer.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm tasteometer API -- -- This module is intended to be imported qualified:@@ -21,6 +20,6 @@ -- Optional: 'limit' -- -- <http://www.lastfm.ru/api/show/tasteometer.compare>-compare ∷ (Targeted u, Targeted v) ⇒ Request f Send u → Request f Send v → Request f Send (APIKey → Ready)+compare :: (Targeted u, Targeted v) => Request f u -> Request f v -> Request f (APIKey -> Ready) compare u v = api "tasteometer.compare" <* comparison 1 u <* comparison 2 v {-# INLINE compare #-}
src/Network/Lastfm/Track.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm track API -- -- This module is intended to be imported qualified:@@ -22,17 +21,17 @@ import Network.Lastfm.Request --- | Unify ('Artist' → 'Track' → …) and ('MBID' → …)+-- | Unify ('Artist' -> 'Track' -> …) and ('MBID' -> …) class ArtistTrackOrMBID a -instance ArtistTrackOrMBID (MBID → APIKey → Ready)-instance ArtistTrackOrMBID (Artist → Track → APIKey → Ready)+instance ArtistTrackOrMBID (MBID -> APIKey -> Ready)+instance ArtistTrackOrMBID (Artist -> Track -> APIKey -> Ready) -- | Tag a track using a list of user supplied tags. -- -- <http://www.last.fm/api/show/track.addTags>-addTags ∷ Request f Sign (Artist → Track → [Tag] → APIKey → SessionKey → Ready)+addTags :: Request f (Artist -> Track -> [Tag] -> APIKey -> SessionKey -> Sign) addTags = api "track.addTags" <* post {-# INLINE addTags #-} @@ -40,7 +39,7 @@ -- | Ban a track for a given user profile. -- -- <http://www.last.fm/api/show/track.ban>-ban ∷ Request f Sign (Artist → Track → APIKey → SessionKey → Ready)+ban :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign) ban = api "track.ban" <* post {-# INLINE ban #-} @@ -50,7 +49,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/track.getBuylinks>-getBuyLinks ∷ ArtistTrackOrMBID t ⇒ Request f Send (Country → t)+getBuyLinks :: ArtistTrackOrMBID t => Request f (Country -> t) getBuyLinks = api "track.getBuyLinks" {-# INLINE getBuyLinks #-} @@ -59,7 +58,7 @@ -- the supplied track has a correction to a canonical track. -- -- <http://www.last.fm/api/show/track.getCorrection>-getCorrection ∷ Request f Send (Artist → Track → APIKey → Ready)+getCorrection :: Request f (Artist -> Track -> APIKey -> Ready) getCorrection = api "track.getCorrection" {-# INLINE getCorrection #-} @@ -69,7 +68,7 @@ -- elements, along with a 'rank' value between 0 and 1 reflecting the confidence for each match. -- -- <http://www.last.fm/api/show/track.getFingerprintMetadata>-getFingerprintMetadata ∷ Request f Send (Fingerprint → APIKey → Ready)+getFingerprintMetadata :: Request f (Fingerprint -> APIKey -> Ready) getFingerprintMetadata = api "track.getFingerprintMetadata" {-# INLINE getFingerprintMetadata #-} @@ -79,7 +78,7 @@ -- Optional: 'autocorrect', 'username' -- -- <http://www.last.fm/api/show/track.getInfo>-getInfo ∷ ArtistTrackOrMBID t ⇒ Request f Send t+getInfo :: ArtistTrackOrMBID t => Request f t getInfo = api "track.getInfo" {-# INLINE getInfo #-} @@ -89,7 +88,7 @@ -- Optional: 'autocorrect', 'limit', 'page' -- -- <http://www.last.fm/api/show/track.getShouts>-getShouts ∷ ArtistTrackOrMBID t ⇒ Request f Send t+getShouts :: ArtistTrackOrMBID t => Request f t getShouts = api "track.getShouts" {-# INLINE getShouts #-} @@ -99,7 +98,7 @@ -- Optional: 'autocorrect', 'limit' -- -- <http://www.last.fm/api/show/track.getSimilar>-getSimilar ∷ ArtistTrackOrMBID t ⇒ Request f Send t+getSimilar :: ArtistTrackOrMBID t => Request f t getSimilar = api "track.getSimilar" {-# INLINE getSimilar #-} @@ -109,7 +108,7 @@ -- Optional: 'autocorrect', 'user' -- -- <http://www.last.fm/api/show/track.getTags>-getTags ∷ ArtistTrackOrMBID t ⇒ Request f Send t+getTags :: ArtistTrackOrMBID t => Request f t getTags = api "track.getTags" {-# INLINE getTags #-} @@ -119,7 +118,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/track.getTopFans>-getTopFans ∷ ArtistTrackOrMBID t ⇒ Request f Send t+getTopFans :: ArtistTrackOrMBID t => Request f t getTopFans = api "track.getTopFans" {-# INLINE getTopFans #-} @@ -129,7 +128,7 @@ -- Optional: 'autocorrect' -- -- <http://www.last.fm/api/show/track.getTopTags>-getTopTags ∷ ArtistTrackOrMBID t ⇒ Request f Send t+getTopTags :: ArtistTrackOrMBID t => Request f t getTopTags = api "track.getTopTags" {-# INLINE getTopTags #-} @@ -137,7 +136,7 @@ -- | Love a track for a user profile. -- -- <http://www.last.fm/api/show/track.love>-love ∷ Request f Sign (Artist → Track → APIKey → SessionKey → Ready)+love :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign) love = api "track.love" <* post {-# INLINE love #-} @@ -145,7 +144,7 @@ -- | Remove a user's tag from a track. -- -- <http://www.last.fm/api/show/track.removeTag>-removeTag ∷ Request f Sign (Artist → Track → Tag → APIKey → SessionKey → Ready)+removeTag :: Request f (Artist -> Track -> Tag -> APIKey -> SessionKey -> Sign) removeTag = api "track.removeTag" <* post {-# INLINE removeTag #-} @@ -156,7 +155,7 @@ -- 'duration', 'mbid', 'streamId', 'trackNumber' -- -- <http://www.last.fm/api/show/track.scrobble>-scrobble ∷ Request f Sign (Artist → Track → Timestamp → APIKey → SessionKey → Ready)+scrobble :: Request f (Artist -> Track -> Timestamp -> APIKey -> SessionKey -> Sign) scrobble = api "track.scrobble" <* post {-# INLINE scrobble #-} @@ -166,7 +165,7 @@ -- Optional: 'artist', 'limit', 'page' -- -- <http://www.last.fm/api/show/track.search>-search ∷ Request f Send (Track → APIKey → Ready)+search :: Request f (Track -> APIKey -> Ready) search = api "track.search" {-# INLINE search #-} @@ -176,7 +175,7 @@ -- Optional: 'public', 'message', 'recipient' -- -- <http://www.last.fm/api/show/track.share>-share ∷ Request f Sign (Artist → Track → Recipient → APIKey → SessionKey → Ready)+share :: Request f (Artist -> Track -> Recipient -> APIKey -> SessionKey -> Sign) share = api "track.share" <* post {-# INLINE share #-} @@ -184,7 +183,7 @@ -- | Unban a track for a user profile. -- -- <http://www.last.fm/api/show/track.unban>-unban ∷ Request f Sign (Artist → Track → APIKey → SessionKey → Ready)+unban :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign) unban = api "track.unban" <* post {-# INLINE unban #-} @@ -192,7 +191,7 @@ -- | Unlove a track for a user profile. -- -- <http://www.last.fm/api/show/track.unlove>-unlove ∷ Request f Sign (Artist → Track → APIKey → SessionKey → Ready)+unlove :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign) unlove = api "track.unlove" <* post {-# INLINE unlove #-} @@ -204,6 +203,6 @@ -- 'duration', 'mbid', 'trackNumber' -- -- <http://www.last.fm/api/show/track.updateNowPlaying>-updateNowPlaying ∷ Request f Sign (Artist → Track → APIKey → SessionKey → Ready)+updateNowPlaying :: Request f (Artist -> Track -> APIKey -> SessionKey -> Sign) updateNowPlaying = api "track.updateNowPlaying" <* post {-# INLINE updateNowPlaying #-}
src/Network/Lastfm/User.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm user API -- -- This module is intended to be imported qualified:@@ -29,7 +28,7 @@ -- Optional: 'startTimestamp', 'page', 'endTimestamp' -- -- <http://www.last.fm/api/show/user.getArtistTracks>-getArtistTracks ∷ Request f Send (User → Artist → APIKey → Ready)+getArtistTracks :: Request f (User -> Artist -> APIKey -> Ready) getArtistTracks = api "user.getArtistTracks" {-# INLINE getArtistTracks #-} @@ -39,7 +38,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getBannedTracks>-getBannedTracks ∷ Request f Send (User → APIKey → Ready)+getBannedTracks :: Request f (User -> APIKey -> Ready) getBannedTracks = api "user.getBannedTracks" {-# INLINE getBannedTracks #-} @@ -50,7 +49,7 @@ -- Optional: 'page', 'festivalsonly', 'limit' -- -- <http://www.last.fm/api/show/user.getEvents>-getEvents ∷ Request f Send (User → APIKey → Ready)+getEvents :: Request f (User -> APIKey -> Ready) getEvents = api "user.getEvents" {-# INLINE getEvents #-} @@ -60,7 +59,7 @@ -- Optional: 'recenttracks', 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getFriends>-getFriends ∷ Request f Send (User → APIKey → Ready)+getFriends :: Request f (User -> APIKey -> Ready) getFriends = api "user.getFriends" {-# INLINE getFriends #-} @@ -68,7 +67,7 @@ -- | Get information about a user profile. -- -- <http://www.last.fm/api/show/user.getInfo>-getInfo ∷ Request f Send (User → APIKey → Ready)+getInfo :: Request f (User -> APIKey -> Ready) getInfo = api "user.getInfo" {-# INLINE getInfo #-} @@ -78,7 +77,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getLovedTracks>-getLovedTracks ∷ Request f Send (User → APIKey → Ready)+getLovedTracks :: Request f (User -> APIKey -> Ready) getLovedTracks = api "user.getLovedTracks" {-# INLINE getLovedTracks #-} @@ -88,7 +87,7 @@ -- Optional: 'limit' -- -- <http://www.last.fm/api/show/user.getNeighbours>-getNeighbours ∷ Request f Send (User → APIKey → Ready)+getNeighbours :: Request f (User -> APIKey -> Ready) getNeighbours = api "user.getNeighbours" {-# INLINE getNeighbours #-} @@ -98,7 +97,7 @@ -- Optional: 'userecs' -- -- <http://www.last.fm/api/show/user.getNewReleases>-getNewReleases ∷ Request f Send (User → APIKey → Ready)+getNewReleases :: Request f (User -> APIKey -> Ready) getNewReleases = api "user.getNewReleases" {-# INLINE getNewReleases #-} @@ -108,7 +107,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/user.getPastEvents>-getPastEvents ∷ Request f Send (User → APIKey → Ready)+getPastEvents :: Request f (User -> APIKey -> Ready) getPastEvents = api "user.getPastEvents" {-# INLINE getPastEvents #-} @@ -118,7 +117,7 @@ -- Optional: 'taggingtype', 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getPersonalTags>-getPersonalTags ∷ Request f Send (User → Tag → TaggingType → APIKey → Ready)+getPersonalTags :: Request f (User -> Tag -> TaggingType -> APIKey -> Ready) getPersonalTags = api "user.getPersonalTags" {-# INLINE getPersonalTags #-} @@ -126,7 +125,7 @@ -- | Get a list of a user's playlists on Last.fm. -- -- <http://www.last.fm/api/show/user.getPlaylists>-getPlaylists ∷ Request f Send (User → APIKey → Ready)+getPlaylists :: Request f (User -> APIKey -> Ready) getPlaylists = api "user.getPlaylists" {-# INLINE getPlaylists #-} @@ -136,7 +135,7 @@ -- Optional: 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getRecentStations>-getRecentStations ∷ Request f Sign (User → APIKey → SessionKey → Ready)+getRecentStations :: Request f (User -> APIKey -> SessionKey -> Sign) getRecentStations = api "user.getRecentStations" {-# INLINE getRecentStations #-} @@ -148,7 +147,7 @@ -- Optional: 'limit', 'page', 'from', 'extended', 'to' -- -- <http://www.last.fm/api/show/user.getRecentTracks>-getRecentTracks ∷ Request f Send (User → APIKey → Ready)+getRecentTracks :: Request f (User -> APIKey -> Ready) getRecentTracks = api "user.getRecentTracks" {-# INLINE getRecentTracks #-} @@ -158,7 +157,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/user.getRecommendedArtists>-getRecommendedArtists ∷ Request f Sign (APIKey → SessionKey → Ready)+getRecommendedArtists :: Request f (APIKey -> SessionKey -> Sign) getRecommendedArtists = api "user.getRecommendedArtists" {-# INLINE getRecommendedArtists #-} @@ -168,7 +167,7 @@ -- Optional: 'limit', 'page', 'latitude', 'longitude', 'festivalsonly', 'country' -- -- <http://www.last.fm/api/show/user.getRecommendedEvents>-getRecommendedEvents ∷ Request f Sign (APIKey → SessionKey → Ready)+getRecommendedEvents :: Request f (APIKey -> SessionKey -> Sign) getRecommendedEvents = api "user.getRecommendedEvents" {-# INLINE getRecommendedEvents #-} @@ -178,7 +177,7 @@ -- Optional: 'page', 'limit' -- -- <http://www.last.fm/api/show/user.getShouts>-getShouts ∷ Request f Send (User → APIKey → Ready)+getShouts :: Request f (User -> APIKey -> Ready) getShouts = api "user.getShouts" {-# INLINE getShouts #-} @@ -189,7 +188,7 @@ -- Optional: 'period', 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getTopAlbums>-getTopAlbums ∷ Request f Send (User → APIKey → Ready)+getTopAlbums :: Request f (User -> APIKey -> Ready) getTopAlbums = api "user.getTopAlbums" {-# INLINE getTopAlbums #-} @@ -200,7 +199,7 @@ -- Optional: 'period', 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getTopArtists>-getTopArtists ∷ Request f Send (User → APIKey → Ready)+getTopArtists :: Request f (User -> APIKey -> Ready) getTopArtists = api "user.getTopArtists" {-# INLINE getTopArtists #-} @@ -210,7 +209,7 @@ -- Optional: 'limit' -- -- <http://www.last.fm/api/show/user.getTopTags>-getTopTags ∷ Request f Send (User → APIKey → Ready)+getTopTags :: Request f (User -> APIKey -> Ready) getTopTags = api "user.getTopTags" {-# INLINE getTopTags #-} @@ -221,7 +220,7 @@ -- Optional: 'period', 'limit', 'page' -- -- <http://www.last.fm/api/show/user.getTopTracks>-getTopTracks ∷ Request f Send (User → APIKey → Ready)+getTopTracks :: Request f (User -> APIKey -> Ready) getTopTracks = api "user.getTopTracks" {-# INLINE getTopTracks #-} @@ -232,7 +231,7 @@ -- Optional: 'from', 'to' -- -- <http://www.last.fm/api/show/user.getWeeklyAlbumChart>-getWeeklyAlbumChart ∷ Request f Send (User → APIKey → Ready)+getWeeklyAlbumChart :: Request f (User -> APIKey -> Ready) getWeeklyAlbumChart = api "user.getWeeklyAlbumChart" {-# INLINE getWeeklyAlbumChart #-} @@ -243,7 +242,7 @@ -- Optional: 'from', 'to' -- -- <http://www.last.fm/api/show/user.getWeeklyArtistChart>-getWeeklyArtistChart ∷ Request f Send (User → APIKey → Ready)+getWeeklyArtistChart :: Request f (User -> APIKey -> Ready) getWeeklyArtistChart = api "user.getWeeklyArtistChart" {-# INLINE getWeeklyArtistChart #-} @@ -252,7 +251,7 @@ -- date ranges which can be sent to the chart services. -- -- <http://www.last.fm/api/show/user.getWeeklyChartList>-getWeeklyChartList ∷ Request f Send (User → APIKey → Ready)+getWeeklyChartList :: Request f (User -> APIKey -> Ready) getWeeklyChartList = api "user.getWeeklyChartList" {-# INLINE getWeeklyChartList #-} @@ -263,7 +262,7 @@ -- Optional: 'from', 'to' -- -- <http://www.last.fm/api/show/user.getWeeklyTrackChart>-getWeeklyTrackChart ∷ Request f Send (User → APIKey → Ready)+getWeeklyTrackChart :: Request f (User -> APIKey -> Ready) getWeeklyTrackChart = api "user.getWeeklyTrackChart" {-# INLINE getWeeklyTrackChart #-} @@ -271,6 +270,6 @@ -- | Shout on this user's shoutbox -- -- <http://www.last.fm/api/show/user.shout>-shout ∷ Request f Sign (User → Message → APIKey → SessionKey → Ready)+shout :: Request f (User -> Message -> APIKey -> SessionKey -> Sign) shout = api "user.shout" <* post {-# INLINE shout #-}
src/Network/Lastfm/Venue.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE UnicodeSyntax #-} -- | Lastfm venue API -- -- This module is intended to be imported qualified:@@ -20,7 +19,7 @@ -- Optional: 'festivalsonly' -- -- <http://www.last.fm/api/show/venue.getEvents>-getEvents ∷ Request f Send (Venue → APIKey → Ready)+getEvents :: Request f (Venue -> APIKey -> Ready) getEvents = api "venue.getEvents" @@ -29,7 +28,7 @@ -- Optional: 'festivalsonly', 'page', 'limit' -- -- <http://www.last.fm/api/show/venue.getPastEvents>-getPastEvents ∷ Request f Send (Venue → APIKey → Ready)+getPastEvents :: Request f (Venue -> APIKey -> Ready) getPastEvents = api "venue.getPastEvents" @@ -38,5 +37,5 @@ -- Optional: 'page', 'limit', 'country' -- -- <http://www.last.fm/api/show/venue.search>-search ∷ Request f Send (VenueName → APIKey → Ready)+search :: Request f (VenueName -> APIKey -> Ready) search = api "venue.search"
tests/Album.hs view
@@ -12,7 +12,7 @@ import Common -auth ∷ Request JSON Sign APIKey → Request JSON Sign SessionKey → Secret → [Test]+auth ∷ Request JSON APIKey → Request JSON SessionKey → Secret → [Test] auth ak sk s = [ testCase "Album.addTags" testAddTags , testCase "Album.getTags-authenticated" testGetTagsAuth@@ -37,7 +37,7 @@ <*> ak <*> sk -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Album.getBuyLinks" testGetBuylinks , testCase "Album.getBuyLinks_mbid" testGetBuylinks_mbid@@ -55,27 +55,27 @@ testGetBuylinks = check gbl $ getBuyLinks <*> country "United Kingdom" <*> artist "Pink Floyd" <*> album "The Wall" <*> ak testGetBuylinks_mbid = check gbl $- getBuyLinks <*> country "United Kingdom" <*> mbid "3a16c04b-922b-35c5-a29b-cbe9111fbe79" <*> ak+ getBuyLinks <*> country "United Kingdom" <*> mbid "816abcd3-924a-3565-92b9-7ab750688f34" <*> ak testGetInfo = check gi $ getInfo <*> artist "Pink Floyd" <*> album "The Wall" <*> ak testGetInfo_mbid = check gi $- getInfo <*> mbid "3a16c04b-922b-35c5-a29b-cbe9111fbe79" <*> ak+ getInfo <*> mbid "816abcd3-924a-3565-92b9-7ab750688f34" <*> ak testGetShouts = check gs $ getShouts <*> artist "Pink Floyd" <*> album "The Wall" <* limit 7 <*> ak testGetShouts_mbid = check gs $- getShouts <*> mbid "3a16c04b-922b-35c5-a29b-cbe9111fbe79" <* limit 7 <*> ak+ getShouts <*> mbid "816abcd3-924a-3565-92b9-7ab750688f34" <* limit 7 <*> ak testGetTags = check gt $ getTags <*> artist "Pink Floyd" <*> album "The Wall" <* user "liblastfm" <*> ak testGetTags_mbid = check gt $- getTags <*> mbid "3a16c04b-922b-35c5-a29b-cbe9111fbe79" <* user "liblastfm" <*> ak+ getTags <*> mbid "816abcd3-924a-3565-92b9-7ab750688f34" <* user "liblastfm" <*> ak testGetTopTags = check gtt $ getTopTags <*> artist "Pink Floyd" <*> album "The Wall" <*> ak testGetTopTags_mbid = check gtt $- getTopTags <*> mbid "3a16c04b-922b-35c5-a29b-cbe9111fbe79" <*> ak+ getTopTags <*> mbid "816abcd3-924a-3565-92b9-7ab750688f34" <*> ak testSearch = check se $ search <*> album "wall" <* limit 5 <*> ak
tests/Artist.hs view
@@ -12,7 +12,7 @@ import Common -auth ∷ Request JSON Sign APIKey → Request JSON Sign SessionKey → Secret → [Test]+auth ∷ Request JSON APIKey → Request JSON SessionKey → Secret → [Test] auth ak sk s = [ testCase "Artist.addTags" testAddTags , testCase "Artist.getTags-authenticated" testGetTagsAuth@@ -33,7 +33,7 @@ share <*> artist "Sleep" <*> recipient "liblastfm" <* message "Just listen!" <*> ak <*> sk -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Artist.getCorrection" testGetCorrection , testCase "Artist.getEvents" testGetEvents
tests/Chart.hs view
@@ -12,7 +12,7 @@ import Common -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Chart.getHypedArtists" testGetHypedArtists , testCase "Chart.getHypedTracks" testGetHypedTracks
tests/Common.hs view
@@ -8,7 +8,7 @@ import Test.HUnit -check ∷ (Value → Parser a) → Request JSON Send Ready → Assertion+check ∷ (Value → Parser a) → Request JSON Ready → Assertion check p q = do r ← lastfm q case parse p `fmap` r of
tests/Event.hs view
@@ -12,7 +12,7 @@ import Common -auth ∷ Request JSON Sign APIKey → Request JSON Sign SessionKey → Secret → [Test]+auth ∷ Request JSON APIKey → Request JSON SessionKey → Secret → [Test] auth ak sk s = [ testCase "Event.attend" testAttend , testCase "Event.share" testShare@@ -25,7 +25,7 @@ share <*> event 3142549 <*> recipient "liblastfm" <* message "Just listen!" <*> ak <*> sk -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Event.getAttendees" testGetAttendees , testCase "Event.getInfo" testGetInfo
tests/Geo.hs view
@@ -12,7 +12,7 @@ import Common -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Geo.getEvents" testGetEvents , testCase "Geo.getMetroArtistChart" testGetMetroArtistChart@@ -37,7 +37,7 @@ getMetroHypeArtistChart <*> metro "New York" <*> country "United States" <*> ak testGetMetroHypeTrackChart = check gt $- getMetroHypeTrackChart <*> metro "Ufa" <*> country "Russia" <*> ak+ getMetroHypeTrackChart <*> metro "Moscow" <*> country "Russia" <*> ak testGetMetroTrackChart = check gt $ getMetroTrackChart <*> metro "Boston" <*> country "United States" <*> ak
tests/Group.hs view
@@ -12,7 +12,7 @@ import Common -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Group.getHype" testGetHype , testCase "Group.getMembers" testGetMembers
tests/Library.hs view
@@ -12,7 +12,7 @@ import Common -auth ∷ Request JSON Sign APIKey → Request JSON Sign SessionKey → Secret → [Test]+auth ∷ Request JSON APIKey → Request JSON SessionKey → Secret → [Test] auth ak sk s = [ testCase "Library.addAlbum" testAddAlbum , testCase "Library.addArtist" testAddArtist@@ -45,7 +45,7 @@ removeScrobble <*> artist "Gojira" <*> track "Ocean" <*> timestamp 1328905590 <*> ak <*> sk -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Library.getAlbums" testGetAlbums , testCase "Library.getArtists" testGetArtists
tests/Playlist.hs view
@@ -13,7 +13,7 @@ import Common -auth ∷ Request JSON Sign APIKey → Request JSON Sign SessionKey → Secret → [Test]+auth ∷ Request JSON APIKey → Request JSON SessionKey → Secret → [Test] auth ak sk s = [ testCase "Playlist.create" testCreate -- Order matters. , testCase "Playlist.addTrack" testAddTrack
tests/Tag.hs view
@@ -12,7 +12,7 @@ import Common -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Tag.getInfo" testGetInfo , testCase "Tag.getSimilar" testGetSimilar
tests/Tasteometer.hs view
@@ -12,7 +12,7 @@ import Common -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Tasteometer.compare" testCompare , testCase "Tasteometer.compare'" testCompare'
tests/Track.hs view
@@ -12,7 +12,7 @@ import Common -auth ∷ Request JSON Sign APIKey → Request JSON Sign SessionKey → Secret → [Test]+auth ∷ Request JSON APIKey → Request JSON SessionKey → Secret → [Test] auth ak sk s = [ testCase "Track.addTags" testAddTags , testCase "Track.ban" testBan@@ -53,7 +53,7 @@ updateNowPlaying <*> artist "Gojira" <*> track "Ocean" <*> ak <*> sk -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Track.getBuylinks" testGetBuylinks , testCase "Track.getCorrection" testGetCorrection@@ -85,32 +85,32 @@ testGetInfo = check gi $ getInfo <*> artist "Pink Floyd" <*> track "Comfortably Numb" <* username "aswalrus" <*> ak testGetInfo_mbid = check gi $- getInfo <*> mbid "b6581c74-0b8c-4981-ab92-7eed0298a4bb" <* username "aswalrus" <*> ak+ getInfo <*> mbid "52d7c9ff-6ae4-48a6-acec-4c1a486f8c92" <* username "aswalrus" <*> ak testGetShouts = check gsh $ getShouts <*> artist "Pink Floyd" <*> track "Comfortably Numb" <* limit 7 <*> ak testGetShouts_mbid = check gsh $- getShouts <*> mbid "b6581c74-0b8c-4981-ab92-7eed0298a4bb" <* limit 7 <*> ak+ getShouts <*> mbid "52d7c9ff-6ae4-48a6-acec-4c1a486f8c92" <* limit 7 <*> ak testGetSimilar = check gsi $ getSimilar <*> artist "Pink Floyd" <*> track "Comfortably Numb" <* limit 4 <*> ak testGetSimilar_mbid = check gsi $- getSimilar <*> mbid "b6581c74-0b8c-4981-ab92-7eed0298a4bb" <* limit 4 <*> ak+ getSimilar <*> mbid "52d7c9ff-6ae4-48a6-acec-4c1a486f8c92" <* limit 4 <*> ak testGetTags = check gt $ getTags <*> artist "Jefferson Airplane" <*> track "White Rabbit" <* user "liblastfm" <*> ak testGetTags_mbid = check gt $- getTags <*> mbid "1fc619ee-c612-4b2a-a8dc-bb8f1b8b2d6d" <* user "liblastfm" <*> ak+ getTags <*> mbid "001b3337-faf4-421a-a11f-45e0b60a7703" <* user "liblastfm" <*> ak testGetTopFans = check gtf $ getTopFans <*> artist "Pink Floyd" <*> track "Comfortably Numb" <*> ak testGetTopFans_mbid = check gtf $- getTopFans <*> mbid "b6581c74-0b8c-4981-ab92-7eed0298a4bb" <*> ak+ getTopFans <*> mbid "52d7c9ff-6ae4-48a6-acec-4c1a486f8c92" <*> ak testGetTopTags = check gtt $ getTopTags <*> artist "Pink Floyd" <*> track "Comfortably Numb" <*> ak testGetTopTags_mbid = check gtt $- getTopTags <*> mbid "b6581c74-0b8c-4981-ab92-7eed0298a4bb" <*> ak+ getTopTags <*> mbid "52d7c9ff-6ae4-48a6-acec-4c1a486f8c92" <*> ak testSearch = check s' $ search <*> track "Believe" <* limit 12 <*> ak
tests/User.hs view
@@ -12,7 +12,7 @@ import Common -auth ∷ Request JSON Sign APIKey → Request JSON Sign SessionKey → Secret → [Test]+auth ∷ Request JSON APIKey → Request JSON SessionKey → Secret → [Test] auth ak sk s = [ testCase "User.getRecentStations" testGetRecentStations , testCase "User.getRecommendedArtists" testGetRecommendedArtists@@ -33,7 +33,7 @@ shout <*> user "liblastfm" <*> message "test message" <*> ak <*> sk -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "User.getArtistTracks" testGetArtistTracks , testCase "User.getBannedTracks" testGetBannedTracks@@ -80,7 +80,7 @@ getNeighbours <*> user "smpcln" <* limit 10 <*> ak testGetNewReleases = check gnr $- getNewReleases <*> user "smpcln" <*> ak+ getNewReleases <*> user "rj" <*> ak testGetPastEvents = check gpe $ getPastEvents <*> user "mokele" <* limit 5 <*> ak@@ -136,7 +136,9 @@ gpe o = parseJSON o >>= (.: "events") >>= (.: "event") >>= mapM (.: "url") gpt o = parseJSON o >>= (.: "taggings") >>= (.: "artists") >>= (.: "artist") >>= mapM (.: "name") gra o = parseJSON o >>= (.: "recommendations") >>= (.: "artist") >>= mapM (.: "name")-gre o = parseJSON o >>= (.: "events") >>= (.: "event") >>= mapM (.: "url")+gre o = do+ m <- parseJSON o >>= (.: "events")+ (m .: "event" >>= mapM (.: "url")) <|> (m .: "event" >>= fmap return . (.: "url")) grs o = parseJSON o >>= (.: "recentstations") >>= (.: "station") >>= mapM (.: "name") grt o = parseJSON o >>= (.: "recenttracks") >>= (.: "track") >>= mapM (.: "name") gs o = parseJSON o >>= (.: "shouts") >>= (.: "shout") >>= mapM (.: "body")
tests/Venue.hs view
@@ -12,7 +12,7 @@ import Common -noauth ∷ Request JSON Send APIKey → [Test]+noauth ∷ Request JSON APIKey → [Test] noauth ak = [ testCase "Venue.getEvents" testGetEvents , testCase "Venue.getPastEvents" testGetPastEvents