Wiki.Enterprise (mediawiki_client v0.6.0)

View Source

Client for the Wikimedia Enterprise API

Docs: https://enterprise.wikimedia.com/docs/

These APIs are only provided by the Enterprise organization and hit two endpoints: one for authentication and the other for information retrieval. An account is required.

For the moment, only the Snapshot API verbs will be implemented.

Summary

Functions

Retrieve a snapshot chunk as a binary .tar.gz

Lists information about available snapshots, namespaces, and chunks.

Get a list of chunk files for a given snapshot, along with the chunk metadata.

Example

Types

client_option()

@type client_option() ::
  {:access_token, binary()}
  | {:debug, true}
  | {:timeout, integer()}
  | {:user_agent, binary()}

client_options()

@type client_options() :: [client_option()]

Functions

get_snapshot_chunk(api, snapshot_id, chunk_id)

@spec get_snapshot_chunk(Wiki.Enterprise.Session.t(), binary(), binary()) :: binary()

Retrieve a snapshot chunk as a binary .tar.gz

Example:

ndjson_tgz = Wiki.Enterprise.get_snapshot_chunk(api, "aawiki_namespace_0", "aawiki_namespace_0_chunk_0")

list_available_snapshots(api)

@spec list_available_snapshots(Wiki.Enterprise.Session.t()) :: list()

Lists information about available snapshots, namespaces, and chunks.

Example:

Wiki.Enterprise.list_available_snapshots(api)

list_snapshot_chunks(api, snapshot_id)

@spec list_snapshot_chunks(Wiki.Enterprise.Session.t(), binary()) :: list()

Get a list of chunk files for a given snapshot, along with the chunk metadata.

The order of chunks doesn't matter, each is a self-contained file.

Example:

Wiki.Enterprise.list_snapshot_chunks(api, "aawiki_namespace_0")

new(opts)

@spec new(client_options()) :: {:ok, Wiki.Enterprise.Session.t()} | {:error, term()}

Example:

{:ok, api} = Wiki.Enterprise.new(
  username: System.get_env("ENTERPRISE_USERNAME"),
  refresh_token: System.get_env("ENTERPRISE_REFRESH_TOKEN"))