reviewboard.webapi.server_info¶
Server information and capability registration for the API.
-
get_server_info
(request=None)[source]¶ Return server information for use in the API.
This is used for the root resource and for the deprecated server info resource.
Parameters: request (django.http.HttpRequest, optional) – The HTTP request from the client. Returns: A dictionary of information about the server and its capabilities. Return type: dict
-
get_capabilities
(request=None)[source]¶ Return the capabilities made available in the API.
Parameters: request (django.http.HttpRequest, optional) – The http request from the client. Returns: The dictionary of capabilities. Return type: dict
-
get_feature_gated_capabilities
(request=None)[source]¶ Return the capabilities gated behind enabled features.
Parameters: request (django.http.HttpRequest, optional) – The HTTP request from the client.
Yields: tuple – A 3-tuple of the following:
- The category of the capability (
unicode
). - The capability name (
unicode
). - Whether or not the capability is enabled (
bool
).
- The category of the capability (
-
register_webapi_capabilities
(capabilities_id, caps)[source]¶ Register a set of web API capabilities.
These capabilities will appear in the dictionary of available capabilities with the ID as their key.
A capabilities_id attribute passed in, and can only be registerd once. A KeyError will be thrown if attempting to register a second time.
Parameters: - capabilities_id (unicode) – A unique ID representing this collection of capabilities. This can only be used once until unregistered.
- caps (dict) – The dictionary of capabilities to register. Each key msut be a string, and each value should be a boolean or a dictionary of string keys to booleans.
Raises: KeyError
– The capabilities ID has already been used.