# `Pluggy.Investments`
[🔗](https://github.com/fellipessanha/pluggy_ai_ex/blob/main/lib/pluggy/investments.ex#L1)

Functions for interacting with the Pluggy Investments API.

# `get`

```elixir
@spec get(Pluggy.Client.t(), String.t()) :: {:ok, term()} | {:error, Pluggy.Error.t()}
```

Gets an investment by ID.

# `get!`

```elixir
@spec get!(Pluggy.Client.t(), String.t()) :: term()
```

# `list`

```elixir
@spec list(Pluggy.Client.t(), String.t() | map(), keyword()) ::
  {:ok, term()} | {:error, Pluggy.Error.t()}
```

Lists investments for a given item.

The second argument accepts either an item ID string or an item map
(e.g. the result of `Pluggy.Items.get/2`) — the `:id` field is extracted
automatically.

## Examples

    Pluggy.Investments.list(client, "item-uuid")
    Pluggy.Investments.list(client, item)   # item is %{id: "item-uuid", ...}

# `list!`

```elixir
@spec list!(Pluggy.Client.t(), String.t() | map(), keyword()) :: term()
```

# `list_with_cursor`

```elixir
@spec list_with_cursor(Pluggy.Client.t(), String.t() | map(), keyword()) ::
  {:ok, map(), Pluggy.HTTP.Cursor.t() | nil} | {:error, Pluggy.Error.t()}
```

Lists investments with cursor-based pagination.

The second argument accepts either an item ID string or an item map —
the `:id` field is extracted automatically.

Returns `{:ok, response, cursor}` where `cursor` is a `%Pluggy.HTTP.Cursor{}`
when more pages are available, or `nil` when on the last page.

Pass the cursor to `Pluggy.HTTP.with_cursor/1` to fetch the next page.

# `transactions`

```elixir
@spec transactions(Pluggy.Client.t(), String.t() | map(), keyword()) ::
  {:ok, term()} | {:error, Pluggy.Error.t()}
```

Fetches transactions for an investment.

The second argument accepts either an investment ID string or an investment map
(e.g. an entry from `Pluggy.Investments.list/2`) — the `:id` field is extracted
automatically:

    {:ok, %{results: [investment | _]}} = Pluggy.Investments.list(client, item_id)
    Pluggy.Investments.transactions(client, investment)

# `transactions!`

```elixir
@spec transactions!(Pluggy.Client.t(), String.t() | map(), keyword()) :: term()
```

---

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