Jump to >

This documentation covers Review Board 3.0. You can see the latest Review Board documentation or all other versions.

WebAPICapabilitiesHook

New in version 2.5.

reviewboard.extensions.hooks.WebAPICapabilitiesHook allows extensions to register new capabilities with the web API.

Extensions must provide a caps dictionary, and pass it as a parameter to WebAPICapabilitiesHook. The API capabilities payload will contain a new key matching the extension ID, with the provided capabilities as the value.

Example

from reviewboard.extensions.base import Extension
from reviewboard.extensions.hooks import WebAPICapabilitiesHook


class SampleExtension(Extension):
    def initialize(self):
        WebAPICapabilitiesHook(
            self,
            {
                'commit_ids': True,
                'tested': True,
            })

The resulting payload would like this:

"capabilities": {
    ...

    "SampleExtensionID": {
        "commit_ids": True,
        "tested": True
    }
}