lago-javascript-client 0.26.0-beta → 0.27.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.
@@ -664,6 +664,24 @@ export class Api extends HttpClient {
664
664
  format: "json",
665
665
  ...params,
666
666
  }),
667
+ /**
668
+ * @description Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple instant charges
669
+ *
670
+ * @tags events
671
+ * @name EventEstimateFees
672
+ * @summary Estimate fees for an instant charge
673
+ * @request POST:/events/estimate_fees
674
+ * @secure
675
+ */
676
+ eventEstimateFees: (data, params = {}) => this.request({
677
+ path: `/events/estimate_fees`,
678
+ method: "POST",
679
+ body: data,
680
+ secure: true,
681
+ type: ContentType.Json,
682
+ format: "json",
683
+ ...params,
684
+ }),
667
685
  };
668
686
  plans = {
669
687
  /**
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.26.0-beta",
7
+ "version": "v0.27.0-beta",
8
8
  "description": "Lago JavaScript API Client",
9
9
  "repository": {
10
10
  "type": "git",
@@ -29,12 +29,12 @@
29
29
  "exports": {
30
30
  ".": {
31
31
  "import": {
32
- "default": "./esm/mod.js",
33
- "types": "./types/mod.d.ts"
32
+ "types": "./types/mod.d.ts",
33
+ "default": "./esm/mod.js"
34
34
  },
35
35
  "require": {
36
- "default": "./script/mod.js",
37
- "types": "./types/mod.d.ts"
36
+ "types": "./types/mod.d.ts",
37
+ "default": "./script/mod.js"
38
38
  }
39
39
  }
40
40
  },
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@types/node": "^18.11.9",
46
46
  "chalk": "^4.1.2",
47
- "@deno/shim-deno": "~0.11.0",
47
+ "@deno/shim-deno": "~0.12.0",
48
48
  "urlpattern-polyfill": "^6.0.2"
49
49
  }
50
50
  }
@@ -668,6 +668,24 @@ class Api extends HttpClient {
668
668
  format: "json",
669
669
  ...params,
670
670
  }),
671
+ /**
672
+ * @description Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple instant charges
673
+ *
674
+ * @tags events
675
+ * @name EventEstimateFees
676
+ * @summary Estimate fees for an instant charge
677
+ * @request POST:/events/estimate_fees
678
+ * @secure
679
+ */
680
+ eventEstimateFees: (data, params = {}) => this.request({
681
+ path: `/events/estimate_fees`,
682
+ method: "POST",
683
+ body: data,
684
+ secure: true,
685
+ type: ContentType.Json,
686
+ format: "json",
687
+ ...params,
688
+ }),
671
689
  };
672
690
  plans = {
673
691
  /**
@@ -4,7 +4,10 @@ export interface BillableMetricGroup {
4
4
  values: (string | object)[];
5
5
  }
6
6
  export interface BillableMetricObject {
7
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
7
+ /**
8
+ * @format uuid
9
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
10
+ */
8
11
  lago_id: string;
9
12
  /** @example "bm1" */
10
13
  name: string;
@@ -12,7 +15,10 @@ export interface BillableMetricObject {
12
15
  code: string;
13
16
  /** @example "description" */
14
17
  description?: string;
15
- /** @example "2022-09-14T16:35:31.000Z" */
18
+ /**
19
+ * @format date-time
20
+ * @example "2022-09-14T16:35:31Z"
21
+ */
16
22
  created_at: string;
17
23
  /** @example "amount" */
18
24
  field_name?: string;
@@ -48,7 +54,10 @@ export interface BillableMetricInput {
48
54
  };
49
55
  }
50
56
  export interface GroupObject {
51
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
57
+ /**
58
+ * @format uuid
59
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
60
+ */
52
61
  lago_id: string;
53
62
  /** @example "region" */
54
63
  key: string;
@@ -59,7 +68,10 @@ export interface Groups {
59
68
  groups: GroupObject[];
60
69
  }
61
70
  export interface AddOnObject {
62
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
71
+ /**
72
+ * @format uuid
73
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
74
+ */
63
75
  lago_id: string;
64
76
  /** @example "example name" */
65
77
  name: string;
@@ -67,7 +79,10 @@ export interface AddOnObject {
67
79
  code: string;
68
80
  /** @example "description" */
69
81
  description?: string;
70
- /** @example "2022-09-14T16:35:31.000Z" */
82
+ /**
83
+ * @format date-time
84
+ * @example "2022-09-14T16:35:31Z"
85
+ */
71
86
  created_at: string;
72
87
  /** @example 1200 */
73
88
  amount_cents: number;
@@ -95,13 +110,22 @@ export interface AddOnInput {
95
110
  };
96
111
  }
97
112
  export interface AppliedAddOnObject {
98
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
113
+ /**
114
+ * @format uuid
115
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
116
+ */
99
117
  lago_id: string;
100
- /** @example "457uj93c-c007-4fbb-afcd-b00c07c41kki" */
118
+ /**
119
+ * @format uuid
120
+ * @example "457uj93c-c007-4fbb-afcd-b00c07c41kki"
121
+ */
101
122
  lago_add_on_id: string;
102
123
  /** @example "code" */
103
124
  add_on_code: string;
104
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
125
+ /**
126
+ * @format uuid
127
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
128
+ */
105
129
  lago_customer_id: string;
106
130
  /** @example "1234567" */
107
131
  external_customer_id: string;
@@ -109,7 +133,10 @@ export interface AppliedAddOnObject {
109
133
  amount_cents: number;
110
134
  /** @example "EUR" */
111
135
  amount_currency: string;
112
- /** @example "2022-09-14T16:35:31.000Z" */
136
+ /**
137
+ * @format date-time
138
+ * @example "2022-09-14T16:35:31Z"
139
+ */
113
140
  created_at: string;
114
141
  }
115
142
  export interface AppliedAddOn {
@@ -128,7 +155,10 @@ export interface AppliedAddOnInput {
128
155
  };
129
156
  }
130
157
  export interface CouponObject {
131
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
158
+ /**
159
+ * @format uuid
160
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
161
+ */
132
162
  lago_id: string;
133
163
  /** @example "coupon1" */
134
164
  name: string;
@@ -145,7 +175,10 @@ export interface CouponObject {
145
175
  /** @example true */
146
176
  limited_plans?: boolean;
147
177
  plan_codes?: string[];
148
- /** @example "2022-09-14T16:35:31.000Z" */
178
+ /**
179
+ * @format date-time
180
+ * @example "2022-09-14T16:35:31Z"
181
+ */
149
182
  created_at: string;
150
183
  /** @example 25 */
151
184
  percentage_rate?: number;
@@ -153,7 +186,10 @@ export interface CouponObject {
153
186
  frequency: "once" | "recurring";
154
187
  /** @example 3 */
155
188
  frequency_duration?: number;
156
- /** @example "2022-09-14T23:59:59.000Z" */
189
+ /**
190
+ * @format date-time
191
+ * @example "2022-09-14T23:59:59Z"
192
+ */
157
193
  expiration_at?: string;
158
194
  /** Expiration type */
159
195
  expiration: "no_expiration" | "time_limit";
@@ -184,7 +220,10 @@ export interface CouponInput {
184
220
  frequency?: "once" | "recurring";
185
221
  /** @example 3 */
186
222
  frequency_duration?: number;
187
- /** @example "2022-09-14T23:59:59.000Z" */
223
+ /**
224
+ * @format date-time
225
+ * @example "2022-09-14T23:59:59Z"
226
+ */
188
227
  expiration_at?: string;
189
228
  /** Expiration type */
190
229
  expiration?: "no_expiration" | "time_limit";
@@ -194,13 +233,22 @@ export interface CouponInput {
194
233
  };
195
234
  }
196
235
  export interface AppliedCouponObject {
197
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
236
+ /**
237
+ * @format uuid
238
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
239
+ */
198
240
  lago_id: string;
199
- /** @example "544da83c-c007-4fbb-afcd-b00c07c41iit" */
241
+ /**
242
+ * @format uuid
243
+ * @example "544da83c-c007-4fbb-afcd-b00c07c41iit"
244
+ */
200
245
  lago_coupon_id: string;
201
246
  /** @example "example_code" */
202
247
  coupon_code: string;
203
- /** @example "321da83c-c007-4fbb-afcd-b00c07c41ssd" */
248
+ /**
249
+ * @format uuid
250
+ * @example "321da83c-c007-4fbb-afcd-b00c07c41ssd"
251
+ */
204
252
  lago_customer_id: string;
205
253
  /** @example "123456" */
206
254
  external_customer_id: string;
@@ -220,11 +268,20 @@ export interface AppliedCouponObject {
220
268
  frequency_duration?: number;
221
269
  /** @example 2 */
222
270
  frequency_duration_remaining?: number;
223
- /** @example "2022-09-14T23:59:59.000Z" */
271
+ /**
272
+ * @format date-time
273
+ * @example "2022-09-14T23:59:59Z"
274
+ */
224
275
  expiration_at?: string;
225
- /** @example "2022-09-14T16:35:31.000Z" */
276
+ /**
277
+ * @format date-time
278
+ * @example "2022-09-14T16:35:31Z"
279
+ */
226
280
  created_at: string;
227
- /** @example "2022-09-14T16:35:31.000Z" */
281
+ /**
282
+ * @format date-time
283
+ * @example "2022-09-14T16:35:31Z"
284
+ */
228
285
  terminated_at?: string;
229
286
  credits: CreditObject[];
230
287
  }
@@ -263,11 +320,17 @@ export interface BillingConfigurationOrganization {
263
320
  vat_rate?: number;
264
321
  }
265
322
  export interface OrganizationObject {
266
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
323
+ /**
324
+ * @format uuid
325
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
326
+ */
267
327
  lago_id?: string;
268
328
  /** @example "example name" */
269
329
  name: string;
270
- /** @example "2022-09-14T16:35:31.000Z" */
330
+ /**
331
+ * @format date-time
332
+ * @example "2022-09-14T16:35:31Z"
333
+ */
271
334
  created_at: string;
272
335
  /** @example "https://example.com" */
273
336
  webhook_url?: string;
@@ -281,7 +344,10 @@ export interface OrganizationObject {
281
344
  state?: string;
282
345
  /** @example "10000" */
283
346
  zipcode?: string;
284
- /** @example "example@example.com" */
347
+ /**
348
+ * @format email
349
+ * @example "example@example.com"
350
+ */
285
351
  email?: string;
286
352
  /** @example "City" */
287
353
  city?: string;
@@ -310,16 +376,20 @@ export interface OrganizationInput {
310
376
  state?: string;
311
377
  /** @example "10000" */
312
378
  zipcode?: string;
313
- /** @example "example@example.com" */
379
+ /**
380
+ * @format email
381
+ * @example "example@example.com"
382
+ */
314
383
  email?: string;
315
384
  /** @example "City" */
316
385
  city?: string;
317
386
  /** @example "name1" */
318
387
  legal_name?: string;
319
- /** @example 10000 */
388
+ /** @example "10000" */
320
389
  legal_number?: string;
321
390
  /** @example "Europe/Paris" */
322
391
  timezone?: string;
392
+ email_settings?: ("invoice.finalized" | "credit_note.created")[];
323
393
  billing_configuration?: BillingConfigurationOrganization;
324
394
  };
325
395
  }
@@ -339,7 +409,10 @@ export interface BillingConfigurationCustomer {
339
409
  [key: string]: any;
340
410
  }
341
411
  export interface CustomerMetadataObject {
342
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
412
+ /**
413
+ * @format uuid
414
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
415
+ */
343
416
  lago_id?: string;
344
417
  /** @example "name" */
345
418
  key?: string;
@@ -347,13 +420,19 @@ export interface CustomerMetadataObject {
347
420
  value?: string;
348
421
  /** @example false */
349
422
  display_in_invoice?: boolean;
350
- /** @example "2022-09-14T16:35:31.000Z" */
423
+ /**
424
+ * @format date-time
425
+ * @example "2022-09-14T16:35:31Z"
426
+ */
351
427
  created_at?: string;
352
428
  }
353
429
  export interface CustomerObject {
354
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
430
+ /**
431
+ * @format uuid
432
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
433
+ */
355
434
  lago_id: string;
356
- /** @example "886da83c-c007-4fbb-afcd-b00c07c41ffe" */
435
+ /** @example "12345" */
357
436
  external_id: string;
358
437
  /** @example "John Doe" */
359
438
  name?: string;
@@ -361,7 +440,10 @@ export interface CustomerObject {
361
440
  sequential_id: number;
362
441
  /** @example "slug" */
363
442
  slug: string;
364
- /** @example "2022-09-14T16:35:31.000Z" */
443
+ /**
444
+ * @format date-time
445
+ * @example "2022-09-14T16:35:31Z"
446
+ */
365
447
  created_at?: string;
366
448
  /** @example "CZ" */
367
449
  country?: string;
@@ -371,21 +453,24 @@ export interface CustomerObject {
371
453
  address_line2?: string;
372
454
  /** @example "state1" */
373
455
  state?: string;
374
- /** @example 10000 */
456
+ /** @example "10000" */
375
457
  zipcode?: string;
376
- /** @example "example@example.com" */
458
+ /**
459
+ * @format email
460
+ * @example "example@example.com"
461
+ */
377
462
  email?: string;
378
463
  /** @example "City" */
379
464
  city?: string;
380
465
  /** @example "https://example.com" */
381
466
  url?: string;
382
- /** @example 3551234567 */
467
+ /** @example "+3551234567" */
383
468
  phone?: string;
384
469
  /** @example "https://lago.url" */
385
470
  lago_url?: string;
386
471
  /** @example "name1" */
387
472
  legal_name?: string;
388
- /** @example 10000 */
473
+ /** @example "10000" */
389
474
  legal_number?: string;
390
475
  /** @example "EUR" */
391
476
  currency?: string;
@@ -404,7 +489,7 @@ export interface Customers {
404
489
  }
405
490
  export interface CustomerInput {
406
491
  customer: {
407
- /** @example "886da83c-c007-4fbb-afcd-b00c07c41ffe" */
492
+ /** @example "12345" */
408
493
  external_id: string;
409
494
  /** @example "John Doe" */
410
495
  name?: string;
@@ -416,21 +501,24 @@ export interface CustomerInput {
416
501
  address_line2?: string;
417
502
  /** @example "state1" */
418
503
  state?: string;
419
- /** @example 10000 */
504
+ /** @example "10000" */
420
505
  zipcode?: string;
421
- /** @example "example@example.com" */
506
+ /**
507
+ * @format email
508
+ * @example "example@example.com"
509
+ */
422
510
  email?: string;
423
511
  /** @example "City" */
424
512
  city?: string;
425
513
  /** @example "https://example.com" */
426
514
  url?: string;
427
- /** @example 3551234567 */
515
+ /** @example "+3551234567" */
428
516
  phone?: string;
429
517
  /** @example "https://lago.url" */
430
518
  lago_url?: string;
431
519
  /** @example "name1" */
432
520
  legal_name?: string;
433
- /** @example 10000 */
521
+ /** @example "10000" */
434
522
  legal_number?: string;
435
523
  /** @example "EUR" */
436
524
  currency?: string;
@@ -438,7 +526,10 @@ export interface CustomerInput {
438
526
  timezone?: string;
439
527
  billing_configuration?: BillingConfigurationCustomer;
440
528
  metadata?: {
441
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
529
+ /**
530
+ * @format uuid
531
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
532
+ */
442
533
  id?: string;
443
534
  /** @example "name" */
444
535
  key?: string;
@@ -457,13 +548,19 @@ export interface ChargeUsageObject {
457
548
  /** @example "EUR" */
458
549
  amount_currency: string;
459
550
  charge: {
460
- /** @example "278da83c-c007-4fbb-afcd-b00c07c41utg" */
551
+ /**
552
+ * @format uuid
553
+ * @example "278da83c-c007-4fbb-afcd-b00c07c41utg"
554
+ */
461
555
  lago_id?: string;
462
556
  /** Charge model type */
463
557
  charge_model?: "standard" | "graduated" | "package" | "percentage" | "volume";
464
558
  };
465
559
  billable_metric: {
466
- /** @example "278da83c-c007-4fbb-afcd-b00c07c41utg" */
560
+ /**
561
+ * @format uuid
562
+ * @example "278da83c-c007-4fbb-afcd-b00c07c41utg"
563
+ */
467
564
  lago_id?: string;
468
565
  /** @example "Example name" */
469
566
  name?: string;
@@ -473,7 +570,10 @@ export interface ChargeUsageObject {
473
570
  aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "recurring_count_agg";
474
571
  };
475
572
  groups: {
476
- /** @example "278da83c-c007-4fbb-afcd-b00c07c41utg" */
573
+ /**
574
+ * @format uuid
575
+ * @example "278da83c-c007-4fbb-afcd-b00c07c41utg"
576
+ */
477
577
  lago_id?: string;
478
578
  /** @example "key" */
479
579
  key?: string;
@@ -486,11 +586,20 @@ export interface ChargeUsageObject {
486
586
  }[];
487
587
  }
488
588
  export interface CustomerUsageObject {
489
- /** @example "2022-09-14T00:00:00.000Z" */
589
+ /**
590
+ * @format date-time
591
+ * @example "2022-09-14T00:00:00Z"
592
+ */
490
593
  from_datetime: string;
491
- /** @example "2022-09-14T00:00:00.000Z" */
594
+ /**
595
+ * @format date-time
596
+ * @example "2022-09-14T00:00:00Z"
597
+ */
492
598
  to_datetime: string;
493
- /** @example "2022-09-15T00:00:00.000Z" */
599
+ /**
600
+ * @format date-time
601
+ * @example "2022-09-15T00:00:00Z"
602
+ */
494
603
  issuing_date: string;
495
604
  /** @example 1200 */
496
605
  amount_cents: number;
@@ -510,24 +619,39 @@ export interface CustomerUsage {
510
619
  customer_usage: CustomerUsageObject;
511
620
  }
512
621
  export interface EventObject {
513
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
622
+ /**
623
+ * @format uuid
624
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
625
+ */
514
626
  lago_id: string;
515
627
  /** @example "987654321" */
516
628
  transaction_id: string;
517
- /** @example "111da83c-c007-4fbb-afcd-b00c07c41iop" */
629
+ /**
630
+ * @format uuid
631
+ * @example "111da83c-c007-4fbb-afcd-b00c07c41iop"
632
+ */
518
633
  lago_customer_id: string;
519
634
  /** @example "123456" */
520
635
  external_customer_id: string;
521
636
  /** @example "code" */
522
637
  code: string;
523
- /** @example "2022-09-14T16:35:31.000Z" */
638
+ /**
639
+ * @format date-time
640
+ * @example "2022-09-14T16:35:31Z"
641
+ */
524
642
  timestamp: string;
525
643
  properties?: object;
526
- /** @example "447da83c-c007-4fbb-afcd-b00c07c41ffe" */
644
+ /**
645
+ * @format uuid
646
+ * @example "447da83c-c007-4fbb-afcd-b00c07c41ffe"
647
+ */
527
648
  lago_subscription_id: string;
528
649
  /** @example "123456" */
529
650
  external_subscription_id: string;
530
- /** @example "2022-09-14T16:35:31.000Z" */
651
+ /**
652
+ * @format date-time
653
+ * @example "2022-09-14T16:35:31Z"
654
+ */
531
655
  created_at: string;
532
656
  }
533
657
  export interface Event {
@@ -548,6 +672,17 @@ export interface EventInput {
548
672
  properties?: object;
549
673
  };
550
674
  }
675
+ export interface EventEstimateFeesInput {
676
+ event: {
677
+ /** @example "code" */
678
+ code: string;
679
+ /** @example "654321" */
680
+ external_customer_id?: string;
681
+ /** @example "123456" */
682
+ external_subscription_id?: string;
683
+ properties?: object;
684
+ };
685
+ }
551
686
  export interface BatchEventInput {
552
687
  event: {
553
688
  /** @example "123456" */
@@ -562,19 +697,31 @@ export interface BatchEventInput {
562
697
  properties?: object;
563
698
  };
564
699
  }
700
+ export interface Fees {
701
+ fees: FeeObject[];
702
+ }
565
703
  export interface GroupPropertiesObject {
566
704
  /** @example "123456" */
567
705
  group_id: string;
568
706
  values: object;
569
707
  }
570
708
  export interface ChargeObject {
571
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
709
+ /**
710
+ * @format uuid
711
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
712
+ */
572
713
  lago_id: string;
573
- /** @example "278da83c-c007-4fbb-afcd-b00c07c41utg" */
714
+ /**
715
+ * @format uuid
716
+ * @example "278da83c-c007-4fbb-afcd-b00c07c41utg"
717
+ */
574
718
  lago_billable_metric_id: string;
575
719
  /** @example "bm_code" */
576
720
  billable_metric_code: string;
577
- /** @example "2022-09-14T16:35:31.000Z" */
721
+ /**
722
+ * @format date-time
723
+ * @example "2022-09-14T16:35:31Z"
724
+ */
578
725
  created_at: string;
579
726
  /** Charge model type */
580
727
  charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
@@ -582,11 +729,17 @@ export interface ChargeObject {
582
729
  group_properties?: GroupPropertiesObject[];
583
730
  }
584
731
  export interface PlanObject {
585
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
732
+ /**
733
+ * @format uuid
734
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
735
+ */
586
736
  lago_id: string;
587
737
  /** @example "example name" */
588
738
  name: string;
589
- /** @example "2022-09-14T16:35:31.000Z" */
739
+ /**
740
+ * @format date-time
741
+ * @example "2022-09-14T16:35:31Z"
742
+ */
590
743
  created_at: string;
591
744
  /** @example "example_code" */
592
745
  code: string;
@@ -637,9 +790,15 @@ export interface PlanInput {
637
790
  /** @example false */
638
791
  bill_charges_monthly?: boolean;
639
792
  charges?: {
640
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
793
+ /**
794
+ * @format uuid
795
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
796
+ */
641
797
  id?: string;
642
- /** @example "278da83c-c007-4fbb-afcd-b00c07c41utg" */
798
+ /**
799
+ * @format uuid
800
+ * @example "278da83c-c007-4fbb-afcd-b00c07c41utg"
801
+ */
643
802
  billable_metric_id?: string;
644
803
  /** Charge model type */
645
804
  charge_model?: "standard" | "graduated" | "package" | "percentage" | "volume";
@@ -653,13 +812,19 @@ export interface PlanInput {
653
812
  };
654
813
  }
655
814
  export interface SubscriptionObject {
656
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
815
+ /**
816
+ * @format uuid
817
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
818
+ */
657
819
  lago_id: string;
658
- /** @example 12345 */
820
+ /** @example "12345" */
659
821
  external_id: string;
660
- /** @example "995da83c-c007-4fbb-afcd-b00c07c41tre" */
822
+ /**
823
+ * @format uuid
824
+ * @example "995da83c-c007-4fbb-afcd-b00c07c41tre"
825
+ */
661
826
  lago_customer_id: string;
662
- /** @example 54321 */
827
+ /** @example "54321" */
663
828
  external_customer_id: string;
664
829
  /** @example "Test subscription" */
665
830
  name?: string;
@@ -669,21 +834,39 @@ export interface SubscriptionObject {
669
834
  status: "active" | "pending" | "terminated" | "canceled";
670
835
  /** Billing time */
671
836
  billing_time: "calendar" | "anniversary";
672
- /** @example "2022-09-14T16:35:31.000Z" */
837
+ /**
838
+ * @format date-time
839
+ * @example "2022-09-14T16:35:31Z"
840
+ */
673
841
  subscription_at: string;
674
- /** @example "2022-09-14T16:35:31.000Z" */
842
+ /**
843
+ * @format date-time
844
+ * @example "2022-09-14T16:35:31Z"
845
+ */
675
846
  started_at: string;
676
- /** @example "2022-09-14T16:35:31.000Z" */
847
+ /**
848
+ * @format date-time
849
+ * @example "2022-09-14T16:35:31Z"
850
+ */
677
851
  terminated_at?: string;
678
- /** @example "2022-09-14T16:35:31.000Z" */
852
+ /**
853
+ * @format date-time
854
+ * @example "2022-09-14T16:35:31Z"
855
+ */
679
856
  canceled_at?: string;
680
- /** @example "2022-09-14T16:35:31.000Z" */
857
+ /**
858
+ * @format date-time
859
+ * @example "2022-09-14T16:35:31Z"
860
+ */
681
861
  created_at: string;
682
862
  /** @example "previous_code" */
683
863
  previous_plan_code?: string;
684
864
  /** @example "next_code" */
685
865
  next_plan_code?: string;
686
- /** @example "2022-09-14T16:35:31.000Z" */
866
+ /**
867
+ * @format date-time
868
+ * @example "2022-09-14T16:35:31Z"
869
+ */
687
870
  downgrade_plan_date?: string;
688
871
  }
689
872
  export interface Subscription {
@@ -694,17 +877,20 @@ export interface Subscriptions {
694
877
  }
695
878
  export interface SubscriptionCreateInput {
696
879
  subscription: {
697
- /** @example 12345 */
880
+ /** @example "12345" */
698
881
  external_customer_id: string;
699
882
  /** @example "example_code" */
700
883
  plan_code: string;
701
884
  /** @example "Test name" */
702
885
  name?: string;
703
- /** @example 54321 */
886
+ /** @example "54321" */
704
887
  external_id: string;
705
888
  /** Billing time */
706
889
  billing_time?: "calendar" | "anniversary";
707
- /** @example "2022-08-08T00:00:00.000Z" */
890
+ /**
891
+ * @format date-time
892
+ * @example "2022-08-08T00:00:00Z"
893
+ */
708
894
  subscription_at?: string;
709
895
  };
710
896
  }
@@ -712,19 +898,28 @@ export interface SubscriptionUpdateInput {
712
898
  subscription: {
713
899
  /** @example "New name" */
714
900
  name?: string;
715
- /** @example "2022-08-08T00:00:00.000Z" */
901
+ /**
902
+ * @format date-time
903
+ * @example "2022-08-08T00:00:00Z"
904
+ */
716
905
  subscription_at?: string;
717
906
  };
718
907
  }
719
908
  export interface CreditObject {
720
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
909
+ /**
910
+ * @format uuid
911
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
912
+ */
721
913
  lago_id: string;
722
914
  /** @example 1200 */
723
915
  amount_cents: number;
724
916
  /** @example "EUR" */
725
917
  amount_currency: string;
726
918
  item: {
727
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
919
+ /**
920
+ * @format uuid
921
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
922
+ */
728
923
  lago_id: string;
729
924
  /** @example "coupon" */
730
925
  type: string;
@@ -734,26 +929,39 @@ export interface CreditObject {
734
929
  name: string;
735
930
  };
736
931
  invoice: {
737
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
932
+ /**
933
+ * @format uuid
934
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
935
+ */
738
936
  lago_id: string;
739
937
  payment_status: "pending" | "succeeded" | "failed";
740
938
  };
741
939
  }
742
940
  export interface FeeObject {
743
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
941
+ /**
942
+ * @format uuid
943
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
944
+ */
744
945
  lago_id: string;
745
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
946
+ /**
947
+ * @format uuid
948
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
949
+ */
746
950
  lago_group_id?: string;
747
- /** @example 1200 */
951
+ /** @example 1000 */
748
952
  amount_cents: number;
749
953
  /** @example "EUR" */
750
954
  amount_currency: string;
751
- /** @example 1200 */
955
+ /** @example 200 */
752
956
  vat_amount_cents: number;
753
957
  /** @example "EUR" */
754
958
  vat_amount_currency: string;
755
959
  /** @example 2.5 */
756
960
  units: number;
961
+ /** @example 1200 */
962
+ total_amount_cents?: number;
963
+ /** @example "EUR" */
964
+ total_amount_currency?: string;
757
965
  /** @example 5 */
758
966
  events_count?: number;
759
967
  item: {
@@ -766,25 +974,40 @@ export interface FeeObject {
766
974
  };
767
975
  }
768
976
  export interface InvoiceMetadataObject {
769
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
977
+ /**
978
+ * @format uuid
979
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
980
+ */
770
981
  lago_id?: string;
771
982
  /** @example "name" */
772
983
  key?: string;
773
984
  /** @example "John" */
774
985
  value?: string;
775
- /** @example "2022-09-14T16:35:31.000Z" */
986
+ /**
987
+ * @format date-time
988
+ * @example "2022-09-14T16:35:31Z"
989
+ */
776
990
  created_at?: string;
777
991
  }
778
992
  export interface InvoiceObject {
779
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
993
+ /**
994
+ * @format uuid
995
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
996
+ */
780
997
  lago_id: string;
781
998
  /** @example 12345 */
782
999
  sequential_id: number;
783
- /** @example 222345 */
1000
+ /** @example "222345" */
784
1001
  number: string;
785
- /** @example "2022-09-14T16:35:31.000Z" */
1002
+ /**
1003
+ * @format date-time
1004
+ * @example "2022-09-14T16:35:31Z"
1005
+ */
786
1006
  charges_from_date: string;
787
- /** @example "2022-09-14T16:35:31.000Z" */
1007
+ /**
1008
+ * @format date-time
1009
+ * @example "2022-09-14T16:35:31Z"
1010
+ */
788
1011
  issuing_date: string;
789
1012
  invoice_type?: "subscription" | "add_on" | "credit";
790
1013
  status: "draft" | "finalized";
@@ -826,7 +1049,10 @@ export interface InvoiceInput {
826
1049
  /** Status */
827
1050
  payment_status: "pending" | "succeeded" | "failed";
828
1051
  metadata?: {
829
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
1052
+ /**
1053
+ * @format uuid
1054
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
1055
+ */
830
1056
  id?: string;
831
1057
  /** @example "name" */
832
1058
  key?: string;
@@ -836,11 +1062,17 @@ export interface InvoiceInput {
836
1062
  };
837
1063
  }
838
1064
  export interface WalletObject {
839
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
1065
+ /**
1066
+ * @format uuid
1067
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
1068
+ */
840
1069
  lago_id: string;
841
- /** @example "254da83c-c007-4fbb-afcd-b00c07c41oit" */
1070
+ /**
1071
+ * @format uuid
1072
+ * @example "254da83c-c007-4fbb-afcd-b00c07c41oit"
1073
+ */
842
1074
  lago_customer_id: string;
843
- /** @example 12345 */
1075
+ /** @example "12345" */
844
1076
  external_customer_id: string;
845
1077
  /** Status */
846
1078
  status: "active" | "terminated";
@@ -856,15 +1088,30 @@ export interface WalletObject {
856
1088
  balance: number;
857
1089
  /** @example 100 */
858
1090
  consumed_credits: number;
859
- /** @example "2022-09-14T16:35:31.000Z" */
1091
+ /**
1092
+ * @format date-time
1093
+ * @example "2022-09-14T16:35:31Z"
1094
+ */
860
1095
  created_at: string;
861
- /** @example "2022-09-14T23:59:59.000Z" */
1096
+ /**
1097
+ * @format date-time
1098
+ * @example "2022-09-14T23:59:59Z"
1099
+ */
862
1100
  expiration_at?: string;
863
- /** @example "2022-09-14T16:35:31.000Z" */
1101
+ /**
1102
+ * @format date-time
1103
+ * @example "2022-09-14T16:35:31Z"
1104
+ */
864
1105
  last_balance_sync_at?: string;
865
- /** @example "2022-09-14T16:35:31.000Z" */
1106
+ /**
1107
+ * @format date-time
1108
+ * @example "2022-09-14T16:35:31Z"
1109
+ */
866
1110
  last_consumed_credit_at?: string;
867
- /** @example "2022-09-14T16:35:31.000Z" */
1111
+ /**
1112
+ * @format date-time
1113
+ * @example "2022-09-14T16:35:31Z"
1114
+ */
868
1115
  terminated_at?: string;
869
1116
  }
870
1117
  export interface Wallet {
@@ -885,9 +1132,12 @@ export interface WalletInput {
885
1132
  paid_credits?: number;
886
1133
  /** @example 10 */
887
1134
  granted_credits?: number;
888
- /** @example 12345 */
1135
+ /** @example "12345" */
889
1136
  external_customer_id: string;
890
- /** @example "2022-09-14T23:59:59.000Z" */
1137
+ /**
1138
+ * @format date-time
1139
+ * @example "2022-09-14T23:59:59Z"
1140
+ */
891
1141
  expiration_at?: string;
892
1142
  };
893
1143
  }
@@ -895,14 +1145,23 @@ export interface WalletUpdateInput {
895
1145
  wallet: {
896
1146
  /** @example "Wallet name" */
897
1147
  name?: string;
898
- /** @example "2022-09-14T23:59:59.000Z" */
1148
+ /**
1149
+ * @format date-time
1150
+ * @example "2022-09-14T23:59:59Z"
1151
+ */
899
1152
  expiration_at?: string;
900
1153
  };
901
1154
  }
902
1155
  export interface WalletTransactionObject {
903
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
1156
+ /**
1157
+ * @format uuid
1158
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
1159
+ */
904
1160
  lago_id: string;
905
- /** @example "985da83c-c007-4fbb-afcd-b00c07c41ffe" */
1161
+ /**
1162
+ * @format uuid
1163
+ * @example "985da83c-c007-4fbb-afcd-b00c07c41ffe"
1164
+ */
906
1165
  lago_wallet_id: string;
907
1166
  /** Status */
908
1167
  status: "pending" | "settled";
@@ -912,9 +1171,15 @@ export interface WalletTransactionObject {
912
1171
  amount: number;
913
1172
  /** @example 100 */
914
1173
  credit_amount: number;
915
- /** @example "2022-09-14T16:35:31.000Z" */
1174
+ /**
1175
+ * @format date-time
1176
+ * @example "2022-09-14T16:35:31Z"
1177
+ */
916
1178
  settled_at?: string;
917
- /** @example "2022-09-14T16:35:31.000Z" */
1179
+ /**
1180
+ * @format date-time
1181
+ * @example "2022-09-14T16:35:31Z"
1182
+ */
918
1183
  created_at: string;
919
1184
  }
920
1185
  export interface WalletTransaction {
@@ -925,7 +1190,10 @@ export interface WalletTransactions {
925
1190
  }
926
1191
  export interface WalletTransactionInput {
927
1192
  wallet_transaction: {
928
- /** @example "985da83c-c007-4fbb-afcd-b00c07c41ffe" */
1193
+ /**
1194
+ * @format uuid
1195
+ * @example "985da83c-c007-4fbb-afcd-b00c07c41ffe"
1196
+ */
929
1197
  wallet_id: string;
930
1198
  /** @example 100 */
931
1199
  paid_credits?: number;
@@ -934,7 +1202,10 @@ export interface WalletTransactionInput {
934
1202
  };
935
1203
  }
936
1204
  export interface CreditNoteItemObject {
937
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
1205
+ /**
1206
+ * @format uuid
1207
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
1208
+ */
938
1209
  lago_id: string;
939
1210
  /** @example 1220 */
940
1211
  amount_cents: number;
@@ -943,17 +1214,26 @@ export interface CreditNoteItemObject {
943
1214
  fee: FeeObject;
944
1215
  }
945
1216
  export interface CreditNoteObject {
946
- /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
1217
+ /**
1218
+ * @format uuid
1219
+ * @example "183da83c-c007-4fbb-afcd-b00c07c41ffe"
1220
+ */
947
1221
  lago_id: string;
948
1222
  /** @example 1234 */
949
1223
  sequential_id: number;
950
1224
  /** @example "123456789" */
951
1225
  number: string;
952
- /** @example "144da83c-c007-4fbb-afcd-b00c07c41ffe" */
1226
+ /**
1227
+ * @format uuid
1228
+ * @example "144da83c-c007-4fbb-afcd-b00c07c41ffe"
1229
+ */
953
1230
  lago_invoice_id: string;
954
1231
  /** @example "123456789" */
955
1232
  invoice_number: string;
956
- /** @example "2022-09-14T16:35:31.000Z" */
1233
+ /**
1234
+ * @format date-time
1235
+ * @example "2022-09-14T16:35:31Z"
1236
+ */
957
1237
  issuing_date: string;
958
1238
  /** Credit status */
959
1239
  credit_status?: "available" | "consumed" | "voided";
@@ -987,9 +1267,15 @@ export interface CreditNoteObject {
987
1267
  refund_amount_cents: number;
988
1268
  /** @example "EUR" */
989
1269
  refund_amount_currency: string;
990
- /** @example "2022-09-14T16:35:31.000Z" */
1270
+ /**
1271
+ * @format date-time
1272
+ * @example "2022-09-14T16:35:31Z"
1273
+ */
991
1274
  created_at: string;
992
- /** @example "2022-09-14T16:35:31.000Z" */
1275
+ /**
1276
+ * @format date-time
1277
+ * @example "2022-09-14T16:35:31Z"
1278
+ */
993
1279
  updated_at: string;
994
1280
  /** @example "https://example.com" */
995
1281
  file_url?: string;
@@ -1004,7 +1290,10 @@ export interface CreditNotes {
1004
1290
  }
1005
1291
  export interface CreditNoteInput {
1006
1292
  credit_note: {
1007
- /** @example "194da83c-c007-4fbb-afcd-b00c07c41fzh" */
1293
+ /**
1294
+ * @format uuid
1295
+ * @example "194da83c-c007-4fbb-afcd-b00c07c41fzh"
1296
+ */
1008
1297
  invoice_id: string;
1009
1298
  /** Reason */
1010
1299
  reason: "duplicated_charge" | "product_unsatisfactory" | "order_change" | "order_cancellation" | "fraudulent_charge" | "other";
@@ -1015,7 +1304,10 @@ export interface CreditNoteInput {
1015
1304
  /** @example 20 */
1016
1305
  refund_amount_cents: number;
1017
1306
  items: {
1018
- /** @example "144da83c-c007-4fbb-afcd-b00c07c41ffe" */
1307
+ /**
1308
+ * @format uuid
1309
+ * @example "144da83c-c007-4fbb-afcd-b00c07c41ffe"
1310
+ */
1019
1311
  fee_id: string;
1020
1312
  /** @example 20 */
1021
1313
  amount_cents: number;
@@ -1532,6 +1824,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1532
1824
  * @secure
1533
1825
  */
1534
1826
  findEvent: (id: string, params?: RequestParams) => Promise<HttpResponse<Event, ApiResponseUnauthorized | ApiResponseNotFound>>;
1827
+ /**
1828
+ * @description Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple instant charges
1829
+ *
1830
+ * @tags events
1831
+ * @name EventEstimateFees
1832
+ * @summary Estimate fees for an instant charge
1833
+ * @request POST:/events/estimate_fees
1834
+ * @secure
1835
+ */
1836
+ eventEstimateFees: (data: EventEstimateFeesInput, params?: RequestParams) => Promise<HttpResponse<Fees, ApiResponseBadRequest | ApiResponseUnauthorized | ApiResponseUnprocessableEntity | ApiResponseNotFound>>;
1535
1837
  };
1536
1838
  plans: {
1537
1839
  /**
@@ -1754,12 +2056,14 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1754
2056
  external_customer_id?: string;
1755
2057
  /**
1756
2058
  * Date from
1757
- * @example "2022-07-08T00:00:00.000Z"
2059
+ * @format date
2060
+ * @example "2022-07-08"
1758
2061
  */
1759
2062
  issuing_date_from?: string;
1760
2063
  /**
1761
2064
  * Date to
1762
- * @example "2022-08-09T00:00:00.000Z"
2065
+ * @format date
2066
+ * @example "2022-08-09"
1763
2067
  */
1764
2068
  issuing_date_to?: string;
1765
2069
  /**