Change Data Capture helpers for incremental QuickBooks synchronization.
CDC responses are returned as grouped per-entity maps so callers can process changed records and deleted IDs without re-parsing the raw QuickBooks payload.
Summary
Functions
Fetches grouped CDC changes since the given checkpoint.
Groups a CDC response by entity name and preserves deleted IDs per entity.
Returns the currently supported CDC entity names.
Types
@type grouped_changes() :: %{optional(String.t()) => entity_group()}
Functions
@spec fetch( ExQuickbooks.Client.t(), [String.t() | atom()] | String.t() | atom(), String.t() | DateTime.t(), keyword() ) :: {:ok, grouped_changes()} | {:error, ExQuickbooks.Error.t()}
Fetches grouped CDC changes since the given checkpoint.
@spec group_changes([map()] | map()) :: {:ok, grouped_changes()} | {:error, ExQuickbooks.Error.t()}
Groups a CDC response by entity name and preserves deleted IDs per entity.
Examples
iex> ExQuickbooks.CDC.group_changes(%{
...> "CDCResponse" => [
...> %{
...> "Customer" => [%{"Id" => "123"}],
...> "DeletedId" => [%{"Type" => "Customer", "Id" => "456"}]
...> }
...> ]
...> })
{:ok,
%{
"Customer" => %{
records: [%{"Id" => "123"}],
deleted_ids: [%{"Type" => "Customer", "Id" => "456"}]
}
}}
@spec supported_entity_names() :: [String.t()]
Returns the currently supported CDC entity names.
Examples
iex> "Customer" in ExQuickbooks.CDC.supported_entity_names()
true