btcpayserver/BTCPayServer.Abstractions/Contracts/IBTCPayServerPlugin.cs
Andrew Camilleri 31738c465d
Plugins: Load plugins by order, aesthetic plugin dependency system (#2020)
* Plugins: Load plugins by order, aesthetic plugin dependency system

Introduces plugins loading in order of installation, BTCPay itself shows up as a system plugin, and that plugins can define other plugins as dependencies.

* use a proper type for plugin dependencies

* rebase fixes

* message when cannot install
2020-11-05 15:43:14 +01:00

32 lines
1,021 B
C#

using System;
using System.Text.Json.Serialization;
using BTCPayServer.Abstractions.Converters;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BTCPayServer.Contracts
{
public interface IBTCPayServerPlugin
{
public string Identifier { get; }
string Name { get; }
[JsonConverter(typeof(VersionConverter))]
Version Version { get; }
string Description { get; }
bool SystemPlugin { get; set; }
PluginDependency[] Dependencies { get; }
void Execute(IApplicationBuilder applicationBuilder, IServiceProvider applicationBuilderApplicationServices);
void Execute(IServiceCollection applicationBuilder);
public class PluginDependency
{
public string Identifier { get; set; }
public string Condition { get; set; }
public override string ToString()
{
return $"{Identifier}: {Condition}";
}
}
}
}