getlago / lago-nodejs-client Goto Github PK
View Code? Open in Web Editor NEWJavascript wrapper for the Lago Rest API
License: MIT License
Javascript wrapper for the Lago Rest API
License: MIT License
This repository is now deprecated.
Please use https://github.com/getlago/lago-javascript-client that supports Typescript.
As we are using this package in our typescript project, it would be nice to have types defined so that we don't have to check if the shape of the objects change with each release.
Plans - CRUD
Coupons - CRUD
Billable metrics - CRUD
Add-ons - CRUD
Invoice - read, list all
Organization - update
Since introduction of billing configuration in order to support stripe as a payment provider, we need to update the client to support the new attributes.
Related to https://github.com/getlago/lago-product/issues/23
When calling get request methods of SDK like findBillableMetric
or findPlan
this line is executed , which returns the JSON Object {"billable_metric":{"lago_id":"fcb0e1b8-acd7-4c1a-9b39-2bd63ef6f6d8","name":"User Start","code":"star","description":"","aggregation_type":"count_agg","created_at":"2022-11-11T13:17:09Z","field_name":null,"group":{}}}
where as the caller expects the response to be a Javascript object and when it tries to read property from the object res.billable_metric
lago-nodejs-client/lib/client.js
Line 265 in 9a78def
Describe the bug
The export for billing_configuration is pointing to a non existent file.
Additional context
I believe you meant to point to lib/model/customer_billing_configuration
instead of lib/model/billing_configuration
How about using TypeScript to write source code?
I think there is no reason not to use TypeScript in this era.
Type definitions can be generated without much effort using json2ts.
Below is the result of generating type definitions from json example in the lago api reference
export interface Charge {
lago_id: string
charge_model: string
}
export interface Charge {
lago_id: string
charge_model: string
}
export interface BillableMetric {
lago_id: string
name: string
code: string
aggregation_type: string
}
export interface ChargesUsage {
units: string
amount_cents: number
amount_currency: string
charge: Charge
billable_metric: BillableMetric
groups: Record<string, any>
}
export interface CustomerUsage {
from_datetime: Date
to_datetime: Date
issuing_date: string
amount_cents: number
amount_currency: string
total_amount_cents: number
total_amount_currency: string
vat_amount_cents: number
vat_amount_currency: string
from_date: string
to_date: string
charges_usage: ChargesUsage[]
}
export interface CustomerUsageResult {
customer_usage: CustomerUsage
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.