Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use IEnumerable<T> instead of List<T> for TwiML enums #671

Merged
merged 2 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Twilio/Converters/Promoter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ namespace Twilio.Converters
/// <summary>
/// Promote objects
/// </summary>
[Obsolete]
public class Promoter
{
/// <summary>
/// Convert a string URL to a Uri object
/// </summary>
/// <param name="url">URL to convert</param>
/// <returns>Converted Uri</returns>
[Obsolete]
public static Uri UriFromString(string url)
{
return new Uri(url);
Expand All @@ -23,6 +25,7 @@ public static Uri UriFromString(string url)
/// </summary>
/// <param name="one">single entry to promote</param>
/// <returns>List of the single object</returns>
[Obsolete]
public static List<T> ListOfOne<T>(T one)
{
return new List<T> {one};
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/Voice/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static implicit operator EventEnum(string value)
/// <summary>
/// Events to trigger status callback
/// </summary>
public List<Application.EventEnum> StatusCallbackEvent { get; set; }
public IEnumerable<Application.EventEnum> StatusCallbackEvent { get; set; }
/// <summary>
/// Status Callback URL
/// </summary>
Expand Down Expand Up @@ -83,7 +83,7 @@ public static implicit operator EventEnum(string value)
public Application(string applicationSid = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Application.EventEnum> statusCallbackEvent = null,
IEnumerable<Application.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
string customerId = null,
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/Voice/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static implicit operator EventEnum(string value)
/// <summary>
/// Events to trigger status callback
/// </summary>
public List<Client.EventEnum> StatusCallbackEvent { get; set; }
public IEnumerable<Client.EventEnum> StatusCallbackEvent { get; set; }
/// <summary>
/// Status Callback URL
/// </summary>
Expand All @@ -72,7 +72,7 @@ public static implicit operator EventEnum(string value)
public Client(string identity = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Client.EventEnum> statusCallbackEvent = null,
IEnumerable<Client.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null) : base("Client")
{
Expand Down
8 changes: 4 additions & 4 deletions src/Twilio/TwiML/Voice/Conference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static implicit operator JitterBufferSizeEnum(string value)
/// <summary>
/// Events to call status callback URL
/// </summary>
public List<Conference.EventEnum> StatusCallbackEvent { get; set; }
public IEnumerable<Conference.EventEnum> StatusCallbackEvent { get; set; }
/// <summary>
/// Status callback URL
/// </summary>
Expand All @@ -199,7 +199,7 @@ public static implicit operator JitterBufferSizeEnum(string value)
/// <summary>
/// Recording status callback events
/// </summary>
public List<Conference.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
public IEnumerable<Conference.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
/// <summary>
/// Event callback URL
/// </summary>
Expand Down Expand Up @@ -249,12 +249,12 @@ public Conference(string name = null,
Conference.RegionEnum region = null,
string coach = null,
Conference.TrimEnum trim = null,
List<Conference.EventEnum> statusCallbackEvent = null,
IEnumerable<Conference.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
Uri recordingStatusCallback = null,
Twilio.Http.HttpMethod recordingStatusCallbackMethod = null,
List<Conference.RecordingEventEnum> recordingStatusCallbackEvent = null,
IEnumerable<Conference.RecordingEventEnum> recordingStatusCallbackEvent = null,
Uri eventCallbackUrl = null,
Conference.JitterBufferSizeEnum jitterBufferSize = null,
string participantLabel = null) : base("Conference")
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/Voice/Connect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ public Connect Conversation(string serviceInstanceSid = null,
Conversation.TrimEnum trim = null,
Uri recordingStatusCallback = null,
Twilio.Http.HttpMethod recordingStatusCallbackMethod = null,
List<Conversation.RecordingEventEnum> recordingStatusCallbackEvent = null,
IEnumerable<Conversation.RecordingEventEnum> recordingStatusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
List<Conversation.EventEnum> statusCallbackEvent = null)
IEnumerable<Conversation.EventEnum> statusCallbackEvent = null)
{
var newChild = new Conversation(
serviceInstanceSid,
Expand Down
8 changes: 4 additions & 4 deletions src/Twilio/TwiML/Voice/Conversation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static implicit operator EventEnum(string value)
/// <summary>
/// Recording status callback events
/// </summary>
public List<Conversation.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
public IEnumerable<Conversation.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
/// <summary>
/// Status callback URL
/// </summary>
Expand All @@ -135,7 +135,7 @@ public static implicit operator EventEnum(string value)
/// <summary>
/// Events to call status callback URL
/// </summary>
public List<Conversation.EventEnum> StatusCallbackEvent { get; set; }
public IEnumerable<Conversation.EventEnum> StatusCallbackEvent { get; set; }

/// <summary>
/// Create a new Conversation
Expand Down Expand Up @@ -164,10 +164,10 @@ public Conversation(string serviceInstanceSid = null,
Conversation.TrimEnum trim = null,
Uri recordingStatusCallback = null,
Twilio.Http.HttpMethod recordingStatusCallbackMethod = null,
List<Conversation.RecordingEventEnum> recordingStatusCallbackEvent = null,
IEnumerable<Conversation.RecordingEventEnum> recordingStatusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
List<Conversation.EventEnum> statusCallbackEvent = null) : base("Conversation")
IEnumerable<Conversation.EventEnum> statusCallbackEvent = null) : base("Conversation")
{
this.ServiceInstanceSid = serviceInstanceSid;
this.InboundAutocreation = inboundAutocreation;
Expand Down
16 changes: 8 additions & 8 deletions src/Twilio/TwiML/Voice/Dial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static implicit operator RecordingTrackEnum(string value)
/// <summary>
/// Recording status callback events
/// </summary>
public List<Dial.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
public IEnumerable<Dial.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
/// <summary>
/// Preserve the ringing behavior of the inbound call until the Dialed call picks up
/// </summary>
Expand Down Expand Up @@ -236,7 +236,7 @@ public Dial(string number = null,
Dial.TrimEnum trim = null,
Uri recordingStatusCallback = null,
Twilio.Http.HttpMethod recordingStatusCallbackMethod = null,
List<Dial.RecordingEventEnum> recordingStatusCallbackEvent = null,
IEnumerable<Dial.RecordingEventEnum> recordingStatusCallbackEvent = null,
bool? answerOnBridge = null,
Dial.RingToneEnum ringTone = null,
Dial.RecordingTrackEnum recordingTrack = null,
Expand Down Expand Up @@ -361,7 +361,7 @@ protected override List<XAttribute> GetElementAttributes()
public Dial Client(string identity = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Client.EventEnum> statusCallbackEvent = null,
IEnumerable<Client.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null)
{
Expand Down Expand Up @@ -424,12 +424,12 @@ public Dial Conference(string name = null,
Conference.RegionEnum region = null,
string coach = null,
Conference.TrimEnum trim = null,
List<Conference.EventEnum> statusCallbackEvent = null,
IEnumerable<Conference.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
Uri recordingStatusCallback = null,
Twilio.Http.HttpMethod recordingStatusCallbackMethod = null,
List<Conference.RecordingEventEnum> recordingStatusCallbackEvent = null,
IEnumerable<Conference.RecordingEventEnum> recordingStatusCallbackEvent = null,
Uri eventCallbackUrl = null,
Conference.JitterBufferSizeEnum jitterBufferSize = null,
string participantLabel = null)
Expand Down Expand Up @@ -495,7 +495,7 @@ public Dial Number(Types.PhoneNumber phoneNumber = null,
string sendDigits = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Number.EventEnum> statusCallbackEvent = null,
IEnumerable<Number.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
string byoc = null,
Expand Down Expand Up @@ -615,7 +615,7 @@ public Dial Sip(Uri sipUrl = null,
string password = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Sip.EventEnum> statusCallbackEvent = null,
IEnumerable<Sip.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
string machineDetection = null,
Expand Down Expand Up @@ -673,7 +673,7 @@ public Dial Sip(Sip sip)
public Dial Application(string applicationSid = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Application.EventEnum> statusCallbackEvent = null,
IEnumerable<Application.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
string customerId = null,
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/Voice/Gather.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public static implicit operator SpeechModelEnum(string value)
/// <summary>
/// Input type Twilio should accept
/// </summary>
public List<Gather.InputEnum> Input { get; set; }
public IEnumerable<Gather.InputEnum> Input { get; set; }
/// <summary>
/// Action URL
/// </summary>
Expand Down Expand Up @@ -285,7 +285,7 @@ public static implicit operator SpeechModelEnum(string value)
/// <param name="actionOnEmptyResult"> Force webhook to the action URL event if there is no input </param>
/// <param name="speechModel"> Specify the model that is best suited for your use case </param>
/// <param name="enhanced"> Use enhanced speech model </param>
public Gather(List<Gather.InputEnum> input = null,
public Gather(IEnumerable<Gather.InputEnum> input = null,
Uri action = null,
Twilio.Http.HttpMethod method = null,
int? timeout = null,
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/Voice/Number.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static implicit operator EventEnum(string value)
/// <summary>
/// Events to call status callback
/// </summary>
public List<Number.EventEnum> StatusCallbackEvent { get; set; }
public IEnumerable<Number.EventEnum> StatusCallbackEvent { get; set; }
/// <summary>
/// Status callback URL
/// </summary>
Expand Down Expand Up @@ -119,7 +119,7 @@ public Number(Types.PhoneNumber phoneNumber = null,
string sendDigits = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Number.EventEnum> statusCallbackEvent = null,
IEnumerable<Number.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
string byoc = null,
Expand Down
10 changes: 5 additions & 5 deletions src/Twilio/TwiML/Voice/Pay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public static implicit operator PaymentMethodEnum(string value)
/// <summary>
/// Comma separated accepted card types
/// </summary>
public List<Pay.ValidCardTypesEnum> ValidCardTypes { get; set; }
public IEnumerable<Pay.ValidCardTypesEnum> ValidCardTypes { get; set; }
/// <summary>
/// Language to use
/// </summary>
Expand Down Expand Up @@ -244,7 +244,7 @@ public Pay(Pay.InputEnum input = null,
string chargeAmount = null,
string currency = null,
string description = null,
List<Pay.ValidCardTypesEnum> validCardTypes = null,
IEnumerable<Pay.ValidCardTypesEnum> validCardTypes = null,
Pay.LanguageEnum language = null) : base("Pay")
{
this.Input = input;
Expand Down Expand Up @@ -358,9 +358,9 @@ protected override List<XAttribute> GetElementAttributes()
/// <param name="requireMatchingInputs"> Require customer to input requested information twice and verify matching.
/// </param>
public Pay Prompt(Prompt.ForEnum for_ = null,
List<Prompt.ErrorTypeEnum> errorType = null,
List<Prompt.CardTypeEnum> cardType = null,
List<int> attempt = null,
IEnumerable<Prompt.ErrorTypeEnum> errorType = null,
IEnumerable<Prompt.CardTypeEnum> cardType = null,
IEnumerable<int> attempt = null,
bool? requireMatchingInputs = null)
{
var newChild = new Prompt(for_, errorType, cardType, attempt, requireMatchingInputs);
Expand Down
12 changes: 6 additions & 6 deletions src/Twilio/TwiML/Voice/Prompt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ public static implicit operator CardTypeEnum(string value)
/// <summary>
/// Type of error
/// </summary>
public List<Prompt.ErrorTypeEnum> ErrorType { get; set; }
public IEnumerable<Prompt.ErrorTypeEnum> ErrorType { get; set; }
/// <summary>
/// Type of the credit card
/// </summary>
public List<Prompt.CardTypeEnum> CardType { get; set; }
public IEnumerable<Prompt.CardTypeEnum> CardType { get; set; }
/// <summary>
/// Current attempt count
/// </summary>
public List<int> Attempt { get; set; }
public IEnumerable<int> Attempt { get; set; }
/// <summary>
/// Require customer to input requested information twice and verify matching.
/// </summary>
Expand All @@ -107,9 +107,9 @@ public static implicit operator CardTypeEnum(string value)
/// <param name="requireMatchingInputs"> Require customer to input requested information twice and verify matching.
/// </param>
public Prompt(Prompt.ForEnum for_ = null,
List<Prompt.ErrorTypeEnum> errorType = null,
List<Prompt.CardTypeEnum> cardType = null,
List<int> attempt = null,
IEnumerable<Prompt.ErrorTypeEnum> errorType = null,
IEnumerable<Prompt.CardTypeEnum> cardType = null,
IEnumerable<int> attempt = null,
bool? requireMatchingInputs = null) : base("Prompt")
{
this.For_ = for_;
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/Voice/Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static implicit operator RecordingEventEnum(string value)
/// <summary>
/// Recording status callback events
/// </summary>
public List<Record.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
public IEnumerable<Record.RecordingEventEnum> RecordingStatusCallbackEvent { get; set; }
/// <summary>
/// Transcribe the recording
/// </summary>
Expand Down Expand Up @@ -120,7 +120,7 @@ public Record(Uri action = null,
Record.TrimEnum trim = null,
Uri recordingStatusCallback = null,
Twilio.Http.HttpMethod recordingStatusCallbackMethod = null,
List<Record.RecordingEventEnum> recordingStatusCallbackEvent = null,
IEnumerable<Record.RecordingEventEnum> recordingStatusCallbackEvent = null,
bool? transcribe = null,
Uri transcribeCallback = null) : base("Record")
{
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/Voice/Sip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static implicit operator EventEnum(string value)
/// <summary>
/// Status callback events
/// </summary>
public List<Sip.EventEnum> StatusCallbackEvent { get; set; }
public IEnumerable<Sip.EventEnum> StatusCallbackEvent { get; set; }
/// <summary>
/// Status callback URL
/// </summary>
Expand Down Expand Up @@ -120,7 +120,7 @@ public Sip(Uri sipUrl = null,
string password = null,
Uri url = null,
Twilio.Http.HttpMethod method = null,
List<Sip.EventEnum> statusCallbackEvent = null,
IEnumerable<Sip.EventEnum> statusCallbackEvent = null,
Uri statusCallback = null,
Twilio.Http.HttpMethod statusCallbackMethod = null,
string machineDetection = null,
Expand Down
Loading