# `ExFattureincloud`
[🔗](https://github.com/elchemista/ex_fattureincloud/blob/v0.1.0/lib/ex_fattureincloud.ex#L1)

Elixir client for Fatture in Cloud API v2.

Create a client with `new/1` and use the resource modules, for example
`ExFattureincloud.Clients.list_clients/3`. Requests return
`{:ok, %ExFattureincloud.Response{}}` or `{:error, %ExFattureincloud.Error{}}`.
JSON keys remain strings; response envelopes and pagination are preserved.

    client = ExFattureincloud.new(token: System.fetch_env!("FIC_ACCESS_TOKEN"))
    ExFattureincloud.User.list_user_companies(client)

Clients are immutable and have no global credentials. Optional supervised
OAuth renewal is provided by `ExFattureincloud.OAuth.TokenManager`.
API writes are never repeated automatically.

# `call`

```elixir
@spec call(
  ExFattureincloud.Client.t(),
  ExFattureincloud.Operations.id(),
  ExFattureincloud.API.options()
) :: ExFattureincloud.Response.result()
```

Calls a catalog operation by its snake_case name or OpenAPI operation ID.

See `ExFattureincloud.API.call/3` for path, query, and request body options.

# `new`

```elixir
@spec new(keyword()) :: ExFattureincloud.Client.t()
```

Creates an immutable client. See `ExFattureincloud.Client.new/1` for options.

To make OAuth requests before you have an access token, create a client
with the default options.

    iex> client = ExFattureincloud.new()
    iex> client.base_url
    "https://api-v2.fattureincloud.it"
    iex> client.token
    nil

# `request`

```elixir
@spec request(ExFattureincloud.Client.t(), atom(), String.t(), keyword()) ::
  ExFattureincloud.Response.result()
```

Makes a request to an API-relative path, including endpoints added after this SDK.

Supply a path starting with `/` and pass parameters separately as `:query`.
Pass `:body` for a JSON value or `:multipart` for a list of Req multipart
fields. `:accept` defaults to `"application/json"` and `:authenticated`
defaults to `true`.

# `unwrap!`

```elixir
@spec unwrap!(ExFattureincloud.Response.result()) :: ExFattureincloud.Response.t()
```

Returns the response or raises `ExFattureincloud.Error`.

---

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