Wiki.Site (mediawiki_client v0.3.0) View Source

Retrieves sites from a wiki farm with the SiteMatrix extension installed.

Link to this section Summary

Functions

Get the Action API for a site

Get a single site, matching on dbname

Link to this section Functions

Specs

action_api(Wiki.Site.Spec.t()) :: String.t()

Get the Action API for a site

"enwiki"
|> Wiki.Site.get()
|> Wiki.Site.action_api()

# "https://en.wikipedia.org/w/api.php"

Arguments

  • site - Populated site structure.

Return value

Calculated Action API.

TODO: Only works for the default configuration, needs to be either customizable or autodetected.

Link to this function

get(api \\ "https://meta.wikimedia.org/w/api.php", dbname)

View Source

Specs

get(String.t(), String.t()) :: {:ok, Wiki.Site.Spec.t()} | {:error, Wiki.Error}

Get a single site, matching on dbname

Arguments

  • dbname - Wiki ID, for example "enwiki"
  • api - Action API URL

Return value

Site spec

Link to this function

get!(api \\ "https://meta.wikimedia.org/w/api.php", dbname)

View Source

Specs

Assertive variant of get.

Link to this function

get_all(api \\ "https://meta.wikimedia.org/w/api.php")

View Source

Specs

get_all(String.t()) :: {:ok, [Wiki.Site.Spec.t()]} | {:error, Wiki.Error}

Get all sites for a wiki farm.

Arguments

  • api - Action API URL for a site participating in the farm.

Return value

List of site specifications.

TODO:

  • Memoize result for a configurable amount of time.
  • Continuation when more than 5000 sites are available.