24 changed files with 1638 additions and 0 deletions
@ -0,0 +1,73 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.ClientProxies |
||||
|
|
||||
|
Webhook client proxy module that provides proxy implementation for webhook clients. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Webhook client proxy |
||||
|
* HTTP client configuration |
||||
|
* Automatic retry mechanism |
||||
|
* Error handling |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksClientProxiesModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Webhooks": { |
||||
|
"ClientProxies": { |
||||
|
"RetryCount": 3, // Number of retry attempts |
||||
|
"RetryInterval": "00:00:05", // Retry interval |
||||
|
"HttpTimeout": "00:00:30" // HTTP request timeout |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure Client Proxy |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpWebhooksClientProxiesOptions>(options => |
||||
|
{ |
||||
|
options.RetryCount = 5; |
||||
|
options.RetryInterval = TimeSpan.FromSeconds(10); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use Client Proxy |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookClientProxy _webhookClientProxy; |
||||
|
|
||||
|
public YourService(IWebhookClientProxy webhookClientProxy) |
||||
|
{ |
||||
|
_webhookClientProxy = webhookClientProxy; |
||||
|
} |
||||
|
|
||||
|
public async Task SendWebhook() |
||||
|
{ |
||||
|
await _webhookClientProxy.SendAsync( |
||||
|
new WebhookSendArgs |
||||
|
{ |
||||
|
WebhookUri = "https://your-webhook-endpoint", |
||||
|
Data = new { /* webhook data */ } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,73 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.ClientProxies |
||||
|
|
||||
|
Webhook客户端代理模块,提供Webhook客户端的代理实现。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* Webhook客户端代理 |
||||
|
* HTTP客户端配置 |
||||
|
* 自动重试机制 |
||||
|
* 错误处理 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksClientProxiesModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Webhooks": { |
||||
|
"ClientProxies": { |
||||
|
"RetryCount": 3, // 重试次数 |
||||
|
"RetryInterval": "00:00:05", // 重试间隔 |
||||
|
"HttpTimeout": "00:00:30" // HTTP请求超时时间 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置客户端代理 |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpWebhooksClientProxiesOptions>(options => |
||||
|
{ |
||||
|
options.RetryCount = 5; |
||||
|
options.RetryInterval = TimeSpan.FromSeconds(10); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用客户端代理 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookClientProxy _webhookClientProxy; |
||||
|
|
||||
|
public YourService(IWebhookClientProxy webhookClientProxy) |
||||
|
{ |
||||
|
_webhookClientProxy = webhookClientProxy; |
||||
|
} |
||||
|
|
||||
|
public async Task SendWebhook() |
||||
|
{ |
||||
|
await _webhookClientProxy.SendAsync( |
||||
|
new WebhookSendArgs |
||||
|
{ |
||||
|
WebhookUri = "https://your-webhook-endpoint", |
||||
|
Data = new { /* webhook data */ } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,70 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.Core |
||||
|
|
||||
|
Core webhook module that provides webhook definition, configuration and basic functionality support. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Webhook definition management |
||||
|
* Configurable webhook timeout and retry mechanism |
||||
|
* Automatic subscription deactivation protection |
||||
|
* Customizable HTTP headers |
||||
|
* Support for multiple webhook providers |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksCoreModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Webhooks": { |
||||
|
"TimeoutDuration": "00:01:00", // Default timeout duration, 60 seconds by default |
||||
|
"MaxSendAttemptCount": 5, // Maximum number of send attempts |
||||
|
"IsAutomaticSubscriptionDeactivationEnabled": true, // Whether to automatically deactivate subscription when reaching maximum consecutive failures |
||||
|
"MaxConsecutiveFailCountBeforeDeactivateSubscription": 15, // Maximum consecutive failures before subscription deactivation, default is MaxSendAttemptCount * 3 |
||||
|
"DefaultAgentIdentifier": "Abp-Webhooks", // Default sender identifier |
||||
|
"DefaultHttpHeaders": { // Default HTTP headers |
||||
|
"_AbpDontWrapResult": "true", |
||||
|
"X-Requested-From": "abp-webhooks" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Define a Webhook |
||||
|
```csharp |
||||
|
public class YourWebhookDefinitionProvider : WebhookDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IWebhookDefinitionContext context) |
||||
|
{ |
||||
|
context.Add( |
||||
|
new WebhookDefinition( |
||||
|
name: "TestWebhook", |
||||
|
displayName: L("DisplayName:TestWebhook"), |
||||
|
description: L("Description:TestWebhook") |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Configure Webhook Options |
||||
|
```csharp |
||||
|
Configure<AbpWebhooksOptions>(options => |
||||
|
{ |
||||
|
options.TimeoutDuration = TimeSpan.FromMinutes(2); |
||||
|
options.MaxSendAttemptCount = 3; |
||||
|
options.AddHeader("Custom-Header", "Value"); |
||||
|
}); |
||||
|
``` |
||||
@ -0,0 +1,70 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.Core |
||||
|
|
||||
|
Webhook核心模块,提供Webhook定义、配置和基础功能支持。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* Webhook定义管理 |
||||
|
* 可配置的Webhook超时和重试机制 |
||||
|
* 自动订阅失效保护 |
||||
|
* 可自定义HTTP请求头 |
||||
|
* 支持多Webhook提供者 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksCoreModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Webhooks": { |
||||
|
"TimeoutDuration": "00:01:00", // 默认超时时间,默认60秒 |
||||
|
"MaxSendAttemptCount": 5, // 默认最大发送次数 |
||||
|
"IsAutomaticSubscriptionDeactivationEnabled": true, // 是否在达到最大连续失败次数时自动取消订阅 |
||||
|
"MaxConsecutiveFailCountBeforeDeactivateSubscription": 15, // 取消订阅前最大连续失败次数,默认为MaxSendAttemptCount * 3 |
||||
|
"DefaultAgentIdentifier": "Abp-Webhooks", // 默认发送方标识 |
||||
|
"DefaultHttpHeaders": { // 默认请求头 |
||||
|
"_AbpDontWrapResult": "true", |
||||
|
"X-Requested-From": "abp-webhooks" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 定义Webhook |
||||
|
```csharp |
||||
|
public class YourWebhookDefinitionProvider : WebhookDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IWebhookDefinitionContext context) |
||||
|
{ |
||||
|
context.Add( |
||||
|
new WebhookDefinition( |
||||
|
name: "TestWebhook", |
||||
|
displayName: L("DisplayName:TestWebhook"), |
||||
|
description: L("Description:TestWebhook") |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 配置Webhook选项 |
||||
|
```csharp |
||||
|
Configure<AbpWebhooksOptions>(options => |
||||
|
{ |
||||
|
options.TimeoutDuration = TimeSpan.FromMinutes(2); |
||||
|
options.MaxSendAttemptCount = 3; |
||||
|
options.AddHeader("Custom-Header", "Value"); |
||||
|
}); |
||||
|
``` |
||||
@ -0,0 +1,58 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.EventBus |
||||
|
|
||||
|
Webhook event bus integration module that provides integration with the ABP event bus. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Support for publishing webhook events to the event bus |
||||
|
* Seamless integration with ABP event bus |
||||
|
* Support for distributed event bus |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksEventBusModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Define Webhook Event Handler |
||||
|
```csharp |
||||
|
public class YourWebhookEventHandler : |
||||
|
IDistributedEventHandler<WebhookEventData>, |
||||
|
ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleEventAsync(WebhookEventData eventData) |
||||
|
{ |
||||
|
// Handle webhook event |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Publish Webhook Event |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IDistributedEventBus _eventBus; |
||||
|
|
||||
|
public YourService(IDistributedEventBus eventBus) |
||||
|
{ |
||||
|
_eventBus = eventBus; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishWebhook() |
||||
|
{ |
||||
|
await _eventBus.PublishAsync(new WebhookEventData |
||||
|
{ |
||||
|
WebhookName = "YourWebhook", |
||||
|
Data = new { /* webhook data */ } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,58 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.EventBus |
||||
|
|
||||
|
Webhook事件总线集成模块,提供与ABP事件总线的集成支持。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 支持将Webhook事件发布到事件总线 |
||||
|
* 与ABP事件总线无缝集成 |
||||
|
* 支持分布式事件总线 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksEventBusModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 定义Webhook事件处理器 |
||||
|
```csharp |
||||
|
public class YourWebhookEventHandler : |
||||
|
IDistributedEventHandler<WebhookEventData>, |
||||
|
ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleEventAsync(WebhookEventData eventData) |
||||
|
{ |
||||
|
// 处理webhook事件 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 发布Webhook事件 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IDistributedEventBus _eventBus; |
||||
|
|
||||
|
public YourService(IDistributedEventBus eventBus) |
||||
|
{ |
||||
|
_eventBus = eventBus; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishWebhook() |
||||
|
{ |
||||
|
await _eventBus.PublishAsync(new WebhookEventData |
||||
|
{ |
||||
|
WebhookName = "YourWebhook", |
||||
|
Data = new { /* webhook data */ } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,58 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.Identity |
||||
|
|
||||
|
Webhook identity integration module that provides integration with ABP identity system. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Integration with ABP identity system |
||||
|
* Support for user and tenant level webhooks |
||||
|
* Identity-related webhook events |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksIdentityModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Handle Identity-related Webhooks |
||||
|
```csharp |
||||
|
public class YourIdentityWebhookHandler : IWebhookHandler, ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleWebhookAsync(WebhookPayload webhook) |
||||
|
{ |
||||
|
if (webhook.WebhookName == "User.Created") |
||||
|
{ |
||||
|
// Handle user creation event |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Publish Identity-related Webhooks |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookPublisher _webhookPublisher; |
||||
|
|
||||
|
public YourService(IWebhookPublisher webhookPublisher) |
||||
|
{ |
||||
|
_webhookPublisher = webhookPublisher; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishIdentityWebhook() |
||||
|
{ |
||||
|
await _webhookPublisher.PublishAsync( |
||||
|
webhookName: "User.Created", |
||||
|
data: new { /* user data */ } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,58 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.Identity |
||||
|
|
||||
|
Webhook身份集成模块,提供与ABP身份系统的集成支持。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 与ABP身份系统集成 |
||||
|
* 支持用户和租户级别的Webhook |
||||
|
* 身份相关的Webhook事件 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksIdentityModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 处理身份相关的Webhook |
||||
|
```csharp |
||||
|
public class YourIdentityWebhookHandler : IWebhookHandler, ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleWebhookAsync(WebhookPayload webhook) |
||||
|
{ |
||||
|
if (webhook.WebhookName == "User.Created") |
||||
|
{ |
||||
|
// 处理用户创建事件 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 发布身份相关的Webhook |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookPublisher _webhookPublisher; |
||||
|
|
||||
|
public YourService(IWebhookPublisher webhookPublisher) |
||||
|
{ |
||||
|
_webhookPublisher = webhookPublisher; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishIdentityWebhook() |
||||
|
{ |
||||
|
await _webhookPublisher.PublishAsync( |
||||
|
webhookName: "User.Created", |
||||
|
data: new { /* user data */ } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,58 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.Saas |
||||
|
|
||||
|
Webhook SaaS integration module that provides integration with ABP SaaS system. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Integration with ABP SaaS system |
||||
|
* Support for multi-tenant webhooks |
||||
|
* SaaS-related webhook events |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksSaasModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Handle SaaS-related Webhooks |
||||
|
```csharp |
||||
|
public class YourSaasWebhookHandler : IWebhookHandler, ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleWebhookAsync(WebhookPayload webhook) |
||||
|
{ |
||||
|
if (webhook.WebhookName == "Tenant.Created") |
||||
|
{ |
||||
|
// Handle tenant creation event |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Publish SaaS-related Webhooks |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookPublisher _webhookPublisher; |
||||
|
|
||||
|
public YourService(IWebhookPublisher webhookPublisher) |
||||
|
{ |
||||
|
_webhookPublisher = webhookPublisher; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishSaasWebhook() |
||||
|
{ |
||||
|
await _webhookPublisher.PublishAsync( |
||||
|
webhookName: "Tenant.Created", |
||||
|
data: new { /* tenant data */ } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,58 @@ |
|||||
|
# LINGYUN.Abp.Webhooks.Saas |
||||
|
|
||||
|
Webhook SaaS集成模块,提供与ABP SaaS系统的集成支持。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 与ABP SaaS系统集成 |
||||
|
* 支持多租户Webhook |
||||
|
* SaaS相关的Webhook事件 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksSaasModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 处理SaaS相关的Webhook |
||||
|
```csharp |
||||
|
public class YourSaasWebhookHandler : IWebhookHandler, ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleWebhookAsync(WebhookPayload webhook) |
||||
|
{ |
||||
|
if (webhook.WebhookName == "Tenant.Created") |
||||
|
{ |
||||
|
// 处理租户创建事件 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 发布SaaS相关的Webhook |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookPublisher _webhookPublisher; |
||||
|
|
||||
|
public YourService(IWebhookPublisher webhookPublisher) |
||||
|
{ |
||||
|
_webhookPublisher = webhookPublisher; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishSaasWebhook() |
||||
|
{ |
||||
|
await _webhookPublisher.PublishAsync( |
||||
|
webhookName: "Tenant.Created", |
||||
|
data: new { /* tenant data */ } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,73 @@ |
|||||
|
# LINGYUN.Abp.Webhooks |
||||
|
|
||||
|
Base webhook module that provides basic webhook definitions and functionality. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Basic webhook definitions |
||||
|
* Webhook publishing and subscription |
||||
|
* Webhook event data handling |
||||
|
* Webhook configuration management |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Define a Webhook |
||||
|
```csharp |
||||
|
public class YourWebhookDefinitionProvider : WebhookDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IWebhookDefinitionContext context) |
||||
|
{ |
||||
|
context.Add( |
||||
|
new WebhookDefinition( |
||||
|
name: "YourWebhook", |
||||
|
displayName: L("DisplayName:YourWebhook"), |
||||
|
description: L("Description:YourWebhook") |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Publish a Webhook |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookPublisher _webhookPublisher; |
||||
|
|
||||
|
public YourService(IWebhookPublisher webhookPublisher) |
||||
|
{ |
||||
|
_webhookPublisher = webhookPublisher; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishWebhook() |
||||
|
{ |
||||
|
await _webhookPublisher.PublishAsync( |
||||
|
webhookName: "YourWebhook", |
||||
|
data: new { /* webhook data */ } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
3. Handle Webhook Events |
||||
|
```csharp |
||||
|
public class YourWebhookHandler : IWebhookHandler, ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleWebhookAsync(WebhookPayload webhook) |
||||
|
{ |
||||
|
// Handle webhook event |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,73 @@ |
|||||
|
# LINGYUN.Abp.Webhooks |
||||
|
|
||||
|
Webhook基础模块,提供Webhook的基本定义和功能。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 基本Webhook定义 |
||||
|
* Webhook发布和订阅 |
||||
|
* Webhook事件数据处理 |
||||
|
* Webhook配置管理 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 定义Webhook |
||||
|
```csharp |
||||
|
public class YourWebhookDefinitionProvider : WebhookDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IWebhookDefinitionContext context) |
||||
|
{ |
||||
|
context.Add( |
||||
|
new WebhookDefinition( |
||||
|
name: "YourWebhook", |
||||
|
displayName: L("DisplayName:YourWebhook"), |
||||
|
description: L("Description:YourWebhook") |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 发布Webhook |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookPublisher _webhookPublisher; |
||||
|
|
||||
|
public YourService(IWebhookPublisher webhookPublisher) |
||||
|
{ |
||||
|
_webhookPublisher = webhookPublisher; |
||||
|
} |
||||
|
|
||||
|
public async Task PublishWebhook() |
||||
|
{ |
||||
|
await _webhookPublisher.PublishAsync( |
||||
|
webhookName: "YourWebhook", |
||||
|
data: new { /* webhook data */ } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
3. 处理Webhook事件 |
||||
|
```csharp |
||||
|
public class YourWebhookHandler : IWebhookHandler, ITransientDependency |
||||
|
{ |
||||
|
public async Task HandleWebhookAsync(WebhookPayload webhook) |
||||
|
{ |
||||
|
// 处理webhook事件 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,64 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Application.Contracts |
||||
|
|
||||
|
Webhook management application service contracts module that defines application service interfaces and DTOs for webhook management. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Webhook subscription service interfaces |
||||
|
* Webhook group service interfaces |
||||
|
* Webhook definition service interfaces |
||||
|
* Webhook log service interfaces |
||||
|
* Webhook permission definitions |
||||
|
* Webhook DTO definitions |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Service Interfaces |
||||
|
|
||||
|
* IWebhookSubscriptionAppService - Webhook subscription management service |
||||
|
* IWebhookGroupAppService - Webhook group management service |
||||
|
* IWebhookDefinitionAppService - Webhook definition management service |
||||
|
* IWebhookSendAttemptAppService - Webhook send attempt log service |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Implement Webhook Subscription Service |
||||
|
```csharp |
||||
|
public class WebhookSubscriptionAppService : |
||||
|
ApplicationService, |
||||
|
IWebhookSubscriptionAppService |
||||
|
{ |
||||
|
public async Task<WebhookSubscriptionDto> CreateAsync( |
||||
|
WebhookSubscriptionCreateDto input) |
||||
|
{ |
||||
|
// Implement subscription creation logic |
||||
|
} |
||||
|
|
||||
|
public async Task<PagedResultDto<WebhookSubscriptionDto>> GetListAsync( |
||||
|
WebhookSubscriptionGetListInput input) |
||||
|
{ |
||||
|
// Implement subscription query logic |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use Webhook DTOs |
||||
|
```csharp |
||||
|
public class YourDto |
||||
|
{ |
||||
|
public WebhookSubscriptionDto Subscription { get; set; } |
||||
|
public WebhookGroupDto Group { get; set; } |
||||
|
public WebhookDefinitionDto Definition { get; set; } |
||||
|
public WebhookSendAttemptDto SendAttempt { get; set; } |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,64 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Application.Contracts |
||||
|
|
||||
|
Webhook管理应用服务契约模块,定义Webhook管理的应用服务接口和DTO。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* Webhook订阅服务接口 |
||||
|
* Webhook组服务接口 |
||||
|
* Webhook定义服务接口 |
||||
|
* Webhook日志服务接口 |
||||
|
* Webhook权限定义 |
||||
|
* Webhook DTO定义 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 服务接口 |
||||
|
|
||||
|
* IWebhookSubscriptionAppService - Webhook订阅管理服务 |
||||
|
* IWebhookGroupAppService - Webhook组管理服务 |
||||
|
* IWebhookDefinitionAppService - Webhook定义管理服务 |
||||
|
* IWebhookSendAttemptAppService - Webhook发送日志服务 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 实现Webhook订阅服务 |
||||
|
```csharp |
||||
|
public class WebhookSubscriptionAppService : |
||||
|
ApplicationService, |
||||
|
IWebhookSubscriptionAppService |
||||
|
{ |
||||
|
public async Task<WebhookSubscriptionDto> CreateAsync( |
||||
|
WebhookSubscriptionCreateDto input) |
||||
|
{ |
||||
|
// 实现创建订阅逻辑 |
||||
|
} |
||||
|
|
||||
|
public async Task<PagedResultDto<WebhookSubscriptionDto>> GetListAsync( |
||||
|
WebhookSubscriptionGetListInput input) |
||||
|
{ |
||||
|
// 实现查询订阅逻辑 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用Webhook DTO |
||||
|
```csharp |
||||
|
public class YourDto |
||||
|
{ |
||||
|
public WebhookSubscriptionDto Subscription { get; set; } |
||||
|
public WebhookGroupDto Group { get; set; } |
||||
|
public WebhookDefinitionDto Definition { get; set; } |
||||
|
public WebhookSendAttemptDto SendAttempt { get; set; } |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,89 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Application |
||||
|
|
||||
|
Webhook management application service module that provides application layer implementation for webhook management. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Webhook subscription management |
||||
|
* Webhook group management |
||||
|
* Webhook definition management |
||||
|
* Webhook log querying |
||||
|
* Webhook permission management |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementApplicationModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Permission Definitions |
||||
|
|
||||
|
* WebhooksManagement.Webhooks |
||||
|
* WebhooksManagement.Webhooks.Create |
||||
|
* WebhooksManagement.Webhooks.Update |
||||
|
* WebhooksManagement.Webhooks.Delete |
||||
|
* WebhooksManagement.Webhooks.ManagePermissions |
||||
|
* WebhooksManagement.Groups |
||||
|
* WebhooksManagement.Groups.Create |
||||
|
* WebhooksManagement.Groups.Update |
||||
|
* WebhooksManagement.Groups.Delete |
||||
|
* WebhooksManagement.Subscriptions |
||||
|
* WebhooksManagement.Subscriptions.Create |
||||
|
* WebhooksManagement.Subscriptions.Update |
||||
|
* WebhooksManagement.Subscriptions.Delete |
||||
|
* WebhooksManagement.Logs |
||||
|
* WebhooksManagement.Logs.Default |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Manage Webhook Subscriptions |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookSubscriptionAppService _webhookSubscriptionAppService; |
||||
|
|
||||
|
public YourService(IWebhookSubscriptionAppService webhookSubscriptionAppService) |
||||
|
{ |
||||
|
_webhookSubscriptionAppService = webhookSubscriptionAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task ManageSubscription() |
||||
|
{ |
||||
|
// Create subscription |
||||
|
await _webhookSubscriptionAppService.CreateAsync(new WebhookSubscriptionCreateDto |
||||
|
{ |
||||
|
WebhookUri = "https://your-webhook-endpoint", |
||||
|
Webhooks = new[] { "YourWebhook" } |
||||
|
}); |
||||
|
|
||||
|
// Query subscriptions |
||||
|
var subscriptions = await _webhookSubscriptionAppService.GetListAsync( |
||||
|
new WebhookSubscriptionGetListInput()); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Query Webhook Logs |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookSendAttemptAppService _webhookSendAttemptAppService; |
||||
|
|
||||
|
public YourService(IWebhookSendAttemptAppService webhookSendAttemptAppService) |
||||
|
{ |
||||
|
_webhookSendAttemptAppService = webhookSendAttemptAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task QueryLogs() |
||||
|
{ |
||||
|
var logs = await _webhookSendAttemptAppService.GetListAsync( |
||||
|
new WebhookSendAttemptGetListInput()); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,89 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Application |
||||
|
|
||||
|
Webhook管理应用服务模块,提供Webhook管理的应用层实现。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* Webhook订阅管理 |
||||
|
* Webhook组管理 |
||||
|
* Webhook定义管理 |
||||
|
* Webhook日志查询 |
||||
|
* Webhook权限管理 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementApplicationModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 权限定义 |
||||
|
|
||||
|
* WebhooksManagement.Webhooks |
||||
|
* WebhooksManagement.Webhooks.Create |
||||
|
* WebhooksManagement.Webhooks.Update |
||||
|
* WebhooksManagement.Webhooks.Delete |
||||
|
* WebhooksManagement.Webhooks.ManagePermissions |
||||
|
* WebhooksManagement.Groups |
||||
|
* WebhooksManagement.Groups.Create |
||||
|
* WebhooksManagement.Groups.Update |
||||
|
* WebhooksManagement.Groups.Delete |
||||
|
* WebhooksManagement.Subscriptions |
||||
|
* WebhooksManagement.Subscriptions.Create |
||||
|
* WebhooksManagement.Subscriptions.Update |
||||
|
* WebhooksManagement.Subscriptions.Delete |
||||
|
* WebhooksManagement.Logs |
||||
|
* WebhooksManagement.Logs.Default |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 管理Webhook订阅 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookSubscriptionAppService _webhookSubscriptionAppService; |
||||
|
|
||||
|
public YourService(IWebhookSubscriptionAppService webhookSubscriptionAppService) |
||||
|
{ |
||||
|
_webhookSubscriptionAppService = webhookSubscriptionAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task ManageSubscription() |
||||
|
{ |
||||
|
// 创建订阅 |
||||
|
await _webhookSubscriptionAppService.CreateAsync(new WebhookSubscriptionCreateDto |
||||
|
{ |
||||
|
WebhookUri = "https://your-webhook-endpoint", |
||||
|
Webhooks = new[] { "YourWebhook" } |
||||
|
}); |
||||
|
|
||||
|
// 查询订阅 |
||||
|
var subscriptions = await _webhookSubscriptionAppService.GetListAsync( |
||||
|
new WebhookSubscriptionGetListInput()); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 查询Webhook日志 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookSendAttemptAppService _webhookSendAttemptAppService; |
||||
|
|
||||
|
public YourService(IWebhookSendAttemptAppService webhookSendAttemptAppService) |
||||
|
{ |
||||
|
_webhookSendAttemptAppService = webhookSendAttemptAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task QueryLogs() |
||||
|
{ |
||||
|
var logs = await _webhookSendAttemptAppService.GetListAsync( |
||||
|
new WebhookSendAttemptGetListInput()); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,67 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Dapr.Client |
||||
|
|
||||
|
Webhook management Dapr client integration module that provides integration with Dapr service invocation building block. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Support for accessing webhook management service through Dapr service invocation |
||||
|
* Seamless integration with Dapr service invocation building block |
||||
|
* Support for distributed service invocation |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementDaprClientModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"WebhooksManagement": { |
||||
|
"Dapr": { |
||||
|
"AppId": "webhooks-management", // Dapr application ID for webhook management service |
||||
|
"HttpEndpoint": "http://localhost:3500" // Dapr sidecar HTTP endpoint |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure Dapr Client |
||||
|
```csharp |
||||
|
Configure<AbpWebhooksManagementDaprClientOptions>(options => |
||||
|
{ |
||||
|
options.AppId = "webhooks-management"; |
||||
|
options.HttpEndpoint = "http://localhost:3500"; |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
2. Use Webhook Management Client |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookSubscriptionAppService _webhookSubscriptionAppService; |
||||
|
|
||||
|
public YourService(IWebhookSubscriptionAppService webhookSubscriptionAppService) |
||||
|
{ |
||||
|
_webhookSubscriptionAppService = webhookSubscriptionAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task SubscribeWebhook() |
||||
|
{ |
||||
|
await _webhookSubscriptionAppService.SubscribeAsync(new WebhookSubscriptionCreateDto |
||||
|
{ |
||||
|
WebhookUri = "https://your-webhook-endpoint", |
||||
|
Webhooks = new[] { "YourWebhook" } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,67 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Dapr.Client |
||||
|
|
||||
|
Webhook管理Dapr客户端集成模块,提供与Dapr服务调用构建块的集成支持。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 支持通过Dapr服务调用访问Webhook管理服务 |
||||
|
* 与Dapr服务调用构建块无缝集成 |
||||
|
* 支持分布式服务调用 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementDaprClientModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"WebhooksManagement": { |
||||
|
"Dapr": { |
||||
|
"AppId": "webhooks-management", // Webhook管理服务的Dapr应用ID |
||||
|
"HttpEndpoint": "http://localhost:3500" // Dapr sidecar HTTP端点 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置Dapr客户端 |
||||
|
```csharp |
||||
|
Configure<AbpWebhooksManagementDaprClientOptions>(options => |
||||
|
{ |
||||
|
options.AppId = "webhooks-management"; |
||||
|
options.HttpEndpoint = "http://localhost:3500"; |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
2. 使用Webhook管理客户端 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookSubscriptionAppService _webhookSubscriptionAppService; |
||||
|
|
||||
|
public YourService(IWebhookSubscriptionAppService webhookSubscriptionAppService) |
||||
|
{ |
||||
|
_webhookSubscriptionAppService = webhookSubscriptionAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task SubscribeWebhook() |
||||
|
{ |
||||
|
await _webhookSubscriptionAppService.SubscribeAsync(new WebhookSubscriptionCreateDto |
||||
|
{ |
||||
|
WebhookUri = "https://your-webhook-endpoint", |
||||
|
Webhooks = new[] { "YourWebhook" } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,67 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Domain |
||||
|
|
||||
|
Webhook management domain module that provides webhook storage and management functionality. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Support for storing static webhooks in database |
||||
|
* Support for dynamic webhook storage |
||||
|
* Webhook cache management |
||||
|
* Timestamp expiration mechanism |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementDomainModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"WebhooksManagement": { |
||||
|
"SaveStaticWebhooksToDatabase": true, // Whether to save static webhooks to database, default true |
||||
|
"IsDynamicWebhookStoreEnabled": false, // Whether to enable dynamic webhook storage, default false |
||||
|
"WebhooksCacheRefreshInterval": "00:00:30", // Cache refresh interval, default 30 seconds |
||||
|
"WebhooksCacheStampTimeOut": "00:02:00", // Timestamp request timeout, default 2 minutes |
||||
|
"WebhooksCacheStampExpiration": "00:30:00" // Timestamp expiration time, default 30 minutes |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure Webhook Management Options |
||||
|
```csharp |
||||
|
Configure<WebhooksManagementOptions>(options => |
||||
|
{ |
||||
|
options.SaveStaticWebhooksToDatabase = true; |
||||
|
options.IsDynamicWebhookStoreEnabled = true; |
||||
|
options.WebhooksCacheRefreshInterval = TimeSpan.FromMinutes(1); |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
2. Using Webhook Storage |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookDefinitionManager _webhookDefinitionManager; |
||||
|
|
||||
|
public YourService(IWebhookDefinitionManager webhookDefinitionManager) |
||||
|
{ |
||||
|
_webhookDefinitionManager = webhookDefinitionManager; |
||||
|
} |
||||
|
|
||||
|
public async Task DoSomething() |
||||
|
{ |
||||
|
var webhooks = await _webhookDefinitionManager.GetAllAsync(); |
||||
|
// Process webhooks |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,67 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.Domain |
||||
|
|
||||
|
Webhook管理领域模块,提供Webhook的存储和管理功能。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 支持静态Webhook存储到数据库 |
||||
|
* 支持动态Webhook存储 |
||||
|
* Webhook缓存管理 |
||||
|
* 时间戳过期机制 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementDomainModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"WebhooksManagement": { |
||||
|
"SaveStaticWebhooksToDatabase": true, // 是否保存静态Webhook到数据库,默认true |
||||
|
"IsDynamicWebhookStoreEnabled": false, // 是否启用动态Webhook存储,默认false |
||||
|
"WebhooksCacheRefreshInterval": "00:00:30", // 缓存刷新时间,默认30秒 |
||||
|
"WebhooksCacheStampTimeOut": "00:02:00", // 申请时间戳超时时间,默认2分钟 |
||||
|
"WebhooksCacheStampExpiration": "00:30:00" // 时间戳过期时间,默认30分钟 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置Webhook管理选项 |
||||
|
```csharp |
||||
|
Configure<WebhooksManagementOptions>(options => |
||||
|
{ |
||||
|
options.SaveStaticWebhooksToDatabase = true; |
||||
|
options.IsDynamicWebhookStoreEnabled = true; |
||||
|
options.WebhooksCacheRefreshInterval = TimeSpan.FromMinutes(1); |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
2. 使用Webhook存储 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookDefinitionManager _webhookDefinitionManager; |
||||
|
|
||||
|
public YourService(IWebhookDefinitionManager webhookDefinitionManager) |
||||
|
{ |
||||
|
_webhookDefinitionManager = webhookDefinitionManager; |
||||
|
} |
||||
|
|
||||
|
public async Task DoSomething() |
||||
|
{ |
||||
|
var webhooks = await _webhookDefinitionManager.GetAllAsync(); |
||||
|
// 处理webhook |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,77 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.HttpApi.Client |
||||
|
|
||||
|
Webhook management HTTP API client module that provides dynamic proxy client for webhook management HTTP API. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Dynamic API client proxy |
||||
|
* Automatic HTTP client configuration |
||||
|
* Support for remote service calls |
||||
|
* Integration with ABP dynamic C# API client |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementHttpApiClientModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"RemoteServices": { |
||||
|
"WebhooksManagement": { |
||||
|
"BaseUrl": "http://localhost:44315/" // Base URL for webhook management service |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure Remote Service |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
|
||||
|
Configure<AbpRemoteServiceOptions>(options => |
||||
|
{ |
||||
|
options.RemoteServices.Default = new RemoteServiceConfiguration( |
||||
|
configuration["RemoteServices:WebhooksManagement:BaseUrl"]); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use HTTP Client |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IWebhookSubscriptionAppService _webhookSubscriptionAppService; |
||||
|
|
||||
|
public YourService(IWebhookSubscriptionAppService webhookSubscriptionAppService) |
||||
|
{ |
||||
|
_webhookSubscriptionAppService = webhookSubscriptionAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task CallRemoteApi() |
||||
|
{ |
||||
|
// Create subscription |
||||
|
await _webhookSubscriptionAppService.CreateAsync(new WebhookSubscriptionCreateDto |
||||
|
{ |
||||
|
WebhookUri = "https://your-webhook-endpoint", |
||||
|
Webhooks = new[] { "YourWebhook" } |
||||
|
}); |
||||
|
|
||||
|
// Query subscriptions |
||||
|
var subscriptions = await _webhookSubscriptionAppService.GetListAsync( |
||||
|
new WebhookSubscriptionGetListInput()); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,77 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.HttpApi.Client |
||||
|
|
||||
|
Webhook管理HTTP API客户端模块,提供对Webhook管理HTTP API的动态代理客户端。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 动态API客户端代理 |
||||
|
* 自动HTTP客户端配置 |
||||
|
* 支持远程服务调用 |
||||
|
* 集成ABP动态C# API客户端 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementHttpApiClientModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"RemoteServices": { |
||||
|
"WebhooksManagement": { |
||||
|
"BaseUrl": "http://localhost:44315/" // Webhook管理服务的基础URL |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置远程服务 |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
|
||||
|
Configure<AbpRemoteServiceOptions>(options => |
||||
|
{ |
||||
|
options.RemoteServices.Default = new RemoteServiceConfiguration( |
||||
|
configuration["RemoteServices:WebhooksManagement:BaseUrl"]); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用HTTP客户端 |
||||
|
```csharp |
||||
|
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()); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,65 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.HttpApi |
||||
|
|
||||
|
Webhook management HTTP API module that provides REST API interfaces for webhook management. |
||||
|
|
||||
|
[简体中文](README.md) |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Webhook subscription REST API |
||||
|
* Webhook group REST API |
||||
|
* Webhook definition REST API |
||||
|
* Webhook log REST API |
||||
|
* Automatic API routing |
||||
|
* API permission control |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementHttpApiModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## API Routes |
||||
|
|
||||
|
* /api/webhooks-management/subscriptions - Webhook subscription management |
||||
|
* /api/webhooks-management/groups - Webhook group management |
||||
|
* /api/webhooks-management/definitions - Webhook definition management |
||||
|
* /api/webhooks-management/logs - Webhook log querying |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure API Routing |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpAspNetCoreMvcOptions>(options => |
||||
|
{ |
||||
|
options.ConventionalControllers.Create( |
||||
|
typeof(AbpWebhooksManagementHttpApiModule).Assembly, |
||||
|
opts => |
||||
|
{ |
||||
|
opts.RootPath = "webhooks-management"; |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. API Call Examples |
||||
|
```http |
||||
|
### Create Webhook Subscription |
||||
|
POST /api/webhooks-management/subscriptions |
||||
|
{ |
||||
|
"webhookUri": "https://your-webhook-endpoint", |
||||
|
"webhooks": ["YourWebhook"] |
||||
|
} |
||||
|
|
||||
|
### Query Webhook Subscriptions |
||||
|
GET /api/webhooks-management/subscriptions?maxResultCount=10&skipCount=0 |
||||
|
|
||||
|
### Query Webhook Logs |
||||
|
GET /api/webhooks-management/logs?maxResultCount=10&skipCount=0 |
||||
|
``` |
||||
@ -0,0 +1,65 @@ |
|||||
|
# LINGYUN.Abp.WebhooksManagement.HttpApi |
||||
|
|
||||
|
Webhook管理HTTP API模块,提供Webhook管理的REST API接口。 |
||||
|
|
||||
|
[English](README.EN.md) |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* Webhook订阅REST API |
||||
|
* Webhook组REST API |
||||
|
* Webhook定义REST API |
||||
|
* Webhook日志REST API |
||||
|
* 自动API路由 |
||||
|
* API权限控制 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpWebhooksManagementHttpApiModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## API路由 |
||||
|
|
||||
|
* /api/webhooks-management/subscriptions - Webhook订阅管理 |
||||
|
* /api/webhooks-management/groups - Webhook组管理 |
||||
|
* /api/webhooks-management/definitions - Webhook定义管理 |
||||
|
* /api/webhooks-management/logs - Webhook日志查询 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置API路由 |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpAspNetCoreMvcOptions>(options => |
||||
|
{ |
||||
|
options.ConventionalControllers.Create( |
||||
|
typeof(AbpWebhooksManagementHttpApiModule).Assembly, |
||||
|
opts => |
||||
|
{ |
||||
|
opts.RootPath = "webhooks-management"; |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 调用API示例 |
||||
|
```http |
||||
|
### 创建Webhook订阅 |
||||
|
POST /api/webhooks-management/subscriptions |
||||
|
{ |
||||
|
"webhookUri": "https://your-webhook-endpoint", |
||||
|
"webhooks": ["YourWebhook"] |
||||
|
} |
||||
|
|
||||
|
### 查询Webhook订阅 |
||||
|
GET /api/webhooks-management/subscriptions?maxResultCount=10&skipCount=0 |
||||
|
|
||||
|
### 查询Webhook日志 |
||||
|
GET /api/webhooks-management/logs?maxResultCount=10&skipCount=0 |
||||
|
``` |
||||
Loading…
Reference in new issue