public GenerateAndSendSmsCodeOperation(IConfirmationCodeStore confirmationCodeStore, SmsAuthenticationOptions smsAuthenticationOptions, ITwilioClient twilioClient, IOpenIdEventSource eventSource) { _confirmationCodeStore = confirmationCodeStore; _smsAuthenticationOptions = smsAuthenticationOptions; _twilioClient = twilioClient; _eventSource = eventSource; }
/// <summary> /// Initializes a new instance of the <see cref="TwilioAdapter"/> class. /// A Twilio adapter will allow the Bot to connect to Twilio's SMS service. /// </summary> /// <param name="options">A set of params with the required values for authentication.</param> /// <param name="twilioApi">A Twilio API interface.</param> public TwilioAdapter(ITwilioAdapterOptions options, ITwilioClient twilioApi) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (string.IsNullOrWhiteSpace(options.TwilioNumber)) { throw new Exception("TwilioNumber is a required part of the configuration."); } if (string.IsNullOrWhiteSpace(options.AccountSid)) { throw new Exception("AccountSid is a required part of the configuration."); } if (string.IsNullOrWhiteSpace(options.AuthToken)) { throw new Exception("AuthToken is a required part of the configuration."); } _options = options; _twilioApi = twilioApi ?? throw new Exception("'twilioApi' is required."); _twilioApi.LogIn(_options.AccountSid, _options.AuthToken); }
public SmsProvider(IAppSettings appSettings, ITwilioClient twilioClient) { _appSettings = appSettings; _twilioClient = twilioClient; _providerRegistration = new Dictionary <string, Func <SmsRequest, string> > { { "ALL", Failover }, { "TWILIO", _twilioClient.SendSms } }; }