@11ma/billing-sdk
v0.2.5
Published
Billing export SDK — self-contained TypeScript client for PPA billing data over DAGQL
Maintainers
Readme
@11ma/billing-sdk
Self-contained TypeScript client for PPA billing data export over DAGQL.
Install
npm install @11ma/billing-sdkQuick Start
import { BillingClient } from "@11ma/billing-sdk"
const client = new BillingClient({
baseUrl: process.env.DAGQL_BASE_URL!,
getAuthToken: async () => process.env.DAGQL_API_KEY!,
getPassword: async () => process.env.DAGQL_APP_SECRET!,
})
// Single page
const response = await client.export("2024-01", { limit: 50 })
// Auto-paginate all organizations
for await (const org of client.exportAll("2024-01")) {
console.log(org.name, org.sites.length, "sites")
}
// Acknowledge receipt
await client.ack("2024-01", orgId)API
| Method | Description |
|--------|-------------|
| client.export(period, options?) | Fetch one page of billing data |
| client.exportAll(period, pageSize?) | Auto-paginating async generator |
| client.ack(period, orgId, options?) | Acknowledge receipt of billing data |
Rate Resolution
Pluggable strategies for escalation and rate structures:
import { BillingClient, compoundingEscalator, touRate } from "@11ma/billing-sdk"
const client = new BillingClient({
// ...auth config
resolution: {
escalator: compoundingEscalator, // or fixedEscalator
rateStructure: touRate, // or flatRate, tieredRate
},
})Documentation
Full interactive docs with live credentials available at /billing-sdk/docs in the PowerBuilDER app.
License
MIT
