private string BatchSendCore(BatchSms sms) { CheckSmsModel(sms); string url; if (Regex.IsMatch(sms.Msg, VariableRegex)) { url = ApiUrl(ApiConsts.VariableSmsUrl); Check.CheckNullOrWhiteSpace(sms.Params, nameof(sms.Params)); } else { url = ApiUrl(ApiConsts.SimpleSmsUrl); Check.CheckNull(sms.Phone, nameof(sms.Phone)); foreach (var phone in sms.Phone) { Check.CheckNullOrWhiteSpace(phone, nameof(phone)); } } return(url); }
public ApiBatchSmsResult BatchSend(BatchSms sms) { return(ApiHttpClient.Post <ApiBatchSmsResult>(BatchSendCore(sms), JsonConvert.SerializeObject(sms))); }
public async Task <ApiBatchSmsResult> BatchSendAsync(BatchSms sms) { return(await ApiHttpClient.PostAsync <ApiBatchSmsResult>(BatchSendCore(sms), JsonConvert.SerializeObject(sms))); }