# `Wenche.AltinnClient`
[🔗](https://github.com/jarls-side-projects/elixir-wenche/blob/main/lib/wenche/altinn_client.ex#L1)

Altinn 3 API client for creating instances, uploading data, and completing submissions.

Ported from `wenche/altinn_client.py` in the original Python Wenche project.

Handles instance creation, data submission, and completion for all three
submission types: annual accounts, tax return, and shareholder register.

# `t`

```elixir
@type t() :: %Wenche.AltinnClient{
  apps_base: String.t(),
  env: String.t(),
  inbox_url: String.t(),
  token: String.t()
}
```

# `complete_instance`

Moves the instance to the next process step (legacy API).

Returns `{:ok, response_body}` or `{:error, reason}`.

# `create_instance`

Creates a new Altinn 3 app instance (legacy API).

Returns `{:ok, instance_body}` or `{:error, reason}`.

# `fullfoor_instans`

Advances the instance to the signing step and returns the Altinn inbox URL
where the user can sign with BankID/ID-Porten.

Signing requires ID-Porten and cannot be done programmatically.

Returns `{:ok, inbox_url}` or `{:error, reason}`.

# `get_status`

Gets the current status of an instance (legacy API).

Returns `{:ok, response_body}` or `{:error, reason}`.

# `hent_status`

Gets the current status of an instance.

Returns `{:ok, response_body}` or `{:error, reason}`.

# `new`

Creates a new AltinnClient with the given token and environment.

## Options

- `:env` — `"test"` or `"prod"` (default: `"prod"`)

# `oppdater_data_element`

Updates an existing data element in the instance with PUT.

Altinn creates data elements automatically upon instance creation;
we find the correct element via dataType and replace its contents.

Returns `{:ok, response_body}` or `{:error, reason}`.

# `opprett_instans`

Creates a new instance for the given submission type and organization.

## App keys

- `"aarsregnskap"` — Annual accounts (BRG)
- `"aksjonaerregister"` — Shareholder register (SKD)
- `"skattemelding"` — Tax return (SKD)

Returns `{:ok, instance_map}` or `{:error, reason}`.

# `update_data_element`

Uploads/updates a data element on an existing instance (legacy API).

Returns `{:ok, response_body}` or `{:error, reason}`.

---

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