using Flurl.Http.Content; namespace Piwigo.Client; internal static class PiwigoMethods { public static void PiwigoLogin(this CapturedMultipartContent part, string username, string password) { part.AddMethod("pwg.session.login").AddString("username", username).AddString("password", password); } public static void PiwigoLogout(this CapturedMultipartContent part) { part.AddMethod("pwg.session.logout"); } public static void PiwigoGetStatus(this CapturedMultipartContent part) { part.AddMethod("pwg.session.getStatus"); } public static void PiwigoGetAllCategories(this CapturedMultipartContent part, bool recursive = true) { part.AddMethod("pwg.categories.getList").AddString("recursive", recursive.ToString()); } 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); } }