ReviewBoard-0.1: Haskell bindings to ReviewBoardSource codeContentsIndex
Base types and functions.
data RBAction a
data RBState = RBState {
rbUrl :: String
rbUser :: String
rbSessionId :: Maybe Cookie
rbErrHandler :: String -> IO ()
runRBAction :: String -> String -> String -> RBAction a -> IO (Either String a, RBState)
setErrorHandler :: (String -> IO ()) -> RBAction ()
data RBStatus
= RBok
| RBerr String
data RBResponse = RBResponse {
rbRspStatus :: RBStatus
rbRspBody :: JSValue
runRequest :: Form -> (RBResponse -> RBAction a) -> RBAction a
liftBA :: BrowserAction a -> RBAction a
mkURI :: String -> RBAction URI
setDebugHTTP :: Bool -> RBAction ()
jsValue :: [String] -> JSValue -> Maybe JSValue
jsInt :: [String] -> JSValue -> Maybe Integer
jsString :: [String] -> JSValue -> Maybe String
data RBAction a Source

The action monad, a state with error handler.

RBAction represents one ReviewBoard session that handles multiple API calls. The RBAction runner runRBAction performs a login into the ReviewBoard server and initializes the session. All session related parameters are stored in the RBState of the action.

Errors are handled in two ways:

  • Network related error are immediately thrown using ErrorT throwError.
  • ReviewRequest response errors are handled using the error handler defined in RBState (default print).
show/hide Instances
data RBState Source
RB action state containing session related information.
rbUrl :: StringReviewBoard server URL
rbUser :: StringLogged in user
rbSessionId :: Maybe CookieSession id cookie retrieve from a successful login
rbErrHandler :: String -> IO ()Error handler, for example error or print
show/hide Instances
runRBAction :: String -> String -> String -> RBAction a -> IO (Either String a, RBState)Source
Run for RBAction, performs a login using provided URL, user and password parameters and executes the action. When login fails runRBAction returns immediately with an error.
setErrorHandler :: (String -> IO ()) -> RBAction ()Source
Set error handler used for ReviewBoard error responses.
data RBStatus Source
Response status type parsed from ReviewBoard Json response stat object, for example { "stat" : "ok/fail" }
RBokSuccessful response
RBerr StringResponse error including error message
show/hide Instances
data RBResponse Source
Response type returned by all API calls
rbRspStatus :: RBStatusparsed RBStatus
rbRspBody :: JSValueoriginal Json response, including stat object
show/hide Instances
runRequest :: Form -> (RBResponse -> RBAction a) -> RBAction aSource
The request runner, generates request from provided Form parameter, executes the requests and handles the response using the handler function.
liftBA :: BrowserAction a -> RBAction aSource
Convenient lift for BrowserActions
mkURI :: String -> RBAction URISource
Create ReviewBoard specific URI for API call URL. In case of invalid URL an exception is thrown.
setDebugHTTP :: Bool -> RBAction ()Source
Enable/disable debug output for Browser module
jsValue :: [String] -> JSValue -> Maybe JSValueSource
Return value for string path e.g. [] (Int 5) -> Just $ Int 5 [stat] (Obj stat (Str ok)) -> Just $ Str ok [stat] (Obj nostat (Str ok)) -> Nothing
jsInt :: [String] -> JSValue -> Maybe IntegerSource
Return Integer value for path or Nothing if path does not exists or is not a JSRational
jsString :: [String] -> JSValue -> Maybe StringSource
String value for path, same as jsInt
Produced by Haddock version 2.3.0