Portability | portable |
---|---|
Stability | provisional |
Maintainer | Sigbjorn Finne <sof@forkIO.com> |
Safe Haskell | Safe-Infered |
A Haskell MediaWiki API binding.
- webGet :: URLString -> Request -> IO String
- webPost :: Maybe AuthUser -> URLString -> String -> Request -> IO ([(String, String)], String)
- webPostXml :: (String -> Either (String, [String]) a) -> Maybe AuthUser -> URLString -> String -> Request -> IO (Maybe a)
- webGetXml :: (String -> Either (String, [String]) a) -> URLString -> Request -> IO (Maybe a)
- queryPage :: PageName -> QueryRequest
- mkQueryAction :: APIRequest a => QueryRequest -> a -> Action
- loginWiki :: URLString -> String -> String -> IO (Maybe LoginResponse)
- queryInfo :: URLString -> PageName -> IO String
- querySiteIWInfo :: URLString -> IO (Maybe SiteInfoResponse)
- queryLangPage :: URLString -> PageName -> Maybe String -> IO String
- parseError :: String -> Either (String, [String]) MediaWikiError
- xmlError :: Element -> Maybe MediaWikiError
- data MediaWikiError = MediaWikiError {}
- mwError :: MediaWikiError
- data SomeMWException = forall e . Exception e => SomeMWException e
- mwToException :: Exception e => e -> SomeException
- mwFromException :: Exception e => SomeException -> Maybe e
- throwMWError :: MediaWikiError -> IO a
- catchMW :: IO a -> (MediaWikiError -> IO a) -> IO a
- handleMW :: (MediaWikiError -> IO a) -> IO a -> IO a
- tryMW :: IO a -> IO (Either MediaWikiError a)
- type URLString = String
Documentation
webGet :: URLString -> Request -> IO StringSource
webGet url req
issues a GET to a MediaWiki server, appending
api.php?
followed by the request req
to the URL base url
.
webPost :: Maybe AuthUser -> URLString -> String -> Request -> IO ([(String, String)], String)Source
webGet mbUser url req
issues a POST to a MediaWiki server, appending
api.php?
followed by the request req
to the URL base url
.
webPostXml :: (String -> Either (String, [String]) a) -> Maybe AuthUser -> URLString -> String -> Request -> IO (Maybe a)Source
mkQueryAction :: APIRequest a => QueryRequest -> a -> ActionSource
loginWiki :: URLString -> String -> String -> IO (Maybe LoginResponse)Source
loginWiki u usr pass
logs in to MediaWiki install at url
as
user usr
with password credentials pass
. Notice that we don't
presently allow HTTP Auth to happen in conjunction with the Wiki
login.
parseError :: String -> Either (String, [String]) MediaWikiErrorSource
data MediaWikiError Source
data SomeMWException Source
forall e . Exception e => SomeMWException e |
mwToException :: Exception e => e -> SomeExceptionSource
mwFromException :: Exception e => SomeException -> Maybe eSource
throwMWError :: MediaWikiError -> IO aSource