ReviewBoard-0.2.2: Haskell bindings to ReviewBoardSource codeContentsIndex
ReviewBoard.Core
Portabilityportable
Stabilityexperimental
Maintaineradam.smyczek@gmail.com
Contents
RB action monad
RB state
Response type
Utils
Description
The core module implements the base types and functions of the bindings.
Synopsis
data RBAction a
runRBAction :: String -> String -> String -> RBAction a -> IO (Either String a, RBState)
liftBA :: BrowserAction a -> RBAction a
runRequest :: RBRequestType -> Form -> (RBResponse -> RBAction a) -> RBAction a
data RBRequestType
= API
| HTTP
data RBState = RBState {
rbUrl :: String
rbUser :: String
rbSessionId :: Maybe Cookie
rbErrHandler :: String -> IO ()
}
setErrorHandler :: (String -> IO ()) -> RBAction ()
setDebugHTTP :: Bool -> RBAction ()
data RBResponse
= RBok JSValue
| RBerr String
responseToEither :: RBResponse -> Either String JSValue
mkApiURI :: String -> RBAction URI
RB action monad
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
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.
liftBA :: BrowserAction a -> RBAction aSource
Convenient lift for BrowserActions
runRequest :: RBRequestType -> 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.
data RBRequestType Source
Type of the request, Web API or default HTTP
Constructors
API
HTTP
show/hide Instances
RB state
data RBState Source
RB action state containing session related information.
Constructors
RBState
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
setErrorHandler :: (String -> IO ()) -> RBAction ()Source
Set error handler used for ReviewBoard error responses.
setDebugHTTP :: Bool -> RBAction ()Source
Enable/disable debug output for Browser module
Response type
data RBResponse Source
Response type return by every API function
Constructors
RBok JSValueSuccessful response, contains JSON response object
RBerr StringResponse error including error message including encoded response
show/hide Instances
responseToEither :: RBResponse -> Either String JSValueSource
Convenient response converter
Utils
mkApiURI :: String -> RBAction URISource
Create ReviewBoard specific URI for a Web API call URL.
Produced by Haddock version 2.3.0