Skip to content

Commit aaabf89

Browse files
authored
Merge pull request #141 from Swimburger/niels/upgrade-versions
Update dependencies and target frameworks
2 parents 4aa77cc + b5cbe3d commit aaabf89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1431
-1483
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ bool IsValidTwilioRequest(HttpContext httpContext)
552552
?.Value ?? throw new Exception("TwilioRequestValidationOptions missing.");
553553

554554
string? urlOverride = null;
555-
if (options.BaseUrlOverride != null)
555+
if (options.BaseUrlOverride is not null)
556556
{
557557
var request = httpContext.Request;
558558
urlOverride = $"{options.BaseUrlOverride.TrimEnd('/')}{request.Path}{request.QueryString}";

build.ps1

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env pwsh
12
$originalLocation = Get-Location
23

34
function Remove-EntirePath() {
+40-40
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
namespace Twilio.AspNet.Common
1+
namespace Twilio.AspNet.Common;
2+
3+
/// <summary>
4+
/// This class can be used as the parameter on your SMS action. Incoming parameters will be bound here.
5+
/// </summary>
6+
/// <remarks>https://www.twilio.com/docs/messaging/guides/webhook-request</remarks>
7+
public class SmsRequest : TwilioRequest
28
{
39
/// <summary>
4-
/// This class can be used as the parameter on your SMS action. Incoming parameters will be bound here.
10+
/// A 34 character unique identifier for the message. May be used to later retrieve this message from the REST API.
511
/// </summary>
6-
/// <remarks>https://www.twilio.com/docs/messaging/guides/webhook-request</remarks>
7-
public class SmsRequest : TwilioRequest
8-
{
9-
/// <summary>
10-
/// A 34 character unique identifier for the message. May be used to later retrieve this message from the REST API.
11-
/// </summary>
12-
public string MessageSid { get; set; }
13-
14-
/// <summary>
15-
/// Same value as MessageSid. Deprecated and included for backward compatibility.
16-
/// </summary>
17-
public string SmsSid { get; set; }
12+
public string MessageSid { get; set; } = null!;
13+
14+
/// <summary>
15+
/// Same value as MessageSid. Deprecated and included for backward compatibility.
16+
/// </summary>
17+
[Obsolete("Use MessageSid instead")]
18+
public string SmsSid { get; set; }= null!;
1819

19-
/// <summary>
20-
/// The text body of the SMS message. Up to 160 characters long
21-
/// </summary>
22-
public string Body { get; set; }
20+
/// <summary>
21+
/// The text body of the SMS message. Up to 160 characters long
22+
/// </summary>
23+
public string Body { get; set; }= null!;
2324

24-
/// <summary>
25-
/// The status of the message
26-
/// </summary>
27-
public string MessageStatus { get; set; }
25+
/// <summary>
26+
/// The status of the message
27+
/// </summary>
28+
public string MessageStatus { get; set; }= null!;
2829

29-
/// <summary>
30-
/// The message OptOut type
31-
/// </summary>
32-
public string OptOutType { get; set; }
30+
/// <summary>
31+
/// The message OptOut type
32+
/// </summary>
33+
public string? OptOutType { get; set; }
3334

34-
/// <summary>
35-
/// A unique identifier of the messaging service
36-
/// </summary>
37-
public string MessagingServiceSid { get; set; }
35+
/// <summary>
36+
/// A unique identifier of the messaging service
37+
/// </summary>
38+
public string? MessagingServiceSid { get; set; }
3839

39-
/// <summary>
40-
/// The number of media items associated with your message
41-
/// </summary>
42-
public int NumMedia { get; set; }
40+
/// <summary>
41+
/// The number of media items associated with your message
42+
/// </summary>
43+
public int NumMedia { get; set; }
4344

44-
/// <summary>
45-
/// The number of media items associated with a "Click to WhatsApp" advertisement.
46-
/// </summary>
47-
public int ReferralNumMedia { get; set; }
48-
}
49-
}
45+
/// <summary>
46+
/// The number of media items associated with a "Click to WhatsApp" advertisement.
47+
/// </summary>
48+
public int ReferralNumMedia { get; set; }
49+
}
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
1-
namespace Twilio.AspNet.Common
1+
namespace Twilio.AspNet.Common;
2+
3+
public class SmsStatusCallbackRequest: SmsRequest
24
{
3-
public class SmsStatusCallbackRequest: SmsRequest
4-
{
5-
/// <summary>
6-
/// The error code (if any) associated with your message. If your message
7-
/// status is failed or undelivered, the ErrorCode can give you more information
8-
/// about the failure. If the message was delivered successfully, no ErrorCode
9-
/// will be present. Find the possible values here:
10-
/// https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors
11-
/// </summary>
12-
public string ErrorCode { get; set; }
5+
/// <summary>
6+
/// The error code (if any) associated with your message. If your message
7+
/// status is failed or undelivered, the ErrorCode can give you more information
8+
/// about the failure. If the message was delivered successfully, no ErrorCode
9+
/// will be present. Find the possible values here:
10+
/// https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors
11+
/// </summary>
12+
public string? ErrorCode { get; set; }
1313

14-
/// <summary>
15-
/// The Installed Channel SID (found on the Channel detail page) that was
16-
/// used to send this message. Only present if the message was sent using a
17-
/// Channel.
18-
/// </summary>
19-
public string ChannelInstallSid { get; set; }
14+
/// <summary>
15+
/// The Installed Channel SID (found on the Channel detail page) that was
16+
/// used to send this message. Only present if the message was sent using a
17+
/// Channel.
18+
/// </summary>
19+
public string? ChannelInstallSid { get; set; }
2020

21-
/// <summary>
22-
/// The Error message returned by the underlying Channel if Message delivery
23-
/// failed. Only present if the message was sent using a Channel and message
24-
/// delivery failed.
25-
/// </summary>
26-
public string ChannelStatusMessage { get; set; }
21+
/// <summary>
22+
/// The Error message returned by the underlying Channel if Message delivery
23+
/// failed. Only present if the message was sent using a Channel and message
24+
/// delivery failed.
25+
/// </summary>
26+
public string? ChannelStatusMessage { get; set; }
2727

28-
/// <summary>
29-
/// Channel specific prefix that allows you to identify which channel this
30-
/// message was sent over.
31-
/// </summary>
32-
public string ChannelPrefix { get; set; }
28+
/// <summary>
29+
/// Channel specific prefix that allows you to identify which channel this
30+
/// message was sent over.
31+
/// </summary>
32+
public string? ChannelPrefix { get; set; }
3333

34-
/// <summary>
35-
/// Contains post-delivery events. If the Channel supports Read receipts, this
36-
/// parameter will be included with a value of READ after the user has read
37-
/// the message. Currently supported only for WhatsApp.
38-
/// </summary>
39-
public string EventType { get; set; }
40-
}
34+
/// <summary>
35+
/// Contains post-delivery events. If the Channel supports Read receipts, this
36+
/// parameter will be included with a value of READ after the user has read
37+
/// the message. Currently supported only for WhatsApp.
38+
/// </summary>
39+
public string? EventType { get; set; }
4140
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
namespace Twilio.AspNet.Common
1+
namespace Twilio.AspNet.Common;
2+
3+
/// <summary>
4+
/// This class can be used as the parameter on your StatusCallback action. Incoming parameters will be bound here.
5+
/// </summary>
6+
/// <remarks>https://www.twilio.com/docs/voice/twiml#ending-the-call-callback-requests</remarks>
7+
public class StatusCallbackRequest : VoiceRequest
28
{
39
/// <summary>
4-
/// This class can be used as the parameter on your StatusCallback action. Incoming parameters will be bound here.
10+
/// The duration in seconds of the just-completed call.
511
/// </summary>
6-
/// <remarks>https://www.twilio.com/docs/voice/twiml#ending-the-call-callback-requests</remarks>
7-
public class StatusCallbackRequest : VoiceRequest
8-
{
9-
/// <summary>
10-
/// The duration in seconds of the just-completed call.
11-
/// </summary>
12-
public float CallDuration { get; set; }
12+
public float CallDuration { get; set; }
1313

14-
public string Called { get; set; }
15-
public string Caller { get; set; }
16-
public float Duration { get; set; }
17-
}
18-
}
14+
public string? Called { get; set; }
15+
public string? Caller { get; set; }
16+
public float Duration { get; set; }
17+
}

src/Twilio.AspNet.Common/Twilio.AspNet.Common.csproj

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>netstandard2.0</TargetFramework>
4+
<LangVersion>13</LangVersion>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
47
<OutputType>Library</OutputType>
58
<Version>0.0.0-alpha</Version>
69
<PackageId>Twilio.AspNet.Common</PackageId>
@@ -9,11 +12,12 @@
912
<Description>Twilio request classes for handling Twilio webhooks.</Description>
1013
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1114
<PackageReleaseNotes>Refer to the changelog at https://github.com/twilio-labs/twilio-aspnet/blob/main/CHANGELOG.md</PackageReleaseNotes>
12-
<Copyright>Copyright 2022 (c) Twilio, Inc. All rights reserved.</Copyright>
15+
<Copyright>Copyright 2024 (c) Twilio, Inc. All rights reserved.</Copyright>
1316
<PackageTags>twilio;twiml;sms;voice;telephony;phone;aspnet</PackageTags>
1417
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1518
<PackageProjectUrl>https://github.com/twilio/twilio-aspnet</PackageProjectUrl>
1619
<RepositoryUrl>https://github.com/twilio-labs/twilio-aspnet.git</RepositoryUrl>
20+
<RepositoryType>git</RepositoryType>
1721
<PackageIconUrl>https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/twilio-icon-64x64.png</PackageIconUrl>
1822
<PackageIcon>icon.png</PackageIcon>
1923
<PackageReadmeFile>README.md</PackageReadmeFile>
@@ -30,7 +34,11 @@
3034
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
3135
</ItemGroup>
3236
<ItemGroup>
33-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
37+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
38+
<PrivateAssets>all</PrivateAssets>
39+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
40+
</PackageReference>
41+
<PackageReference Include="PolySharp" Version="1.15.0">
3442
<PrivateAssets>all</PrivateAssets>
3543
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3644
</PackageReference>
+56-57
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,68 @@
1-
namespace Twilio.AspNet.Common
2-
{
1+
namespace Twilio.AspNet.Common;
2+
3+
/// <summary>
4+
/// Base class for mapping incoming request parameters into a strongly typed object
5+
/// </summary>
6+
public abstract class TwilioRequest
7+
{
38
/// <summary>
4-
/// Base class for mapping incoming request parameters into a strongly typed object
9+
/// Your Twilio account id. It is 34 characters long, and always starts with the letters AC
510
/// </summary>
6-
public abstract class TwilioRequest
7-
{
8-
/// <summary>
9-
/// Your Twilio account id. It is 34 characters long, and always starts with the letters AC
10-
/// </summary>
11-
public string AccountSid { get; set; }
11+
public string AccountSid { get; set; } = null!;
1212

13-
/// <summary>
14-
/// The phone number or client identifier of the party that initiated the call
15-
/// </summary>
16-
/// <remarks>
17-
/// Phone numbers are formatted with a '+' and country code, e.g. +16175551212 (E.164 format). Client identifiers begin with the client: URI scheme; for example, for a call from a client named 'tommy', the From parameter will be client:tommy.
18-
/// </remarks>
19-
public string From { get; set; }
13+
/// <summary>
14+
/// The phone number or client identifier of the party that initiated the call
15+
/// </summary>
16+
/// <remarks>
17+
/// Phone numbers are formatted with a '+' and country code, e.g. +16175551212 (E.164 format). Client identifiers begin with the client: URI scheme; for example, for a call from a client named 'tommy', the From parameter will be client:tommy.
18+
/// </remarks>
19+
public string From { get; set; } = null!;
2020

21-
/// <summary>
22-
/// The phone number or client identifier of the called party
23-
/// </summary>
24-
/// <remarks>
25-
/// Phone numbers are formatted with a '+' and country code, e.g. +16175551212 (E.164 format). Client identifiers begin with the client: URI scheme; for example, for a call to a client named 'jenny', the To parameter will be client:jenny.
26-
/// </remarks>
27-
public string To { get; set; }
21+
/// <summary>
22+
/// The phone number or client identifier of the called party
23+
/// </summary>
24+
/// <remarks>
25+
/// Phone numbers are formatted with a '+' and country code, e.g. +16175551212 (E.164 format). Client identifiers begin with the client: URI scheme; for example, for a call to a client named 'jenny', the To parameter will be client:jenny.
26+
/// </remarks>
27+
public string To { get; set; } = null!;
2828

29-
/// <summary>
30-
/// The city of the caller
31-
/// </summary>
32-
public string FromCity { get; set; }
29+
/// <summary>
30+
/// The city of the caller
31+
/// </summary>
32+
public string? FromCity { get; set; }
3333

34-
/// <summary>
35-
/// The state or province of the caller
36-
/// </summary>
37-
public string FromState { get; set; }
34+
/// <summary>
35+
/// The state or province of the caller
36+
/// </summary>
37+
public string? FromState { get; set; }
3838

39-
/// <summary>
40-
/// The postal code of the caller
41-
/// </summary>
42-
public string FromZip { get; set; }
39+
/// <summary>
40+
/// The postal code of the caller
41+
/// </summary>
42+
public string? FromZip { get; set; }
4343

44-
/// <summary>
45-
/// The country of the caller
46-
/// </summary>
47-
public string FromCountry { get; set; }
44+
/// <summary>
45+
/// The country of the caller
46+
/// </summary>
47+
public string? FromCountry { get; set; }
4848

49-
/// <summary>
50-
/// The city of the called party
51-
/// </summary>
52-
public string ToCity { get; set; }
49+
/// <summary>
50+
/// The city of the called party
51+
/// </summary>
52+
public string? ToCity { get; set; }
5353

54-
/// <summary>
55-
/// The state or province of the called party
56-
/// </summary>
57-
public string ToState { get; set; }
54+
/// <summary>
55+
/// The state or province of the called party
56+
/// </summary>
57+
public string? ToState { get; set; }
5858

59-
/// <summary>
60-
/// The postal code of the called party
61-
/// </summary>
62-
public string ToZip { get; set; }
59+
/// <summary>
60+
/// The postal code of the called party
61+
/// </summary>
62+
public string? ToZip { get; set; }
6363

64-
/// <summary>
65-
/// The country of the called party
66-
/// </summary>
67-
public string ToCountry { get; set; }
68-
}
69-
}
64+
/// <summary>
65+
/// The country of the called party
66+
/// </summary>
67+
public string? ToCountry { get; set; }
68+
}

0 commit comments

Comments
 (0)