lago-javascript-client 1.1.0 → 1.3.0

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.
@@ -401,6 +401,7 @@ export interface BillableMetricObject {
401
401
  weighted_interval?: "seconds" | null;
402
402
  /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
403
403
  group?: BillableMetricGroup;
404
+ filters?: BillableMetricFilterObject[];
404
405
  /**
405
406
  * Number of active subscriptions using this billable metric.
406
407
  * @example 4
@@ -459,14 +460,38 @@ export interface BillableMetricBaseInput {
459
460
  weighted_interval?: "seconds" | null;
460
461
  /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
461
462
  group?: BillableMetricGroup;
463
+ filters?: BillableMetricFilterInput[];
462
464
  }
463
465
  export interface BillableMetricCreateInput {
464
466
  billable_metric: BillableMetricBaseInput;
465
467
  }
468
+ /** Values used to apply differentiated pricing based on additional event properties. */
469
+ export interface BillableMetricFilterInput {
470
+ /**
471
+ * Filter key to add to the event properties payload
472
+ * @example "region"
473
+ */
474
+ key: string;
475
+ /** List of possible filter values */
476
+ values: string[];
477
+ }
478
+ /** Values used to apply differentiated pricing based on additional event properties. */
479
+ export interface BillableMetricFilterObject {
480
+ /**
481
+ * Filter key to add to the event properties payload
482
+ * @example "region"
483
+ */
484
+ key: string;
485
+ /** List of possible filter values */
486
+ values: string[];
487
+ }
466
488
  export interface BillableMetricUpdateInput {
467
489
  billable_metric: BillableMetricBaseInput;
468
490
  }
469
- /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
491
+ /**
492
+ * Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric.
493
+ * @deprecated
494
+ */
470
495
  export interface BillableMetricGroup {
471
496
  /**
472
497
  * Name of the event property used to group values.
@@ -494,6 +519,36 @@ export interface BillableMetricsPaginated {
494
519
  billable_metrics: BillableMetricObject[];
495
520
  meta: PaginationMeta;
496
521
  }
522
+ /** Values used to apply differentiated pricing based on additional event properties. */
523
+ export interface ChargeFilterInput {
524
+ /**
525
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the values of the filter will be used as the default display name.
526
+ * @example "AWS"
527
+ */
528
+ invoice_display_name?: string | null;
529
+ /** List of all thresholds utilized for calculating the charge. */
530
+ properties?: ChargeProperties;
531
+ /**
532
+ * List of possible filter values. The key and values must match one of the billable metric filters.
533
+ * @example {"region":["us-east-1"]}
534
+ */
535
+ values?: Record<string, string[]>;
536
+ }
537
+ /** Values used to apply differentiated pricing based on additional event properties. */
538
+ export interface ChargeFilterObject {
539
+ /**
540
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the values of the filter will be used as the default display name.
541
+ * @example "AWS"
542
+ */
543
+ invoice_display_name: string | null;
544
+ /** List of all thresholds utilized for calculating the charge. */
545
+ properties: ChargeProperties;
546
+ /**
547
+ * List of possible filter values. The key and values must match one of the billable metric filters.
548
+ * @example {"region":["us-east-1"]}
549
+ */
550
+ values: Record<string, string[]>;
551
+ }
497
552
  export interface ChargeObject {
498
553
  /**
499
554
  * Unique identifier of charge, created by Lago.
@@ -551,7 +606,12 @@ export interface ChargeObject {
551
606
  min_amount_cents?: number;
552
607
  /** List of all thresholds utilized for calculating the charge. */
553
608
  properties?: ChargeProperties;
554
- /** All charge information, sorted by groups. */
609
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
610
+ filters?: ChargeFilterObject[];
611
+ /**
612
+ * All charge information, sorted by groups.
613
+ * @deprecated
614
+ */
555
615
  group_properties?: GroupPropertiesObject[];
556
616
  /** All taxes applied to the charge. */
557
617
  taxes?: TaxObject[];
@@ -1351,6 +1411,35 @@ export interface CustomerBillingConfiguration {
1351
1411
  */
1352
1412
  provider_payment_methods?: string[] | null;
1353
1413
  }
1414
+ /** Array of filter object, representing multiple dimensions for a charge item. */
1415
+ export type CustomerChargeFiltersUsageObject = {
1416
+ /**
1417
+ * The number of units consumed for a specific charge filter related to a charge item.
1418
+ * @pattern ^[0-9]+.?[0-9]*$
1419
+ * @example "0.9"
1420
+ */
1421
+ units?: string;
1422
+ /**
1423
+ * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
1424
+ * @example 1000
1425
+ */
1426
+ amount_cents?: number;
1427
+ /**
1428
+ * The quantity of usage events that have been recorded for a particular charge filter during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1429
+ * @example 10
1430
+ */
1431
+ events_count?: number;
1432
+ /**
1433
+ * Specifies the name that will be displayed on an invoice.
1434
+ * @example "AWS eu-east-1"
1435
+ */
1436
+ invoice_display_name?: string;
1437
+ /**
1438
+ * List of filter values applied to the usage.
1439
+ * @example {"region":"us-east-1"}
1440
+ */
1441
+ values?: Record<string, string>;
1442
+ }[];
1354
1443
  /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
1355
1444
  export type CustomerChargeGroupedUsageObject = {
1356
1445
  /**
@@ -1371,10 +1460,15 @@ export type CustomerChargeGroupedUsageObject = {
1371
1460
  units?: string;
1372
1461
  /** Key value list of event properties aggregated by the charge model */
1373
1462
  grouped_by?: Record<string, string>;
1463
+ /** Array of filter object, representing multiple dimensions for a charge item. */
1464
+ filters?: CustomerChargeFiltersUsageObject;
1374
1465
  /** Array of group object, representing multiple dimensions for a charge item. */
1375
1466
  groups?: CustomerChargeGroupsUsageObject;
1376
1467
  }[];
1377
- /** Array of group object, representing multiple dimensions for a charge item. */
1468
+ /**
1469
+ * Array of group object, representing multiple dimensions for a charge item.
1470
+ * @deprecated
1471
+ */
1378
1472
  export type CustomerChargeGroupsUsageObject = {
1379
1473
  /**
1380
1474
  * 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.
@@ -1471,6 +1565,8 @@ export interface CustomerChargeUsageObject {
1471
1565
  */
1472
1566
  aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg";
1473
1567
  };
1568
+ /** Array of filter object, representing multiple dimensions for a charge item. */
1569
+ filters?: CustomerChargeFiltersUsageObject;
1474
1570
  /** Array of group object, representing multiple dimensions for a charge item. */
1475
1571
  groups: CustomerChargeGroupsUsageObject;
1476
1572
  /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
@@ -1951,10 +2047,17 @@ export interface FeeObject {
1951
2047
  lago_id?: string | null;
1952
2048
  /**
1953
2049
  * Unique identifier assigned to the group that the fee belongs to
2050
+ * @deprecated
1954
2051
  * @format uuid
1955
2052
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1956
2053
  */
1957
2054
  lago_group_id?: string | null;
2055
+ /**
2056
+ * Unique identifier assigned to the charge filter that the fee belongs to
2057
+ * @format uuid
2058
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2059
+ */
2060
+ lago_charge_filter_id?: string | null;
1958
2061
  /**
1959
2062
  * Unique identifier assigned to the invoice that the fee belongs to
1960
2063
  * @format uuid
@@ -2289,8 +2392,16 @@ export interface FeeObject {
2289
2392
  * @example "Setup Fee (SF1)"
2290
2393
  */
2291
2394
  invoice_display_name?: string;
2395
+ /**
2396
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the actual charge filter values will be used as the default display name.
2397
+ * @example "AWS eu-east-1"
2398
+ */
2399
+ filter_invoice_display_name?: string;
2400
+ /** Key value list of event properties */
2401
+ filters?: Record<string, string[]>;
2292
2402
  /**
2293
2403
  * 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.
2404
+ * @deprecated
2294
2405
  * @example "Transactions - ACH"
2295
2406
  */
2296
2407
  group_invoice_display_name?: string;
@@ -2557,7 +2668,7 @@ export interface InvoiceObject {
2557
2668
  * This ID helps in uniquely identifying and organizing the invoices associated with a specific customer. It provides a sequential numbering system specific to the customer, allowing for easy tracking and management of invoices within the customer's context.
2558
2669
  * @example 2
2559
2670
  */
2560
- sequential_id: number;
2671
+ sequential_id?: number;
2561
2672
  /**
2562
2673
  * The unique number assigned to the invoice. This number serves as a distinct identifier for the invoice and helps in differentiating it from other invoices in the system.
2563
2674
  * @example "LAG-1234-001-002"
@@ -2569,6 +2680,12 @@ export interface InvoiceObject {
2569
2680
  * @example "2022-04-30"
2570
2681
  */
2571
2682
  issuing_date: string;
2683
+ /**
2684
+ * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
2685
+ * @format date-time
2686
+ * @example "2022-09-14T16:35:31Z"
2687
+ */
2688
+ payment_dispute_lost_at?: string;
2572
2689
  /**
2573
2690
  * The payment due date for the invoice, specified in the ISO 8601 date format.
2574
2691
  * @format date
@@ -3091,7 +3208,10 @@ export interface PlanCreateInput {
3091
3208
  min_amount_cents?: number;
3092
3209
  /** List of all thresholds utilized for calculating the charge. */
3093
3210
  properties?: ChargeProperties;
3094
- /** All charge information, sorted by groups. */
3211
+ /**
3212
+ * All charge information, sorted by groups.
3213
+ * @deprecated
3214
+ */
3095
3215
  group_properties?: {
3096
3216
  /**
3097
3217
  * Unique identifier of a billable metric group, created by Lago.
@@ -3101,6 +3221,8 @@ export interface PlanCreateInput {
3101
3221
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
3102
3222
  values: ChargeProperties;
3103
3223
  }[];
3224
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
3225
+ filters?: ChargeFilterInput[];
3104
3226
  /**
3105
3227
  * List of unique code used to identify the taxes.
3106
3228
  * @example ["french_standard_vat"]
@@ -3170,7 +3292,10 @@ export interface PlanOverridesObject {
3170
3292
  min_amount_cents?: number;
3171
3293
  /** List of all thresholds utilized for calculating the charge. */
3172
3294
  properties?: ChargeProperties;
3173
- /** All charge information, sorted by groups. */
3295
+ /**
3296
+ * All charge information, sorted by groups.
3297
+ * @deprecated
3298
+ */
3174
3299
  group_properties?: {
3175
3300
  /**
3176
3301
  * Unique identifier of a billable metric group, created by Lago.
@@ -3180,6 +3305,8 @@ export interface PlanOverridesObject {
3180
3305
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
3181
3306
  values: ChargeProperties;
3182
3307
  }[];
3308
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
3309
+ filters?: ChargeFilterInput[];
3183
3310
  /**
3184
3311
  * List of unique code used to identify the taxes.
3185
3312
  * @example ["french_standard_vat"]
@@ -3296,7 +3423,10 @@ export interface PlanUpdateInput {
3296
3423
  min_amount_cents?: number;
3297
3424
  /** List of all thresholds utilized for calculating the charge. */
3298
3425
  properties?: ChargeProperties;
3299
- /** All charge information, sorted by groups. */
3426
+ /**
3427
+ * All charge information, sorted by groups.
3428
+ * @deprecated
3429
+ */
3300
3430
  group_properties?: {
3301
3431
  /**
3302
3432
  * Unique identifier of a billable metric group, created by Lago.
@@ -3306,6 +3436,8 @@ export interface PlanUpdateInput {
3306
3436
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
3307
3437
  values: ChargeProperties;
3308
3438
  }[];
3439
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
3440
+ filters?: ChargeFilterInput[];
3309
3441
  /**
3310
3442
  * List of unique code used to identify the taxes.
3311
3443
  * @example ["french_standard_vat"]
@@ -3387,7 +3519,7 @@ export interface PlanObject {
3387
3519
  minimum_commitment?: MinimumCommitmentObject;
3388
3520
  /**
3389
3521
  * Additional usage-based charges for this plan.
3390
- * @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":[]}]
3522
+ * @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},"filters":[]},{"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"}]},"filters":[]},{"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":{},"filters":[{"invoice_display_name":"Europe","properties":{"amount":"10"},"values":{"region":["Europe"]}},{"invoice_display_name":"USA","properties":{"amount":"5"},"values":{"region":["USA"]}},{"invoice_display_name":"Africa","properties":{"amount":"8"},"values":{"region":["Africa"]}}]},{"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"}]},"filters":[]},{"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"},"filters":[]}]
3391
3523
  */
3392
3524
  charges?: ChargeObject[];
3393
3525
  /** All taxes applied to the plan. */
@@ -3570,6 +3702,12 @@ export interface SubscriptionObject {
3570
3702
  * @example "2022-04-30"
3571
3703
  */
3572
3704
  downgrade_plan_date?: string | null;
3705
+ /**
3706
+ * The date when the free trial is ended, represented in ISO 8601 date format.
3707
+ * @format date-time
3708
+ * @example "2022-08-08T00:00:00Z"
3709
+ */
3710
+ trial_ended_at?: string | null;
3573
3711
  }
3574
3712
  export type SubscriptionObjectExtended = SubscriptionObject & {
3575
3713
  plan?: PlanObject;
@@ -3724,17 +3862,17 @@ export interface WalletCreateInput {
3724
3862
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3725
3863
  recurring_transaction_rules?: {
3726
3864
  /**
3727
- * The rule type. Possible values are `interval` or `threshold`.
3865
+ * The trigger. Possible values are `interval` or `threshold`.
3728
3866
  * @example "interval"
3729
3867
  */
3730
- rule_type: "interval" | "threshold";
3868
+ trigger: "interval" | "threshold";
3731
3869
  /**
3732
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when rule type is `interval`.
3870
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when trigger is `interval`.
3733
3871
  * @example "monthly"
3734
3872
  */
3735
3873
  interval?: "weekly" | "monthly" | "quarterly" | "yearly";
3736
3874
  /**
3737
- * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
3875
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
3738
3876
  * @pattern ^[0-9]+.?[0-9]*$
3739
3877
  * @example "20.0"
3740
3878
  */
@@ -3834,17 +3972,17 @@ export interface WalletObject {
3834
3972
  */
3835
3973
  lago_id: string;
3836
3974
  /**
3837
- * The rule type. Possible values are `interval` or `threshold`.
3975
+ * The trigger. Possible values are `interval` or `threshold`.
3838
3976
  * @example "interval"
3839
3977
  */
3840
- rule_type: "interval" | "threshold";
3978
+ trigger: "interval" | "threshold";
3841
3979
  /**
3842
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only if rule type is set to `interval`.
3980
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only if trigger is set to `interval`.
3843
3981
  * @example "monthly"
3844
3982
  */
3845
3983
  interval?: "weekly" | "monthly" | "quarterly" | "yearly";
3846
3984
  /**
3847
- * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
3985
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
3848
3986
  * @pattern ^[0-9]+.?[0-9]*$
3849
3987
  * @example "20.0"
3850
3988
  */
@@ -3904,17 +4042,23 @@ export interface WalletTransactionCreateInput {
3904
4042
  */
3905
4043
  wallet_id: string;
3906
4044
  /**
3907
- * The number of paid credits. Required only if there is no granted credits.
4045
+ * The number of paid credits.
3908
4046
  * @pattern ^[0-9]+.?[0-9]*$
3909
4047
  * @example "20.0"
3910
4048
  */
3911
4049
  paid_credits?: string;
3912
4050
  /**
3913
- * The number of free granted credits. Required only if there is no paid credits.
4051
+ * The number of free granted credits.
3914
4052
  * @pattern ^[0-9]+.?[0-9]*$
3915
4053
  * @example "10.0"
3916
4054
  */
3917
4055
  granted_credits?: string;
4056
+ /**
4057
+ * The number of voided credits.
4058
+ * @pattern ^[0-9]+.?[0-9]*$
4059
+ * @example "5.0"
4060
+ */
4061
+ voided_credits?: string;
3918
4062
  };
3919
4063
  }
3920
4064
  export interface WalletTransactionObject {
@@ -3935,6 +4079,11 @@ export interface WalletTransactionObject {
3935
4079
  * @example "settled"
3936
4080
  */
3937
4081
  status: "pending" | "settled";
4082
+ /**
4083
+ * The transaction status of the wallet transaction. Possible values are `purchased` (with pending or settled status), `granted` (without invoice_id), `voided` or `invoiced`.
4084
+ * @example "purchased"
4085
+ */
4086
+ transaction_status: "purchased" | "granted" | "voided" | "invoiced";
3938
4087
  /**
3939
4088
  * The type of transaction. Possible values are `inbound` (increasing the balance) or `outbound` (decreasing the balance).
3940
4089
  * @example "inbound"
@@ -3993,17 +4142,17 @@ export interface WalletUpdateInput {
3993
4142
  */
3994
4143
  lago_id?: string;
3995
4144
  /**
3996
- * The rule type. Possible values are `interval` or `threshold`.
4145
+ * The trigger. Possible values are `interval` or `threshold`.
3997
4146
  * @example "interval"
3998
4147
  */
3999
- rule_type?: "interval" | "threshold";
4148
+ trigger?: "interval" | "threshold";
4000
4149
  /**
4001
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when rule type is set to `interval`.
4150
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when trigger is set to `interval`.
4002
4151
  * @example "monthly"
4003
4152
  */
4004
4153
  interval?: "weekly" | "monthly" | "quarterly" | "yearly";
4005
4154
  /**
4006
- * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
4155
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
4007
4156
  * @pattern ^[0-9]+.?[0-9]*$
4008
4157
  * @example "20.0"
4009
4158
  */
@@ -4148,7 +4297,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4148
4297
  }
4149
4298
  /**
4150
4299
  * @title Lago API documentation
4151
- * @version 1.1.0
4300
+ * @version 1.2.0
4152
4301
  * @license AGPLv3
4153
4302
  * @baseUrl https://api.getlago.com/api/v1
4154
4303
  * @externalDocs https://github.com/getlago
@@ -4238,6 +4387,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4238
4387
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4239
4388
  */
4240
4389
  external_customer_id?: string;
4390
+ /**
4391
+ * Show data only for given number of months.
4392
+ * @example 12
4393
+ */
4394
+ months?: number;
4241
4395
  }, params?: RequestParams) => Promise<HttpResponse<GrossRevenues, ApiErrorUnauthorized>>;
4242
4396
  /**
4243
4397
  * @description Represents a monthly aggregation, detailing both the total count and the cumulative amount of invoices that have been marked as `finalized`. This report sorts invoices categorically based on their `payment_status`.
@@ -4251,6 +4405,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4251
4405
  findAllInvoiceCollections: (query?: {
4252
4406
  /** The currency of revenue analytics. Format must be ISO 4217. */
4253
4407
  currency?: Currency;
4408
+ /**
4409
+ * Show data only for given number of months.
4410
+ * @example 12
4411
+ */
4412
+ months?: number;
4254
4413
  }, params?: RequestParams) => Promise<HttpResponse<InvoiceCollections, ApiErrorUnauthorized>>;
4255
4414
  /**
4256
4415
  * @description Reports a monthly analysis focused on the revenue generated from all usage-based fees. It exclusively accounts for revenue that has been formally invoiced. Importantly, this report does not include revenue related to the usage in the current billing period, limiting its scope to previously invoiced amounts.
@@ -4264,6 +4423,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4264
4423
  findAllInvoicedUsages: (query?: {
4265
4424
  /** The currency of invoiced usage analytics. Format must be ISO 4217. */
4266
4425
  currency?: Currency;
4426
+ /**
4427
+ * Show data only for given number of months.
4428
+ * @example 12
4429
+ */
4430
+ months?: number;
4267
4431
  }, params?: RequestParams) => Promise<HttpResponse<InvoicedUsages, ApiErrorUnauthorized>>;
4268
4432
  /**
4269
4433
  * @description This endpoint is used to list MRR.
@@ -4403,6 +4567,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4403
4567
  * @name FindAllBillableMetricGroups
4404
4568
  * @summary Find a billable metric's groups
4405
4569
  * @request GET:/billable_metrics/{code}/groups
4570
+ * @deprecated
4406
4571
  * @secure
4407
4572
  */
4408
4573
  findAllBillableMetricGroups: (code: string, query?: {
@@ -4988,6 +5153,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4988
5153
  * @secure
4989
5154
  */
4990
5155
  finalizeInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5156
+ /**
5157
+ * @description This endpoint is used for setting invoice's payment dispute as lost.
5158
+ *
5159
+ * @tags invoices
5160
+ * @name LoseDisputeInvoice
5161
+ * @summary Mark an invoice payment dispute as lost
5162
+ * @request POST:/invoices/{lago_id}/lose_dispute
5163
+ * @secure
5164
+ */
5165
+ loseDisputeInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
4991
5166
  /**
4992
5167
  * @description This endpoint is used for refreshing a draft invoice.
4993
5168
  *
@@ -5371,6 +5546,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5371
5546
  * @example "pending"
5372
5547
  */
5373
5548
  status?: string;
5549
+ /**
5550
+ * The transaction status of the wallet transaction. Possible values are `purchased` (with pending or settled status), `granted` (without invoice_id), `voided` or `invoiced`.
5551
+ * @example "purchased"
5552
+ */
5553
+ transaction_status?: string;
5374
5554
  /**
5375
5555
  * The transaction type of the wallet transaction. Possible values are `inbound` (increasing the wallet balance) or `outbound` (decreasing the wallet balance).
5376
5556
  * @example "inbound"
@@ -148,7 +148,7 @@ export class HttpClient {
148
148
  }
149
149
  /**
150
150
  * @title Lago API documentation
151
- * @version 1.1.0
151
+ * @version 1.2.0
152
152
  * @license AGPLv3
153
153
  * @baseUrl https://api.getlago.com/api/v1
154
154
  * @externalDocs https://github.com/getlago
@@ -444,6 +444,7 @@ export class Api extends HttpClient {
444
444
  * @name FindAllBillableMetricGroups
445
445
  * @summary Find a billable metric's groups
446
446
  * @request GET:/billable_metrics/{code}/groups
447
+ * @deprecated
447
448
  * @secure
448
449
  */
449
450
  findAllBillableMetricGroups: (code, query, params = {}) => this.request({
@@ -1040,6 +1041,22 @@ export class Api extends HttpClient {
1040
1041
  format: "json",
1041
1042
  ...params,
1042
1043
  }),
1044
+ /**
1045
+ * @description This endpoint is used for setting invoice's payment dispute as lost.
1046
+ *
1047
+ * @tags invoices
1048
+ * @name LoseDisputeInvoice
1049
+ * @summary Mark an invoice payment dispute as lost
1050
+ * @request POST:/invoices/{lago_id}/lose_dispute
1051
+ * @secure
1052
+ */
1053
+ loseDisputeInvoice: (lagoId, params = {}) => this.request({
1054
+ path: `/invoices/${lagoId}/lose_dispute`,
1055
+ method: "POST",
1056
+ secure: true,
1057
+ format: "json",
1058
+ ...params,
1059
+ }),
1043
1060
  /**
1044
1061
  * @description This endpoint is used for refreshing a draft invoice.
1045
1062
  *
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": "v1.1.0",
6
+ "version": "v1.3.0",
7
7
  "description": "Lago JavaScript API Client",
8
8
  "repository": {
9
9
  "type": "git",
@@ -401,6 +401,7 @@ export interface BillableMetricObject {
401
401
  weighted_interval?: "seconds" | null;
402
402
  /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
403
403
  group?: BillableMetricGroup;
404
+ filters?: BillableMetricFilterObject[];
404
405
  /**
405
406
  * Number of active subscriptions using this billable metric.
406
407
  * @example 4
@@ -459,14 +460,38 @@ export interface BillableMetricBaseInput {
459
460
  weighted_interval?: "seconds" | null;
460
461
  /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
461
462
  group?: BillableMetricGroup;
463
+ filters?: BillableMetricFilterInput[];
462
464
  }
463
465
  export interface BillableMetricCreateInput {
464
466
  billable_metric: BillableMetricBaseInput;
465
467
  }
468
+ /** Values used to apply differentiated pricing based on additional event properties. */
469
+ export interface BillableMetricFilterInput {
470
+ /**
471
+ * Filter key to add to the event properties payload
472
+ * @example "region"
473
+ */
474
+ key: string;
475
+ /** List of possible filter values */
476
+ values: string[];
477
+ }
478
+ /** Values used to apply differentiated pricing based on additional event properties. */
479
+ export interface BillableMetricFilterObject {
480
+ /**
481
+ * Filter key to add to the event properties payload
482
+ * @example "region"
483
+ */
484
+ key: string;
485
+ /** List of possible filter values */
486
+ values: string[];
487
+ }
466
488
  export interface BillableMetricUpdateInput {
467
489
  billable_metric: BillableMetricBaseInput;
468
490
  }
469
- /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
491
+ /**
492
+ * Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric.
493
+ * @deprecated
494
+ */
470
495
  export interface BillableMetricGroup {
471
496
  /**
472
497
  * Name of the event property used to group values.
@@ -494,6 +519,36 @@ export interface BillableMetricsPaginated {
494
519
  billable_metrics: BillableMetricObject[];
495
520
  meta: PaginationMeta;
496
521
  }
522
+ /** Values used to apply differentiated pricing based on additional event properties. */
523
+ export interface ChargeFilterInput {
524
+ /**
525
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the values of the filter will be used as the default display name.
526
+ * @example "AWS"
527
+ */
528
+ invoice_display_name?: string | null;
529
+ /** List of all thresholds utilized for calculating the charge. */
530
+ properties?: ChargeProperties;
531
+ /**
532
+ * List of possible filter values. The key and values must match one of the billable metric filters.
533
+ * @example {"region":["us-east-1"]}
534
+ */
535
+ values?: Record<string, string[]>;
536
+ }
537
+ /** Values used to apply differentiated pricing based on additional event properties. */
538
+ export interface ChargeFilterObject {
539
+ /**
540
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the values of the filter will be used as the default display name.
541
+ * @example "AWS"
542
+ */
543
+ invoice_display_name: string | null;
544
+ /** List of all thresholds utilized for calculating the charge. */
545
+ properties: ChargeProperties;
546
+ /**
547
+ * List of possible filter values. The key and values must match one of the billable metric filters.
548
+ * @example {"region":["us-east-1"]}
549
+ */
550
+ values: Record<string, string[]>;
551
+ }
497
552
  export interface ChargeObject {
498
553
  /**
499
554
  * Unique identifier of charge, created by Lago.
@@ -551,7 +606,12 @@ export interface ChargeObject {
551
606
  min_amount_cents?: number;
552
607
  /** List of all thresholds utilized for calculating the charge. */
553
608
  properties?: ChargeProperties;
554
- /** All charge information, sorted by groups. */
609
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
610
+ filters?: ChargeFilterObject[];
611
+ /**
612
+ * All charge information, sorted by groups.
613
+ * @deprecated
614
+ */
555
615
  group_properties?: GroupPropertiesObject[];
556
616
  /** All taxes applied to the charge. */
557
617
  taxes?: TaxObject[];
@@ -1351,6 +1411,35 @@ export interface CustomerBillingConfiguration {
1351
1411
  */
1352
1412
  provider_payment_methods?: string[] | null;
1353
1413
  }
1414
+ /** Array of filter object, representing multiple dimensions for a charge item. */
1415
+ export type CustomerChargeFiltersUsageObject = {
1416
+ /**
1417
+ * The number of units consumed for a specific charge filter related to a charge item.
1418
+ * @pattern ^[0-9]+.?[0-9]*$
1419
+ * @example "0.9"
1420
+ */
1421
+ units?: string;
1422
+ /**
1423
+ * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
1424
+ * @example 1000
1425
+ */
1426
+ amount_cents?: number;
1427
+ /**
1428
+ * The quantity of usage events that have been recorded for a particular charge filter during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1429
+ * @example 10
1430
+ */
1431
+ events_count?: number;
1432
+ /**
1433
+ * Specifies the name that will be displayed on an invoice.
1434
+ * @example "AWS eu-east-1"
1435
+ */
1436
+ invoice_display_name?: string;
1437
+ /**
1438
+ * List of filter values applied to the usage.
1439
+ * @example {"region":"us-east-1"}
1440
+ */
1441
+ values?: Record<string, string>;
1442
+ }[];
1354
1443
  /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
1355
1444
  export type CustomerChargeGroupedUsageObject = {
1356
1445
  /**
@@ -1371,10 +1460,15 @@ export type CustomerChargeGroupedUsageObject = {
1371
1460
  units?: string;
1372
1461
  /** Key value list of event properties aggregated by the charge model */
1373
1462
  grouped_by?: Record<string, string>;
1463
+ /** Array of filter object, representing multiple dimensions for a charge item. */
1464
+ filters?: CustomerChargeFiltersUsageObject;
1374
1465
  /** Array of group object, representing multiple dimensions for a charge item. */
1375
1466
  groups?: CustomerChargeGroupsUsageObject;
1376
1467
  }[];
1377
- /** Array of group object, representing multiple dimensions for a charge item. */
1468
+ /**
1469
+ * Array of group object, representing multiple dimensions for a charge item.
1470
+ * @deprecated
1471
+ */
1378
1472
  export type CustomerChargeGroupsUsageObject = {
1379
1473
  /**
1380
1474
  * 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.
@@ -1471,6 +1565,8 @@ export interface CustomerChargeUsageObject {
1471
1565
  */
1472
1566
  aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg";
1473
1567
  };
1568
+ /** Array of filter object, representing multiple dimensions for a charge item. */
1569
+ filters?: CustomerChargeFiltersUsageObject;
1474
1570
  /** Array of group object, representing multiple dimensions for a charge item. */
1475
1571
  groups: CustomerChargeGroupsUsageObject;
1476
1572
  /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
@@ -1951,10 +2047,17 @@ export interface FeeObject {
1951
2047
  lago_id?: string | null;
1952
2048
  /**
1953
2049
  * Unique identifier assigned to the group that the fee belongs to
2050
+ * @deprecated
1954
2051
  * @format uuid
1955
2052
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1956
2053
  */
1957
2054
  lago_group_id?: string | null;
2055
+ /**
2056
+ * Unique identifier assigned to the charge filter that the fee belongs to
2057
+ * @format uuid
2058
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2059
+ */
2060
+ lago_charge_filter_id?: string | null;
1958
2061
  /**
1959
2062
  * Unique identifier assigned to the invoice that the fee belongs to
1960
2063
  * @format uuid
@@ -2289,8 +2392,16 @@ export interface FeeObject {
2289
2392
  * @example "Setup Fee (SF1)"
2290
2393
  */
2291
2394
  invoice_display_name?: string;
2395
+ /**
2396
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the actual charge filter values will be used as the default display name.
2397
+ * @example "AWS eu-east-1"
2398
+ */
2399
+ filter_invoice_display_name?: string;
2400
+ /** Key value list of event properties */
2401
+ filters?: Record<string, string[]>;
2292
2402
  /**
2293
2403
  * 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.
2404
+ * @deprecated
2294
2405
  * @example "Transactions - ACH"
2295
2406
  */
2296
2407
  group_invoice_display_name?: string;
@@ -2557,7 +2668,7 @@ export interface InvoiceObject {
2557
2668
  * This ID helps in uniquely identifying and organizing the invoices associated with a specific customer. It provides a sequential numbering system specific to the customer, allowing for easy tracking and management of invoices within the customer's context.
2558
2669
  * @example 2
2559
2670
  */
2560
- sequential_id: number;
2671
+ sequential_id?: number;
2561
2672
  /**
2562
2673
  * The unique number assigned to the invoice. This number serves as a distinct identifier for the invoice and helps in differentiating it from other invoices in the system.
2563
2674
  * @example "LAG-1234-001-002"
@@ -2569,6 +2680,12 @@ export interface InvoiceObject {
2569
2680
  * @example "2022-04-30"
2570
2681
  */
2571
2682
  issuing_date: string;
2683
+ /**
2684
+ * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
2685
+ * @format date-time
2686
+ * @example "2022-09-14T16:35:31Z"
2687
+ */
2688
+ payment_dispute_lost_at?: string;
2572
2689
  /**
2573
2690
  * The payment due date for the invoice, specified in the ISO 8601 date format.
2574
2691
  * @format date
@@ -3091,7 +3208,10 @@ export interface PlanCreateInput {
3091
3208
  min_amount_cents?: number;
3092
3209
  /** List of all thresholds utilized for calculating the charge. */
3093
3210
  properties?: ChargeProperties;
3094
- /** All charge information, sorted by groups. */
3211
+ /**
3212
+ * All charge information, sorted by groups.
3213
+ * @deprecated
3214
+ */
3095
3215
  group_properties?: {
3096
3216
  /**
3097
3217
  * Unique identifier of a billable metric group, created by Lago.
@@ -3101,6 +3221,8 @@ export interface PlanCreateInput {
3101
3221
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
3102
3222
  values: ChargeProperties;
3103
3223
  }[];
3224
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
3225
+ filters?: ChargeFilterInput[];
3104
3226
  /**
3105
3227
  * List of unique code used to identify the taxes.
3106
3228
  * @example ["french_standard_vat"]
@@ -3170,7 +3292,10 @@ export interface PlanOverridesObject {
3170
3292
  min_amount_cents?: number;
3171
3293
  /** List of all thresholds utilized for calculating the charge. */
3172
3294
  properties?: ChargeProperties;
3173
- /** All charge information, sorted by groups. */
3295
+ /**
3296
+ * All charge information, sorted by groups.
3297
+ * @deprecated
3298
+ */
3174
3299
  group_properties?: {
3175
3300
  /**
3176
3301
  * Unique identifier of a billable metric group, created by Lago.
@@ -3180,6 +3305,8 @@ export interface PlanOverridesObject {
3180
3305
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
3181
3306
  values: ChargeProperties;
3182
3307
  }[];
3308
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
3309
+ filters?: ChargeFilterInput[];
3183
3310
  /**
3184
3311
  * List of unique code used to identify the taxes.
3185
3312
  * @example ["french_standard_vat"]
@@ -3296,7 +3423,10 @@ export interface PlanUpdateInput {
3296
3423
  min_amount_cents?: number;
3297
3424
  /** List of all thresholds utilized for calculating the charge. */
3298
3425
  properties?: ChargeProperties;
3299
- /** All charge information, sorted by groups. */
3426
+ /**
3427
+ * All charge information, sorted by groups.
3428
+ * @deprecated
3429
+ */
3300
3430
  group_properties?: {
3301
3431
  /**
3302
3432
  * Unique identifier of a billable metric group, created by Lago.
@@ -3306,6 +3436,8 @@ export interface PlanUpdateInput {
3306
3436
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
3307
3437
  values: ChargeProperties;
3308
3438
  }[];
3439
+ /** List of filters used to apply differentiated pricing based on additional event properties. */
3440
+ filters?: ChargeFilterInput[];
3309
3441
  /**
3310
3442
  * List of unique code used to identify the taxes.
3311
3443
  * @example ["french_standard_vat"]
@@ -3387,7 +3519,7 @@ export interface PlanObject {
3387
3519
  minimum_commitment?: MinimumCommitmentObject;
3388
3520
  /**
3389
3521
  * Additional usage-based charges for this plan.
3390
- * @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":[]}]
3522
+ * @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},"filters":[]},{"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"}]},"filters":[]},{"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":{},"filters":[{"invoice_display_name":"Europe","properties":{"amount":"10"},"values":{"region":["Europe"]}},{"invoice_display_name":"USA","properties":{"amount":"5"},"values":{"region":["USA"]}},{"invoice_display_name":"Africa","properties":{"amount":"8"},"values":{"region":["Africa"]}}]},{"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"}]},"filters":[]},{"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"},"filters":[]}]
3391
3523
  */
3392
3524
  charges?: ChargeObject[];
3393
3525
  /** All taxes applied to the plan. */
@@ -3570,6 +3702,12 @@ export interface SubscriptionObject {
3570
3702
  * @example "2022-04-30"
3571
3703
  */
3572
3704
  downgrade_plan_date?: string | null;
3705
+ /**
3706
+ * The date when the free trial is ended, represented in ISO 8601 date format.
3707
+ * @format date-time
3708
+ * @example "2022-08-08T00:00:00Z"
3709
+ */
3710
+ trial_ended_at?: string | null;
3573
3711
  }
3574
3712
  export type SubscriptionObjectExtended = SubscriptionObject & {
3575
3713
  plan?: PlanObject;
@@ -3724,17 +3862,17 @@ export interface WalletCreateInput {
3724
3862
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3725
3863
  recurring_transaction_rules?: {
3726
3864
  /**
3727
- * The rule type. Possible values are `interval` or `threshold`.
3865
+ * The trigger. Possible values are `interval` or `threshold`.
3728
3866
  * @example "interval"
3729
3867
  */
3730
- rule_type: "interval" | "threshold";
3868
+ trigger: "interval" | "threshold";
3731
3869
  /**
3732
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when rule type is `interval`.
3870
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when trigger is `interval`.
3733
3871
  * @example "monthly"
3734
3872
  */
3735
3873
  interval?: "weekly" | "monthly" | "quarterly" | "yearly";
3736
3874
  /**
3737
- * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
3875
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
3738
3876
  * @pattern ^[0-9]+.?[0-9]*$
3739
3877
  * @example "20.0"
3740
3878
  */
@@ -3834,17 +3972,17 @@ export interface WalletObject {
3834
3972
  */
3835
3973
  lago_id: string;
3836
3974
  /**
3837
- * The rule type. Possible values are `interval` or `threshold`.
3975
+ * The trigger. Possible values are `interval` or `threshold`.
3838
3976
  * @example "interval"
3839
3977
  */
3840
- rule_type: "interval" | "threshold";
3978
+ trigger: "interval" | "threshold";
3841
3979
  /**
3842
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only if rule type is set to `interval`.
3980
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only if trigger is set to `interval`.
3843
3981
  * @example "monthly"
3844
3982
  */
3845
3983
  interval?: "weekly" | "monthly" | "quarterly" | "yearly";
3846
3984
  /**
3847
- * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
3985
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
3848
3986
  * @pattern ^[0-9]+.?[0-9]*$
3849
3987
  * @example "20.0"
3850
3988
  */
@@ -3904,17 +4042,23 @@ export interface WalletTransactionCreateInput {
3904
4042
  */
3905
4043
  wallet_id: string;
3906
4044
  /**
3907
- * The number of paid credits. Required only if there is no granted credits.
4045
+ * The number of paid credits.
3908
4046
  * @pattern ^[0-9]+.?[0-9]*$
3909
4047
  * @example "20.0"
3910
4048
  */
3911
4049
  paid_credits?: string;
3912
4050
  /**
3913
- * The number of free granted credits. Required only if there is no paid credits.
4051
+ * The number of free granted credits.
3914
4052
  * @pattern ^[0-9]+.?[0-9]*$
3915
4053
  * @example "10.0"
3916
4054
  */
3917
4055
  granted_credits?: string;
4056
+ /**
4057
+ * The number of voided credits.
4058
+ * @pattern ^[0-9]+.?[0-9]*$
4059
+ * @example "5.0"
4060
+ */
4061
+ voided_credits?: string;
3918
4062
  };
3919
4063
  }
3920
4064
  export interface WalletTransactionObject {
@@ -3935,6 +4079,11 @@ export interface WalletTransactionObject {
3935
4079
  * @example "settled"
3936
4080
  */
3937
4081
  status: "pending" | "settled";
4082
+ /**
4083
+ * The transaction status of the wallet transaction. Possible values are `purchased` (with pending or settled status), `granted` (without invoice_id), `voided` or `invoiced`.
4084
+ * @example "purchased"
4085
+ */
4086
+ transaction_status: "purchased" | "granted" | "voided" | "invoiced";
3938
4087
  /**
3939
4088
  * The type of transaction. Possible values are `inbound` (increasing the balance) or `outbound` (decreasing the balance).
3940
4089
  * @example "inbound"
@@ -3993,17 +4142,17 @@ export interface WalletUpdateInput {
3993
4142
  */
3994
4143
  lago_id?: string;
3995
4144
  /**
3996
- * The rule type. Possible values are `interval` or `threshold`.
4145
+ * The trigger. Possible values are `interval` or `threshold`.
3997
4146
  * @example "interval"
3998
4147
  */
3999
- rule_type?: "interval" | "threshold";
4148
+ trigger?: "interval" | "threshold";
4000
4149
  /**
4001
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when rule type is set to `interval`.
4150
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when trigger is set to `interval`.
4002
4151
  * @example "monthly"
4003
4152
  */
4004
4153
  interval?: "weekly" | "monthly" | "quarterly" | "yearly";
4005
4154
  /**
4006
- * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
4155
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
4007
4156
  * @pattern ^[0-9]+.?[0-9]*$
4008
4157
  * @example "20.0"
4009
4158
  */
@@ -4148,7 +4297,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4148
4297
  }
4149
4298
  /**
4150
4299
  * @title Lago API documentation
4151
- * @version 1.1.0
4300
+ * @version 1.2.0
4152
4301
  * @license AGPLv3
4153
4302
  * @baseUrl https://api.getlago.com/api/v1
4154
4303
  * @externalDocs https://github.com/getlago
@@ -4238,6 +4387,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4238
4387
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4239
4388
  */
4240
4389
  external_customer_id?: string;
4390
+ /**
4391
+ * Show data only for given number of months.
4392
+ * @example 12
4393
+ */
4394
+ months?: number;
4241
4395
  }, params?: RequestParams) => Promise<HttpResponse<GrossRevenues, ApiErrorUnauthorized>>;
4242
4396
  /**
4243
4397
  * @description Represents a monthly aggregation, detailing both the total count and the cumulative amount of invoices that have been marked as `finalized`. This report sorts invoices categorically based on their `payment_status`.
@@ -4251,6 +4405,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4251
4405
  findAllInvoiceCollections: (query?: {
4252
4406
  /** The currency of revenue analytics. Format must be ISO 4217. */
4253
4407
  currency?: Currency;
4408
+ /**
4409
+ * Show data only for given number of months.
4410
+ * @example 12
4411
+ */
4412
+ months?: number;
4254
4413
  }, params?: RequestParams) => Promise<HttpResponse<InvoiceCollections, ApiErrorUnauthorized>>;
4255
4414
  /**
4256
4415
  * @description Reports a monthly analysis focused on the revenue generated from all usage-based fees. It exclusively accounts for revenue that has been formally invoiced. Importantly, this report does not include revenue related to the usage in the current billing period, limiting its scope to previously invoiced amounts.
@@ -4264,6 +4423,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4264
4423
  findAllInvoicedUsages: (query?: {
4265
4424
  /** The currency of invoiced usage analytics. Format must be ISO 4217. */
4266
4425
  currency?: Currency;
4426
+ /**
4427
+ * Show data only for given number of months.
4428
+ * @example 12
4429
+ */
4430
+ months?: number;
4267
4431
  }, params?: RequestParams) => Promise<HttpResponse<InvoicedUsages, ApiErrorUnauthorized>>;
4268
4432
  /**
4269
4433
  * @description This endpoint is used to list MRR.
@@ -4403,6 +4567,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4403
4567
  * @name FindAllBillableMetricGroups
4404
4568
  * @summary Find a billable metric's groups
4405
4569
  * @request GET:/billable_metrics/{code}/groups
4570
+ * @deprecated
4406
4571
  * @secure
4407
4572
  */
4408
4573
  findAllBillableMetricGroups: (code: string, query?: {
@@ -4988,6 +5153,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4988
5153
  * @secure
4989
5154
  */
4990
5155
  finalizeInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5156
+ /**
5157
+ * @description This endpoint is used for setting invoice's payment dispute as lost.
5158
+ *
5159
+ * @tags invoices
5160
+ * @name LoseDisputeInvoice
5161
+ * @summary Mark an invoice payment dispute as lost
5162
+ * @request POST:/invoices/{lago_id}/lose_dispute
5163
+ * @secure
5164
+ */
5165
+ loseDisputeInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
4991
5166
  /**
4992
5167
  * @description This endpoint is used for refreshing a draft invoice.
4993
5168
  *
@@ -5371,6 +5546,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5371
5546
  * @example "pending"
5372
5547
  */
5373
5548
  status?: string;
5549
+ /**
5550
+ * The transaction status of the wallet transaction. Possible values are `purchased` (with pending or settled status), `granted` (without invoice_id), `voided` or `invoiced`.
5551
+ * @example "purchased"
5552
+ */
5553
+ transaction_status?: string;
5374
5554
  /**
5375
5555
  * The transaction type of the wallet transaction. Possible values are `inbound` (increasing the wallet balance) or `outbound` (decreasing the wallet balance).
5376
5556
  * @example "inbound"
@@ -152,7 +152,7 @@ class HttpClient {
152
152
  exports.HttpClient = HttpClient;
153
153
  /**
154
154
  * @title Lago API documentation
155
- * @version 1.1.0
155
+ * @version 1.2.0
156
156
  * @license AGPLv3
157
157
  * @baseUrl https://api.getlago.com/api/v1
158
158
  * @externalDocs https://github.com/getlago
@@ -448,6 +448,7 @@ class Api extends HttpClient {
448
448
  * @name FindAllBillableMetricGroups
449
449
  * @summary Find a billable metric's groups
450
450
  * @request GET:/billable_metrics/{code}/groups
451
+ * @deprecated
451
452
  * @secure
452
453
  */
453
454
  findAllBillableMetricGroups: (code, query, params = {}) => this.request({
@@ -1044,6 +1045,22 @@ class Api extends HttpClient {
1044
1045
  format: "json",
1045
1046
  ...params,
1046
1047
  }),
1048
+ /**
1049
+ * @description This endpoint is used for setting invoice's payment dispute as lost.
1050
+ *
1051
+ * @tags invoices
1052
+ * @name LoseDisputeInvoice
1053
+ * @summary Mark an invoice payment dispute as lost
1054
+ * @request POST:/invoices/{lago_id}/lose_dispute
1055
+ * @secure
1056
+ */
1057
+ loseDisputeInvoice: (lagoId, params = {}) => this.request({
1058
+ path: `/invoices/${lagoId}/lose_dispute`,
1059
+ method: "POST",
1060
+ secure: true,
1061
+ format: "json",
1062
+ ...params,
1063
+ }),
1047
1064
  /**
1048
1065
  * @description This endpoint is used for refreshing a draft invoice.
1049
1066
  *