25 changed files with 2241 additions and 8 deletions
@ -0,0 +1,7 @@ |
|||||
|
namespace LINGYUN.Abp.Webhooks; |
||||
|
|
||||
|
public static class WebhooksDefinitionConsts |
||||
|
{ |
||||
|
public static int MinimumTimeoutDuration { get; set; } = 10; |
||||
|
public static int MaximumTimeoutDuration { get; set; } = 300; |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Integration; |
||||
|
|
||||
|
[IntegrationService] |
||||
|
public interface IWebhookPublishIntegrationService : IApplicationService |
||||
|
{ |
||||
|
Task PublishAsync(WebhookPublishInput input); |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
using LINGYUN.Abp.Webhooks; |
||||
|
using Newtonsoft.Json; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Integration; |
||||
|
|
||||
|
public class WebhookPublishIntegrationService : WebhooksManagementAppServiceBase, IWebhookPublishIntegrationService |
||||
|
{ |
||||
|
protected IWebhookPublisher InnerPublisher { get; } |
||||
|
|
||||
|
public WebhookPublishIntegrationService(IWebhookPublisher innerPublisher) |
||||
|
{ |
||||
|
InnerPublisher = innerPublisher; |
||||
|
} |
||||
|
|
||||
|
public async virtual Task PublishAsync(WebhookPublishInput input) |
||||
|
{ |
||||
|
var webhookHeader = new WebhookHeader |
||||
|
{ |
||||
|
UseOnlyGivenHeaders = input.Header.UseOnlyGivenHeaders, |
||||
|
Headers = input.Header.Headers, |
||||
|
}; |
||||
|
var inputData = JsonConvert.DeserializeObject(input.Data); |
||||
|
|
||||
|
if (input.TenantIds.Any()) |
||||
|
{ |
||||
|
await InnerPublisher.PublishAsync( |
||||
|
input.TenantIds.ToArray(), |
||||
|
input.WebhookName, |
||||
|
inputData, |
||||
|
input.SendExactSameData, |
||||
|
webhookHeader); |
||||
|
return; |
||||
|
} |
||||
|
await InnerPublisher.PublishAsync( |
||||
|
input.WebhookName, |
||||
|
inputData, |
||||
|
input.SendExactSameData, |
||||
|
webhookHeader); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
||||
|
using LINGYUN.Abp.WebhooksManagement.Definitions; |
||||
|
using LINGYUN.Abp.WebhooksManagement.Definitions.Dto; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Http.Client.ClientProxying; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Definitions; |
||||
|
|
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
[ExposeServices(typeof(IWebhookDefinitionAppService), typeof(WebhookDefinitionClientProxy))] |
||||
|
public partial class WebhookDefinitionClientProxy : ClientProxyBase<IWebhookDefinitionAppService>, IWebhookDefinitionAppService |
||||
|
{ |
||||
|
public virtual async Task<WebhookDefinitionDto> CreateAsync(WebhookDefinitionCreateDto input) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookDefinitionDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookDefinitionCreateDto), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeleteAsync(string name) |
||||
|
{ |
||||
|
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(string), name } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<WebhookDefinitionDto> GetAsync(string name) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookDefinitionDto>(nameof(GetAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(string), name } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<ListResultDto<WebhookDefinitionDto>> GetListAsync(WebhookDefinitionGetListInput input) |
||||
|
{ |
||||
|
return await RequestAsync<ListResultDto<WebhookDefinitionDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookDefinitionGetListInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<WebhookDefinitionDto> UpdateAsync(string name, WebhookDefinitionUpdateDto input) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookDefinitionDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(string), name }, |
||||
|
{ typeof(WebhookDefinitionUpdateDto), input } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of WebhookDefinitionClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Definitions; |
||||
|
|
||||
|
public partial class WebhookDefinitionClientProxy |
||||
|
{ |
||||
|
} |
||||
@ -0,0 +1,60 @@ |
|||||
|
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
||||
|
using LINGYUN.Abp.WebhooksManagement.Definitions; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Http.Client.ClientProxying; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Definitions; |
||||
|
|
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
[ExposeServices(typeof(IWebhookGroupDefinitionAppService), typeof(WebhookGroupDefinitionClientProxy))] |
||||
|
public partial class WebhookGroupDefinitionClientProxy : ClientProxyBase<IWebhookGroupDefinitionAppService>, IWebhookGroupDefinitionAppService |
||||
|
{ |
||||
|
public virtual async Task<WebhookGroupDefinitionDto> CreateAsync(WebhookGroupDefinitionCreateDto input) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookGroupDefinitionDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookGroupDefinitionCreateDto), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeleteAsync(string name) |
||||
|
{ |
||||
|
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(string), name } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<WebhookGroupDefinitionDto> GetAsync(string name) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookGroupDefinitionDto>(nameof(GetAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(string), name } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<ListResultDto<WebhookGroupDefinitionDto>> GetListAsync(WebhookGroupDefinitionGetListInput input) |
||||
|
{ |
||||
|
return await RequestAsync<ListResultDto<WebhookGroupDefinitionDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookGroupDefinitionGetListInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<WebhookGroupDefinitionDto> UpdateAsync(string name, WebhookGroupDefinitionUpdateDto input) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookGroupDefinitionDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(string), name }, |
||||
|
{ typeof(WebhookGroupDefinitionUpdateDto), input } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of WebhookGroupDefinitionClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Definitions; |
||||
|
|
||||
|
public partial class WebhookGroupDefinitionClientProxy |
||||
|
{ |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
||||
|
using LINGYUN.Abp.WebhooksManagement; |
||||
|
using LINGYUN.Abp.WebhooksManagement.Integration; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Http.Client.ClientProxying; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Integration; |
||||
|
|
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
[ExposeServices(typeof(IWebhookPublishIntegrationService), typeof(WebhookPublishIntegrationClientProxy))] |
||||
|
[IntegrationService] |
||||
|
public partial class WebhookPublishIntegrationClientProxy : ClientProxyBase<IWebhookPublishIntegrationService>, IWebhookPublishIntegrationService |
||||
|
{ |
||||
|
public virtual async Task PublishAsync(WebhookPublishInput input) |
||||
|
{ |
||||
|
await RequestAsync(nameof(PublishAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookPublishInput), input } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of WebhookPublishIntegrationClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Integration; |
||||
|
|
||||
|
public partial class WebhookPublishIntegrationClientProxy |
||||
|
{ |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
||||
|
using LINGYUN.Abp.WebhooksManagement; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Http.Client.ClientProxying; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement; |
||||
|
|
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
[ExposeServices(typeof(IWebhookPublishAppService), typeof(WebhookPublishClientProxy))] |
||||
|
public partial class WebhookPublishClientProxy : ClientProxyBase<IWebhookPublishAppService>, IWebhookPublishAppService |
||||
|
{ |
||||
|
public virtual async Task PublishAsync(WebhookPublishInput input) |
||||
|
{ |
||||
|
await RequestAsync(nameof(PublishAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookPublishInput), input } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of WebhookPublishClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement; |
||||
|
|
||||
|
public partial class WebhookPublishClientProxy |
||||
|
{ |
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
||||
|
using LINGYUN.Abp.WebhooksManagement; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Http.Client.ClientProxying; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement; |
||||
|
|
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
[ExposeServices(typeof(IWebhookSendRecordAppService), typeof(WebhookSendRecordClientProxy))] |
||||
|
public partial class WebhookSendRecordClientProxy : ClientProxyBase<IWebhookSendRecordAppService>, IWebhookSendRecordAppService |
||||
|
{ |
||||
|
public virtual async Task<WebhookSendRecordDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookSendRecordDto>(nameof(GetAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(Guid), id } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(Guid), id } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeleteManyAsync(WebhookSendRecordDeleteManyInput input) |
||||
|
{ |
||||
|
await RequestAsync(nameof(DeleteManyAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookSendRecordDeleteManyInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<PagedResultDto<WebhookSendRecordDto>> GetListAsync(WebhookSendRecordGetListInput input) |
||||
|
{ |
||||
|
return await RequestAsync<PagedResultDto<WebhookSendRecordDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookSendRecordGetListInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task ResendAsync(Guid id) |
||||
|
{ |
||||
|
await RequestAsync(nameof(ResendAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(Guid), id } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task ResendManyAsync(WebhookSendRecordResendManyInput input) |
||||
|
{ |
||||
|
await RequestAsync(nameof(ResendManyAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookSendRecordResendManyInput), input } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of WebhookSendRecordClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement; |
||||
|
|
||||
|
public partial class WebhookSendRecordClientProxy |
||||
|
{ |
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
||||
|
using LINGYUN.Abp.WebhooksManagement; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Client; |
||||
|
using Volo.Abp.Http.Client.ClientProxying; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement; |
||||
|
|
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
[ExposeServices(typeof(IWebhookSubscriptionAppService), typeof(WebhookSubscriptionClientProxy))] |
||||
|
public partial class WebhookSubscriptionClientProxy : ClientProxyBase<IWebhookSubscriptionAppService>, IWebhookSubscriptionAppService |
||||
|
{ |
||||
|
public virtual async Task<WebhookSubscriptionDto> CreateAsync(WebhookSubscriptionCreateInput input) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookSubscriptionDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookSubscriptionCreateInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(Guid), id } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeleteManyAsync(WebhookSubscriptionDeleteManyInput input) |
||||
|
{ |
||||
|
await RequestAsync(nameof(DeleteManyAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookSubscriptionDeleteManyInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<WebhookSubscriptionDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookSubscriptionDto>(nameof(GetAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(Guid), id } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<PagedResultDto<WebhookSubscriptionDto>> GetListAsync(WebhookSubscriptionGetListInput input) |
||||
|
{ |
||||
|
return await RequestAsync<PagedResultDto<WebhookSubscriptionDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(WebhookSubscriptionGetListInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<WebhookSubscriptionDto> UpdateAsync(Guid id, WebhookSubscriptionUpdateInput input) |
||||
|
{ |
||||
|
return await RequestAsync<WebhookSubscriptionDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue |
||||
|
{ |
||||
|
{ typeof(Guid), id }, |
||||
|
{ typeof(WebhookSubscriptionUpdateInput), input } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<ListResultDto<WebhookAvailableGroupDto>> GetAllAvailableWebhooksAsync() |
||||
|
{ |
||||
|
return await RequestAsync<ListResultDto<WebhookAvailableGroupDto>>(nameof(GetAllAvailableWebhooksAsync)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of WebhookSubscriptionClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement; |
||||
|
|
||||
|
public partial class WebhookSubscriptionClientProxy |
||||
|
{ |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,26 @@ |
|||||
|
using Asp.Versioning; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace LINGYUN.Abp.WebhooksManagement.Integration; |
||||
|
|
||||
|
[Area(WebhooksManagementRemoteServiceConsts.ModuleName)] |
||||
|
[ControllerName("WebhookPublishIntegration")] |
||||
|
[RemoteService(Name = WebhooksManagementRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Route($"integration-api/{WebhooksManagementRemoteServiceConsts.ModuleName}/webhooks/publish")] |
||||
|
public class WebhookPublishIntegrationController : WebhooksManagementControllerBase, IWebhookPublishIntegrationService |
||||
|
{ |
||||
|
protected IWebhookPublishIntegrationService PublishAppService { get; } |
||||
|
|
||||
|
public WebhookPublishIntegrationController(IWebhookPublishIntegrationService publishAppService) |
||||
|
{ |
||||
|
PublishAppService = publishAppService; |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
public virtual Task PublishAsync(WebhookPublishInput input) |
||||
|
{ |
||||
|
return PublishAppService.PublishAsync(input); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue