ReviewBoard-0.1: Haskell bindings to ReviewBoardSource codeContentsIndex
ReviewBoard.Api
Portabilityportable
Stabilityexperimental
Maintaineradam.smyczek@gmail.com
Contents
Example
Description

ReviewBoard API

This package provides the basic ReviewBoard API calls. All calls are executed inside the RBAction monad that represents a session to the ReviewBoard server. A login to the server is performed in the RBAction run method runRBAction.

All actions return the RBResponse object containing the response status RBStatus and the original JSon response. Errors are handled in two ways:

  • Network errors, for example connection errors throw an exception.
  • Response errors resulting in for example invalid request parameters are handled using the rbErrHandler (by default print to stdin).

The current version provides mainly API calls to handle review requests, but this can be easily extended using generalized rbPostRequest, rbGetRequest or directly the main runRequest functions.

Refer to project page for details: http://code.google.com/p/reviewboard/wiki/ReviewBoardAPI

TODOs:

  • Add more API calls, of cause!
  • Add abstraction for response data, for example reviewRequestNew should return the id of the new created request. Currently this have to be parsed from the JSon response e.g. using rrId function.
Synopsis
module ReviewBoard.Core
module ReviewBoard.Browser
reviewRequest :: Integer -> RBAction RBResponse
reviewRequestNew :: String -> Maybe String -> RBAction RBResponse
reviewRequestDelete :: Integer -> RBAction RBResponse
reviewRequestSet :: Integer -> [(RRField, String)] -> RBAction RBResponse
reviewRequestSetField :: Integer -> RRField -> String -> RBAction RBResponse
reviewRequestSaveDraft :: Integer -> RBAction RBResponse
reviewRequestDiffNew :: Integer -> String -> String -> RBAction RBResponse
reviewRequestList :: Maybe String -> Maybe String -> RBAction RBResponse
data RRField
= STATUS
| PUBLIC
| SUMMARY
| DESCRIPTION
| TESTING_DONE
| BUGS_CLOSED
| BRANCH
| TARGET_GROUPS
| TARGET_PEOPLE
execRBAction :: String -> String -> String -> RBAction a -> IO a
rbPostRequest :: String -> [(String, String)] -> RBAction RBResponse
rbGetRequest :: String -> [(String, String)] -> RBAction RBResponse
rrId :: RBResponse -> Maybe Integer
Documentation
module ReviewBoard.Core
module ReviewBoard.Browser
reviewRequest :: Integer -> RBAction RBResponseSource
Get review request with id.
reviewRequestNew :: String -> Maybe String -> RBAction RBResponseSource
Create new review request using the provided repository path and an optional submit_as user. The returned response contains the id of the new created review request that can be accessed using rrId helper function.
reviewRequestDelete :: Integer -> RBAction RBResponseSource
Delete review request with request id.
reviewRequestSet :: Integer -> [(RRField, String)] -> RBAction RBResponseSource
Set fields to review request draft with id.
reviewRequestSetField :: Integer -> RRField -> String -> RBAction RBResponseSource
Set one field for review request draft with id.
reviewRequestSaveDraft :: Integer -> RBAction RBResponseSource
Save review request draft whith id.
reviewRequestDiffNew :: Integer -> String -> String -> RBAction RBResponseSource
Add a new diff to a review request with id, file path and the basedir parameter.
reviewRequestList :: Maybe String -> Maybe String -> RBAction RBResponseSource
List review requests addressed to one user with a status. If user and status are Nothing, reviewRequestList lists all request.
data RRField Source
Review request field type.
Constructors
STATUS
PUBLIC
SUMMARY
DESCRIPTION
TESTING_DONE
BUGS_CLOSED
BRANCH
TARGET_GROUPS
TARGET_PEOPLE
show/hide Instances
execRBAction :: String -> String -> String -> RBAction a -> IO aSource
Execute a ReviewBoard action using the provided URL, user and password.
rbPostRequest :: String -> [(String, String)] -> RBAction RBResponseSource
Default POST request builder for text field parameters only.
rbGetRequest :: String -> [(String, String)] -> RBAction RBResponseSource
Default GET request builder for text field parameters only.
rrId :: RBResponse -> Maybe IntegerSource
Get the id from a review request response.
Example

The following RBAction creates a new review request draft, sets few fields and uploads a diff file:

    newRRAction :: RBAction ()
    newRRAction = do
        rsp <- reviewRequestNew "repository" Nothing
        let id = fromJust . rrId $ rsp
        reviewRequestsSetField id TARGET_PEOPLE "reviewers"
        reviewRequestsSetField id DESCRIPTION "Request description"
        reviewRequestsDiffNew  id "basedir" "diffFileName"
        reviewRequestSaveDraft id
        liftIO $ print "Done."

To run this action, execute:

   execRBAction "url" "user" "password" newRRAction
Produced by Haddock version 2.3.0