Expand description
ATP integration SDK for Rust applications.
The crate deliberately has no dependency on ATP’s AWS/backend implementation.
Enable the default axum feature for ready-made billing endpoints and guards;
use default-features = false for the framework-neutral client and claims API.
Re-exports§
pub use axum_integration::AuthenticatedBillingUser;pub use axum_integration::BillingContext;pub use axum_integration::BillingPrincipal;pub use axum_integration::BillingRouter;pub use axum_integration::BillingUserResolver;pub use axum_integration::ExtensionBillingUserResolver;pub use axum_integration::require_credits;pub use axum_integration::require_tier;
Modules§
- axum_
integration - Ready-made Axum routes, authenticated-principal adapters, request context, and guards.
Structs§
- ApiError
Body - ATP’s stable JSON error envelope.
- AtpClaims
- Stable, namespaced billing facts to embed under the
atpJWT claim. - AtpClient
- Cloneable, async client for ATP’s tenant-facing HTTP API.
- AtpClient
Builder - Builder for
AtpClienttransport and retry behavior. - Balance
- Current balances for a user, including an optional team contribution.
- Billing
Cache - Bounded, process-local store for recent per-user billing status.
- Billing
Cache Config - Bounds status-cache freshness, memory use, and outage behavior.
- Billing
Snapshot - Billing status plus cache/fallback provenance needed for safe decisions.
- Billing
Status - Entitlement and balance facts returned by the consolidated status endpoint.
- Cached
Billing Client - ATP client wrapper that caches status lookups but never caches writes.
- Checkout
Input - Browser-safe Checkout input for
crate::BillingRouter. - Checkout
Request - Server-to-server Checkout request including authenticated user identity.
- Checkout
Response - Newly created Stripe Checkout session.
- Claims
Enricher - Enriches an application’s existing claims object before its normal JWT signer runs.
- Debit
Request - Request to atomically consume credits for a business operation.
- Debit
Result - Result of a debit or refund, broken down by original credit source.
- Ledger
Entry - Immutable ledger fact describing one balance change.
- Portal
Input - Browser-safe Customer Portal input for
crate::BillingRouter. - Portal
Response - Newly created Stripe Customer Portal session.
- Refund
Request - Request to reverse one previously completed debit.
- Tier
Policy - Ordered tier hierarchy used by Axum’s minimum-tier guard.
Enums§
- Failure
Mode - Determines how a status lookup behaves when ATP cannot be reached.
- Purchase
- Product a user intends to buy through Stripe Checkout.
- SdkError
- Errors produced by client configuration, transport, or the ATP API.
- Snapshot
Source - Provenance of the status held by a
BillingSnapshot.
Traits§
- Billing
Provider - Framework-neutral source of a per-user billing snapshot.
- Claims
Target - Implement this for the claims object your existing authentication flow already signs. The SDK never verifies, rewrites, or signs JWTs itself.
Type Aliases§
- SdkResult
- Result alias used by all SDK operations.