You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.8 KiB
1.8 KiB
LINGYUN.Abp.WebhooksManagement.HttpApi.Client
Webhook管理HTTP API客户端模块,提供对Webhook管理HTTP API的动态代理客户端。
功能特性
- 动态API客户端代理
- 自动HTTP客户端配置
- 支持远程服务调用
- 集成ABP动态C# API客户端
模块引用
[DependsOn(typeof(AbpWebhooksManagementHttpApiClientModule))]
public class YouProjectModule : AbpModule
{
// other
}
配置项
{
"RemoteServices": {
"WebhooksManagement": {
"BaseUrl": "http://localhost:44315/" // Webhook管理服务的基础URL
}
}
}
基本用法
- 配置远程服务
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<AbpRemoteServiceOptions>(options =>
{
options.RemoteServices.Default = new RemoteServiceConfiguration(
configuration["RemoteServices:WebhooksManagement:BaseUrl"]);
});
}
- 使用HTTP客户端
public class YourService
{
private readonly IWebhookSubscriptionAppService _webhookSubscriptionAppService;
public YourService(IWebhookSubscriptionAppService webhookSubscriptionAppService)
{
_webhookSubscriptionAppService = webhookSubscriptionAppService;
}
public async Task CallRemoteApi()
{
// 创建订阅
await _webhookSubscriptionAppService.CreateAsync(new WebhookSubscriptionCreateDto
{
WebhookUri = "https://your-webhook-endpoint",
Webhooks = new[] { "YourWebhook" }
});
// 查询订阅
var subscriptions = await _webhookSubscriptionAppService.GetListAsync(
new WebhookSubscriptionGetListInput());
}
}