lago-javascript-client 0.28.0-beta → 0.30.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.
@@ -148,7 +148,7 @@ export class HttpClient {
148
148
  }
149
149
  /**
150
150
  * @title Lago API documentation
151
- * @version 0.28.0-beta
151
+ * @version 0.29.0-beta
152
152
  * @baseUrl https://api.getlago.com/api/v1
153
153
  * @externalDocs https://github.com/getlago
154
154
  * @contact <tech@getlago.com>
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "types": "./types/mod.d.ts",
5
5
  "name": "lago-javascript-client",
6
6
  "sideEffects": false,
7
- "version": "v0.28.0-beta",
7
+ "version": "v0.30.0-beta",
8
8
  "description": "Lago JavaScript API Client",
9
9
  "repository": {
10
10
  "type": "git",
@@ -19,7 +19,9 @@
19
19
  "contributors": [
20
20
  "Lovro Colic",
21
21
  "Jérémy Denquin",
22
- "Arjun Yelamanchili"
22
+ "Arjun Yelamanchili",
23
+ "Vincent Pochet",
24
+ "Romain Sempé"
23
25
  ],
24
26
  "license": "MIT",
25
27
  "bugs": {
@@ -152,7 +152,7 @@ class HttpClient {
152
152
  exports.HttpClient = HttpClient;
153
153
  /**
154
154
  * @title Lago API documentation
155
- * @version 0.28.0-beta
155
+ * @version 0.29.0-beta
156
156
  * @baseUrl https://api.getlago.com/api/v1
157
157
  * @externalDocs https://github.com/getlago
158
158
  * @contact <tech@getlago.com>
@@ -35,8 +35,9 @@ export interface BillableMetricObject {
35
35
  export interface BillableMetric {
36
36
  billable_metric: BillableMetricObject;
37
37
  }
38
- export interface BillableMetrics {
38
+ export interface BillableMetricsPaginated {
39
39
  billable_metrics: BillableMetricObject[];
40
+ meta: PaginationMeta;
40
41
  }
41
42
  export interface BillableMetricInput {
42
43
  billable_metric: {
@@ -64,8 +65,9 @@ export interface GroupObject {
64
65
  /** @example "EU" */
65
66
  value: string;
66
67
  }
67
- export interface Groups {
68
+ export interface GroupsPaginated {
68
69
  groups: GroupObject[];
70
+ meta: PaginationMeta;
69
71
  }
70
72
  export interface AddOnObject {
71
73
  /**
@@ -92,8 +94,9 @@ export interface AddOnObject {
92
94
  export interface AddOn {
93
95
  add_on: AddOnObject;
94
96
  }
95
- export interface AddOns {
97
+ export interface AddOnsPaginated {
96
98
  add_ons: AddOnObject[];
99
+ meta: PaginationMeta;
97
100
  }
98
101
  export interface AddOnInput {
99
102
  add_on: {
@@ -175,6 +178,9 @@ export interface CouponObject {
175
178
  /** @example true */
176
179
  limited_plans?: boolean;
177
180
  plan_codes?: string[];
181
+ /** @example true */
182
+ limited_billable_metrics?: boolean;
183
+ billable_metric_codes?: string[];
178
184
  /**
179
185
  * @format date-time
180
186
  * @example "2022-09-14T16:35:31Z"
@@ -197,8 +203,9 @@ export interface CouponObject {
197
203
  export interface Coupon {
198
204
  coupon: CouponObject;
199
205
  }
200
- export interface Coupons {
206
+ export interface CouponsPaginated {
201
207
  coupons: CouponObject[];
208
+ meta: PaginationMeta;
202
209
  }
203
210
  export interface CouponInput {
204
211
  coupon: {
@@ -229,6 +236,7 @@ export interface CouponInput {
229
236
  expiration?: "no_expiration" | "time_limit";
230
237
  applies_to?: {
231
238
  plan_codes?: string[];
239
+ billable_metric_codes?: string[];
232
240
  };
233
241
  };
234
242
  }
@@ -283,13 +291,16 @@ export interface AppliedCouponObject {
283
291
  * @example "2022-09-14T16:35:31Z"
284
292
  */
285
293
  terminated_at?: string;
286
- credits: CreditObject[];
287
294
  }
295
+ export type AppliedCouponObjectExtended = AppliedCouponObject & {
296
+ credits: CreditObject[];
297
+ };
288
298
  export interface AppliedCoupon {
289
299
  applied_coupon: AppliedCouponObject;
290
300
  }
291
- export interface AppliedCoupons {
292
- applied_coupons: AppliedCouponObject[];
301
+ export interface AppliedCouponsPaginated {
302
+ applied_coupons: AppliedCouponObjectExtended[];
303
+ meta: PaginationMeta;
293
304
  }
294
305
  export interface AppliedCouponInput {
295
306
  applied_coupon: {
@@ -484,8 +495,9 @@ export interface CustomerObject {
484
495
  export interface Customer {
485
496
  customer: CustomerObject;
486
497
  }
487
- export interface Customers {
498
+ export interface CustomersPaginated {
488
499
  customers: CustomerObject[];
500
+ meta: PaginationMeta;
489
501
  }
490
502
  export interface CustomerInput {
491
503
  customer: {
@@ -556,6 +568,8 @@ export interface ChargeUsageObject {
556
568
  /** Charge model type */
557
569
  charge_model?: "standard" | "graduated" | "package" | "percentage" | "volume";
558
570
  instant?: boolean;
571
+ /** @example 1200 */
572
+ min_amount_cents?: number;
559
573
  };
560
574
  billable_metric: {
561
575
  /**
@@ -701,10 +715,9 @@ export interface BatchEventInput {
701
715
  export interface Fees {
702
716
  fees: FeeObject[];
703
717
  }
704
- export interface FeesPaginated {
705
- fees: FeeObject[];
718
+ export type FeesPaginated = Fees & {
706
719
  meta: PaginationMeta;
707
- }
720
+ };
708
721
  export interface FeeUpdateInput {
709
722
  invoice: {
710
723
  /** Status */
@@ -738,6 +751,8 @@ export interface ChargeObject {
738
751
  charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
739
752
  /** @example true */
740
753
  instant?: boolean;
754
+ /** @example 1200 */
755
+ min_amount_cents?: number;
741
756
  properties?: object;
742
757
  group_properties?: GroupPropertiesObject[];
743
758
  }
@@ -779,8 +794,9 @@ export interface PlanObject {
779
794
  export interface Plan {
780
795
  plan: PlanObject;
781
796
  }
782
- export interface Plans {
797
+ export interface PlansPaginated {
783
798
  plans: PlanObject[];
799
+ meta: PaginationMeta;
784
800
  }
785
801
  export interface PlanInput {
786
802
  plan: {
@@ -816,6 +832,7 @@ export interface PlanInput {
816
832
  /** Charge model type */
817
833
  charge_model?: "standard" | "graduated" | "package" | "percentage" | "volume";
818
834
  instant?: boolean;
835
+ min_amount_cents?: number;
819
836
  properties?: object;
820
837
  group_properties?: {
821
838
  /** @example "123456" */
@@ -886,8 +903,9 @@ export interface SubscriptionObject {
886
903
  export interface Subscription {
887
904
  subscription: SubscriptionObject;
888
905
  }
889
- export interface Subscriptions {
906
+ export interface SubscriptionsPaginated {
890
907
  subscriptions: SubscriptionObject[];
908
+ meta: PaginationMeta;
891
909
  }
892
910
  export interface SubscriptionCreateInput {
893
911
  subscription: {
@@ -967,6 +985,16 @@ export interface FeeObject {
967
985
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
968
986
  */
969
987
  lago_invoice_id?: string;
988
+ /**
989
+ * @format uuid
990
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
991
+ */
992
+ lago_true_up_fee_id?: string;
993
+ /**
994
+ * @format uuid
995
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
996
+ */
997
+ lago_true_up_parent_fee_id?: string;
970
998
  /** @example "54321" */
971
999
  external_subscription_id?: string;
972
1000
  /** @example 1000 */
@@ -1091,17 +1119,23 @@ export interface InvoiceObject {
1091
1119
  /** @example "https://example.com" */
1092
1120
  file_url?: string;
1093
1121
  customer: CustomerObject;
1094
- subscriptions: SubscriptionObject[];
1095
1122
  metadata?: InvoiceMetadataObject[];
1096
- fees: FeeObject[];
1097
- credits: CreditObject[];
1098
1123
  }
1124
+ export type InvoiceObjectExtended = InvoiceObject & {
1125
+ credits: CreditObject[];
1126
+ fees: FeeObject[];
1127
+ subscriptions: SubscriptionObject[];
1128
+ };
1099
1129
  export interface Invoice {
1100
- invoice: InvoiceObject;
1130
+ invoice: InvoiceObjectExtended;
1101
1131
  }
1102
1132
  export interface Invoices {
1103
1133
  invoices: InvoiceObject[];
1104
1134
  }
1135
+ export interface InvoicesPaginated {
1136
+ invoices: InvoiceObject[];
1137
+ meta: PaginationMeta;
1138
+ }
1105
1139
  export interface InvoiceInput {
1106
1140
  invoice: {
1107
1141
  /** Status */
@@ -1180,8 +1214,9 @@ export interface WalletObject {
1180
1214
  export interface Wallet {
1181
1215
  wallet: WalletObject;
1182
1216
  }
1183
- export interface Wallets {
1217
+ export interface WalletsPaginated {
1184
1218
  wallets: WalletObject[];
1219
+ meta: PaginationMeta;
1185
1220
  }
1186
1221
  export interface WalletInput {
1187
1222
  wallet?: {
@@ -1251,6 +1286,9 @@ export interface WalletTransaction {
1251
1286
  export interface WalletTransactions {
1252
1287
  wallet_transactions: WalletTransactionObject[];
1253
1288
  }
1289
+ export type WalletTransactionsPaginated = WalletTransactions & {
1290
+ meta: PaginationMeta;
1291
+ };
1254
1292
  export interface WalletTransactionInput {
1255
1293
  wallet_transaction: {
1256
1294
  /**
@@ -1342,7 +1380,6 @@ export interface CreditNoteObject {
1342
1380
  updated_at: string;
1343
1381
  /** @example "https://example.com" */
1344
1382
  file_url?: string;
1345
- customer?: CustomerObject;
1346
1383
  items?: CreditNoteItemObject[];
1347
1384
  }
1348
1385
  export interface CreditNote {
@@ -1518,7 +1555,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
1518
1555
  }
1519
1556
  /**
1520
1557
  * @title Lago API documentation
1521
- * @version 0.28.0-beta
1558
+ * @version 0.29.0-beta
1522
1559
  * @baseUrl https://api.getlago.com/api/v1
1523
1560
  * @externalDocs https://github.com/getlago
1524
1561
  * @contact <tech@getlago.com>
@@ -1557,7 +1594,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1557
1594
  * @example 20
1558
1595
  */
1559
1596
  per_page?: number;
1560
- }, params?: RequestParams) => Promise<HttpResponse<BillableMetrics, ApiResponseUnauthorized>>;
1597
+ }, params?: RequestParams) => Promise<HttpResponse<BillableMetricsPaginated, ApiResponseUnauthorized>>;
1561
1598
  /**
1562
1599
  * @description Update an existing billable metric by code
1563
1600
  *
@@ -1608,7 +1645,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1608
1645
  * @example 20
1609
1646
  */
1610
1647
  per_page?: number;
1611
- }, params?: RequestParams) => Promise<HttpResponse<Groups, ApiResponseUnauthorized>>;
1648
+ }, params?: RequestParams) => Promise<HttpResponse<GroupsPaginated, ApiResponseUnauthorized>>;
1612
1649
  };
1613
1650
  addOns: {
1614
1651
  /**
@@ -1641,7 +1678,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1641
1678
  * @example 20
1642
1679
  */
1643
1680
  per_page?: number;
1644
- }, params?: RequestParams) => Promise<HttpResponse<AddOns, ApiResponseUnauthorized>>;
1681
+ }, params?: RequestParams) => Promise<HttpResponse<AddOnsPaginated, ApiResponseUnauthorized>>;
1645
1682
  /**
1646
1683
  * @description Update an existing add-on by code
1647
1684
  *
@@ -1716,7 +1753,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1716
1753
  * @example 20
1717
1754
  */
1718
1755
  per_page?: number;
1719
- }, params?: RequestParams) => Promise<HttpResponse<Coupons, ApiResponseUnauthorized>>;
1756
+ }, params?: RequestParams) => Promise<HttpResponse<CouponsPaginated, ApiResponseUnauthorized>>;
1720
1757
  /**
1721
1758
  * @description Update an existing coupon by code
1722
1759
  *
@@ -1786,7 +1823,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1786
1823
  * @example "12345"
1787
1824
  */
1788
1825
  external_customer_id?: string;
1789
- }, params?: RequestParams) => Promise<HttpResponse<AppliedCoupons, ApiResponseUnauthorized>>;
1826
+ }, params?: RequestParams) => Promise<HttpResponse<AppliedCouponsPaginated, ApiResponseUnauthorized>>;
1790
1827
  };
1791
1828
  organizations: {
1792
1829
  /**
@@ -1831,7 +1868,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1831
1868
  * @example 20
1832
1869
  */
1833
1870
  per_page?: number;
1834
- }, params?: RequestParams) => Promise<HttpResponse<Customers, ApiResponseUnauthorized>>;
1871
+ }, params?: RequestParams) => Promise<HttpResponse<CustomersPaginated, ApiResponseUnauthorized>>;
1835
1872
  /**
1836
1873
  * @description Return a single customer
1837
1874
  *
@@ -1967,7 +2004,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1967
2004
  * @example 20
1968
2005
  */
1969
2006
  per_page?: number;
1970
- }, params?: RequestParams) => Promise<HttpResponse<Plans, ApiResponseUnauthorized>>;
2007
+ }, params?: RequestParams) => Promise<HttpResponse<PlansPaginated, ApiResponseUnauthorized>>;
1971
2008
  /**
1972
2009
  * @description Update an existing plan by code
1973
2010
  *
@@ -2035,7 +2072,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2035
2072
  * @example "12345"
2036
2073
  */
2037
2074
  external_customer_id: string;
2038
- }, params?: RequestParams) => Promise<HttpResponse<Subscriptions, ApiResponseUnauthorized | ApiResponseNotFound>>;
2075
+ }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiResponseUnauthorized | ApiResponseNotFound>>;
2039
2076
  /**
2040
2077
  * @description Update an existing subscription by external ID
2041
2078
  *
@@ -2109,7 +2146,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2109
2146
  issuing_date_to?: string;
2110
2147
  /** Status */
2111
2148
  status?: "draft" | "finalized";
2112
- }, params?: RequestParams) => Promise<HttpResponse<Invoices, ApiResponseUnauthorized>>;
2149
+ }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiResponseUnauthorized>>;
2113
2150
  /**
2114
2151
  * @description Update an existing invoice
2115
2152
  *
@@ -2328,7 +2365,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2328
2365
  * @example "12345"
2329
2366
  */
2330
2367
  external_customer_id: string;
2331
- }, params?: RequestParams) => Promise<HttpResponse<Wallets, ApiResponseUnauthorized>>;
2368
+ }, params?: RequestParams) => Promise<HttpResponse<WalletsPaginated, ApiResponseUnauthorized>>;
2332
2369
  /**
2333
2370
  * @description Update an existing wallet
2334
2371
  *
@@ -2389,7 +2426,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2389
2426
  * @example "inbound"
2390
2427
  */
2391
2428
  transaction_type?: string;
2392
- }, params?: RequestParams) => Promise<HttpResponse<WalletTransactions, ApiResponseUnauthorized | ApiResponseNotFound>>;
2429
+ }, params?: RequestParams) => Promise<HttpResponse<WalletTransactionsPaginated, ApiResponseUnauthorized | ApiResponseNotFound>>;
2393
2430
  };
2394
2431
  walletTransactions: {
2395
2432
  /**