reviewboard.integrations.base¶
Base support for creating and using integrations.
This module provides a method for getting the integration manager used by
Review Board (get_integration_manager()
) and a base class for defining
integrations (Integration
).
- class Integration(integration_mgr: IntegrationManager)[source]¶
Bases:
Integration
Base class for an integration.
Integrations are pluggable components that interface the application with a third-party service, notifying the service or triggering actions on certain events, or fetching data from the service. They can be registered by the consuming application or through extensions.
Unlike an extension, an integration can contain multiple configurations active at one time. This is useful, for instance, when you want multiple, distinct configurations for posting messages to different channels on a chat service.
There’s one
Integration
instance for each class, and it typically operates by responding to events and communicating with another service, making use of the state stored in one or moreIntegrationConfig
instances, which it can query. This allows hook registration and other logic to be shared across all configurations of an instance.Integrations can make use of Python Extension Hooks, binding the lifecycle of that hook’s registration to the lifecycle of that particular integration, making it very easy to tie an integration into any part of the application.
- get_configs(local_site)[source]¶
Return configurations matching the given filters.
This will return all enabled configurations for this integration matching the provided
local_site
.The configurations can be filtered down further by the caller, based on the settings.
- Parameters:
local_site (
reviewboard.site.models.LocalSite
) – The Local Site matching any configurations. This should correspond to the value used for any repositories, review requests, reviews, etc. being used to trigger an operation, and should be set based on those objects.- Returns:
A list of enabled integration configurations matching the query.
- Return type:
- __annotations__ = {}¶
- class GetIntegrationManagerMixin[source]¶
Bases:
object
Mixin for supplying an IntegrationManager for classes.
This is used in any class that needs a
get_integration_manager()
function.- classmethod get_integration_manager()[source]¶
Return the IntegrationManager for the class.
- Returns:
The integration manager used in Review Board.
- Return type:
- __annotations__ = {}¶