module Network.Lastfm.API.Album
( addTags, getBuyLinks, getInfo, getShouts, getTags
, getTopTags, removeTag, search, share
) where
import Control.Arrow ((|||))
import Network.Lastfm
addTags :: (Artist, Album) -> [Tag] -> APIKey -> SessionKey -> Secret -> Lastfm Response
addTags (artist, album) tags apiKey sessionKey secret = callAPIsigned secret
[ (#) (Method "album.addTags")
, (#) artist
, (#) album
, (#) tags
, (#) apiKey
, (#) sessionKey
]
getBuyLinks :: Either (Artist, Album) Mbid -> Maybe Autocorrect -> Country -> APIKey -> Lastfm Response
getBuyLinks a autocorrect country apiKey = callAPI $
target a ++
[ (#) (Method "album.getBuyLinks")
, (#) autocorrect
, (#) country
, (#) apiKey
]
getInfo :: Either (Artist, Album) Mbid -> Maybe Autocorrect -> Maybe Language -> Maybe Username -> APIKey -> Lastfm Response
getInfo a autocorrect lang username apiKey = callAPI $
target a ++
[ (#) (Method "album.getInfo")
, (#) autocorrect
, (#) lang
, (#) username
, (#) apiKey
]
getShouts :: Either (Artist, Album) Mbid -> Maybe Autocorrect -> Maybe Page -> Maybe Limit -> APIKey -> Lastfm Response
getShouts a autocorrect page limit apiKey = callAPI $
target a ++
[ (#) (Method "album.getShouts")
, (#) autocorrect
, (#) page
, (#) limit
, (#) apiKey
]
getTags :: Either (Artist, Album) Mbid -> Maybe Autocorrect -> Either User (SessionKey, Secret) -> APIKey -> Lastfm Response
getTags a autocorrect b apiKey = case b of
Left user -> callAPI $ target a ++ [(#) user] ++ args
Right (sessionKey, secret) -> callAPIsigned secret $ target a ++ [(#) sessionKey] ++ args
where args =
[ (#) (Method "album.getTags")
, (#) autocorrect
, (#) apiKey
]
getTopTags :: Either (Artist, Album) Mbid -> Maybe Autocorrect -> APIKey -> Lastfm Response
getTopTags a autocorrect apiKey = callAPI $
target a ++
[ (#) (Method "album.getTopTags")
, (#) autocorrect
, (#) apiKey
]
removeTag :: Artist -> Album -> Tag -> APIKey -> SessionKey -> Secret -> Lastfm Response
removeTag artist album tag apiKey sessionKey secret = callAPIsigned secret
[ (#) (Method "album.removeTag")
, (#) artist
, (#) album
, (#) tag
, (#) apiKey
, (#) sessionKey
]
search :: Album -> Maybe Page -> Maybe Limit -> APIKey -> Lastfm Response
search album page limit apiKey = callAPI
[ (#) (Method "album.search")
, (#) album
, (#) page
, (#) limit
, (#) apiKey
]
share :: Artist -> Album -> Recipient -> Maybe Message -> Maybe Public -> APIKey -> SessionKey -> Secret -> Lastfm Response
share artist album recipient message public apiKey sessionKey secret = callAPIsigned secret
[ (#) (Method "album.share")
, (#) artist
, (#) album
, (#) public
, (#) message
, (#) recipient
, (#) apiKey
, (#) sessionKey
]
target :: Either (Artist, Album) Mbid -> [(String, String)]
target = (\(artist, album) -> [(#) artist, (#) album]) ||| return . (#)