diff --git a/WikiClientLibrary/Generators/AllPagesGenerator.cs b/WikiClientLibrary/Generators/AllPagesGenerator.cs
index f4d140eee..ab753c124 100644
--- a/WikiClientLibrary/Generators/AllPagesGenerator.cs
+++ b/WikiClientLibrary/Generators/AllPagesGenerator.cs
@@ -1,13 +1,6 @@
-using System;
-using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Newtonsoft.Json.Linq;
using WikiClientLibrary.Generators.Primitive;
-using WikiClientLibrary.Pages;
using WikiClientLibrary.Sites;
namespace WikiClientLibrary.Generators
@@ -68,9 +61,19 @@ public AllPagesGenerator(WikiSite site) : base(site)
///
public int? MaxPageContentLength { get; set; }
+ ///
+ /// Limit to protected pages only.
+ ///
+ public List? ProtectionType { get; set; }
+
+ ///
+ /// Filter protections based on protection level (must be used with ProtectionType).
+ ///
+ public List? ProtectionLevel { get; set; }
+
///
public override string ListName => "allpages";
-
+
///
public override IEnumerable> EnumListParameters()
{
@@ -85,6 +88,8 @@ public AllPagesGenerator(WikiSite site) : base(site)
{"apfilterlanglinks", LanguageLinkFilter.ToString("withlanglinks", "withoutlanglinks")},
{"apminsize", MinPageContentLength},
{"apmaxsize", MaxPageContentLength},
+ {"apprtype", ProtectionType != null && ProtectionType.Count != 0 ? string.Join('|', ProtectionType.Select(x => x.ToString().ToLower())) : null},
+ {"apprlevel", ProtectionLevel != null && ProtectionLevel.Count != 0 ? string.Join('|', ProtectionLevel.Select(x => x.ToString().ToLower())) : null},
// TODO add other filters
};
}
@@ -110,4 +115,19 @@ public enum PropertyFilterOption
///
WithoutProperty,
}
+
+ public enum ProtectionType
+ {
+ Edit,
+ Move,
+ Upload
+ }
+
+ public enum ProtectionLevel
+ {
+ Autoconfirmed,
+ ExtendedConfirmed,
+ TemplateEditor,
+ Sysop,
+ }
}
\ No newline at end of file