/// <summary> /// Receive SMS messages wich satisfiy criteria. Make GET request /// </summary> /// <param name="smsMessageOptions">Sms message options for narrowing search</param> /// <returns></returns> public async Task<SmsMessageResult> GetSmsMessages(SmsMessageListOptions smsMessageOptions) { var request = new RestRequest(); request.Resource = RequestUri.GetSmsMessagesUri; CreateSmsMessageListOptions(smsMessageOptions, request); return await Execute<SmsMessageResult>(request); }
/// <summary> /// Helper Method to populate RestRequest params /// </summary> /// <param name="smsMessageOptions">Sms message options</param> /// <param name="request">Rest request</param> private void CreateSmsMessageListOptions(SmsMessageListOptions smsMessageOptions, RestRequest request) { var dateSentParameterName = GetParameterNameWithEquality(smsMessageOptions.DateSentComparison, "DateSent"); if (smsMessageOptions.To != null) request.AddParameter("To", smsMessageOptions.To); if (smsMessageOptions.From != null) request.AddParameter("From", smsMessageOptions.From); if (smsMessageOptions.DateSent.HasValue) request.AddParameter(dateSentParameterName, smsMessageOptions.DateSent.Value.ToString("yyyy-MM-dd")); if (smsMessageOptions.Page.HasValue) request.AddParameter("Page", smsMessageOptions.Page.Value); if (smsMessageOptions.PageSize.HasValue) request.AddParameter("PageSize", smsMessageOptions.PageSize.Value); }