private static void Rollback(Wiki wiki) { var title = "Test"; var tokens = wiki.CreateTitlesSource(title).Select( p => p.revisions() .Where(r => r.token == revisionstoken.rollback) .Select(r => r.rollbacktoken). ToEnumerable()) .ToEnumerable().Single(); var result = wiki.rollback(title, "127.0.0.1", tokens.First()); Console.WriteLine(result); }
private static void BigTitlesSource(Wiki wiki) { var pageTitles = wiki.Query.allpages() .Where(p => p.filterredir == allpagesfilterredir.nonredirects) .Select(p => p.title) .ToEnumerable(); var pagesSource = wiki.CreateTitlesSource(pageTitles); var lotsOfCategories = pagesSource .Select(p => new { p.info.title, categories = p.categories().Select(c => 1).ToEnumerable().Count() }) .ToEnumerable() .Where(p => p.categories >= 20) .Take(5); Write(lotsOfCategories); }
private static void FileRevert(Wiki wiki) { var fileName = "TOR1.jpeg"; var info = wiki.CreateTitlesSource("File:" + fileName) .Select( f => new { token = f.info.edittoken, archiveNames = f.imageinfo().Select(i => i.archivename).ToEnumerable() }) .ToEnumerable().Single(); var archiveName = info.archiveNames.ElementAt(1); var result = wiki.filerevert(fileName, archiveName, "I don't like this version of the image.", info.token); Console.WriteLine(result); }
private static PagesSource <Page> TitlePages(Wiki wiki) { return(wiki.CreateTitlesSource( "User:Svick", "User talk:Svick/WikiProject cleanup listing", "Nonfoobar", "Special:Version")); }