BotSharp/src/Plugins/BotSharp.Plugin.TencentCos/TencentCosPlugin.cs
2024-08-09 16:03:29 -05:00

37 lines
1.2 KiB
C#

using BotSharp.Abstraction.Files;
using BotSharp.Abstraction.Repositories.Enums;
using BotSharp.Abstraction.Settings;
using BotSharp.Plugin.TencentCos;
using BotSharp.Plugin.TencentCos.Services;
using BotSharp.Plugin.TencentCos.Settings;
namespace BotSharp.Plugin.TencentCosFile.Files;
public class TencentCosPlugin : IBotSharpPlugin
{
public string Id => "3f55b702-8a28-4f9a-907c-affc24f845f1";
public string Name => "TencentCos";
public string Description => "Provides connection to Tencent Cloud object storage service.";
public void RegisterDI(IServiceCollection services, IConfiguration config)
{
var fileCoreSettings = new FileCoreSettings();
config.Bind("FileCore", fileCoreSettings);
if (fileCoreSettings.Storage == FileStorageEnum.TencentCosStorage)
{
services.AddScoped(provider =>
{
var settingService = provider.GetRequiredService<ISettingService>();
return settingService.Bind<TencentCosSettings>("TencentCos");
});
services.AddScoped<TencentCosClient>();
services.AddScoped<IFileStorageService, TencentCosService>();
}
}
}