PaperTiger.DataSource behaviour (PaperTiger v1.0.2)

Copy Markdown View Source

Behaviour for an external data source that can preload PaperTiger stores.

Implementations should return lists of maps with atom keys matching Stripe resource shapes (e.g. %{id: "price_123", unit_amount: 500, ...}).

This behaviour is intentionally minimal and supports only loading the resources PaperTiger needs at bootstrap but can be extended.

Summary

Callbacks

Return a list of Customer-like maps with atom keys.

Return a list of PaymentMethod-like maps with atom keys.

Return a list of Plan-like maps with atom keys.

Return a list of Price-like maps with atom keys.

Return a list of Product-like maps with atom keys.

Return a list of SubscriptionItem-like maps with atom keys.

Return a list of Subscription-like maps with atom keys.

Callbacks

load_customers()

@callback load_customers() :: [map()]

Return a list of Customer-like maps with atom keys.

load_payment_methods()

@callback load_payment_methods() :: [map()]

Return a list of PaymentMethod-like maps with atom keys.

load_plans()

@callback load_plans() :: [map()]

Return a list of Plan-like maps with atom keys.

load_prices()

@callback load_prices() :: [map()]

Return a list of Price-like maps with atom keys.

load_products()

@callback load_products() :: [map()]

Return a list of Product-like maps with atom keys.

load_subscription_items()

@callback load_subscription_items() :: [map()]

Return a list of SubscriptionItem-like maps with atom keys.

load_subscriptions()

@callback load_subscriptions() :: [map()]

Return a list of Subscription-like maps with atom keys.