piwigodotnet/PiwigoDotnet/Piwigo.Client/PiwigoMethods.cs

32 lines
1.0 KiB
C#
Raw Normal View History

using Flurl.Http.Content;
namespace Piwigo.Client;
internal static class PiwigoMethods
{
public static CapturedMultipartContent PiwigoLogin(this CapturedMultipartContent part, string username,
string password)
{
return part.AddMethod("pwg.session.login").AddString("username", username).AddString("password", password);
}
public static CapturedMultipartContent PiwigoLogout(this CapturedMultipartContent part)
{
return part.AddMethod("pwg.session.logout");
}
public static CapturedMultipartContent PiwigoGetStatus(this CapturedMultipartContent part)
{
return part.AddMethod("pwg.session.getStatus");
}
2022-10-07 23:11:28 +02:00
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);
}
}