Skip to content

Commit

Permalink
Merge pull request #2 from Reloadly/v101
Browse files Browse the repository at this point in the history
Upgrading to v1.0.1 and updating doc links
  • Loading branch information
epiard13 authored May 19, 2021
2 parents 6896404 + 31788af commit 1a54165
Show file tree
Hide file tree
Showing 60 changed files with 54 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- run:
command: dotnet build .\dotnet-sdk-airtime\src\main\Reloadly.Airtime.csproj
- run:
command: dotnet test .\dotnet-sdk-airtime\test\Reloadly.Airtime.Tests.Unit\Reloadly.Airtime.Tests.Unit.csproj
command: dotnet test .\dotnet-sdk-airtime\src\test\Reloadly.Airtime.Tests.Unit\Reloadly.Airtime.Tests.Unit.csproj
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,25 @@ This project is licensed under the MIT license. See the [LICENSE](LICENSE) file

[api-credentials-help]: https://faq.reloadly.com/en/articles/3519543-locating-your-api-credentials

[sdk-issues]: https://github.com/reloadly/reloadly-sdk-dotnet/issues
[sdk-issues]: https://github.com/Reloadly/reloadly-sdk-.NET/issues

[sdk-license]: http://www.reloadly.com/software/apache2.0/

[gitter]: https://gitter.im/reloadly/reloadly-sdk-dotnet

[sample-code]: https://github.com/reloadly/reloadly-sdk-dotnet/blob/master/SAMPLE-CODE.md
[sample-code]: https://github.com/Reloadly/reloadly-sdk-.NET/blob/main/SAMPLE-CODE.md

[docs-api]: https://developers.reloadly.com

[features]: https://github.com/reloadly/reloadly-sdk-dotnet/issues?q=is%3Aopen+is%3Aissue+label%3A%22feature-request%22
[features]: https://github.com/reloadly/reloadly-sdk-.NET/issues?q=is%3Aopen+is%3Aissue+label%3A%22feature-request%22

[api-docs]: https://developers.reloadly.com

[dotnetdoc]: https://reloadly.dev/reloadly-dotnet

[mit-badge]: http://img.shields.io/:license-mit-blue.svg?style=flat

[mit-url]: https://github.com/reloadly/reloadly-sdk-dotnet/raw/master/LICENSE
[mit-url]: https://github.com/reloadly/reloadly-sdk-dotnet/raw/main/LICENSE

[maven-badge]: https://img.shields.io/maven-central/v/software.reloadly/reloadly-dotnet/reloadly.svg

Expand Down
2 changes: 1 addition & 1 deletion Reloadly.Console.Example/Reloadly.Console.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
</ItemGroup>
Expand Down
28 changes: 14 additions & 14 deletions Reloadly.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
todo.txt = todo.txt
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloadly.Airtime.Tests.Integration", "dotnet-sdk-airtime\test\Reloadly.Airtime.Tests.Integration\Reloadly.Airtime.Tests.Integration.csproj", "{D2312EA3-1B03-4523-8E39-502593D3913A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloadly.Core.Testing", "dotnet-sdk-core\src\test\Reloadly.Core.Testing\Reloadly.Core.Testing.csproj", "{9642AEDD-4DE4-484B-80BC-257B658CB989}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7FFAC8D3-6D55-4084-9E53-1A6834F7631A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloadly.Core.Tests.Unit", "dotnet-sdk-core\src\test\Reloadly.Core.Tests.Unit\Reloadly.Core.Tests.Unit.csproj", "{A678045D-6119-465A-89A9-E881B6946681}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloadly.Airtime.Tests.Unit", "dotnet-sdk-airtime\test\Reloadly.Airtime.Tests.Unit\Reloadly.Airtime.Tests.Unit.csproj", "{20CAEF58-E91C-4682-86A9-422B61E4E086}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "example", "example", "{08058798-DF81-4472-BD39-C27CEEB75874}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloadly.Console.Example", "Reloadly.Console.Example\Reloadly.Console.Example.csproj", "{66E45DE9-5E18-45FF-8D9F-41A820783D74}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloadly.Airtime.Tests.Unit", "dotnet-sdk-airtime\src\test\Reloadly.Airtime.Tests.Unit\Reloadly.Airtime.Tests.Unit.csproj", "{6DEB05CF-C191-4A28-841F-695123023120}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reloadly.Airtime.Tests.Integration", "dotnet-sdk-airtime\src\test\Reloadly.Airtime.Tests.Integration\Reloadly.Airtime.Tests.Integration.csproj", "{97956BC4-AEE4-4A28-91EB-13E97020410F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -73,10 +73,6 @@ Global
{EF5529D1-4C7F-44A2-AB4E-2C04DAE0F58A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF5529D1-4C7F-44A2-AB4E-2C04DAE0F58A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF5529D1-4C7F-44A2-AB4E-2C04DAE0F58A}.Release|Any CPU.Build.0 = Release|Any CPU
{D2312EA3-1B03-4523-8E39-502593D3913A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2312EA3-1B03-4523-8E39-502593D3913A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2312EA3-1B03-4523-8E39-502593D3913A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2312EA3-1B03-4523-8E39-502593D3913A}.Release|Any CPU.Build.0 = Release|Any CPU
{9642AEDD-4DE4-484B-80BC-257B658CB989}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9642AEDD-4DE4-484B-80BC-257B658CB989}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9642AEDD-4DE4-484B-80BC-257B658CB989}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -85,14 +81,18 @@ Global
{A678045D-6119-465A-89A9-E881B6946681}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A678045D-6119-465A-89A9-E881B6946681}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A678045D-6119-465A-89A9-E881B6946681}.Release|Any CPU.Build.0 = Release|Any CPU
{20CAEF58-E91C-4682-86A9-422B61E4E086}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20CAEF58-E91C-4682-86A9-422B61E4E086}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20CAEF58-E91C-4682-86A9-422B61E4E086}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20CAEF58-E91C-4682-86A9-422B61E4E086}.Release|Any CPU.Build.0 = Release|Any CPU
{66E45DE9-5E18-45FF-8D9F-41A820783D74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66E45DE9-5E18-45FF-8D9F-41A820783D74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66E45DE9-5E18-45FF-8D9F-41A820783D74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66E45DE9-5E18-45FF-8D9F-41A820783D74}.Release|Any CPU.Build.0 = Release|Any CPU
{6DEB05CF-C191-4A28-841F-695123023120}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6DEB05CF-C191-4A28-841F-695123023120}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6DEB05CF-C191-4A28-841F-695123023120}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6DEB05CF-C191-4A28-841F-695123023120}.Release|Any CPU.Build.0 = Release|Any CPU
{97956BC4-AEE4-4A28-91EB-13E97020410F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97956BC4-AEE4-4A28-91EB-13E97020410F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97956BC4-AEE4-4A28-91EB-13E97020410F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97956BC4-AEE4-4A28-91EB-13E97020410F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -109,12 +109,12 @@ Global
{EA1A7B24-BA52-4490-87A0-AED684BAEE27} = {F83E0ED7-385C-427D-87BE-1216779EA3A0}
{5FBC958F-736D-422F-9EA0-35C4DD470253} = {7D8B6245-0F52-4A35-9262-CEB693C0F3A6}
{EF5529D1-4C7F-44A2-AB4E-2C04DAE0F58A} = {5FBC958F-736D-422F-9EA0-35C4DD470253}
{D2312EA3-1B03-4523-8E39-502593D3913A} = {EA1A7B24-BA52-4490-87A0-AED684BAEE27}
{9642AEDD-4DE4-484B-80BC-257B658CB989} = {7FFAC8D3-6D55-4084-9E53-1A6834F7631A}
{7FFAC8D3-6D55-4084-9E53-1A6834F7631A} = {7D8B6245-0F52-4A35-9262-CEB693C0F3A6}
{A678045D-6119-465A-89A9-E881B6946681} = {7FFAC8D3-6D55-4084-9E53-1A6834F7631A}
{20CAEF58-E91C-4682-86A9-422B61E4E086} = {EA1A7B24-BA52-4490-87A0-AED684BAEE27}
{66E45DE9-5E18-45FF-8D9F-41A820783D74} = {08058798-DF81-4472-BD39-C27CEEB75874}
{6DEB05CF-C191-4A28-841F-695123023120} = {EA1A7B24-BA52-4490-87A0-AED684BAEE27}
{97956BC4-AEE4-4A28-91EB-13E97020410F} = {EA1A7B24-BA52-4490-87A0-AED684BAEE27}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3451D67D-05DA-4982-83FF-1C6BD485AE2C}
Expand Down
8 changes: 2 additions & 6 deletions dotnet-sdk-airtime/src/main/Reloadly.Airtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<Version>1.0.1</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\dotnet-sdk-authentication\src\main\Reloadly.Authentication.csproj" />
<ProjectReference Include="..\..\..\dotnet-sdk-core\src\main\Reloadly.Core\Reloadly.Core.csproj" />
<PackageReference Include="Reloadly.Authentication" Version="1.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
Expand All @@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
<PackageReference Include="coverlet.collector" Version="3.0.3">
Expand All @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\main\Reloadly.Airtime.csproj" />
<ProjectReference Include="..\..\main\Reloadly.Airtime.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task AirtimeApiShouldRefreshAccessToken()

var reloadlyHttpClient = new ReloadlyHttpClient(factoryMock.Object, ReloadlyApiVersion.AirtimeV1);
var result = await reloadlyHttpClient.SendAsync(ex.Request);
Assert.AreEqual(9m, result.Amount);
Assert.AreEqual(9m, result?.Amount);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
Expand All @@ -29,9 +29,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\dotnet-sdk-authentication\src\main\Reloadly.Authentication.csproj" />
<ProjectReference Include="..\..\..\dotnet-sdk-core\src\test\Reloadly.Core.Testing\Reloadly.Core.Testing.csproj" />
<ProjectReference Include="..\..\src\main\Reloadly.Airtime.csproj" />
<ProjectReference Include="..\..\..\..\dotnet-sdk-core\src\test\Reloadly.Core.Testing\Reloadly.Core.Testing.csproj" />
<ProjectReference Include="..\..\main\Reloadly.Airtime.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<Version>1.0.1</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\dotnet-sdk-core\src\main\Reloadly.Core\Reloadly.Core.csproj" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Reloadly.Core" Version="1.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Reloadly.Core.Internal.Net
{
public interface IReloadlyHttpClient
{
public Task<TResponse> SendAsync<TResponse>(ReloadlyRequest<TResponse> request)
public Task<TResponse?> SendAsync<TResponse>(ReloadlyRequest<TResponse> request)
where TResponse : class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ReloadlyHttpClient Clone(bool skipApiVersion = false)
return new ReloadlyHttpClient(_httpClientFactory, apiVersion, _disableTelemetry);
}

public async Task<TResponse> SendAsync<TResponse>(ReloadlyRequest<TResponse> request)
public async Task<TResponse?> SendAsync<TResponse>(ReloadlyRequest<TResponse> request)
where TResponse : class
{
var reqMessage = request.CreateHttpRequestMessage();
Expand All @@ -46,9 +46,10 @@ public async Task<TResponse> SendAsync<TResponse>(ReloadlyRequest<TResponse> req

var httpClient = _httpClientFactory.CreateClient();
var resMessage = await httpClient.SendAsync(reqMessage);
return await ParseResponse<TResponse>(request, resMessage);
return await ParseResponse(request, resMessage);
}
private async Task<TResponse> ParseResponse<TResponse>(ReloadlyRequest<TResponse> request, HttpResponseMessage responseMessage)

private async Task<TResponse?> ParseResponse<TResponse>(ReloadlyRequest<TResponse> request, HttpResponseMessage responseMessage)
where TResponse : class
{
if (!responseMessage.IsSuccessStatusCode)
Expand All @@ -60,8 +61,7 @@ private async Task<TResponse> ParseResponse<TResponse>(ReloadlyRequest<TResponse

try
{
TResponse body = JsonConvert.DeserializeObject<TResponse>(payload);
return body;
return JsonConvert.DeserializeObject<TResponse>(payload);
}
catch (System.Exception ex)
{
Expand Down
5 changes: 3 additions & 2 deletions dotnet-sdk-core/src/main/Reloadly.Core/Reloadly.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<Version>1.0.1</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.9.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.11.0" />
</ItemGroup>

</Project>
11 changes: 9 additions & 2 deletions dotnet-sdk-core/src/test/Reloadly.Core.Testing/HttpTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Reloadly.Core.Testing
{
public class HttpTest
{
private Uri _baseUri;
private readonly Uri _baseUri;

public HttpTest(Uri baseUri)
{
Expand Down Expand Up @@ -39,7 +39,14 @@ public IHttpClientFactory Factory
public T ResponseBody<T>()
{
Debug.Assert(_responseBody != null, nameof(_responseBody));
return JsonConvert.DeserializeObject<T>(_responseBody);
var deserialized = JsonConvert.DeserializeObject<T>(_responseBody);

if (deserialized == null)
{
throw new System.Exception($"Cannot deserialize '{nameof(_responseBody)}'.");
}

return deserialized;
}

public HttpTest ConfigureOAuth(object responseBody)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\main\Reloadly.Core\Reloadly.Core.csproj" />
<PackageReference Include="Reloadly.Core" Version="1.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
Expand Down

0 comments on commit 1a54165

Please sign in to comment.