rdioh-0.2.1: A Haskell wrapper for Rdio's API.

Safe HaskellNone

Rdioh

Synopsis

Documentation

runRdio :: String -> String -> Rdio a -> IO aSource

Takes: a key, a secret, a function to run.

runRdioWithAuth :: String -> String -> Rdio a -> IO aSource

Same as runRdio, but with 3-legged authentication i.e. the user will | have to authorize your app.

type Rdio a = ReaderT Token IO aSource

The Rdio monad...just a wrapper around a ReaderT monad.

mkExtras :: Show e => [e] -> (String, String)Source

used internally

runRequest :: (Show v, FromJSON v) => [(String, String)] -> Rdio (Either String v)Source

Send a arbitrary request to rdio's api. Return type should | be an instance of FromJSON, and you need to specify the type. Example:

 result <- (runRequest [("method", "getTopCharts"), ("type", "Artist")] :: Rdio (Either String [Artist]))

get :: (Show a, FromJSON a) => [String] -> [String] -> Rdio (Either String a)Source

Takes: [keys], [extras] (optional)

getObjectFromShortCode :: (Show a, FromJSON a) => String -> [String] -> Rdio (Either String a)Source

Takes: short code (everything after the http:rd.iox), [extras] (optional)

getObjectFromUrl :: (Show a, FromJSON a) => String -> [String] -> Rdio (Either String a)Source

Takes: url (everything after http:rdio.com/), [extras] (optional)

getAlbumsByUPC :: Int -> [AlbumExtra] -> Rdio (Either String [Album])Source

Takes: a UPC code, [extras] (optional)

getAlbumsForArtist :: String -> Rdio (Either String [Album])Source

Takes: A key of an artist

getAlbumsForLabel :: String -> Rdio (Either String [Album])Source

Takes: a key of a label

getArtistsForLabel :: String -> Rdio (Either String [Artist])Source

Takes: a key of a label

getTracksByISRC :: String -> [TrackExtra] -> Rdio (Either String [Track])Source

Takes: an ISRC code, [extras] (optional)

getTracksForArtist :: String -> Rdio (Either String [Track])Source

Takes: an artist key

search :: (Show a, FromJSON a) => String -> String -> Rdio (Either String [a])Source

Takes: a query, a type ("Artist", "Album", "Track", "Playlist", or "User") This method can return any of those types, so you need to specify what you want returned. Example:

 search "Radiohead" "Artist" :: Rdio (Either String [Artist])

addToCollection :: [String] -> Rdio (Either String Object)Source

Takes: a list of keys of tracks or playlists. *Requires authentication*.

getAlbumsForArtistInCollection :: String -> Rdio (Either String [Album])Source

Takes: an artist key. Requires authentication OR use getAlbumsForArtistInCollection' and pass in a user key.

getAlbumsInCollection :: Rdio (Either String [Album])Source

Requires authentication OR use getAlbumsInCollection' and pass in a user key.

getArtistsInCollection :: Rdio (Either String [Artist])Source

Requires authentication OR use getArtistsInCollection' and pass in a user key.

getOfflineTracks :: Rdio (Either String [Track])Source

Requires authentication.

getTracksForAlbumInCollection :: String -> Rdio (Either String [Track])Source

Takes: an album key. Requires authentication OR use getTracksForAlbumInCollection' and pass in a user key.

getTracksForArtistInCollection :: String -> Rdio (Either String [Track])Source

Takes: an artist key. Requires authentication OR use getTracksForArtistInCollection' and pass in a user key.

getTracksInCollection :: Rdio (Either String [Track])Source

Requires authentication OR use getTracksInCollection' and pass in a user key.

removeFromCollection :: [String] -> Rdio (Either String Bool)Source

Takes: a list of track or playlist keys. Requires authentication.

setAvailableOffline :: [String] -> Bool -> Rdio (Either String Object)Source

Takes: a list of track or playlist keys. Requires authentication.

addToPlaylist :: String -> [String] -> [PlaylistExtra] -> Rdio (Either String Playlist)Source

Takes: a playlist key, a list of track keys to add to the playlist, [extras] (optional). Requires authentication.

createPlaylist :: String -> String -> [String] -> [PlaylistExtra] -> Rdio (Either String Playlist)Source

Takes: a name, a description, a list of track keys to start the playlist with, [extras] (optional). Requires authentication.

deletePlaylist :: String -> Rdio (Either String Bool)Source

Takes: a playlist key. Requires authentication.

getPlaylists :: Rdio (Either String UserPlaylists)Source

Requires authentication OR use getPlaylists' and pass in a user key.

getUserPlaylists :: String -> Rdio (Either String [Playlist])Source

Requires authentication OR use getUserPlaylists' and pass in a user key.

removeFromPlaylist :: String -> Int -> Int -> Int -> [PlaylistExtra] -> Rdio (Either String Playlist)Source

Takes: - a playlist key

  • the index of the first item to remove
  • number of tracks to remove
  • the keys of the tracks to remove (redundancy to prevent accidental deletion)
  • [extras] (optional)

Requires authentication.

setPlaylistCollaborating :: String -> Bool -> Rdio (Either String Bool)Source

Takes: a playlist key, a boolean (true == collaborating, false == not collaborating). Requires authentication.

setPlaylistCollaborationMode :: String -> CollaborationMode -> Rdio (Either String Bool)Source

Takes: a playlist key, a collaboration mode. Requires authentication.

setPlaylistFields :: String -> String -> String -> Rdio (Either String Bool)Source

Takes: a playlist key, a name, a description. Requires authentication.

setPlaylistOrder :: String -> [String] -> [PlaylistExtra] -> Rdio (Either String Playlist)Source

Takes: a playlist key, a list of track keys, [extras] (optional). Requires authentication.

addFriend :: String -> Rdio (Either String Bool)Source

Takes: a user key. Requires authentication.

currentUser :: [UserExtra] -> Rdio (Either String User)Source

Requires authentication.

findUserByEmail :: String -> [UserExtra] -> Rdio (Either String User)Source

Takes: an email address, [extras] (optional).

findUserByName :: String -> [UserExtra] -> Rdio (Either String User)Source

Takes: user name, [extras] (optional).

removeFriend :: String -> Rdio (Either String Bool)Source

Takes: a user key. Requires authentication.

userFollowers :: String -> Rdio (Either String [User])Source

Takes: a user key.

userFollowing :: String -> Rdio (Either String [User])Source

Takes: a user key.

getActivityStream :: String -> Scope -> Rdio (Either String Activity)Source

Takes: a user key, a scope.

getPlaybackToken :: Maybe String -> Rdio (Either String String)Source

Takes: the domain that the playback SWF will be embedded in (optional).