twilio / twilio-csharp

Twilio C#/.NET Helper Library for .NET6+.
MIT License
676 stars 301 forks source link

Date range options removed from ReadCallOptions and ReadMessageOptions in v 7.0.0 #740

Closed ScottMB closed 8 months ago

ScottMB commented 8 months ago

Issue Summary

There are some breaking changes in version 7.X.X related to the date options in ReadCallOptions and ReadMessageOptions and I cannot find a work around in our implementation of this library.

The merge commit in which the change was introduced: https://github.com/twilio/twilio-csharp/pull/728/files?file-filters%5B%5D=.cs&show-viewed-files=true#top

File: src/Twilio/Rest/Api/V2010/Account/CallOptions.cs Class: Twilio.Rest.Api.V2010.Account.ReadCallOptions Removed the properties: StartTimeBefore, StartTimeAfter, EndTimeBefore and EndTimeAfter

File: src/Twilio/Rest/Api/V2010/Account/MessageOptions.cs Class: Twilio.Rest.Api.V2010.Account.ReadMessageOptions Removed the properties: DateSentBefore and DateSentAfter

This update removed the ability to do date range searches in calls to CallResource.Read() and MessageResource.Read(). The comments for the remaining properties (StartTime, EndTime, and DateSent) imply that this functionality still exists with verbiage like:

"You can also specify an inequality, such as EndTime<=YYYY-MM-DD, to read calls that ended on or before midnight of this date, and EndTime>=YYYY-MM-DD to read calls that ended on or after midnight of this date."

However, this isn't possible given the current structure as the remaining properties all have DateTime? type, so a range qualifier like ">=" will not compile.

Can we have these range properties added back (as well as the proper param building back to the GetParams() method)?

Steps to Reproduce

NA

Code Snippet

Example use case:

DateTime dateSentAfter = DateTime.Now.AddHours(-24);
ReadMessageOptions readMessageOptions = new ReadMessageOptions();
readMessageOptions.DateSentAfter = dateSentAfter;
var messages = MessageResource.Read(readMessageOptions);

Exception/Log

'ReadMessageOptions' does not contain a definition for 'DateSentAfter' and no accessible extension method 'DateSentAfter' accepting a first argument of type 'ReadMessageOptions' could be found (are you missing a using directive or an assembly reference?)

Technical details:

sbansla commented 8 months ago

This has been fixed in latest twilio-csharp(7.0.2) https://www.nuget.org/packages/Twilio/7.0.2