/WikiClientLibrary

/*🌻*/ Wiki Client Library is an asynchronous MediaWiki API client library targeting modern .NET platforms

Primary LanguageC#Apache License 2.0Apache-2.0

Wiki Client Library

CI Gitter

A hand-crafted asynchronous MediaWiki API client library for wiki sites (including Wikipedia and its sister projects, as well as FANDOM and Wikia.org. The library targets at .NET 6.0 & 8.0 (See Supported Platforms), and focuses on the API compatibility with MediaWiki 1.19, as well as the state-of-art APIs of MediaWiki (i.e. 1.34-wmf, as in 2019-05). Other versions in between are hopefully also compatible.

For migrated FANDOM sites on MW 1.33+ (See UCP migration post), you may need to use Bot Password in order to login successfully.

If you are on prior versions of .NET Core or .NET Framework, you may use prior version of the WCL packages.

  • WCL v0.7.x libraries target .NET Standard 1.1 and has dependency on Newtonsoft.Json
  • WCL v0.8.x libraries target .NET Standard 2.1, .NET 6.0 & .NET 8.0, and has dependency on Newtonsoft.Json

The packages CXuesong.MW.WikiClientLibrary.* are now available on NuGet. E.g. you may install the main package using the following command

#  Package Management Console
Install-Package CXuesong.MW.WikiClientLibrary
#  .NET CLI
dotnet add package CXuesong.MW.WikiClientLibrary
Package Status
CXuesong.MW.WikiClientLibrary NuGet version (CXuesong.MW.WikiClientLibrary) NuGet version (CXuesong.MW.WikiClientLibrary)
CXuesong.MW.WikiClientLibrary.Cargo NuGet version (CXuesong.MW.WikiClientLibrary.Cargo)NuGet version (CXuesong.MW.WikiClientLibrary)
CXuesong.MW.WikiClientLibrary.Flow NuGet version (CXuesong.MW.WikiClientLibrary.Flow) NuGet version (CXuesong.MW.WikiClientLibrary.Flow)
CXuesong.MW.WikiClientLibrary.Wikia NuGet version (CXuesong.MW.WikiClientLibrary.Wikia) NuGet version (CXuesong.MW.WikiClientLibrary.Wikia)
CXuesong.MW.WikiClientLibrary.Wikibase NuGet version (CXuesong.MW.WikiClientLibrary.Wikibase) NuGet version (CXuesong.MW.WikiClientLibrary.Wikibase)

If you bump into bugs, have any suggestions or feature requests, feel free to open an issue. Any contributions on documentations (code annotations & repository wiki) are also welcomed. Thank you.

See also

Overview

Developed in Visual Studio 2019, this portable & asynchronous MediaWiki API client provides an easy and asynchronous access to commonly-used MediaWiki API. The library has the following features

  • Queries for and edits to pages, categories, and files; page information inspection; file uploading.

  • Login/logout via simple asynchronous functions.

    • Client code has access to CookieContainer, and therefore has chance to persist it.
  • Tokens are encapsulated in the library functions, so that client won't bother to retrieve them over and over again.

  • Query continuations are encapsulated by IAsyncEnumerable, which will ease the pain when using page generators.

  • Other miscellaneous MediaWiki API, such as

    • OpenSearch
    • Page parsing
    • Patrol
  • Scribunto Lua console and server-side module execution support

  • StructuredDiscussions (aka. Flow) support

  • Basic Wikibase (Wikidata's back-end) API support; the library provides facility to consume Wikibase JSON dump

  • Basic FANDOM / Wikia API (Nirvana, Wikia AJAX, and Wikia REST-ful API v1) support