lago-javascript-client 0.53.0-beta → 0.56.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.
@@ -174,7 +174,7 @@ export interface AppliedCouponInput {
174
174
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
175
175
  * @example "recurring"
176
176
  */
177
- frequency?: "once" | "recurring" | null;
177
+ frequency?: "once" | "recurring" | "forever" | null;
178
178
  /**
179
179
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
180
180
  * @example 3
@@ -260,7 +260,7 @@ export interface AppliedCouponObject {
260
260
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
261
261
  * @example "recurring"
262
262
  */
263
- frequency: "once" | "recurring";
263
+ frequency: "once" | "recurring" | "forever";
264
264
  /**
265
265
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
266
266
  * @example 3
@@ -663,6 +663,11 @@ export interface ChargeProperties {
663
663
  * @example "1.75"
664
664
  */
665
665
  per_transaction_min_amount?: string | null;
666
+ /**
667
+ * The list of event properties that are used to group the events on the invoice for a `standard` charge model.
668
+ * @example ["agent_name"]
669
+ */
670
+ grouped_by?: string[];
666
671
  /** Volume ranges, sorted from bottom to top tiers, used for a `volume` charge model. */
667
672
  volume_ranges?: {
668
673
  /**
@@ -746,7 +751,7 @@ export interface CouponBaseInput {
746
751
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
747
752
  * @example "recurring"
748
753
  */
749
- frequency?: "once" | "recurring";
754
+ frequency?: "once" | "recurring" | "forever";
750
755
  /**
751
756
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
752
757
  * @example 6
@@ -859,7 +864,7 @@ export interface CouponObject {
859
864
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
860
865
  * @example "recurring"
861
866
  */
862
- frequency: "once" | "recurring";
867
+ frequency: "once" | "recurring" | "forever";
863
868
  /**
864
869
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
865
870
  * @example 6
@@ -1315,6 +1320,11 @@ export interface CustomerBillingConfiguration {
1315
1320
  * @example "stripe"
1316
1321
  */
1317
1322
  payment_provider?: "stripe" | "adyen" | "gocardless";
1323
+ /**
1324
+ * Unique code used to identify a payment provider connection.
1325
+ * @example "stripe-eu-1"
1326
+ */
1327
+ payment_provider_code?: string;
1318
1328
  /**
1319
1329
  * The customer ID within the payment provider's system. If this field is not provided, Lago has the option to create a new customer record within the payment provider's system on behalf of the customer
1320
1330
  * @example "cus_12345"
@@ -1341,6 +1351,64 @@ export interface CustomerBillingConfiguration {
1341
1351
  */
1342
1352
  provider_payment_methods?: string[] | null;
1343
1353
  }
1354
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
1355
+ export type CustomerChargeGroupedUsageObject = {
1356
+ /**
1357
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1358
+ * @example 1000
1359
+ */
1360
+ amount_cents?: number;
1361
+ /**
1362
+ * 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.
1363
+ * @example 10
1364
+ */
1365
+ events_count?: number;
1366
+ /**
1367
+ * The number of units consumed for a specific group related to a charge item.
1368
+ * @pattern ^[0-9]+.?[0-9]*$
1369
+ * @example "0.9"
1370
+ */
1371
+ units?: string;
1372
+ /** Key value list of event properties aggregated by the charge model */
1373
+ grouped_by?: Record<string, string>;
1374
+ /** Array of group object, representing multiple dimensions for a charge item. */
1375
+ groups?: CustomerChargeGroupsUsageObject;
1376
+ }[];
1377
+ /** Array of group object, representing multiple dimensions for a charge item. */
1378
+ export type CustomerChargeGroupsUsageObject = {
1379
+ /**
1380
+ * Unique identifier assigned to the group within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the group record within the Lago system.
1381
+ * @format uuid
1382
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1383
+ */
1384
+ lago_id?: string;
1385
+ /**
1386
+ * The group key, only returned for groups with two dimensions.
1387
+ * @example null
1388
+ */
1389
+ key?: string | null;
1390
+ /**
1391
+ * The group value.
1392
+ * @example "europe"
1393
+ */
1394
+ value?: string;
1395
+ /**
1396
+ * The number of units consumed for a specific group related to a charge item.
1397
+ * @pattern ^[0-9]+.?[0-9]*$
1398
+ * @example "0.9"
1399
+ */
1400
+ units?: string;
1401
+ /**
1402
+ * 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.
1403
+ * @example 10
1404
+ */
1405
+ events_count?: number;
1406
+ /**
1407
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1408
+ * @example 1000
1409
+ */
1410
+ amount_cents?: number;
1411
+ }[];
1344
1412
  export interface CustomerChargeUsageObject {
1345
1413
  /**
1346
1414
  * The number of units consumed by the customer for a specific charge item.
@@ -1404,40 +1472,9 @@ export interface CustomerChargeUsageObject {
1404
1472
  aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg";
1405
1473
  };
1406
1474
  /** Array of group object, representing multiple dimensions for a charge item. */
1407
- groups: {
1408
- /**
1409
- * Unique identifier assigned to the group within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the group record within the Lago system.
1410
- * @format uuid
1411
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1412
- */
1413
- lago_id?: string;
1414
- /**
1415
- * The group key, only returned for groups with two dimensions.
1416
- * @example null
1417
- */
1418
- key?: string | null;
1419
- /**
1420
- * The group value.
1421
- * @example "europe"
1422
- */
1423
- value?: string;
1424
- /**
1425
- * The number of units consumed for a specific group related to a charge item.
1426
- * @pattern ^[0-9]+.?[0-9]*$
1427
- * @example "0.9"
1428
- */
1429
- units?: string;
1430
- /**
1431
- * 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.
1432
- * @example 10
1433
- */
1434
- events_count?: number;
1435
- /**
1436
- * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1437
- * @example 1000
1438
- */
1439
- amount_cents?: number;
1440
- }[];
1475
+ groups: CustomerChargeGroupsUsageObject;
1476
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
1477
+ grouped_usage?: CustomerChargeGroupedUsageObject;
1441
1478
  }
1442
1479
  export interface CustomerCreateInput {
1443
1480
  customer: {
@@ -1768,42 +1805,7 @@ export interface Event {
1768
1805
  event: EventObject;
1769
1806
  }
1770
1807
  export interface EventBatchInput {
1771
- event: {
1772
- /**
1773
- * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
1774
- * @example "transaction_1234567890"
1775
- */
1776
- transaction_id: string;
1777
- /**
1778
- * The customer external unique identifier (provided by your own application). This field is optional if you send the `external_subscription_ids`, targeting a specific subscription.
1779
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1780
- */
1781
- external_customer_id?: string;
1782
- /**
1783
- * Array of unique identifiers of the targeted subscriptions within your application.
1784
- * @example ["sub_1234567890","sub_0987654321"]
1785
- */
1786
- external_subscription_ids: string[];
1787
- /**
1788
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1789
- * @example "storage"
1790
- */
1791
- code: string;
1792
- /**
1793
- * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
1794
- * @example 1651240791
1795
- */
1796
- timestamp?: number;
1797
- /**
1798
- * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
1799
- * @example {"gb":10}
1800
- */
1801
- properties?: {
1802
- /** The `operation_type` field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a `unique_count_agg` aggregation method. In other cases, the `operation_type` field is not required. The valid values for the `operation_type` field are `add` or `remove`, which indicate whether the unit is being added or removed from the unique count aggregation, respectively. */
1803
- operation_type?: "add" | "remove";
1804
- [key: string]: any;
1805
- };
1806
- };
1808
+ events: EventInput[];
1807
1809
  }
1808
1810
  export interface EventEstimateFeesInput {
1809
1811
  event: {
@@ -2156,10 +2158,11 @@ export interface FeeObject {
2156
2158
  */
2157
2159
  flat_unit_amount: string;
2158
2160
  /**
2159
- * Amount per unit within a specified tier.
2161
+ * Percentage rate applied within a specified tier.
2162
+ * @format ^[0-9]+.?[0-9]*$
2160
2163
  * @example "1.0"
2161
2164
  */
2162
- per_unit_amount: string;
2165
+ rate: string;
2163
2166
  /**
2164
2167
  * Total amount of received units to be charged within a specified tier.
2165
2168
  * @example "10.0"
@@ -2206,10 +2209,11 @@ export interface FeeObject {
2206
2209
  */
2207
2210
  free_events?: number;
2208
2211
  /**
2209
- * Amount per unit for the Percentage charge model.
2212
+ * Percentage rate applied for the Percentage charge model.
2213
+ * @format ^[0-9]+.?[0-9]*$
2210
2214
  * @example "1.0"
2211
2215
  */
2212
- per_unit_amount?: string;
2216
+ rate?: string;
2213
2217
  /**
2214
2218
  * Total amount of received units to be charged for the Percentage charge model.
2215
2219
  * @example "10.0"
@@ -2295,6 +2299,8 @@ export interface FeeObject {
2295
2299
  * @example "Subscription"
2296
2300
  */
2297
2301
  item_type: "AddOn" | "BillableMetric" | "Subscription" | "WalletTransaction";
2302
+ /** Key value list of event properties aggregated by the charge model */
2303
+ grouped_by?: Record<string, string>;
2298
2304
  };
2299
2305
  /** List of fee applied taxes */
2300
2306
  applied_taxes?: FeeAppliedTaxObject[];
@@ -2517,9 +2523,10 @@ export interface InvoiceObject {
2517
2523
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2518
2524
  * - `draft`: the invoice is in the draft state, waiting for the end of the grace period to be finalized. During this period, events can still be ingested and added to the invoice.
2519
2525
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2526
+ * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
2520
2527
  * @example "finalized"
2521
2528
  */
2522
- status: "draft" | "finalized";
2529
+ status: "draft" | "finalized" | "voided";
2523
2530
  /**
2524
2531
  * The status of the payment associated with the invoice. It can have one of the following values:
2525
2532
  * - `pending`: the payment is pending, waiting for payment processing in Stripe or when the invoice is emitted but users have not updated the payment status through the endpoint.
@@ -3789,6 +3796,28 @@ export interface WalletObject {
3789
3796
  */
3790
3797
  created_at: string;
3791
3798
  }[];
3799
+ /**
3800
+ * The wallet ongoing balance expressed in cents.
3801
+ * @example 800
3802
+ */
3803
+ ongoing_balance_cents: number;
3804
+ /**
3805
+ * The wallet ongoing usage balance expressed in cents.
3806
+ * @example 200
3807
+ */
3808
+ ongoing_usage_balance_cents: number;
3809
+ /**
3810
+ * The wallet ongoing balance expressed in credits.
3811
+ * @pattern ^[0-9]+.?[0-9]*$
3812
+ * @example "8.0"
3813
+ */
3814
+ credits_ongoing_balance: string;
3815
+ /**
3816
+ * The wallet ongoing usage balance expressed in credits.
3817
+ * @pattern ^[0-9]+.?[0-9]*$
3818
+ * @example "2.0"
3819
+ */
3820
+ credits_ongoing_usage_balance: string;
3792
3821
  }
3793
3822
  export interface WalletsPaginated {
3794
3823
  wallets: WalletObject[];
@@ -4047,7 +4076,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4047
4076
  }
4048
4077
  /**
4049
4078
  * @title Lago API documentation
4050
- * @version 0.53.0-beta
4079
+ * @version 0.56.0-beta
4051
4080
  * @license AGPLv3
4052
4081
  * @baseUrl https://api.getlago.com/api/v1
4053
4082
  * @externalDocs https://github.com/getlago
@@ -4610,26 +4639,28 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4610
4639
  * @secure
4611
4640
  */
4612
4641
  generateCustomerCheckoutUrl: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<{
4613
- /**
4614
- * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4615
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4616
- */
4617
- lago_customer_id?: string | undefined;
4618
- /**
4619
- * The customer external unique identifier (provided by your own application)
4620
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4621
- */
4622
- external_customer_id?: string | undefined;
4623
- /**
4624
- * The Payment Provider name linked to the Customer.
4625
- * @example "stripe"
4626
- */
4627
- payment_provider?: string | undefined;
4628
- /**
4629
- * The new generated Payment Provider Checkout URL for the Customer.
4630
- * @example "https://foo.bar"
4631
- */
4632
- checkout_url?: string | undefined;
4642
+ customer?: {
4643
+ /**
4644
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4645
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4646
+ */
4647
+ lago_customer_id?: string | undefined;
4648
+ /**
4649
+ * The customer external unique identifier (provided by your own application)
4650
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4651
+ */
4652
+ external_customer_id?: string | undefined;
4653
+ /**
4654
+ * The Payment Provider name linked to the Customer.
4655
+ * @example "stripe"
4656
+ */
4657
+ payment_provider?: string | undefined;
4658
+ /**
4659
+ * The new generated Payment Provider Checkout URL for the Customer.
4660
+ * @example "https://foo.bar"
4661
+ */
4662
+ checkout_url?: string | undefined;
4663
+ } | undefined;
4633
4664
  }, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4634
4665
  };
4635
4666
  events: {
@@ -4644,13 +4675,12 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4644
4675
  */
4645
4676
  createEvent: (data: EventInput, params?: RequestParams) => Promise<HttpResponse<Event, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4646
4677
  /**
4647
- * @description This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.
4678
+ * @description This endpoint is used to send a batch of usage records.
4648
4679
  *
4649
4680
  * @tags events
4650
4681
  * @name CreateBatchEvents
4651
4682
  * @summary Batch multiple events
4652
4683
  * @request POST:/events/batch
4653
- * @deprecated
4654
4684
  * @secure
4655
4685
  */
4656
4686
  createBatchEvents: (data: EventBatchInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
@@ -148,7 +148,7 @@ export class HttpClient {
148
148
  }
149
149
  /**
150
150
  * @title Lago API documentation
151
- * @version 0.53.0-beta
151
+ * @version 0.56.0-beta
152
152
  * @license AGPLv3
153
153
  * @baseUrl https://api.getlago.com/api/v1
154
154
  * @externalDocs https://github.com/getlago
@@ -834,13 +834,12 @@ export class Api extends HttpClient {
834
834
  ...params,
835
835
  }),
836
836
  /**
837
- * @description This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.
837
+ * @description This endpoint is used to send a batch of usage records.
838
838
  *
839
839
  * @tags events
840
840
  * @name CreateBatchEvents
841
841
  * @summary Batch multiple events
842
842
  * @request POST:/events/batch
843
- * @deprecated
844
843
  * @secure
845
844
  */
846
845
  createBatchEvents: (data, params = {}) => this.request({
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.53.0-beta",
6
+ "version": "v0.56.0-beta",
7
7
  "description": "Lago JavaScript API Client",
8
8
  "repository": {
9
9
  "type": "git",
@@ -174,7 +174,7 @@ export interface AppliedCouponInput {
174
174
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
175
175
  * @example "recurring"
176
176
  */
177
- frequency?: "once" | "recurring" | null;
177
+ frequency?: "once" | "recurring" | "forever" | null;
178
178
  /**
179
179
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
180
180
  * @example 3
@@ -260,7 +260,7 @@ export interface AppliedCouponObject {
260
260
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
261
261
  * @example "recurring"
262
262
  */
263
- frequency: "once" | "recurring";
263
+ frequency: "once" | "recurring" | "forever";
264
264
  /**
265
265
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
266
266
  * @example 3
@@ -663,6 +663,11 @@ export interface ChargeProperties {
663
663
  * @example "1.75"
664
664
  */
665
665
  per_transaction_min_amount?: string | null;
666
+ /**
667
+ * The list of event properties that are used to group the events on the invoice for a `standard` charge model.
668
+ * @example ["agent_name"]
669
+ */
670
+ grouped_by?: string[];
666
671
  /** Volume ranges, sorted from bottom to top tiers, used for a `volume` charge model. */
667
672
  volume_ranges?: {
668
673
  /**
@@ -746,7 +751,7 @@ export interface CouponBaseInput {
746
751
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
747
752
  * @example "recurring"
748
753
  */
749
- frequency?: "once" | "recurring";
754
+ frequency?: "once" | "recurring" | "forever";
750
755
  /**
751
756
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
752
757
  * @example 6
@@ -859,7 +864,7 @@ export interface CouponObject {
859
864
  * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
860
865
  * @example "recurring"
861
866
  */
862
- frequency: "once" | "recurring";
867
+ frequency: "once" | "recurring" | "forever";
863
868
  /**
864
869
  * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
865
870
  * @example 6
@@ -1315,6 +1320,11 @@ export interface CustomerBillingConfiguration {
1315
1320
  * @example "stripe"
1316
1321
  */
1317
1322
  payment_provider?: "stripe" | "adyen" | "gocardless";
1323
+ /**
1324
+ * Unique code used to identify a payment provider connection.
1325
+ * @example "stripe-eu-1"
1326
+ */
1327
+ payment_provider_code?: string;
1318
1328
  /**
1319
1329
  * The customer ID within the payment provider's system. If this field is not provided, Lago has the option to create a new customer record within the payment provider's system on behalf of the customer
1320
1330
  * @example "cus_12345"
@@ -1341,6 +1351,64 @@ export interface CustomerBillingConfiguration {
1341
1351
  */
1342
1352
  provider_payment_methods?: string[] | null;
1343
1353
  }
1354
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
1355
+ export type CustomerChargeGroupedUsageObject = {
1356
+ /**
1357
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1358
+ * @example 1000
1359
+ */
1360
+ amount_cents?: number;
1361
+ /**
1362
+ * 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.
1363
+ * @example 10
1364
+ */
1365
+ events_count?: number;
1366
+ /**
1367
+ * The number of units consumed for a specific group related to a charge item.
1368
+ * @pattern ^[0-9]+.?[0-9]*$
1369
+ * @example "0.9"
1370
+ */
1371
+ units?: string;
1372
+ /** Key value list of event properties aggregated by the charge model */
1373
+ grouped_by?: Record<string, string>;
1374
+ /** Array of group object, representing multiple dimensions for a charge item. */
1375
+ groups?: CustomerChargeGroupsUsageObject;
1376
+ }[];
1377
+ /** Array of group object, representing multiple dimensions for a charge item. */
1378
+ export type CustomerChargeGroupsUsageObject = {
1379
+ /**
1380
+ * Unique identifier assigned to the group within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the group record within the Lago system.
1381
+ * @format uuid
1382
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1383
+ */
1384
+ lago_id?: string;
1385
+ /**
1386
+ * The group key, only returned for groups with two dimensions.
1387
+ * @example null
1388
+ */
1389
+ key?: string | null;
1390
+ /**
1391
+ * The group value.
1392
+ * @example "europe"
1393
+ */
1394
+ value?: string;
1395
+ /**
1396
+ * The number of units consumed for a specific group related to a charge item.
1397
+ * @pattern ^[0-9]+.?[0-9]*$
1398
+ * @example "0.9"
1399
+ */
1400
+ units?: string;
1401
+ /**
1402
+ * 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.
1403
+ * @example 10
1404
+ */
1405
+ events_count?: number;
1406
+ /**
1407
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1408
+ * @example 1000
1409
+ */
1410
+ amount_cents?: number;
1411
+ }[];
1344
1412
  export interface CustomerChargeUsageObject {
1345
1413
  /**
1346
1414
  * The number of units consumed by the customer for a specific charge item.
@@ -1404,40 +1472,9 @@ export interface CustomerChargeUsageObject {
1404
1472
  aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg";
1405
1473
  };
1406
1474
  /** Array of group object, representing multiple dimensions for a charge item. */
1407
- groups: {
1408
- /**
1409
- * Unique identifier assigned to the group within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the group record within the Lago system.
1410
- * @format uuid
1411
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1412
- */
1413
- lago_id?: string;
1414
- /**
1415
- * The group key, only returned for groups with two dimensions.
1416
- * @example null
1417
- */
1418
- key?: string | null;
1419
- /**
1420
- * The group value.
1421
- * @example "europe"
1422
- */
1423
- value?: string;
1424
- /**
1425
- * The number of units consumed for a specific group related to a charge item.
1426
- * @pattern ^[0-9]+.?[0-9]*$
1427
- * @example "0.9"
1428
- */
1429
- units?: string;
1430
- /**
1431
- * 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.
1432
- * @example 10
1433
- */
1434
- events_count?: number;
1435
- /**
1436
- * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1437
- * @example 1000
1438
- */
1439
- amount_cents?: number;
1440
- }[];
1475
+ groups: CustomerChargeGroupsUsageObject;
1476
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
1477
+ grouped_usage?: CustomerChargeGroupedUsageObject;
1441
1478
  }
1442
1479
  export interface CustomerCreateInput {
1443
1480
  customer: {
@@ -1768,42 +1805,7 @@ export interface Event {
1768
1805
  event: EventObject;
1769
1806
  }
1770
1807
  export interface EventBatchInput {
1771
- event: {
1772
- /**
1773
- * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
1774
- * @example "transaction_1234567890"
1775
- */
1776
- transaction_id: string;
1777
- /**
1778
- * The customer external unique identifier (provided by your own application). This field is optional if you send the `external_subscription_ids`, targeting a specific subscription.
1779
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1780
- */
1781
- external_customer_id?: string;
1782
- /**
1783
- * Array of unique identifiers of the targeted subscriptions within your application.
1784
- * @example ["sub_1234567890","sub_0987654321"]
1785
- */
1786
- external_subscription_ids: string[];
1787
- /**
1788
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1789
- * @example "storage"
1790
- */
1791
- code: string;
1792
- /**
1793
- * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
1794
- * @example 1651240791
1795
- */
1796
- timestamp?: number;
1797
- /**
1798
- * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
1799
- * @example {"gb":10}
1800
- */
1801
- properties?: {
1802
- /** The `operation_type` field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a `unique_count_agg` aggregation method. In other cases, the `operation_type` field is not required. The valid values for the `operation_type` field are `add` or `remove`, which indicate whether the unit is being added or removed from the unique count aggregation, respectively. */
1803
- operation_type?: "add" | "remove";
1804
- [key: string]: any;
1805
- };
1806
- };
1808
+ events: EventInput[];
1807
1809
  }
1808
1810
  export interface EventEstimateFeesInput {
1809
1811
  event: {
@@ -2156,10 +2158,11 @@ export interface FeeObject {
2156
2158
  */
2157
2159
  flat_unit_amount: string;
2158
2160
  /**
2159
- * Amount per unit within a specified tier.
2161
+ * Percentage rate applied within a specified tier.
2162
+ * @format ^[0-9]+.?[0-9]*$
2160
2163
  * @example "1.0"
2161
2164
  */
2162
- per_unit_amount: string;
2165
+ rate: string;
2163
2166
  /**
2164
2167
  * Total amount of received units to be charged within a specified tier.
2165
2168
  * @example "10.0"
@@ -2206,10 +2209,11 @@ export interface FeeObject {
2206
2209
  */
2207
2210
  free_events?: number;
2208
2211
  /**
2209
- * Amount per unit for the Percentage charge model.
2212
+ * Percentage rate applied for the Percentage charge model.
2213
+ * @format ^[0-9]+.?[0-9]*$
2210
2214
  * @example "1.0"
2211
2215
  */
2212
- per_unit_amount?: string;
2216
+ rate?: string;
2213
2217
  /**
2214
2218
  * Total amount of received units to be charged for the Percentage charge model.
2215
2219
  * @example "10.0"
@@ -2295,6 +2299,8 @@ export interface FeeObject {
2295
2299
  * @example "Subscription"
2296
2300
  */
2297
2301
  item_type: "AddOn" | "BillableMetric" | "Subscription" | "WalletTransaction";
2302
+ /** Key value list of event properties aggregated by the charge model */
2303
+ grouped_by?: Record<string, string>;
2298
2304
  };
2299
2305
  /** List of fee applied taxes */
2300
2306
  applied_taxes?: FeeAppliedTaxObject[];
@@ -2517,9 +2523,10 @@ export interface InvoiceObject {
2517
2523
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2518
2524
  * - `draft`: the invoice is in the draft state, waiting for the end of the grace period to be finalized. During this period, events can still be ingested and added to the invoice.
2519
2525
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2526
+ * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
2520
2527
  * @example "finalized"
2521
2528
  */
2522
- status: "draft" | "finalized";
2529
+ status: "draft" | "finalized" | "voided";
2523
2530
  /**
2524
2531
  * The status of the payment associated with the invoice. It can have one of the following values:
2525
2532
  * - `pending`: the payment is pending, waiting for payment processing in Stripe or when the invoice is emitted but users have not updated the payment status through the endpoint.
@@ -3789,6 +3796,28 @@ export interface WalletObject {
3789
3796
  */
3790
3797
  created_at: string;
3791
3798
  }[];
3799
+ /**
3800
+ * The wallet ongoing balance expressed in cents.
3801
+ * @example 800
3802
+ */
3803
+ ongoing_balance_cents: number;
3804
+ /**
3805
+ * The wallet ongoing usage balance expressed in cents.
3806
+ * @example 200
3807
+ */
3808
+ ongoing_usage_balance_cents: number;
3809
+ /**
3810
+ * The wallet ongoing balance expressed in credits.
3811
+ * @pattern ^[0-9]+.?[0-9]*$
3812
+ * @example "8.0"
3813
+ */
3814
+ credits_ongoing_balance: string;
3815
+ /**
3816
+ * The wallet ongoing usage balance expressed in credits.
3817
+ * @pattern ^[0-9]+.?[0-9]*$
3818
+ * @example "2.0"
3819
+ */
3820
+ credits_ongoing_usage_balance: string;
3792
3821
  }
3793
3822
  export interface WalletsPaginated {
3794
3823
  wallets: WalletObject[];
@@ -4047,7 +4076,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4047
4076
  }
4048
4077
  /**
4049
4078
  * @title Lago API documentation
4050
- * @version 0.53.0-beta
4079
+ * @version 0.56.0-beta
4051
4080
  * @license AGPLv3
4052
4081
  * @baseUrl https://api.getlago.com/api/v1
4053
4082
  * @externalDocs https://github.com/getlago
@@ -4610,26 +4639,28 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4610
4639
  * @secure
4611
4640
  */
4612
4641
  generateCustomerCheckoutUrl: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<{
4613
- /**
4614
- * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4615
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4616
- */
4617
- lago_customer_id?: string | undefined;
4618
- /**
4619
- * The customer external unique identifier (provided by your own application)
4620
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4621
- */
4622
- external_customer_id?: string | undefined;
4623
- /**
4624
- * The Payment Provider name linked to the Customer.
4625
- * @example "stripe"
4626
- */
4627
- payment_provider?: string | undefined;
4628
- /**
4629
- * The new generated Payment Provider Checkout URL for the Customer.
4630
- * @example "https://foo.bar"
4631
- */
4632
- checkout_url?: string | undefined;
4642
+ customer?: {
4643
+ /**
4644
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4645
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4646
+ */
4647
+ lago_customer_id?: string | undefined;
4648
+ /**
4649
+ * The customer external unique identifier (provided by your own application)
4650
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4651
+ */
4652
+ external_customer_id?: string | undefined;
4653
+ /**
4654
+ * The Payment Provider name linked to the Customer.
4655
+ * @example "stripe"
4656
+ */
4657
+ payment_provider?: string | undefined;
4658
+ /**
4659
+ * The new generated Payment Provider Checkout URL for the Customer.
4660
+ * @example "https://foo.bar"
4661
+ */
4662
+ checkout_url?: string | undefined;
4663
+ } | undefined;
4633
4664
  }, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4634
4665
  };
4635
4666
  events: {
@@ -4644,13 +4675,12 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4644
4675
  */
4645
4676
  createEvent: (data: EventInput, params?: RequestParams) => Promise<HttpResponse<Event, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4646
4677
  /**
4647
- * @description This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.
4678
+ * @description This endpoint is used to send a batch of usage records.
4648
4679
  *
4649
4680
  * @tags events
4650
4681
  * @name CreateBatchEvents
4651
4682
  * @summary Batch multiple events
4652
4683
  * @request POST:/events/batch
4653
- * @deprecated
4654
4684
  * @secure
4655
4685
  */
4656
4686
  createBatchEvents: (data: EventBatchInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
@@ -152,7 +152,7 @@ class HttpClient {
152
152
  exports.HttpClient = HttpClient;
153
153
  /**
154
154
  * @title Lago API documentation
155
- * @version 0.53.0-beta
155
+ * @version 0.56.0-beta
156
156
  * @license AGPLv3
157
157
  * @baseUrl https://api.getlago.com/api/v1
158
158
  * @externalDocs https://github.com/getlago
@@ -838,13 +838,12 @@ class Api extends HttpClient {
838
838
  ...params,
839
839
  }),
840
840
  /**
841
- * @description This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.
841
+ * @description This endpoint is used to send a batch of usage records.
842
842
  *
843
843
  * @tags events
844
844
  * @name CreateBatchEvents
845
845
  * @summary Batch multiple events
846
846
  * @request POST:/events/batch
847
- * @deprecated
848
847
  * @secure
849
848
  */
850
849
  createBatchEvents: (data, params = {}) => this.request({