Unified donations fetcher factory.
Three overload signatures are exposed so the return type is
narrowed to the concrete underlying fetcher when the caller
passes a string-literal charityType. This matters because
Tiltify and Twitch donations paginate differently:
metadata.after).
The returned closure expects pageParam: string | null | undefined
and returns PaginatedResponse<TiltifyDonation, TiltifyPaginationMetadata>.metadata.nextPage).
The returned closure expects pageParam: number | null | undefined
and returns PaginatedResponse<TiltifyDonation, TwitchPaginationMetadata>.
Note that even on the Twitch path the rows are shaped as
TiltifyDonation — the per-row conversion happens inside the
factory via convertTwitchToTiltifyDonation.When the caller passes a runtime-typed CharityType (the
fallthrough overload) the union of both shapes is returned and the
caller must narrow before consuming pageParam.
Both underlying factories are themselves cursor-aware closures
shaped to plug directly into TanStack Query's useInfiniteQuery.
Source-platform campaign UUID.
String-literal "tiltify" / "twitch"
to engage the typed overloads; a runtime CharityType to use the
fallthrough.
Optionalconfig?: DonationFetchConfigDonationFetchConfig (completedBefore,
completedAfter, test-flag toggles, caching). Twitch reads only
the two timestamp filters; the rest are Tiltify-only.
Optionalcount?: numberPage size, clamped to 100 by the Tiltify client. Defaults to 100.
OptionalisTeam?: booleanTiltify-only: route through team_campaigns.
Ignored on the Twitch path.
Tiltify overload — see the main createDonationsFetcher docblock.
A cursor-aware closure where pageParam is the Tiltify
opaque after cursor and the response carries
metadata.after / metadata.before for cursor advancement.
Fallthrough overload — used when
charityTypeis a runtime value (CharityType) rather than a string literal. The return type is the union of both Tiltify + Twitch shapes; consumers must narrow onmetadata.aftervs.metadata.nextPagebefore advancing.See the main createDonationsFetcher docblock for full behavior notes.