Protocol for provider-agnostic billing record extraction
# Source: https://github.com/polarsource/polar | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from collections.abc import AsyncIterator, Sequence
from dataclasses import dataclass
from typing import Any, Protocol
from ..canonical import CanonicalAccount, CanonicalRecord, CanonicalSubscription
@dataclass(frozen=True)
class ExtractionPage:
records: Sequence[CanonicalRecord]
next_cursor: dict[str, Any] | None
class SourceAdapter(Protocol):
"""Reads one billing provider into provider-agnostic CanonicalRecords.
``extract`` is an async iterator because source data can be huge and must be
streamed, not materialized. Credential validation is provider-specific and
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key