# `Wiki.Enterprise`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L16)

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.

# `client_option`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L33)

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

# `client_options`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L39)

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

# `get_snapshot_chunk`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L184)

```elixir
@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")
```

# `get_snapshot_info`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L152)

```elixir
@spec get_snapshot_info(Wiki.Enterprise.Session.t(), binary()) :: map()
```

Get metadata about the snapshot.

Example:
```
Wiki.Enterprise.get_snapshot_info(api, "aawiki_namespace_0")
```

# `list_available_snapshots`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L76)

```elixir
@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`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L169)

```elixir
@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`
[🔗](https://gitlab.com/wmde/technical-wishes/mediawiki_client_ex/blob/main/lib/enterprise.ex#L53)

```elixir
@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"))
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
