# `Codat.BankFeeds.SourceAccounts`
[🔗](https://github.com/iamkanishka/codat.git/blob/v1.0.0/lib/codat/bank_feeds/bank_feeds.ex#L1)

Manage source bank accounts for bank feeds.

Source accounts are the bank/credit card accounts in your application
that you want to feed into a customer's accounting software.

## Lifecycle

1. Create a bank feed connection via `Codat.Platform.Connections.create/3`
   with the appropriate Bank Feeds integration key
2. Create source accounts here
3. Ask the customer to map source accounts to their chart of accounts
   via `Codat.BankFeeds.AccountMapping`
4. Push transactions via `Codat.BankFeeds.Transactions`

## Example

    {:ok, account} = Codat.BankFeeds.SourceAccounts.create(client, company_id, conn_id, %{
      accountName: "Business Checking",
      accountNumber: "12345678",
      accountType: "Checking",
      currency: "USD",
      balance: 10_000.00
    })

# `create`

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

Creates a new bankFeedAccounts (async). Returns a push operation.

# `delete`

```elixir
@spec delete(Codat.Client.t() | String.t(), String.t(), String.t() | keyword()) ::
  {:ok, nil} | {:error, Codat.Error.t()}
```

Deletes a bankFeedAccounts by ID (async).

# `fetch_all`

```elixir
@spec fetch_all(Codat.Client.t() | String.t(), String.t() | keyword(), keyword()) ::
  {:ok, [map()]} | {:error, Codat.Error.t()}
```

Fetches all bankFeedAccounts across all pages concurrently.

# `get`

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

Fetches a single bankFeedAccounts by ID.

# `get_create_model`

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

Returns the push model for creating bankFeedAccounts.

# `get_update_model`

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

Returns the push model for updating a bankFeedAccounts record.

# `list`

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

Returns a paginated list of bankFeedAccounts.

# `stream`

```elixir
@spec stream(Codat.Client.t() | String.t(), String.t() | keyword(), keyword()) ::
  Enumerable.t()
```

Returns a lazy `Stream` of all results.

# `update`

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

Updates an existing bankFeedAccounts (async).

# `update_batch`

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

Updates multiple source accounts in a single request.

## Example

    {:ok, accounts} = Codat.BankFeeds.SourceAccounts.update_batch(
      client, company_id, conn_id,
      [%{id: "acc-1", balance: 12_500.00}, %{id: "acc-2", balance: 500.00}]
    )

---

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