The Extension API is available through the module symphony.bdk.core.extension. Extensions are registered programmatically via the ExtensionService. A Service Provider extension is a specific type of extension loaded on demand when calling the ExtensionService#service(MyExtensionType) method.
To make your extension Service Provider, your extension definition must implement the method get_service(self).
# Usage example.
async def run():
config = BdkConfigLoader.load_from_symphony_dir("config.yaml")
async with SymphonyBdk(config) as bdk:
extension_service = bdk.extensions()
extension_service.register(MyBdkExtensionService)
service = extension_service.service(MyBdkExtensionService)
service.say_hello("Symphony")
asyncio.run(run())
BDK Aware Extensions
The BDK Extension Model allows extensions to access to some core objects such as the configuration or the api clients.
Developers that wish to use these objects are free to implement a set of abstract base classes all suffixed with the Aware keyword.
List of Aware classes:
BdkConfigAware- allows extensions to read the BdkConfig:
BdkApiClientFactoryAware - can be used by extensions that need to use the ApiClientFactory
BdkAuthenticationAware- can be used by extensions that need to rely on the service account authentication session (AuthSession)
Symphony Groups Extension
As part of this PR we also leveraged this new Extension Mechanism to implement a new custom extension to support the Symphony Groups APIs.
Description
The Extension API is available through the module
symphony.bdk.core.extension
. Extensions are registered programmatically via theExtensionService
. A Service Provider extension is a specific type of extension loaded on demand when calling theExtensionService#service(MyExtensionType)
method.To make your extension Service Provider, your extension definition must implement the method
get_service(self)
.BDK Aware Extensions
The BDK Extension Model allows extensions to access to some core objects such as the configuration or the api clients. Developers that wish to use these objects are free to implement a set of abstract base classes all suffixed with the
Aware
keyword. List of Aware classes:BdkConfigAware
- allows extensions to read theBdkConfig
:BdkApiClientFactoryAware
- can be used by extensions that need to use theApiClientFactory
BdkAuthenticationAware
- can be used by extensions that need to rely on the service account authentication session (AuthSession
)Symphony Groups Extension
As part of this PR we also leveraged this new Extension Mechanism to implement a new custom extension to support the Symphony Groups APIs.