Esempio n. 1
0
        private string SendCore(SingleSms sms)
        {
            string url;

            CheckSmsModel(sms);

            if (Regex.IsMatch(sms.Msg, VariableRegex))
            {
                url = ApiUrl(ApiConsts.VariableSmsUrl);
                Check.CheckNullOrWhiteSpace(sms.Params, nameof(sms.Params));
            }
            else
            {
                url = ApiUrl(ApiConsts.SimpleSmsUrl);
                Check.CheckNullOrWhiteSpace(sms.Phone, nameof(sms.Phone));
            }

            return(url);
        }
Esempio n. 2
0
 public ApiSendSmsResultBase Send(SingleSms sms)
 {
     return(ApiHttpClient.Post <ApiSendSmsResultBase>(SendCore(sms), JsonConvert.SerializeObject(sms)));
 }
Esempio n. 3
0
        public async Task <ApiSendSmsResultBase> SendAsync(SingleSms sms)
        {
            var url = SendCore(sms);

            return(await ApiHttpClient.PostAsync <ApiSendSmsResultBase>(url, JsonConvert.SerializeObject(sms)));
        }