Exemplo n.º 1
0
 /// <summary>
 /// Sets operation's callbacks if the operation contains the <see cref="WebHookSubscriptionPointAttribute"/>
 /// </summary>
 /// <param name="operation"></param>
 /// <param name="context"></param>
 public void Apply(OpenApiOperation operation, OperationFilterContext context)
 {
     if (context.MethodInfo.GetCustomAttributes(true).OfType <WebHookSubscriptionPointAttribute>().Any())
     {
         operation.Callbacks = _webHookTriggerProvider.GetAvailableTriggers().ToDictionary(t => t.Key, t => Generate(t.Value, context));
     }
 }
Exemplo n.º 2
0
 public ActionResult <IEnumerable <WebHookTrigger> > Get()
 {
     return(Ok(_webHookTriggerProvider.GetAvailableTriggers().Values));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Generates the appropriate <see cref="OpenApiCallback"/> fields matching the given <see cref="IWebHookTriggerProvider"/>
 /// </summary>
 /// <returns></returns>
 public IDictionary <string, OpenApiCallback> GenerateCallbacks()
 => _webHookTriggerProvider.GetAvailableTriggers().ToDictionary(t => t.Key, t => Generate(t.Value));