/// <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)); } }
public ActionResult <IEnumerable <WebHookTrigger> > Get() { return(Ok(_webHookTriggerProvider.GetAvailableTriggers().Values)); }
/// <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));