Generic AspNet Webhook middleware.
A Github and appveyor was implemented by default.
websocket-sharp is available on the NuGet Gallery, as still a prerelease version.
Install-Package AspNet.Core.Webhooks -Version 1.0.0
- Add this code in ConfigureServices method of Startup class
services.TryAddSingleton();
services.UseGithubWebhook(() => new GithubOptions
{
ApiKey = "test",
WebHookAction = async (context, message) =>
{
context.Response.ContentType = "application/json";
context.Response.StatusCode = StatusCodes.Status200OK;
await context.Response.WriteAsync(JsonConvert.SerializeObject(new { source = nameof(GithubOptions), message = message }), CancellationToken.None);
}
}).UseAppVeyorWebhook(() => new AppveyorOptions
{
ApiKey = "qwertyuiopasdfghjklzxcvbnm123456",
WebHookAction = async (context, message) =>
{
context.Response.ContentType = "application/json";
context.Response.StatusCode = StatusCodes.Status200OK;
await context.Response.WriteAsync(JsonConvert.SerializeObject(new { source = nameof(AppveyorOptions), message = message }), CancellationToken.None);
}
});
- In Configure method Add this code :
app.UseWebHooks(typeof(AppveyorReceiver));
app.UseWebHooks(typeof(GithubReceiver));
- Async
- auto Resolver assemblies by interface IWebHookHandler
- config from settings files
- Log
- Auto upload to nuget
- Add capability to user app.UseMiddleware