Shared helpers for Stripe-style list endpoint filtering.
Resource modules still declare their own supported filters. This module only provides typed matching, created-range filtering, and list-item expansion so filtering happens before cursor pagination consistently across resources.
Summary
Functions
Applies a resource's declared list filters to items.
Expands objects inside a list response.
Rejects unsupported parameter combinations before filtering.
Types
@type filter() :: {:boolean, atom()} | {:boolean, atom(), atom()} | {:string, atom()} | {:string, atom(), atom()} | {:enum, atom(), [String.t()]} | {:enum, atom(), atom(), [String.t()]} | {:string_in, atom(), atom(), keyword()} | {:nested_enum, [atom()], [String.t()]} | {:nested_string, [atom()]} | {:created, atom()}
Functions
@spec apply([map()], map(), [filter()]) :: {:ok, [map()]} | {:error, PaperTiger.Error.t()}
Applies a resource's declared list filters to items.
@spec expand_page(PaperTiger.List.t(), map()) :: PaperTiger.List.t()
Expands objects inside a list response.
Stripe list expansion paths are usually prefixed with data., for example
expand[]=data.product. Single-object paths are accepted too because tests
and clients sometimes reuse retrieve-style params with list endpoints.
@spec reject_combination(map(), atom(), [atom()]) :: :ok | {:error, PaperTiger.Error.t()}
Rejects unsupported parameter combinations before filtering.