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); }
public ApiSendSmsResultBase Send(SingleSms sms) { return(ApiHttpClient.Post <ApiSendSmsResultBase>(SendCore(sms), JsonConvert.SerializeObject(sms))); }
public async Task <ApiSendSmsResultBase> SendAsync(SingleSms sms) { var url = SendCore(sms); return(await ApiHttpClient.PostAsync <ApiSendSmsResultBase>(url, JsonConvert.SerializeObject(sms))); }