Class PluginBase<TClient, THook>
Abstract base class for extending SDK functionality via plugins. Consumers should provide specific implementations of this class with the appropariate client and hook types for their use case. This class includes default implementations for optional methods, allowing LaunchDarkly to expand the list of plugin methods without breaking customer integrations. Plugins provide an interface which allows for initialization, access to credentials, and hook registration in a single interface.
Inherited Members
Namespace: LaunchDarkly.Sdk.Integrations.Plugins
Assembly: LaunchDarkly.CommonSdk.dll
Syntax
public abstract class PluginBase<TClient, THook>
Type Parameters
| Name | Description |
|---|---|
| TClient | The type of the LaunchDarkly client (e.g., ILdClient) |
| THook | The type of hooks used by this plugin (e.g., Hook) |
Constructors
PluginBase(string)
Initializes a new instance of the PluginBase<TClient, THook> class with the specified name.
Declaration
public PluginBase(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the plugin. |
Properties
Metadata
Get metadata about the plugin implementation.
Declaration
public PluginMetadata Metadata { get; }
Property Value
| Type | Description |
|---|---|
| PluginMetadata | Metadata describing this plugin |
Methods
GetHooks(EnvironmentMetadata)
Returns a list of hooks to be registered for the plugin, based on the provided environment metadata.
Declaration
public virtual IList<THook> GetHooks(EnvironmentMetadata metadata)
Parameters
| Type | Name | Description |
|---|---|---|
| EnvironmentMetadata | metadata | Metadata about the environment. |
Returns
| Type | Description |
|---|---|
| IList<THook> | A list of hook instances to be registered. |
Register(TClient, EnvironmentMetadata)
Registers the plugin with the specified LaunchDarkly client and environment metadata.
Declaration
public abstract void Register(TClient client, EnvironmentMetadata metadata)
Parameters
| Type | Name | Description |
|---|---|---|
| TClient | client | An instance of the LaunchDarkly client to register the plugin with. |
| EnvironmentMetadata | metadata | Metadata about the environment. |