8000 feat: LS-613: Add URLShortener parameters in message resource creation by Gravellent · Pull Request #607 · twilio/twilio-csharp · GitHub
[go: up one dir, main page]

Skip to content

feat: LS-613: Add URLShortener parameters in message resour 8000 ce creation #607

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
add url shortening capabilities"
  • Loading branch information
twilio-dx committed May 12, 2022
commit 6a79368f24dcf44e25c31206d5cb466408c5183d
12 changes: 12 additions & 0 deletions src/Twilio/Rest/Api/V2010/Account/MessageOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public class CreateMessageOptions : IOptions<MessageResource>
/// </summary>
public bool? SendAsMms { get; set; }

public bool? ShortenUrls { get; set; }

public string DomainSid { get; set; }

/// <summary>
/// Construct a new CreateMessageOptions
/// </summary>
Expand Down Expand Up @@ -209,6 +213,14 @@ public List<KeyValuePair<string, string>> GetParams()
{
p.Add(new KeyValuePair<string, string>("SendAsMms", SendAsMms.Value.ToString().ToLower()));
}
if (ShortenUrls != null)
{
p.Add(new KeyValuePair<string, string>("ShortenUrls", ShortenUrls.Value.ToString().ToLower()));
}
if (DomainSid != null)
{
p.Add(new KeyValuePair<string, string>("DomainSid", DomainSid.ToString()));
}

return p;
}
Expand Down
16 changes: 12 additions & 4 deletions src/Twilio/Rest/Api/V2010/Account/MessageResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public static async System.Threading.Tasks.Task<MessageResource> CreateAsync(Cre
/// <param name="sendAsMms"> If set to True, Twilio will deliver the message as a single MMS message, regardless of the
/// presence of media. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <param name="shortenUrls"> Whether or not shorten URL in message </param>
/// <param name="domainSid"> The domain used for shorten URL </param>
/// <returns> A single instance of Message </returns>
public static MessageResource Create(Types.PhoneNumber to,
string pathAccountSid = null,
Expand All @@ -210,9 +212,11 @@ public static MessageResource Create(Types.PhoneNumber to,
MessageResource.ScheduleTypeEnum scheduleType = null,
DateTime? sendAt = null,
bool? sendAsMms = null,
ITwilioRestClient client = null)
ITwilioRestClient client = null,
bool? shortenUrls = null,
string domainSid = null)
{
var options = new CreateMessageOptions(to){PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, Attempt = attempt, ValidityPeriod = validityPeriod, ForceDelivery = forceDelivery, ContentRetention = contentRetention, AddressRetention = addressRetention, SmartEncoded = smartEncoded, PersistentAction = persistentAction, ScheduleType = scheduleType, SendAt = sendAt, SendAsMms = sendAsMms};
var options = new CreateMessageOptions(to){PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, Attempt = attempt, ValidityPeriod = validityPeriod, ForceDelivery = forceDelivery, ContentRetention = contentRetention, AddressRetention = addressRetention, SmartEncoded = smartEncoded, PersistentAction = persistentAction, ScheduleType = scheduleType, SendAt = sendAt, SendAsMms = sendAsMms, ShortenUrls = shortenUrls, DomainSid = domainSid};
return Create(options, client);
}

Expand Down Expand Up @@ -246,6 +250,8 @@ public static MessageResource Create(Types.PhoneNumber to,
/// <param name="sendAsMms"> If set to True, Twilio will deliver the message as a single MMS message, regardless of the
/// presence of media. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <param name="shortenUrls"> Whether or not shorten URL in message </param>
/// <param name="domainSid"> The domain used for shorten URL </param>
/// <returns> Task that resolves to A single instance of Message </returns>
public static async System.Threading.Tasks.Task<MessageResource> CreateAsync(Types.PhoneNumber to,
string pathAccountSid = null,
Expand All @@ -267,9 +273,11 @@ public static async System.Threading.Tasks.Task<MessageResource> CreateAsync(Typ
MessageResource.ScheduleTypeEnum scheduleType = null,
DateTime? sendAt = null,
bool? sendAsMms = null,
ITwilioRestClient client = null)
ITwilioRestClient client = null,
bool? shortenUrls = null,
string domainSid = null)
{
var options = new CreateMessageOptions(to){PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, Attempt = attempt, ValidityPeriod = validityPeriod, ForceDelivery = forceDelivery, ContentRetention = contentRetention, AddressRetention = addressRetention, SmartEncoded = smartEncoded, PersistentAction = persistentAction, ScheduleType = scheduleType, SendAt = sendAt, SendAsMms = sendAsMms};
var options = new CreateMessageOptions(to){PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, Attempt = attempt, ValidityPeriod = validityPeriod, ForceDelivery = forceDelivery, ContentRetention = contentRetention, AddressRetention = addressRetention, SmartEncoded = smartEncoded, PersistentAction = persistentAction, ScheduleType = scheduleType, SendAt = sendAt, SendAsMms = sendAsMms, ShortenUrls = shortenUrls, DomainSid = domainSid};
return await CreateAsync(options, client);
}
#endif
Expand Down
0