View Source Wiki.SiteMatrix (mediawiki_client v0.4.0)

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

Link to this section Summary

Functions

Get the Action API for a site

Assertive variant of get.

Get a single site, matching on dbname

Get all sites for a wiki farm.

Options

Link to this section Types

@type client_options() :: [Wiki.Action.client_option() | {:api, binary()}]
Link to this opaque

sitematrix_state()

View Source (opaque)
@opaque sitematrix_state()

Link to this section Functions

@spec action_api(String.t() | Wiki.SiteMatrix.Spec.t()) :: String.t()

Get the Action API for a site

Wiki.SiteMatrix.new()
|> Wiki.SiteMatrix.get("enwiki")
|> Wiki.SiteMatrix.action_api()

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

As a convenience, the site can be referenced as a bare string, in which case it will be looked up in the default Wikimedia farm. Note that this will be uncached and so inappropriate for most production use.

Wiki.SiteMatrix.action_api("dewiki")

arguments

Arguments

  • site - Populated site structure.

return-value

Return value

Calculated Action API.

Link to this function

get!(sitematrix, dbname)

View Source

Assertive variant of get.

@spec get(sitematrix_state(), String.t()) ::
  {:ok, Wiki.SiteMatrix.Spec.t()} | {:error, any()}

Get a single site, matching on dbname

arguments

Arguments

  • sitematrix - Result of Sitematrix.new()
  • dbname - Wiki ID, for example "enwiki"

return-value

Return value

Site spec

@spec get_all(sitematrix_state()) ::
  {:ok, [Wiki.SiteMatrix.Spec.t()]} | {:error, any()}

Get all sites for a wiki farm.

arguments

Arguments

  • sitematrix - Result of Sitematrix.new()

return-value

Return value

List of site specifications.

@spec new(client_options()) :: sitematrix_state()

options

Options