/// <summary> /// Envoi d'un SMS (avec param) /// </summary> public async Task <SmsManagerSendContext> SendSmsAsync(SmsBatchParams smsSendData) { if (smsSendData == null) { throw new ArgumentNullException("smsSendData"); } try { SmsManagerSendContext ctx = new SmsManagerSendContext(); if (string.IsNullOrEmpty(smsSendData.Message)) { throw new ArgumentNullException("smsSendData.Message"); } if (smsSendData.To == null || smsSendData.To.Length == 0 || string.IsNullOrWhiteSpace(smsSendData.To[0])) { throw new ArgumentNullException("smsSendData.To"); } if (string.IsNullOrWhiteSpace(this.defaultSenderFrom)) { await this.InitManager(); } if (string.IsNullOrEmpty(smsSendData.From)) { smsSendData.From = this.defaultSenderFrom; } ctx.SendRequest = smsSendData; // validation mobilephone // Send ctx.SendResponse = await this.wrapper.SmsBatchesPut(this.defaultServiceName, smsSendData); ctx.SmsModel = ctx.SendResponse; // mise en cache pour suivis SmsCache.Add(ctx); return(ctx); } catch (Exception ex) { throw new Exception("SendSms " + ex.Message, ex); } }
/// <summary> /// [POST] "/sms/{serviceName}/batches" sms.Batch--serviceName, /// SEND SMS /// </summary> /// <param name="serviceName"></param> /// <param name="smsBatchParams"></param> /// <returns></returns> public async Task <SMS.SmsBatch> SmsBatchesPut(string serviceName, SmsBatchParams smsBatchParams) => await OvhApiTools.ExecuteWithModelAsync <SMS.SmsBatch>(this.client, this.Credentials, HttpMethod.Post, $"sms/{serviceName}/batches", null, smsBatchParams);