# `AshScim.Encoder`
[🔗](https://github.com/ash-project/ash_scim/blob/main/lib/ash_scim/encoder.ex#L5)

Encodes Ash records into SCIM 2.0 JSON-shaped maps using the mappings
declared in the resource's `scim` section.

The result is a plain map suitable for `Jason.encode!/1`. List-response
envelopes are the responsibility of the router; this module concerns itself
only with single-resource encoding.

# `opts`

```elixir
@type opts() :: [{:base_url, String.t()}]
```

# `encode`

```elixir
@spec encode(Ash.Resource.Record.t(), opts()) :: %{required(String.t()) =&gt; term()}
```

Encode a single Ash record as a SCIM resource.

Options:

  * `:base_url` — used to build `meta.location`. If omitted, `meta.location`
    is not emitted.

# `list_response`

```elixir
@spec list_response([%{required(String.t()) =&gt; term()}], keyword()) :: %{
  required(String.t()) =&gt; term()
}
```

Wrap a list of encoded resources in a SCIM `ListResponse` envelope.

`total_results` should reflect the unfiltered/unpaginated count when
pagination is in play; for the simple case, pass `length(resources)`.

---

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