Generic query helpers for QuickBooks Online.
The query helper accepts raw QuickBooks query statements and optionally
appends STARTPOSITION / MAXRESULTS clauses for caller-driven pagination.
Summary
Functions
Runs a raw QuickBooks query statement.
Extracts the primary top-level collection from a QueryResponse payload.
Functions
@spec run(ExQuickbooks.Client.t(), String.t(), keyword()) :: {:ok, map()} | {:error, ExQuickbooks.Error.t()}
Runs a raw QuickBooks query statement.
When :start_position or :max_results are provided, the helper appends the
matching STARTPOSITION and MAXRESULTS clauses unless the statement
already includes them.
@spec top_level_collection(map()) :: {:ok, {String.t(), list()}} | {:error, ExQuickbooks.Error.t()}
Extracts the primary top-level collection from a QueryResponse payload.
Examples
iex> ExQuickbooks.Query.top_level_collection(%{
...> "Customer" => [%{"Id" => "123"}],
...> "startPosition" => 1,
...> "maxResults" => 1
...> })
{:ok, {"Customer", [%{"Id" => "123"}]}}