Documentation
¶
Overview ¶
Package commerce is the typed client for the "commerce" app's internal ops.
Every call here is a ZAP call BY NAME over the peer's unix socket — no URL, no env var, no HTTP round trip, and no way to reach the public edge by accident. That last one is not a style preference: commerce's own callers used to reach it through CLOUD_COMMERCE_HTTP_URL, which defaulted to the api.hanzo.ai edge — the SAME binary — so the forwarder re-entered itself and the billing gate died of it. A call by name cannot express that mistake.
It depends on the CONTRACT (package plane) and never on commerce's implementation, so importing it costs a caller nothing but the types it is already sending.
Index ¶
- Constants
- Variables
- func FinanceAuthorize(ctx context.Context, in *plane.AuthorizeIn) (*plane.Verdict, error)
- func FinanceBalance(ctx context.Context, in *plane.BalanceIn) (*plane.Balance, error)
- func FinanceCredit(ctx context.Context, in *plane.CreditIn) (*plane.Credited, error)
- func FinanceRecord(ctx context.Context, in *plane.RecordIn) (*plane.Recorded, error)
- func FinanceScopeRules(ctx context.Context) (*plane.ScopeRules, error)
- func FinanceTxns(ctx context.Context) (*plane.Txns, error)
- func FinanceUsage(ctx context.Context) (*plane.UsageRows, error)
Constants ¶
const App = "commerce"
App is the peer's name, which is also the socket it answers on. It is the ONE place this package spells it.
Variables ¶
var Ops = []string{ plane.FinanceAuthorize, plane.FinanceBalance, plane.FinanceCredit, plane.FinanceRecord, plane.FinanceScopeRules, plane.FinanceTxns, plane.FinanceUsage, }
Ops is every op this peer answers, in the spelling the wire uses.
It exists so a test can hold this generated surface against the LIVE plane registry and fail when they disagree — which is what lets this be generated from source without the document drifting away from the program. See plane_registry_test.go.
Functions ¶
func FinanceAuthorize ¶
FinanceAuthorize authorize one prepaid spend.
Calls plane.FinanceAuthorize on commerce over the peer plane.
func FinanceBalance ¶
FinanceBalance spendable prepaid balance.
Calls plane.FinanceBalance on commerce over the peer plane.
func FinanceCredit ¶
FinanceCredit credit one subject's prepaid ledger, exactly once per ref.
Calls plane.FinanceCredit on commerce over the peer plane.
func FinanceRecord ¶
FinanceRecord debit one metered act.
Calls plane.FinanceRecord on commerce over the peer plane.
func FinanceScopeRules ¶
func FinanceScopeRules(ctx context.Context) (*plane.ScopeRules, error)
FinanceScopeRules per-scope request-rate ceilings from this org's spend-alert rows.
Calls plane.FinanceScopeRules on commerce over the peer plane.
func FinanceTxns ¶
FinanceTxns ledger entries for this org.
Calls plane.FinanceTxns on commerce over the peer plane.
Types ¶
This section is empty.