public NewerReleaseConfig(string latestReleaseUrl,
                           ParseSemanticVersionFromResponseBodyDelegate semanticVersionFromResponseBodyCallback,
                           PostfixAlertMessageDelegate?postfixAlertMessageCallback,
                           OverrideHttpRequestCallback?overrideHttpRequestCallback,
                           Predicate <Command>?skipCommand)
 {
     LatestReleaseUrl = latestReleaseUrl;
     ParseSemanticVersionFromResponseBodyCallback = semanticVersionFromResponseBodyCallback;
     PostfixAlertMessageCallback = postfixAlertMessageCallback;
     OverrideHttpRequestCallback = overrideHttpRequestCallback;
     SkipCommand = skipCommand;
 }
 /// <summary>
 /// This middleware will call the <see cref="latestReleaseUrl"/> and
 /// use <see cref="parseSemanticVersionFromResponseBodyCallback"/> to parse a
 /// semantic version from the response.<br/>
 /// If the version is greater than the file version of the assembly,
 /// an alert is output to the console.<br/>
 /// See <see cref="GitHubMiddleware"/> for an example of how to use this method.
 /// </summary>
 /// <param name="appRunner">the <see cref="AppRunner"/> to run the middleware</param>
 /// <param name="latestReleaseUrl">the url for metadata about the latest release</param>
 /// <param name="parseSemanticVersionFromResponseBodyCallback">callback to get the semantic version for response from the <see cref="latestReleaseUrl"/></param>
 /// <param name="postfixAlertMessageCallback">the results of this callback will be post-fixed to the alert message.  i.e. download link.</param>
 /// <param name="overrideHttpRequestCallback">use this callback to append headers and auth info for tests. Also useful for mocking requests for unit tests.</param>
 /// <param name="skipCommand">
 /// Use this to skip the alert for commands where the alert would result in bad output.
 /// i.e. Command output that could be piped to another command.
 /// </param>
 public static AppRunner UseNewerReleaseAlert(this AppRunner appRunner,
                                              string latestReleaseUrl,
                                              ParseSemanticVersionFromResponseBodyDelegate parseSemanticVersionFromResponseBodyCallback,
                                              PostfixAlertMessageDelegate?postfixAlertMessageCallback = null,
                                              OverrideHttpRequestCallback?overrideHttpRequestCallback = null,
                                              Predicate <Command>?skipCommand = null)
 {
     return(appRunner.Configure(c =>
     {
         c.UseMiddleware(AlertOnNewVersion, MiddlewareSteps.NewerReleaseAlerts);
         c.Services.Add(new NewerReleaseConfig(
                            latestReleaseUrl,
                            parseSemanticVersionFromResponseBodyCallback,
                            postfixAlertMessageCallback,
                            overrideHttpRequestCallback,
                            skipCommand
                            ));
     }));
 }
 /// <summary>
 /// This middleware will call the <see cref="latestReleaseUrl"/> and
 /// use <see cref="parseSemanticVersionFromResponseBodyCallback"/> to parse a
 /// semantic version from the response.<br/>
 /// If the version is greater than the file version of the assembly,
 /// an alert is output to the console.<br/>
 /// See <see cref="GitHubMiddleware"/> for an example of how to use this method.
 /// </summary>
 /// <param name="appRunner">the <see cref="AppRunner"/> to run the middleware</param>
 /// <param name="latestReleaseUrl">the url for metadata about the latest release</param>
 /// <param name="parseSemanticVersionFromResponseBodyCallback">callback to get the semantic version for response from the <see cref="latestReleaseUrl"/></param>
 /// <param name="postfixAlertMessageCallback">the results of this callback will be post-fixed to the alert message.  i.e. download link.</param>
 /// <param name="overrideHttpRequestCallback">use this callback to append headers and auth info for tests. Also useful for mocking requests for unit tests.</param>
 /// <param name="skipCommand">
 /// Use this to skip the alert for commands where the alert would result in bad output.
 /// i.e. Command output that could be piped to another command.
 /// </param>
 public static AppRunner UseNewerReleaseAlert(this AppRunner appRunner,
                                              string latestReleaseUrl,
                                              ParseSemanticVersionFromResponseBodyDelegate parseSemanticVersionFromResponseBodyCallback,
                                              PostfixAlertMessageDelegate postfixAlertMessageCallback = null,
                                              OverrideHttpRequestCallback overrideHttpRequestCallback = null,
                                              Predicate <Command> skipCommand = null)
 {
     return(appRunner.Configure(c =>
     {
         c.Services.Add(new NewerReleaseConfig
         {
             LatestReleaseUrl = latestReleaseUrl,
             ParseSematicVersionFromResponseBodyCallback = parseSemanticVersionFromResponseBodyCallback,
             PostfixAlertMessageCallback = postfixAlertMessageCallback,
             OverrideHttpRequestCallback = overrideHttpRequestCallback,
             SkipCommand = skipCommand
         });
         c.UseMiddleware(AlertOnNewVersion, MiddlewareStages.PostParseInputPreBindValues);
     }));
 }