Safe Haskell | None |
---|---|
Language | Haskell98 |
This module contains definitions of VK various API bindings. I tried to
keep it as simple as possible. More, the user is expected to copy any
function from this module into their runhaskell
script and customize
as required.
Runhaskell script may looks like the following: @ #!usrbin/env runhaskell {--} {--}
import Web.VKHS import Web.VKHS.Imports
main :: IO ()
main = runVK_ defaultOptions $ do
Sized cnt gs <- groupSearch "Котики"
forM_ gs $ grGroupRecord{..} -> do
liftIO $ tputStrLn gr_name
liftIO $ tputStrLn "--------------"
Sized wc ws <- getGroupWall gr
forM_ ws $ WallRecord{..} -> do
liftIO $ tputStrLn wr_text
liftIO $ tputStrLn "--------------"
See more scripts under .apprunhaskell
folder
- max_count :: Integer
- ver :: Text
- apiSimpleF :: (MonadAPI m x s, FromJSON b) => MethodName -> [(String, Text)] -> (b -> Either String a) -> API m x a
- apiSimple :: (MonadAPI m x s, FromJSON a) => MethodName -> [(String, Text)] -> API m x a
- apiSimpleH :: (MonadAPI m x s, FromJSON a) => MethodName -> [(String, Text)] -> (ErrorRecord -> Maybe a) -> API m x a
- apiSimpleHM :: (MonadAPI m x s, FromJSON a) => MethodName -> [(String, Text)] -> (ErrorRecord -> API m x (Maybe a)) -> API m x a
- apiVer :: (MonadAPI m x s, FromJSON a) => String -> [(String, Text)] -> API m x a
- groupSearch :: MonadAPI m x s => Text -> API m x (Sized [GroupRecord])
- getCountries :: MonadAPI m x s => API m x (Sized [Country])
- getCities :: MonadAPI m x s => Country -> Maybe Text -> API m x (Sized [City])
- getGroupWall :: forall m x s. MonadAPI m x s => GroupRecord -> API m x (Sized [WallRecord])
- getAlbums :: MonadAPI m x s => Maybe Integer -> API m x (Sized [Album])
- getPhotoUploadServer :: MonadAPI m x s => Album -> API m x PhotoUploadServer
- getCurrentUser :: MonadAPI m x s => API m x UserRecord
- setUserPhoto :: MonadAPI m x s => UserRecord -> FilePath -> API m x ()
Documentation
apiSimpleF :: (MonadAPI m x s, FromJSON b) => MethodName -> [(String, Text)] -> (b -> Either String a) -> API m x a Source #
apiSimpleH :: (MonadAPI m x s, FromJSON a) => MethodName -> [(String, Text)] -> (ErrorRecord -> Maybe a) -> API m x a Source #
apiSimpleHM :: (MonadAPI m x s, FromJSON a) => MethodName -> [(String, Text)] -> (ErrorRecord -> API m x (Maybe a)) -> API m x a Source #
groupSearch :: MonadAPI m x s => Text -> API m x (Sized [GroupRecord]) Source #
This function demonstrates pure-functional error handling
getGroupWall :: forall m x s. MonadAPI m x s => GroupRecord -> API m x (Sized [WallRecord]) Source #
See [https:/vk.comdev/wall.get]
This function demonstrates monadic error handling
getPhotoUploadServer :: MonadAPI m x s => Album -> API m x PhotoUploadServer Source #
getCurrentUser :: MonadAPI m x s => API m x UserRecord Source #
FIXME fix setUserPhoto, it is not actually working
FIXME move low-level upload code to API.Base
setUserPhoto :: MonadAPI m x s => UserRecord -> FilePath -> API m x () Source #