/// <summary> /// Инициализирует новый экземпляр <see cref="SmsProNikitaClient"/> класса. /// </summary> /// <param name="login">Логин выдаваемый при создании аккаунта</param> /// <param name="password">Пароль</param> /// <param name="sender">Имя отправителя, отображаемое в телефоне получателя. Может состоять либо из 11 латинских букв, цифр и знаков точка и тире, либо из 14 цифр.</param> /// <param name="webProxy">webProxy</param> /// <exception cref="ArgumentException"> /// Логин не может быть пустым - login /// или /// Пароль не может быть пустым - password /// или /// Имя отправителя не может быть пустым - sender /// </exception> public SmsProNikitaClient(string login, string password, string sender, IWebProxy webProxy = null) { if (string.IsNullOrWhiteSpace(login)) { throw new ArgumentException("Логин не может быть пустым", "login"); } if (string.IsNullOrWhiteSpace(password)) { throw new ArgumentException("Пароль не может быть пустым", "password"); } if (string.IsNullOrWhiteSpace(sender)) { throw new ArgumentException("Имя отправителя не может быть пустым", "sender"); } _config = new SmsProNikitaConfig(login, password, sender); _xmlCreator = new XmlCreator(_config); _httpService = webProxy != null ? new HttpService(webProxy) : new HttpService(); }
/// <summary> /// Initializes a new instance of the <see cref="XmlCreator"/> class. /// </summary> /// <param name="smsProNikitaConfig">The SMS pro nikita configuration.</param> /// <exception cref="ArgumentNullException">smsProNikitaConfig</exception> public XmlCreator(SmsProNikitaConfig smsProNikitaConfig) { _config = smsProNikitaConfig ?? throw new ArgumentNullException("smsProNikitaConfig"); }
/// <summary> /// Инициализирует новый экземпляр <see cref="SmsProNikitaClient"/> класса. /// </summary> /// <param name="smsProNikitaConfig">SmsProNikitaConfig</param> /// <param name="webProxy">webProxy</param> /// <exception cref="ArgumentNullException">smsProNikitaConfig</exception> public SmsProNikitaClient(SmsProNikitaConfig smsProNikitaConfig, IWebProxy webProxy = null) { _config = smsProNikitaConfig ?? throw new ArgumentNullException("smsProNikitaConfig"); _xmlCreator = new XmlCreator(_config); _httpService = webProxy != null ? new HttpService(webProxy) : new HttpService(); }