lago-javascript-client 0.48.0-beta → 0.49.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,11 @@ export interface AddOnBaseInput {
4
4
  * @example "Setup Fee"
5
5
  */
6
6
  name?: string;
7
+ /**
8
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
9
+ * @example "Setup Fee (SF1)"
10
+ */
11
+ invoice_display_name?: string;
7
12
  /**
8
13
  * Unique code used to identify the add-on.
9
14
  * @example "setup_fee"
@@ -42,6 +47,11 @@ export interface AddOnObject {
42
47
  * @example "Setup Fee"
43
48
  */
44
49
  name: string;
50
+ /**
51
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
52
+ * @example "Setup Fee (SF1)"
53
+ */
54
+ invoice_display_name?: string;
45
55
  /**
46
56
  * Unique code used to identify the add-on.
47
57
  * @example "setup_fee"
@@ -380,10 +390,10 @@ export interface BillableMetricObject {
380
390
  */
381
391
  field_name?: string | null;
382
392
  /**
383
- * Aggregation method used to compute usage for this billable metric. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
393
+ * Aggregation method used to compute usage for this billable metric.
384
394
  * @example "sum_agg"
385
395
  */
386
- aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg";
396
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
387
397
  /**
388
398
  * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
389
399
  * @example "seconds"
@@ -438,10 +448,10 @@ export interface BillableMetricBaseInput {
438
448
  */
439
449
  field_name?: string | null;
440
450
  /**
441
- * Aggregation method used to compute usage for this billable metric. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
451
+ * Aggregation method used to compute usage for this billable metric.
442
452
  * @example "sum_agg"
443
453
  */
444
- aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg";
454
+ aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
445
455
  /**
446
456
  * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
447
457
  * @example "seconds"
@@ -502,6 +512,11 @@ export interface ChargeObject {
502
512
  * @example "requests"
503
513
  */
504
514
  billable_metric_code: string;
515
+ /**
516
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
517
+ * @example "Setup"
518
+ */
519
+ invoice_display_name?: string;
505
520
  /**
506
521
  * The date and time when the charge was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
507
522
  * @format date-time
@@ -1208,6 +1223,11 @@ export interface CustomerChargeUsageObject {
1208
1223
  * @example "1.0"
1209
1224
  */
1210
1225
  units: string;
1226
+ /**
1227
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1228
+ * @example 10
1229
+ */
1230
+ events_count: number;
1211
1231
  /**
1212
1232
  * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
1213
1233
  * @example 123
@@ -1277,6 +1297,11 @@ export interface CustomerChargeUsageObject {
1277
1297
  * @example "0.9"
1278
1298
  */
1279
1299
  units?: string;
1300
+ /**
1301
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1302
+ * @example 10
1303
+ */
1304
+ events_count?: number;
1280
1305
  /**
1281
1306
  * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1282
1307
  * @example 1000
@@ -1553,6 +1578,10 @@ export type CustomerObjectExtended = CustomerObject & {
1553
1578
  /** List of customer taxes */
1554
1579
  taxes?: TaxObject[];
1555
1580
  };
1581
+ export interface CustomerPastUsage {
1582
+ usage_periods: CustomerUsage[];
1583
+ meta: PaginationMeta;
1584
+ }
1556
1585
  export interface CustomersPaginated {
1557
1586
  customers: CustomerObjectExtended[];
1558
1587
  meta: PaginationMeta;
@@ -1579,6 +1608,12 @@ export interface CustomerUsageObject {
1579
1608
  * @example "2022-08-01T23:59:59Z"
1580
1609
  */
1581
1610
  issuing_date: string;
1611
+ /**
1612
+ * A unique identifier associated with the invoice related to this particular usage record.
1613
+ * @format uuid
1614
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1615
+ */
1616
+ lago_invoice_id?: string | null;
1582
1617
  /** The currency of the customer’s current usage. */
1583
1618
  currency?: Currency;
1584
1619
  /**
@@ -1822,6 +1857,11 @@ export interface FeeObject {
1822
1857
  * @example "external_id"
1823
1858
  */
1824
1859
  external_subscription_id?: string | null;
1860
+ /**
1861
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
1862
+ * @example "Setup Fee (SF1)"
1863
+ */
1864
+ invoice_display_name?: string;
1825
1865
  /**
1826
1866
  * The cost of this specific fee, excluding any applicable taxes.
1827
1867
  * @example 100
@@ -1929,6 +1969,11 @@ export interface FeeObject {
1929
1969
  * @example "Startup"
1930
1970
  */
1931
1971
  name: string;
1972
+ /**
1973
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
1974
+ * @example "Setup Fee (SF1)"
1975
+ */
1976
+ invoice_display_name?: string;
1932
1977
  /**
1933
1978
  * Unique identifier of the fee item, created by Lago. It can be the identifier of the `add-on`, the identifier of the `charge`, the identifier of the `credit` or the identifier of the `subscription`.
1934
1979
  * @format uuid
@@ -1984,6 +2029,11 @@ export interface GroupPropertiesObject {
1984
2029
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1985
2030
  */
1986
2031
  group_id: string;
2032
+ /**
2033
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual group will be used as the default display name.
2034
+ * @example "AWS"
2035
+ */
2036
+ invoice_display_name?: string;
1987
2037
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
1988
2038
  values: ChargeProperties;
1989
2039
  }
@@ -2168,6 +2218,11 @@ export interface InvoiceOneOffCreateInput {
2168
2218
  * @example "setup_fee"
2169
2219
  */
2170
2220
  add_on_code: string;
2221
+ /**
2222
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2223
+ * @example "Setup Fee (SF1)"
2224
+ */
2225
+ invoice_display_name?: string;
2171
2226
  /**
2172
2227
  * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
2173
2228
  * @example 12000
@@ -2440,6 +2495,11 @@ export interface PlanCreateInput {
2440
2495
  * @example "Startup"
2441
2496
  */
2442
2497
  name?: string;
2498
+ /**
2499
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2500
+ * @example "Startup plan"
2501
+ */
2502
+ invoice_display_name?: string;
2443
2503
  /**
2444
2504
  * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2445
2505
  * @example "startup"
@@ -2484,7 +2544,7 @@ export interface PlanCreateInput {
2484
2544
  tax_codes?: string[];
2485
2545
  /**
2486
2546
  * Additional usage-based charges for this plan.
2487
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2547
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2488
2548
  */
2489
2549
  charges?: {
2490
2550
  /**
@@ -2508,6 +2568,11 @@ export interface PlanCreateInput {
2508
2568
  * @example true
2509
2569
  */
2510
2570
  invoiceable?: boolean;
2571
+ /**
2572
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2573
+ * @example "Setup"
2574
+ */
2575
+ invoice_display_name?: string;
2511
2576
  /**
2512
2577
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2513
2578
  *
@@ -2549,6 +2614,11 @@ export interface PlanUpdateInput {
2549
2614
  * @example "Startup"
2550
2615
  */
2551
2616
  name?: string;
2617
+ /**
2618
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2619
+ * @example "Startup plan"
2620
+ */
2621
+ invoice_display_name?: string;
2552
2622
  /**
2553
2623
  * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2554
2624
  * @example "startup"
@@ -2593,7 +2663,7 @@ export interface PlanUpdateInput {
2593
2663
  tax_codes?: string[];
2594
2664
  /**
2595
2665
  * Additional usage-based charges for this plan.
2596
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2666
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2597
2667
  */
2598
2668
  charges?: {
2599
2669
  /**
@@ -2623,6 +2693,11 @@ export interface PlanUpdateInput {
2623
2693
  * @example true
2624
2694
  */
2625
2695
  invoiceable?: boolean;
2696
+ /**
2697
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2698
+ * @example "Setup"
2699
+ */
2700
+ invoice_display_name?: string;
2626
2701
  /**
2627
2702
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2628
2703
  *
@@ -2669,6 +2744,11 @@ export interface PlanObject {
2669
2744
  * @example "Startup"
2670
2745
  */
2671
2746
  name: string;
2747
+ /**
2748
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2749
+ * @example "Startup plan"
2750
+ */
2751
+ invoice_display_name?: string;
2672
2752
  /**
2673
2753
  * The date and time when the plan was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the plan was initially created.
2674
2754
  * @format date-time
@@ -2724,7 +2804,7 @@ export interface PlanObject {
2724
2804
  draft_invoices_count: number;
2725
2805
  /**
2726
2806
  * Additional usage-based charges for this plan.
2727
- * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2807
+ * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2728
2808
  */
2729
2809
  charges?: ChargeObject[];
2730
2810
  /** All taxes applied to the plan. */
@@ -3352,7 +3432,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
3352
3432
  }
3353
3433
  /**
3354
3434
  * @title Lago API documentation
3355
- * @version 0.48.0-beta
3435
+ * @version 0.49.0-beta
3356
3436
  * @license AGPLv3
3357
3437
  * @baseUrl https://api.getlago.com/api/v1
3358
3438
  * @externalDocs https://github.com/getlago
@@ -3788,6 +3868,42 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3788
3868
  */
3789
3869
  external_subscription_id: string;
3790
3870
  }, params?: RequestParams) => Promise<HttpResponse<CustomerUsage, ApiErrorUnauthorized | ApiErrorNotFound>>;
3871
+ /**
3872
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
3873
+ *
3874
+ * @tags customers
3875
+ * @name FindAllCustomerPastUsage
3876
+ * @summary Retrieve customer past usage
3877
+ * @request GET:/customers/{external_customer_id}/past_usage
3878
+ * @secure
3879
+ */
3880
+ findAllCustomerPastUsage: (externalCustomerId: string, query: {
3881
+ /**
3882
+ * Page number.
3883
+ * @example 1
3884
+ */
3885
+ page?: number;
3886
+ /**
3887
+ * Number of records per page.
3888
+ * @example 20
3889
+ */
3890
+ per_page?: number;
3891
+ /**
3892
+ * The unique identifier of the subscription within your application.
3893
+ * @example "sub_1234567890"
3894
+ */
3895
+ external_subscription_id: string;
3896
+ /**
3897
+ * Billable metric code filter to apply to the charge usage
3898
+ * @example "cpu"
3899
+ */
3900
+ billable_metric_code?: string;
3901
+ /**
3902
+ * Number of past billing period to returns in the result
3903
+ * @example 5
3904
+ */
3905
+ periods_count?: number;
3906
+ }, params?: RequestParams) => Promise<HttpResponse<CustomerPastUsage, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3791
3907
  };
3792
3908
  events: {
3793
3909
  /**
@@ -3807,6 +3923,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3807
3923
  * @name CreateBatchEvents
3808
3924
  * @summary Batch multiple events
3809
3925
  * @request POST:/events/batch
3926
+ * @deprecated
3810
3927
  * @secure
3811
3928
  */
3812
3929
  createBatchEvents: (data: EventBatchInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
@@ -4185,6 +4302,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4185
4302
  */
4186
4303
  status?: ("pending" | "canceled" | "terminated" | "active")[];
4187
4304
  }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
4305
+ /**
4306
+ * @description This endpoint retrieves a specific subscription.
4307
+ *
4308
+ * @tags subscriptions
4309
+ * @name FindSubscription
4310
+ * @summary Retrieve a subscription
4311
+ * @request GET:/subscriptions/{external_id}
4312
+ * @secure
4313
+ */
4314
+ findSubscription: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound>>;
4188
4315
  /**
4189
4316
  * @description This endpoint allows you to update a subscription.
4190
4317
  *
@@ -148,7 +148,7 @@ export class HttpClient {
148
148
  }
149
149
  /**
150
150
  * @title Lago API documentation
151
- * @version 0.48.0-beta
151
+ * @version 0.49.0-beta
152
152
  * @license AGPLv3
153
153
  * @baseUrl https://api.getlago.com/api/v1
154
154
  * @externalDocs https://github.com/getlago
@@ -692,6 +692,23 @@ export class Api extends HttpClient {
692
692
  format: "json",
693
693
  ...params,
694
694
  }),
695
+ /**
696
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
697
+ *
698
+ * @tags customers
699
+ * @name FindAllCustomerPastUsage
700
+ * @summary Retrieve customer past usage
701
+ * @request GET:/customers/{external_customer_id}/past_usage
702
+ * @secure
703
+ */
704
+ findAllCustomerPastUsage: (externalCustomerId, query, params = {}) => this.request({
705
+ path: `/customers/${externalCustomerId}/past_usage`,
706
+ method: "GET",
707
+ query: query,
708
+ secure: true,
709
+ format: "json",
710
+ ...params,
711
+ }),
695
712
  };
696
713
  events = {
697
714
  /**
@@ -718,6 +735,7 @@ export class Api extends HttpClient {
718
735
  * @name CreateBatchEvents
719
736
  * @summary Batch multiple events
720
737
  * @request POST:/events/batch
738
+ * @deprecated
721
739
  * @secure
722
740
  */
723
741
  createBatchEvents: (data, params = {}) => this.request({
@@ -1093,6 +1111,22 @@ export class Api extends HttpClient {
1093
1111
  format: "json",
1094
1112
  ...params,
1095
1113
  }),
1114
+ /**
1115
+ * @description This endpoint retrieves a specific subscription.
1116
+ *
1117
+ * @tags subscriptions
1118
+ * @name FindSubscription
1119
+ * @summary Retrieve a subscription
1120
+ * @request GET:/subscriptions/{external_id}
1121
+ * @secure
1122
+ */
1123
+ findSubscription: (externalId, params = {}) => this.request({
1124
+ path: `/subscriptions/${externalId}`,
1125
+ method: "GET",
1126
+ secure: true,
1127
+ format: "json",
1128
+ ...params,
1129
+ }),
1096
1130
  /**
1097
1131
  * @description This endpoint allows you to update a subscription.
1098
1132
  *
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/mod.js",
4
4
  "name": "lago-javascript-client",
5
5
  "sideEffects": false,
6
- "version": "v0.48.0-beta",
6
+ "version": "v0.49.0-beta",
7
7
  "description": "Lago JavaScript API Client",
8
8
  "repository": {
9
9
  "type": "git",
@@ -4,6 +4,11 @@ export interface AddOnBaseInput {
4
4
  * @example "Setup Fee"
5
5
  */
6
6
  name?: string;
7
+ /**
8
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
9
+ * @example "Setup Fee (SF1)"
10
+ */
11
+ invoice_display_name?: string;
7
12
  /**
8
13
  * Unique code used to identify the add-on.
9
14
  * @example "setup_fee"
@@ -42,6 +47,11 @@ export interface AddOnObject {
42
47
  * @example "Setup Fee"
43
48
  */
44
49
  name: string;
50
+ /**
51
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
52
+ * @example "Setup Fee (SF1)"
53
+ */
54
+ invoice_display_name?: string;
45
55
  /**
46
56
  * Unique code used to identify the add-on.
47
57
  * @example "setup_fee"
@@ -380,10 +390,10 @@ export interface BillableMetricObject {
380
390
  */
381
391
  field_name?: string | null;
382
392
  /**
383
- * Aggregation method used to compute usage for this billable metric. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
393
+ * Aggregation method used to compute usage for this billable metric.
384
394
  * @example "sum_agg"
385
395
  */
386
- aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg";
396
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
387
397
  /**
388
398
  * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
389
399
  * @example "seconds"
@@ -438,10 +448,10 @@ export interface BillableMetricBaseInput {
438
448
  */
439
449
  field_name?: string | null;
440
450
  /**
441
- * Aggregation method used to compute usage for this billable metric. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
451
+ * Aggregation method used to compute usage for this billable metric.
442
452
  * @example "sum_agg"
443
453
  */
444
- aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg";
454
+ aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
445
455
  /**
446
456
  * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
447
457
  * @example "seconds"
@@ -502,6 +512,11 @@ export interface ChargeObject {
502
512
  * @example "requests"
503
513
  */
504
514
  billable_metric_code: string;
515
+ /**
516
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
517
+ * @example "Setup"
518
+ */
519
+ invoice_display_name?: string;
505
520
  /**
506
521
  * The date and time when the charge was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
507
522
  * @format date-time
@@ -1208,6 +1223,11 @@ export interface CustomerChargeUsageObject {
1208
1223
  * @example "1.0"
1209
1224
  */
1210
1225
  units: string;
1226
+ /**
1227
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1228
+ * @example 10
1229
+ */
1230
+ events_count: number;
1211
1231
  /**
1212
1232
  * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
1213
1233
  * @example 123
@@ -1277,6 +1297,11 @@ export interface CustomerChargeUsageObject {
1277
1297
  * @example "0.9"
1278
1298
  */
1279
1299
  units?: string;
1300
+ /**
1301
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1302
+ * @example 10
1303
+ */
1304
+ events_count?: number;
1280
1305
  /**
1281
1306
  * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1282
1307
  * @example 1000
@@ -1553,6 +1578,10 @@ export type CustomerObjectExtended = CustomerObject & {
1553
1578
  /** List of customer taxes */
1554
1579
  taxes?: TaxObject[];
1555
1580
  };
1581
+ export interface CustomerPastUsage {
1582
+ usage_periods: CustomerUsage[];
1583
+ meta: PaginationMeta;
1584
+ }
1556
1585
  export interface CustomersPaginated {
1557
1586
  customers: CustomerObjectExtended[];
1558
1587
  meta: PaginationMeta;
@@ -1579,6 +1608,12 @@ export interface CustomerUsageObject {
1579
1608
  * @example "2022-08-01T23:59:59Z"
1580
1609
  */
1581
1610
  issuing_date: string;
1611
+ /**
1612
+ * A unique identifier associated with the invoice related to this particular usage record.
1613
+ * @format uuid
1614
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1615
+ */
1616
+ lago_invoice_id?: string | null;
1582
1617
  /** The currency of the customer’s current usage. */
1583
1618
  currency?: Currency;
1584
1619
  /**
@@ -1822,6 +1857,11 @@ export interface FeeObject {
1822
1857
  * @example "external_id"
1823
1858
  */
1824
1859
  external_subscription_id?: string | null;
1860
+ /**
1861
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
1862
+ * @example "Setup Fee (SF1)"
1863
+ */
1864
+ invoice_display_name?: string;
1825
1865
  /**
1826
1866
  * The cost of this specific fee, excluding any applicable taxes.
1827
1867
  * @example 100
@@ -1929,6 +1969,11 @@ export interface FeeObject {
1929
1969
  * @example "Startup"
1930
1970
  */
1931
1971
  name: string;
1972
+ /**
1973
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
1974
+ * @example "Setup Fee (SF1)"
1975
+ */
1976
+ invoice_display_name?: string;
1932
1977
  /**
1933
1978
  * Unique identifier of the fee item, created by Lago. It can be the identifier of the `add-on`, the identifier of the `charge`, the identifier of the `credit` or the identifier of the `subscription`.
1934
1979
  * @format uuid
@@ -1984,6 +2029,11 @@ export interface GroupPropertiesObject {
1984
2029
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1985
2030
  */
1986
2031
  group_id: string;
2032
+ /**
2033
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual group will be used as the default display name.
2034
+ * @example "AWS"
2035
+ */
2036
+ invoice_display_name?: string;
1987
2037
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
1988
2038
  values: ChargeProperties;
1989
2039
  }
@@ -2168,6 +2218,11 @@ export interface InvoiceOneOffCreateInput {
2168
2218
  * @example "setup_fee"
2169
2219
  */
2170
2220
  add_on_code: string;
2221
+ /**
2222
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2223
+ * @example "Setup Fee (SF1)"
2224
+ */
2225
+ invoice_display_name?: string;
2171
2226
  /**
2172
2227
  * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
2173
2228
  * @example 12000
@@ -2440,6 +2495,11 @@ export interface PlanCreateInput {
2440
2495
  * @example "Startup"
2441
2496
  */
2442
2497
  name?: string;
2498
+ /**
2499
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2500
+ * @example "Startup plan"
2501
+ */
2502
+ invoice_display_name?: string;
2443
2503
  /**
2444
2504
  * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2445
2505
  * @example "startup"
@@ -2484,7 +2544,7 @@ export interface PlanCreateInput {
2484
2544
  tax_codes?: string[];
2485
2545
  /**
2486
2546
  * Additional usage-based charges for this plan.
2487
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2547
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2488
2548
  */
2489
2549
  charges?: {
2490
2550
  /**
@@ -2508,6 +2568,11 @@ export interface PlanCreateInput {
2508
2568
  * @example true
2509
2569
  */
2510
2570
  invoiceable?: boolean;
2571
+ /**
2572
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2573
+ * @example "Setup"
2574
+ */
2575
+ invoice_display_name?: string;
2511
2576
  /**
2512
2577
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2513
2578
  *
@@ -2549,6 +2614,11 @@ export interface PlanUpdateInput {
2549
2614
  * @example "Startup"
2550
2615
  */
2551
2616
  name?: string;
2617
+ /**
2618
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2619
+ * @example "Startup plan"
2620
+ */
2621
+ invoice_display_name?: string;
2552
2622
  /**
2553
2623
  * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2554
2624
  * @example "startup"
@@ -2593,7 +2663,7 @@ export interface PlanUpdateInput {
2593
2663
  tax_codes?: string[];
2594
2664
  /**
2595
2665
  * Additional usage-based charges for this plan.
2596
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2666
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2597
2667
  */
2598
2668
  charges?: {
2599
2669
  /**
@@ -2623,6 +2693,11 @@ export interface PlanUpdateInput {
2623
2693
  * @example true
2624
2694
  */
2625
2695
  invoiceable?: boolean;
2696
+ /**
2697
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2698
+ * @example "Setup"
2699
+ */
2700
+ invoice_display_name?: string;
2626
2701
  /**
2627
2702
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2628
2703
  *
@@ -2669,6 +2744,11 @@ export interface PlanObject {
2669
2744
  * @example "Startup"
2670
2745
  */
2671
2746
  name: string;
2747
+ /**
2748
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2749
+ * @example "Startup plan"
2750
+ */
2751
+ invoice_display_name?: string;
2672
2752
  /**
2673
2753
  * The date and time when the plan was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the plan was initially created.
2674
2754
  * @format date-time
@@ -2724,7 +2804,7 @@ export interface PlanObject {
2724
2804
  draft_invoices_count: number;
2725
2805
  /**
2726
2806
  * Additional usage-based charges for this plan.
2727
- * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2807
+ * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2728
2808
  */
2729
2809
  charges?: ChargeObject[];
2730
2810
  /** All taxes applied to the plan. */
@@ -3352,7 +3432,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
3352
3432
  }
3353
3433
  /**
3354
3434
  * @title Lago API documentation
3355
- * @version 0.48.0-beta
3435
+ * @version 0.49.0-beta
3356
3436
  * @license AGPLv3
3357
3437
  * @baseUrl https://api.getlago.com/api/v1
3358
3438
  * @externalDocs https://github.com/getlago
@@ -3788,6 +3868,42 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3788
3868
  */
3789
3869
  external_subscription_id: string;
3790
3870
  }, params?: RequestParams) => Promise<HttpResponse<CustomerUsage, ApiErrorUnauthorized | ApiErrorNotFound>>;
3871
+ /**
3872
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
3873
+ *
3874
+ * @tags customers
3875
+ * @name FindAllCustomerPastUsage
3876
+ * @summary Retrieve customer past usage
3877
+ * @request GET:/customers/{external_customer_id}/past_usage
3878
+ * @secure
3879
+ */
3880
+ findAllCustomerPastUsage: (externalCustomerId: string, query: {
3881
+ /**
3882
+ * Page number.
3883
+ * @example 1
3884
+ */
3885
+ page?: number;
3886
+ /**
3887
+ * Number of records per page.
3888
+ * @example 20
3889
+ */
3890
+ per_page?: number;
3891
+ /**
3892
+ * The unique identifier of the subscription within your application.
3893
+ * @example "sub_1234567890"
3894
+ */
3895
+ external_subscription_id: string;
3896
+ /**
3897
+ * Billable metric code filter to apply to the charge usage
3898
+ * @example "cpu"
3899
+ */
3900
+ billable_metric_code?: string;
3901
+ /**
3902
+ * Number of past billing period to returns in the result
3903
+ * @example 5
3904
+ */
3905
+ periods_count?: number;
3906
+ }, params?: RequestParams) => Promise<HttpResponse<CustomerPastUsage, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3791
3907
  };
3792
3908
  events: {
3793
3909
  /**
@@ -3807,6 +3923,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3807
3923
  * @name CreateBatchEvents
3808
3924
  * @summary Batch multiple events
3809
3925
  * @request POST:/events/batch
3926
+ * @deprecated
3810
3927
  * @secure
3811
3928
  */
3812
3929
  createBatchEvents: (data: EventBatchInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
@@ -4185,6 +4302,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4185
4302
  */
4186
4303
  status?: ("pending" | "canceled" | "terminated" | "active")[];
4187
4304
  }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
4305
+ /**
4306
+ * @description This endpoint retrieves a specific subscription.
4307
+ *
4308
+ * @tags subscriptions
4309
+ * @name FindSubscription
4310
+ * @summary Retrieve a subscription
4311
+ * @request GET:/subscriptions/{external_id}
4312
+ * @secure
4313
+ */
4314
+ findSubscription: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound>>;
4188
4315
  /**
4189
4316
  * @description This endpoint allows you to update a subscription.
4190
4317
  *
@@ -152,7 +152,7 @@ class HttpClient {
152
152
  exports.HttpClient = HttpClient;
153
153
  /**
154
154
  * @title Lago API documentation
155
- * @version 0.48.0-beta
155
+ * @version 0.49.0-beta
156
156
  * @license AGPLv3
157
157
  * @baseUrl https://api.getlago.com/api/v1
158
158
  * @externalDocs https://github.com/getlago
@@ -696,6 +696,23 @@ class Api extends HttpClient {
696
696
  format: "json",
697
697
  ...params,
698
698
  }),
699
+ /**
700
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
701
+ *
702
+ * @tags customers
703
+ * @name FindAllCustomerPastUsage
704
+ * @summary Retrieve customer past usage
705
+ * @request GET:/customers/{external_customer_id}/past_usage
706
+ * @secure
707
+ */
708
+ findAllCustomerPastUsage: (externalCustomerId, query, params = {}) => this.request({
709
+ path: `/customers/${externalCustomerId}/past_usage`,
710
+ method: "GET",
711
+ query: query,
712
+ secure: true,
713
+ format: "json",
714
+ ...params,
715
+ }),
699
716
  };
700
717
  events = {
701
718
  /**
@@ -722,6 +739,7 @@ class Api extends HttpClient {
722
739
  * @name CreateBatchEvents
723
740
  * @summary Batch multiple events
724
741
  * @request POST:/events/batch
742
+ * @deprecated
725
743
  * @secure
726
744
  */
727
745
  createBatchEvents: (data, params = {}) => this.request({
@@ -1097,6 +1115,22 @@ class Api extends HttpClient {
1097
1115
  format: "json",
1098
1116
  ...params,
1099
1117
  }),
1118
+ /**
1119
+ * @description This endpoint retrieves a specific subscription.
1120
+ *
1121
+ * @tags subscriptions
1122
+ * @name FindSubscription
1123
+ * @summary Retrieve a subscription
1124
+ * @request GET:/subscriptions/{external_id}
1125
+ * @secure
1126
+ */
1127
+ findSubscription: (externalId, params = {}) => this.request({
1128
+ path: `/subscriptions/${externalId}`,
1129
+ method: "GET",
1130
+ secure: true,
1131
+ format: "json",
1132
+ ...params,
1133
+ }),
1100
1134
  /**
1101
1135
  * @description This endpoint allows you to update a subscription.
1102
1136
  *