Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SlackAdapter"/> class.
 /// Creates a Slack adapter.
 /// </summary>
 /// <param name="adapterOptions">The adapter options to be used when connecting to the Slack API.</param>
 /// <param name="logger">The ILogger implementation this adapter should use.</param>
 /// <param name="slackClient">The SlackClientWrapper used to connect to the Slack API.</param>
 public SlackAdapter(SlackClientWrapper slackClient, SlackAdapterOptions adapterOptions, ILogger logger = null)
 {
     _slackClient = slackClient ?? throw new ArgumentNullException(nameof(adapterOptions));
     _logger      = logger ?? NullLogger.Instance;
     _options     = adapterOptions ?? new SlackAdapterOptions();
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SlackAdapter"/> class using configuration settings.
 /// </summary>
 /// <param name="configuration">An <see cref="IConfiguration"/> instance.</param>
 /// <remarks>
 /// The configuration keys are:
 /// SlackVerificationToken: A token for validating the origin of incoming webhooks.
 /// SlackBotToken: A token for a bot to work on a single workspace.
 /// SlackClientSigningSecret: The token used to validate that incoming webhooks are originated from Slack.
 /// </remarks>
 /// <param name="options">An instance of <see cref="SlackAdapterOptions"/>.</param>
 /// <param name="logger">The ILogger implementation this adapter should use.</param>
 public SlackAdapter(IConfiguration configuration, SlackAdapterOptions options = null, ILogger logger = null)
     : this(new SlackClientWrapper(new SlackClientWrapperOptions(configuration[SlackVerificationTokenKey], configuration[SlackBotTokenKey], configuration[SlackClientSigningSecretKey])), options, logger)
 {
 }