コード例 #1
0
 /// <summary>
 /// Handles generic webhooks from Vonage
 /// </summary>
 /// <typeparam name="T">The type of webhook you'd like to handle, e.g. <see cref="Messaging.DeliveryReceipt"/></typeparam>
 /// <param name="builder"></param>
 /// <param name="handler">the delegate to call back on when the webhook is parsed</param>
 /// <param name="path">The path to handle the webhook on</param>
 /// <param name="invokeNextMiddleware">whether to invoke the next piece of middleware in your pipeline</param>
 /// <returns></returns>
 public static IApplicationBuilder UseWebhookRoute <T>(this IApplicationBuilder builder,
                                                       WebhookDelegate <T> handler,
                                                       string path,
                                                       bool invokeNextMiddleware = false) where T : class
 {
     return(builder.Map(path, b => b.UseMiddleware <WebhookMiddleware <T> >(handler, invokeNextMiddleware)));
 }
コード例 #2
0
 public WebhookMiddleware(RequestDelegate next, WebhookDelegate <T> handler, bool invokeNextMiddleware)
 {
     _next       = next;
     _handler    = handler;
     _invokeNext = invokeNextMiddleware;
 }