Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
AJLange authored Dec 5, 2024
2 parents 1d81672 + 9eeff30 commit b43d31b
Show file tree
Hide file tree
Showing 52 changed files with 1,499 additions and 1,547 deletions.
69 changes: 26 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
default: 0.0.0-alpha
required: false
type: string

push:
branches: [ "main" ]
paths:
Expand All @@ -30,25 +30,24 @@ on:
description: 'The version of the library to use when compiling and packaging.'
required: true

env:
env:
CI: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true

jobs:
build:
name: Build, test, and pack
runs-on: windows-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-quality: ga
dotnet-version: 9.x

- name: Update project versions
run: |
Expand All @@ -62,67 +61,59 @@ jobs:
}
}
shell: pwsh

# Build and pack Twilio.AspNet.Common
- name: (Twilio.AspNet.Common) Restore
run: dotnet restore
working-directory: src/Twilio.AspNet.Common/
shell: pwsh

- name: (Twilio.AspNet.Common) Build
run: dotnet build --no-restore --configuration Release
working-directory: src/Twilio.AspNet.Common/
shell: pwsh

- name: (Twilio.AspNet.Common) Pack
run: dotnet pack -c Release -o ..\..\
working-directory: src/Twilio.AspNet.Common/
shell: pwsh

- name: (Twilio.AspNet.Common) Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Twilio.AspNet.Common NuGet Package
path: |
Twilio.AspNet.Common.${{ inputs.libraryVersion || '0.0.0-alpha' }}.nupkg
Twilio.AspNet.Common.${{ inputs.libraryVersion || '0.0.0-alpha' }}.snupkg
# Build, test, and pack Twilio.AspNet.Core
- name: (Twilio.AspNet.Core) Restore
run: dotnet restore
working-directory: src/Twilio.AspNet.Core/
shell: pwsh

- name: (Twilio.AspNet.Core) Build
run: dotnet build --no-restore --configuration Release
working-directory: src/Twilio.AspNet.Core/
shell: pwsh

- name: (Twilio.AspNet.Core.UnitTests) Restore
run: dotnet restore
working-directory: src/Twilio.AspNet.Core.UnitTests/
shell: pwsh

- name: (Twilio.AspNet.Core.UnitTests) Build
run: dotnet build --no-restore
working-directory: src/Twilio.AspNet.Core.UnitTests/
shell: pwsh

- name: (Twilio.AspNet.Core.UnitTests) Test
run: dotnet test --no-build --logger trx
run: dotnet test --no-build --no-restore
working-directory: src/Twilio.AspNet.Core.UnitTests/
shell: pwsh

- name: (Twilio.AspNet.Core.UnitTests) Report Tests
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Twilio.AspNet.Core.UnitTests
path: src/Twilio.AspNet.Core.UnitTests/TestResults/*.trx
reporter: dotnet-trx

- name: (Twilio.AspNet.Core) Pack
run: dotnet pack -c Release -o ..\..\
run: dotnet pack --no-build --no-restore -c Release -o ..\..\
working-directory: src/Twilio.AspNet.Core/
shell: pwsh

Expand All @@ -133,48 +124,40 @@ jobs:
path: |
Twilio.AspNet.Core.${{ inputs.libraryVersion || '0.0.0-alpha' }}.nupkg
Twilio.AspNet.Core.${{ inputs.libraryVersion || '0.0.0-alpha' }}.snupkg
# Build, test, and pack Twilio.AspNet.Mvc
- name: (Twilio.AspNet.Mvc) Restore
run: dotnet restore
working-directory: src/Twilio.AspNet.Mvc/
shell: pwsh

- name: (Twilio.AspNet.Mvc) Build
run: dotnet build --no-restore --configuration Release
working-directory: src/Twilio.AspNet.Mvc/
shell: pwsh

- name: (Twilio.AspNet.Mvc.UnitTests) Restore
run: dotnet restore
working-directory: src/Twilio.AspNet.Mvc.UnitTests/
shell: pwsh

- name: (Twilio.AspNet.Mvc.UnitTests) Build
run: dotnet build --no-restore
working-directory: src/Twilio.AspNet.Mvc.UnitTests/
shell: pwsh

- name: (Twilio.AspNet.Mvc.UnitTests) Test
run: dotnet test --no-build --logger trx
run: dotnet test --no-build --no-restore
working-directory: src/Twilio.AspNet.Mvc.UnitTests/
shell: pwsh

- name: (Twilio.AspNet.Mvc.UnitTests) Report Tests
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Twilio.AspNet.Mvc.UnitTests
path: src/Twilio.AspNet.Mvc.UnitTests/TestResults/*.trx
reporter: dotnet-trx

- name: (Twilio.AspNet.Mvc) Pack
run: dotnet pack -c Release -o ..\..\
run: dotnet pack --no-build --no-restore -c Release -o ..\..\
working-directory: src/Twilio.AspNet.Mvc/
shell: pwsh

- name: (Twilio.AspNet.Mvc) Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Twilio.AspNet.Mvc NuGet Package
path: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
jobs:
build:
uses: ./.github/workflows/ci.yml
if: contains('["Swimburger","dprothero"]', github.actor)
if: contains('["Swimburger","dprothero","AJLange"]', github.actor)
name: Build, test, and pack
permissions:
checks: write
Expand All @@ -29,21 +29,21 @@ jobs:
secrets: inherit

release:
if: contains('["Swimburger","dprothero"]', github.actor)
if: contains('["Swimburger","dprothero","AJLange"]', github.actor)
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Download Twilio.AspNet.Common NuGet Package
with:
name: Twilio.AspNet.Common NuGet Package

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Download Twilio.AspNet.Core NuGet Package
with:
name: Twilio.AspNet.Core NuGet Package

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Download Twilio.AspNet.Mvc NuGet Package
with:
name: Twilio.AspNet.Mvc NuGet Package
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ bool IsValidTwilioRequest(HttpContext httpContext)
?.Value ?? throw new Exception("TwilioRequestValidationOptions missing.");

string? urlOverride = null;
if (options.BaseUrlOverride != null)
if (options.BaseUrlOverride is not null)
{
var request = httpContext.Request;
urlOverride = $"{options.BaseUrlOverride.TrimEnd('/')}{request.Path}{request.QueryString}";
Expand Down
1 change: 1 addition & 0 deletions build.ps1
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env pwsh
$originalLocation = Get-Location

function Remove-EntirePath() {
Expand Down
89 changes: 45 additions & 44 deletions src/Twilio.AspNet.Common/SmsRequest.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,55 @@
namespace Twilio.AspNet.Common
namespace Twilio.AspNet.Common;

/// <summary>
/// This class can be used as the parameter on your SMS action. Incoming parameters will be bound here.
/// </summary>
/// <remarks>https://www.twilio.com/docs/messaging/guides/webhook-request</remarks>
public class SmsRequest : TwilioRequest
{
/// <summary>
/// This class can be used as the parameter on your SMS action. Incoming parameters will be bound here.
/// A 34 character unique identifier for the message. May be used to later retrieve this message from the REST API.
/// </summary>
/// <remarks>https://www.twilio.com/docs/messaging/guides/webhook-request</remarks>
public class SmsRequest : TwilioRequest
{
/// <summary>
/// A 34 character unique identifier for the message. May be used to later retrieve this message from the REST API.
/// </summary>
public string MessageSid { get; set; }

/// <summary>
/// Same value as MessageSid. Deprecated and included for backward compatibility.
/// </summary>
public string SmsSid { get; set; }
public string MessageSid { get; set; } = null!;

/// <summary>
/// Same value as MessageSid. Deprecated and included for backward compatibility.
/// </summary>
[Obsolete("Use MessageSid instead")]
public string SmsSid { get; set; }= null!;

/// <summary>
/// The text body of the SMS message. Up to 160 characters long
/// </summary>
public string Body { get; set; }
/// <summary>
/// The text body of the SMS message. Up to 160 characters long
/// </summary>
public string Body { get; set; }= null!;

/// <summary>
/// The status of the message
/// </summary>
public string MessageStatus { get; set; }
/// <summary>
/// The status of the message
/// </summary>
public string MessageStatus { get; set; }= null!;

/// <summary>
/// The message OptOut type
/// </summary>
public string OptOutType { get; set; }
/// <summary>
/// The message OptOut type
/// </summary>
public string? OptOutType { get; set; }

/// <summary>
/// A unique identifier of the messaging service
/// </summary>
public string MessagingServiceSid { get; set; }

/// <summary>
/// The number of media items associated with your message
/// </summary>
public int NumMedia { get; set; }
/// <summary>
/// A unique identifier of the messaging service
/// </summary>
public string? MessagingServiceSid { get; set; }

/// <summary>
/// The number of media items associated with a "Click to WhatsApp" advertisement.
/// </summary>
public int ReferralNumMedia { get; set; }
/// <summary>
/// The number of media items associated with your message
/// </summary>
public int NumMedia { get; set; }

/// <summary>
/// The number of media files associated with the Message resource
/// </summary>
public int NumSegments { get; set; }
}
/// <summary>
/// The number of media items associated with a "Click to WhatsApp" advertisement.
/// </summary>
public int ReferralNumMedia { get; set; }

/// <summary>
/// The number of media files associated with the Message resource
/// </summary>
public int NumSegments { get; set; }

}
Loading

0 comments on commit b43d31b

Please sign in to comment.