Skip to content

Commit eb410ff

Browse files
committed
Merge branch 'release/0.98.0'
2 parents e016dc8 + 0dbc48f commit eb410ff

26 files changed

+208
-240
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"cake.tool": {
6-
"version": "5.1.0",
6+
"version": "6.0.0",
77
"commands": [
88
"dotnet-cake"
99
]

Source/ZoomNet.IntegrationTests/ZoomNet.IntegrationTests.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<AssemblyName>ZoomNet.IntegrationTests</AssemblyName>
77
<RootNamespace>ZoomNet.IntegrationTests</RootNamespace>
88
</PropertyGroup>
@@ -13,12 +13,12 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Formitable.BetterStack.Logger.Microsoft" Version="0.1.3-beta0002" />
16-
<PackageReference Include="Microsoft.Extensions.Diagnostics" Version="9.0.10" />
17-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
18-
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.10" />
19-
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
20-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.10" />
21-
<PackageReference Include="System.Text.Json" Version="9.0.10" />
16+
<PackageReference Include="Microsoft.Extensions.Diagnostics" Version="10.0.0" />
17+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
18+
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0" />
19+
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
20+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />
21+
<PackageReference Include="System.Text.Json" Version="10.0.0" />
2222
</ItemGroup>
2323

2424
<ItemGroup>

Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net48;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net48;net10.0</TargetFrameworks>
55
<AssemblyName>ZoomNet.UnitTests</AssemblyName>
66
<RootNamespace>ZoomNet.UnitTests</RootNamespace>
77
<IsPackable>false</IsPackable>
88
<IsTestProject>true</IsTestProject>
99
<OutputType>Exe</OutputType>
1010
</PropertyGroup>
1111

12-
<!-- Enable the MSTest runner -->
1312
<PropertyGroup>
14-
<EnableMSTestRunner>true</EnableMSTestRunner>
15-
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
13+
<!--
14+
UseMicrosoftTestingPlatformRunner continues to be necessary for .NET 10, because this flag has nothing to do with dotnet test.
15+
It changes how dotnet run works, which is completely independent of dotnet test.
16+
https://github.com/xunit/xunit/issues/3421
17+
-->
1618
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
1719
</PropertyGroup>
18-
20+
1921
<ItemGroup>
20-
<PackageReference Include="MartinCostello.Logging.XUnit.v3" Version="0.6.0" />
21-
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.10" />
22-
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
23-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
22+
<PackageReference Include="MartinCostello.Logging.XUnit.v3" Version="0.7.0" />
23+
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0" />
24+
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
25+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2426
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />
2527
<PackageReference Include="NSubstitute" Version="5.3.0" />
2628
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.17">
@@ -29,7 +31,7 @@
2931
</PackageReference>
3032
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
3133
<PackageReference Include="Shouldly" Version="4.3.0" />
32-
<PackageReference Include="System.Text.Json" Version="9.0.10" />
34+
<PackageReference Include="System.Text.Json" Version="10.0.0" />
3335
<PackageReference Include="xunit.v3.mtp-v2" Version="3.2.0" />
3436
</ItemGroup>
3537

Source/ZoomNet.sln

Lines changed: 0 additions & 42 deletions
This file was deleted.

Source/ZoomNet.slnx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="../README.md" />
4+
</Folder>
5+
<Project Path="ZoomNet.IntegrationTests/ZoomNet.IntegrationTests.csproj" />
6+
<Project Path="ZoomNet.UnitTests/ZoomNet.UnitTests.csproj" />
7+
<Project Path="ZoomNet/ZoomNet.csproj" />
8+
</Solution>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#if NETFRAMEWORK || NETSTANDARD
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Runtime.CompilerServices;
6+
7+
namespace System
8+
{
9+
/// <summary>
10+
/// Extension methods for <see cref="ArgumentNullException"/>.
11+
/// </summary>
12+
internal static class ArgumentNullExceptionExtensions
13+
{
14+
// Use the new C# 14 'extension' feature to add static methods to ArgumentNullException
15+
extension(ArgumentNullException)
16+
{
17+
/// <summary>
18+
/// Throws an exception if the specified argument is null.
19+
/// </summary>
20+
/// <param name="argument">The object to validate for null. If this value is null, an <see cref="ArgumentNullException"/> is thrown.</param>
21+
/// <param name="paramName">The name of the parameter to include in the exception message. If not specified, the caller's argument expression
22+
/// is used.</param>
23+
/// <param name="message">An optional custom message to include in the exception. If null, the default exception message is used.</param>
24+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="argument"/> is null.</exception>
25+
public static void ThrowIfNull(object argument, [CallerArgumentExpression(nameof(argument))] string paramName = null, string message = null)
26+
{
27+
if (argument is null)
28+
throw new ArgumentNullException(paramName, message);
29+
}
30+
31+
/// <summary>
32+
/// Throws an exception if the specified string argument is null or empty.
33+
/// </summary>
34+
/// <remarks>Use this method to enforce that a string parameter is not null or empty before proceeding with
35+
/// further logic. This is typically used at the start of a method to validate input arguments.</remarks>
36+
/// <param name="argument">The string value to validate. Cannot be null or empty.</param>
37+
/// <param name="paramName">The name of the parameter being validated. If not specified, the caller's argument expression is used.</param>
38+
/// <param name="message">An optional custom error message to include in the exception. If null, a default message is used.</param>
39+
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is null or an empty string.</exception>
40+
public static void ThrowIfEmpty(string argument, [CallerArgumentExpression(nameof(argument))] string paramName = null, string message = null)
41+
{
42+
if (string.IsNullOrEmpty(argument))
43+
throw new ArgumentNullException(paramName, message);
44+
}
45+
46+
/// <summary>
47+
/// Throws an exception if the specified collection is null or contains no elements.
48+
/// </summary>
49+
/// <remarks>Use this method to validate that a collection argument is not null and contains at least one
50+
/// element before proceeding with further operations.</remarks>
51+
/// <typeparam name="T">The type of elements in the collection to validate.</typeparam>
52+
/// <param name="argument">The collection to check for null or emptiness.</param>
53+
/// <param name="paramName">The name of the parameter to include in the exception message. If not specified, the caller's argument expression
54+
/// is used.</param>
55+
/// <param name="message">An optional custom message to include in the exception if thrown.</param>
56+
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is null or contains no elements.</exception>
57+
public static void ThrowIfEmpty<T>(IEnumerable<T> argument, [CallerArgumentExpression(nameof(argument))] string paramName = null, string message = null)
58+
{
59+
if (argument is null || !argument.Any())
60+
throw new ArgumentNullException(paramName, message);
61+
}
62+
}
63+
}
64+
}
65+
#endif

Source/ZoomNet/Extensions/Internal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ private static T GetElementValue<T>(this JsonElement element)
13591359
Type datetimeType when datetimeType == typeof(DateTime) => (T)(object)element.GetDateTime(),
13601360
Type offsetType when offsetType == typeof(DateTimeOffset) => (T)(object)element.GetDateTimeOffset(),
13611361
Type guidType when guidType == typeof(Guid) => (T)(object)element.GetGuid(),
1362-
_ => throw new ArgumentException($"Unsable to map {typeof(T).FullName} to a corresponding JSON type", nameof(T)),
1362+
_ => throw new ArgumentException($"Unsable to map {typeOfT.FullName} to a corresponding JSON type", nameof(T)),
13631363
};
13641364
}
13651365
}

Source/ZoomNet/Models/TimeZones.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,5 +550,13 @@ public enum TimeZones
550550
/// <summary>Independent State of Samoa.</summary>
551551
[EnumMember(Value = "Pacific/Apia")]
552552
Pacific_Apia,
553+
554+
/// <summary>Manila.</summary>
555+
/// <remarks>
556+
/// This timezone is undocumented.
557+
/// See <a href="https://github.com/Jericho/ZoomNet/issues/443">GH-443</a> for details.
558+
/// </remarks>
559+
[EnumMember(Value = "Asia/Manila")]
560+
Asia_Manila,
553561
}
554562
}

Source/ZoomNet/OAuthConnectionInfo.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public class OAuthConnectionInfo : IConnectionInfo
9494
[Obsolete("This constructor has been replaced with OAuthConnectionInfo.WithClientCredentials")]
9595
public OAuthConnectionInfo(string clientId, string clientSecret)
9696
{
97-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
98-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
97+
ArgumentNullException.ThrowIfEmpty(clientId);
98+
ArgumentNullException.ThrowIfEmpty(clientSecret);
9999

100100
ClientId = clientId;
101101
ClientSecret = clientSecret;
@@ -128,9 +128,9 @@ public OAuthConnectionInfo(string clientId, string clientSecret)
128128
[Obsolete("This constructor has been replaced with OAuthConnectionInfo.WithAuthorizationCode")]
129129
public OAuthConnectionInfo(string clientId, string clientSecret, string authorizationCode, OnTokenRefreshedDelegate onTokenRefreshed, string redirectUri = null, string codeVerifier = null)
130130
{
131-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
132-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
133-
if (string.IsNullOrEmpty(authorizationCode)) throw new ArgumentNullException(nameof(authorizationCode));
131+
ArgumentNullException.ThrowIfEmpty(clientId);
132+
ArgumentNullException.ThrowIfEmpty(clientSecret);
133+
ArgumentNullException.ThrowIfEmpty(authorizationCode);
134134

135135
ClientId = clientId;
136136
ClientSecret = clientSecret;
@@ -165,9 +165,9 @@ public OAuthConnectionInfo(string clientId, string clientSecret, string authoriz
165165
[Obsolete("This constructor has been replaced with OAuthConnectionInfo.WithRefreshToken")]
166166
public OAuthConnectionInfo(string clientId, string clientSecret, string refreshToken, string accessToken, OnTokenRefreshedDelegate onTokenRefreshed)
167167
{
168-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
169-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
170-
if (string.IsNullOrEmpty(refreshToken)) throw new ArgumentNullException(nameof(refreshToken));
168+
ArgumentNullException.ThrowIfEmpty(clientId);
169+
ArgumentNullException.ThrowIfEmpty(clientSecret);
170+
ArgumentNullException.ThrowIfEmpty(refreshToken);
171171

172172
ClientId = clientId;
173173
ClientSecret = clientSecret;
@@ -191,9 +191,9 @@ public OAuthConnectionInfo(string clientId, string clientSecret, string refreshT
191191
[Obsolete("This constructor has been replaced with OAuthConnectionInfo.ForServerToServer")]
192192
public OAuthConnectionInfo(string clientId, string clientSecret, string accountId, OnTokenRefreshedDelegate onTokenRefreshed)
193193
{
194-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
195-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
196-
if (string.IsNullOrEmpty(accountId)) throw new ArgumentNullException(nameof(accountId));
194+
ArgumentNullException.ThrowIfEmpty(clientId);
195+
ArgumentNullException.ThrowIfEmpty(clientSecret);
196+
ArgumentNullException.ThrowIfEmpty(accountId);
197197

198198
ClientId = clientId;
199199
ClientSecret = clientSecret;
@@ -265,8 +265,8 @@ public static OAuthConnectionInfo WithClientCredentials(string clientId, string
265265
/// <returns>The connection info.</returns>
266266
public static OAuthConnectionInfo WithClientCredentials(string clientId, string clientSecret, string accessToken, OnTokenRefreshedDelegate onTokenRefreshed)
267267
{
268-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
269-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
268+
ArgumentNullException.ThrowIfEmpty(clientId);
269+
ArgumentNullException.ThrowIfEmpty(clientSecret);
270270

271271
return new OAuthConnectionInfo
272272
{
@@ -305,9 +305,9 @@ public static OAuthConnectionInfo WithClientCredentials(string clientId, string
305305
/// <returns>The connection info.</returns>
306306
public static OAuthConnectionInfo WithAuthorizationCode(string clientId, string clientSecret, string authorizationCode, OnTokenRefreshedDelegate onTokenRefreshed, string redirectUri = null, string codeVerifier = null)
307307
{
308-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
309-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
310-
if (string.IsNullOrEmpty(authorizationCode)) throw new ArgumentNullException(nameof(authorizationCode));
308+
ArgumentNullException.ThrowIfEmpty(clientId);
309+
ArgumentNullException.ThrowIfEmpty(clientSecret);
310+
ArgumentNullException.ThrowIfEmpty(authorizationCode);
311311

312312
return new OAuthConnectionInfo
313313
{
@@ -361,9 +361,9 @@ public static OAuthConnectionInfo WithRefreshToken(string clientId, string clien
361361
/// <returns>The connection info.</returns>
362362
public static OAuthConnectionInfo WithRefreshToken(string clientId, string clientSecret, string refreshToken, string accessToken, OnTokenRefreshedDelegate onTokenRefreshed)
363363
{
364-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
365-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
366-
if (string.IsNullOrEmpty(refreshToken)) throw new ArgumentNullException(nameof(refreshToken));
364+
ArgumentNullException.ThrowIfEmpty(clientId);
365+
ArgumentNullException.ThrowIfEmpty(clientSecret);
366+
ArgumentNullException.ThrowIfEmpty(refreshToken);
367367

368368
return new OAuthConnectionInfo
369369
{
@@ -416,9 +416,9 @@ public static OAuthConnectionInfo ForServerToServer(string clientId, string clie
416416
/// <returns>The connection info.</returns>
417417
public static OAuthConnectionInfo ForServerToServer(string clientId, string clientSecret, string accountId, string accessToken, OnTokenRefreshedDelegate onTokenRefreshed = null)
418418
{
419-
if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException(nameof(clientId));
420-
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException(nameof(clientSecret));
421-
if (string.IsNullOrEmpty(accountId)) throw new ArgumentNullException(nameof(accountId));
419+
ArgumentNullException.ThrowIfEmpty(clientId);
420+
ArgumentNullException.ThrowIfEmpty(clientSecret);
421+
ArgumentNullException.ThrowIfEmpty(accountId);
422422

423423
return new OAuthConnectionInfo
424424
{

0 commit comments

Comments
 (0)