Skip to content

Commit

Permalink
Merge pull request #124 from messagebird/4.x
Browse files Browse the repository at this point in the history
4.x
  • Loading branch information
marcel corso gonzalez authored Jul 11, 2022
2 parents 5c287e2 + 0eb4c2d commit b4bd3dd
Show file tree
Hide file tree
Showing 57 changed files with 139 additions and 442 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish dotnet package to nuget

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout csharp-rest-api
uses: actions/checkout@v3

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: Build release
run: dotnet build --configuration Release MessageBird -f net6.0

- name: Create the package
run: dotnet pack --configuration Release /p:Version=${{github.event.release.tag_name}} MessageBird

- name: Publish the package to GPR
run: dotnet nuget push MessageBird/bin/Release/*.nupkg --api-key ${{secrets.NUGET_AUTH_TOKEN}} --source https://api.nuget.org/v3/index.json
22 changes: 13 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ name: Tests
on:
pull_request:
push:
branches: [master, main]
branches: [ master, main ]

jobs:
build:
runs-on: ubuntu-latest
name: Dotnet Side by Side testing sample
name: Build and test
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
- name: Checkout csharp-rest-api
uses: actions/checkout@v3

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
2.1.x
3.1.x
- run: dotnet build MessageBird -f netstandard2.0
- run: dotnet test Tests/UnitTests/MessageBirdUnitTests -f netcoreapp2.0
dotnet-version: 6.0.x

- name: Build
run: dotnet build MessageBird -f net6.0

- name: Test
run: dotnet test Tests/MessageBird.Tests -f net6.0
7 changes: 3 additions & 4 deletions MessageBird/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ public static Client CreateDefault(string accessKey, IProxyConfigurationInjector

#region Programmable SMS API

public Message SendMessage(string originator, string body, long[] msisdns, MessageOptionalArguments optionalArguments = null)
public Message SendMessage(string originator, string body, long[] recipients, MessageOptionalArguments optionalArguments = null)
{
ParameterValidator.IsNotNullOrWhiteSpace(originator, "originator");
ParameterValidator.IsNotNullOrWhiteSpace(body, "body");
ParameterValidator.ContainsAtLeast(msisdns, 1, "msisdns");
ParameterValidator.ContainsAtLeast(recipients, 1, "recipients");

if (optionalArguments != null)
{
ParameterValidator.IsValidMessageType(optionalArguments.Type);
}

var recipients = new Recipients(msisdns);
var message = new Message(originator, body, recipients, optionalArguments);
var message = new Message(originator, body, new Recipients(recipients), optionalArguments);

var messages = new Messages(message);
var result = restClient.Create(messages);
Expand Down
3 changes: 1 addition & 2 deletions MessageBird/Exceptions/ErrorException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public bool HasReason
get { return !String.IsNullOrEmpty(Reason); }
}

public ErrorException(string reason, Exception innerException = null)
: base(reason, innerException)
public ErrorException(string reason, Exception? innerException = null) : base(reason, innerException)
{
Reason = reason;
}
Expand Down
23 changes: 6 additions & 17 deletions MessageBird/MessageBird.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net40;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<Product>MessageBird</Product>
<Title>MessageBird</Title>
<Company>MessageBird</Company>
<Copyright>Copyright © 2019</Copyright>
<FileVersion>3.1.0.0</FileVersion>
<InformationalVersion>3.1.0.0</InformationalVersion>
<Version>3.1.0.0</Version>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<LangVersion>4</LangVersion>
<Copyright>Copyright © 2022</Copyright>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Conditionally obtain references for the .NET Framework 4.0 target -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
</ItemGroup>

<ItemGroup>
<PackageReference Include="JWT" Version="8.2.3" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Objects\Common\" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>MessageBirdUnitTests</_Parameter1>
Expand Down
26 changes: 0 additions & 26 deletions MessageBird/MessageBird.csproj.nuspec

This file was deleted.

3 changes: 1 addition & 2 deletions MessageBird/Objects/Recipients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public Recipients()
SerializeMsisdnsOnly = true;
}

public Recipients(IEnumerable<long> msisdns)
: this()
public Recipients(IEnumerable<long> msisdns) : this()
{
foreach (long msisdn in msisdns)
{
Expand Down
50 changes: 0 additions & 50 deletions MessageBird/Objects/Request.cs

This file was deleted.

86 changes: 0 additions & 86 deletions MessageBird/RequestSigner.cs

This file was deleted.

4 changes: 2 additions & 2 deletions MessageBird/RequestValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public RequestValidator(string secret, bool skipURLValidation = false)
}

/// <summary>
/// Internal constructor visible for unit testing.
/// Constructor that allows you to overwrite the dateTimeProvider for easier testing
/// </summary>
internal RequestValidator(string secret, IDateTimeProvider dateTimeProvider) : this(secret)
public RequestValidator(string secret, IDateTimeProvider dateTimeProvider) : this(secret)
{
_jwtBuilder = _jwtBuilder.WithDateTimeProvider(dateTimeProvider);
}
Expand Down
2 changes: 0 additions & 2 deletions NuGet/.gitignore

This file was deleted.

Binary file removed NuGet/MessageBird.dll
Binary file not shown.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Requirements

- [Sign up](https://www.messagebird.com/en/signup) for a free MessageBird account
- Create a new access_key in the developers sections
- MessageBird API client for C# requires **.NET Framework >= 4** or **.NET Standard >= 2.0**
- It has a dependency on **JSON.NET >= 4.5.6**

Installation
-----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\MessageBird\MessageBird.csproj" />
<ProjectReference Include="..\..\MessageBird\MessageBird.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Moq" Version="4.12.0" />
<PackageReference Include="WireMock.Net" Version="1.0.21" />
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="WireMock.Net" Version="1.2.18" />
</ItemGroup>
<ItemGroup>
<Content Include="Responses\**">
Expand All @@ -34,4 +34,4 @@
<ItemGroup>
<None Include="Responses\WebhooksList.json" />
</ItemGroup>
</Project>
</Project>
Loading

0 comments on commit b4bd3dd

Please sign in to comment.