-
-
Notifications
You must be signed in to change notification settings - Fork 538
/
Copy pathTencentCosPlugin.cs
36 lines (28 loc) · 1.17 KB
/
TencentCosPlugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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>();
}
}
}