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: LS-613: Add URLShortener parameters in message resource creation #607

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
twilio-csharp Changelog
=======================

[2022-05-09] Version 99.99.99
-----------------------------
**Api**
- Add property `media_url` to the recording resources


[2022-05-04] Version 5.75.0
---------------------------
**Library - Chore**
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

internal class AssemblyInfomation
{
public const string AssemblyInformationalVersion = "5.75.0";
public const string AssemblyInformationalVersion = "99.99.99";
}
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
5 changes: 5 additions & 0 deletions src/Twilio/Rest/Api/V2010/Account/RecordingResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@ public static RecordingResource FromJson(string json)
/// </summary>
[JsonProperty("subresource_uris")]
public Dictionary<string, string> SubresourceUris { get; private set; }
/// <summary>
/// The URL of the media file.
/// </summary>
[JsonProperty("media_url")]
public Uri MediaUrl { get; private set; }

private RecordingResource()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Twilio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Copyright>Copyright © Twilio</Copyright>
<AssemblyTitle>Twilio</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>5.75.0</VersionPrefix>
<VersionPrefix>99.99.99</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<Authors>Twilio</Authors>
Expand Down
Loading