/// <summary> /// Initializes a new instance of the <see cref="TwilioAdapter"/> class. /// </summary> /// <param name="twilioClient">The Twilio client to connect to.</param> /// <param name="adapterOptions">Options for the <see cref="TwilioAdapter"/>.</param> /// <param name="logger">The ILogger implementation this adapter should use.</param> public TwilioAdapter(TwilioClientWrapper twilioClient, TwilioAdapterOptions adapterOptions, ILogger logger = null) { _twilioClient = twilioClient ?? throw new ArgumentNullException(nameof(twilioClient)); _logger = logger ?? NullLogger.Instance; _options = adapterOptions ?? new TwilioAdapterOptions(); }
/// <summary> /// Initializes a new instance of the <see cref="TwilioAdapter"/> class using configuration settings. /// </summary> /// <param name="configuration">An <see cref="IConfiguration"/> instance.</param> /// <remarks> /// The configuration keys are: /// TwilioNumber: The phone number associated with the Twilio account. /// TwilioAccountSid: The string identifier of the account. See https://www.twilio.com/docs/glossary/what-is-a-sid /// TwilioAuthToken: The authentication token for the account. /// TwilioValidationUrl: The validation URL for incoming requests. /// </remarks> /// <param name="adapterOptions">Options for the <see cref="TwilioAdapter"/>.</param> /// <param name="logger">The ILogger implementation this adapter should use.</param> public TwilioAdapter(IConfiguration configuration, TwilioAdapterOptions adapterOptions = null, ILogger logger = null) : this( new TwilioClientWrapper(new TwilioClientWrapperOptions(configuration[TwilioNumberKey], configuration[TwilioAccountSidKey], configuration[TwilioAuthTokenKey], new Uri(configuration[TwilioValidationUrlKey]))), adapterOptions, logger) { }