consolidates extension methods

This commit is contained in:
Philipp Häfelfinger 2022-10-07 23:11:28 +02:00
parent 5f7f6f6efa
commit 5cdd637faf
2 changed files with 10 additions and 16 deletions

View File

@ -1,16 +0,0 @@
using Flurl.Http.Content;
namespace Piwigo.Client;
internal static class CapturedMultipartContentExtensions
{
public static CapturedMultipartContent AddMethod(this CapturedMultipartContent part, string piwigoMethod)
{
if (string.IsNullOrWhiteSpace(piwigoMethod))
{
throw new ArgumentException("Value cannot be null or whitespace.", nameof(piwigoMethod));
}
return part.AddString("method", piwigoMethod);
}
}

View File

@ -19,4 +19,14 @@ internal static class PiwigoMethods
{
return part.AddMethod("pwg.session.getStatus");
}
private static CapturedMultipartContent AddMethod(this CapturedMultipartContent part, string piwigoMethod)
{
if (string.IsNullOrWhiteSpace(piwigoMethod))
{
throw new ArgumentException("Value cannot be null or whitespace.", nameof(piwigoMethod));
}
return part.AddString("method", piwigoMethod);
}
}