Пример #1
0
        /// <summary>
        /// Extension method for adding the Slack integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of SlackIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithSlack(
            this WardenConfiguration.Builder builder,
            SlackIntegrationConfiguration configuration)
        {
            builder.AddIntegration(SlackIntegration.Create(configuration));

            return(builder);
        }
        public SlackIntegration(SlackIntegrationConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration),
                                                "Slack Integration configuration has not been provided.");
            }

            _configuration = configuration;
            _slackService  = _configuration.SlackServiceProvider();
        }
 /// <summary>
 /// Factory method for creating a new instance of SlackIntegration.
 /// </summary>
 /// <param name="configuration">Configuration of Slack integration.</param>
 /// <returns>Instance of SlackIntegration.</returns>
 public static SlackIntegration Create(SlackIntegrationConfiguration configuration)
 => new SlackIntegration(configuration);
 /// <summary>
 /// Constructor of fluent builder for the SlackIntegrationConfiguration.
 /// </summary>
 /// <param name="webhookUrl">Full URL of the Slack webhook integration.</param>
 /// <returns>Instance of fluent builder for the SlackIntegrationConfiguration.</returns>
 public Builder(string webhookUrl)
 {
     Configuration = new SlackIntegrationConfiguration(webhookUrl);
 }