# `Codat.Platform.SupplementalData`
[🔗](https://github.com/iamkanishka/codat.git/blob/v1.0.0/lib/codat/platform/supplemental_data.ex#L1)

Configure supplemental data — extra fields pulled from an integration and
merged into standard Codat data type responses.

Supplemental data allows you to capture integration-specific fields that
Codat doesn't expose by default (e.g., custom fields in QuickBooks, extra
metadata in Xero) and have them returned alongside the standard fields.

## How It Works

1. Configure a supplemental data property for a data type + integration pair
2. When Codat syncs that data type, it pulls the extra fields from the integration
3. The extra fields appear in `supplementalData.content` on each record

## Example

    # Configure supplemental data for invoices in QuickBooks Online
    {:ok, _} = Codat.Platform.SupplementalData.configure(client,
      "invoices",    # Codat data type
      "gbol",        # Integration key (QuickBooks Online)
      %{
        supplementalDataConfig: %{
          "CustomField1" => %{
            dataType: "invoices",
            pullData: %{
              "invoices" => "CustomField1.DefinitionId"   # Path in QBO API
            }
          }
        }
      }
    )

    # Now GET /companies/{id}/data/invoices will include:
    # %{
    #   "id" => "inv-1",
    #   ...standard fields...
    #   "supplementalData" => %{
    #     "content" => %{"CustomField1" => "value"}
    #   }
    # }

# `configure`

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

Sets the supplemental data configuration for a data type + integration pair.

## Parameters

- `data_type` — Codat data type, e.g. `"invoices"`, `"bills"`, `"customers"`
- `integration_key` — integration platform key, e.g. `"gbol"` (QuickBooks Online)
- `body` — configuration body (see module docs for shape)

## Example

    {:ok, _} = Codat.Platform.SupplementalData.configure(client,
      "invoices", "gbol",
      %{
        supplementalDataConfig: %{
          "PONumber" => %{
            dataType: "invoices",
            pullData: %{"invoices" => "PONumber"}
          }
        }
      }
    )

# `get_config`

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

Returns the supplemental data configuration for a data type and integration.

## Example

    {:ok, config} = Codat.Platform.SupplementalData.get_config(
      client, "invoices", "gbol"
    )

---

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