lago-javascript-client 0.19.4-alpha

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.
@@ -0,0 +1,1095 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ /* tslint:disable */
4
+ /*
5
+ * ---------------------------------------------------------------
6
+ * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
7
+ * ## ##
8
+ * ## AUTHOR: acacode ##
9
+ * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
10
+ * ---------------------------------------------------------------
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.Api = exports.HttpClient = exports.ContentType = void 0;
14
+ var ContentType;
15
+ (function (ContentType) {
16
+ ContentType["Json"] = "application/json";
17
+ ContentType["FormData"] = "multipart/form-data";
18
+ ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
19
+ ContentType["Text"] = "text/plain";
20
+ })(ContentType = exports.ContentType || (exports.ContentType = {}));
21
+ class HttpClient {
22
+ baseUrl = "https://api.getlago.com/api/v1";
23
+ securityData = null;
24
+ securityWorker;
25
+ abortControllers = new Map();
26
+ customFetch = (...fetchParams) => fetch(...fetchParams);
27
+ baseApiParams = {
28
+ credentials: "same-origin",
29
+ headers: {},
30
+ redirect: "follow",
31
+ referrerPolicy: "no-referrer",
32
+ };
33
+ constructor(apiConfig = {}) {
34
+ Object.assign(this, apiConfig);
35
+ }
36
+ setSecurityData = (data) => {
37
+ this.securityData = data;
38
+ };
39
+ encodeQueryParam(key, value) {
40
+ const encodedKey = encodeURIComponent(key);
41
+ return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
42
+ }
43
+ addQueryParam(query, key) {
44
+ return this.encodeQueryParam(key, query[key]);
45
+ }
46
+ addArrayQueryParam(query, key) {
47
+ const value = query[key];
48
+ return value.map((v) => this.encodeQueryParam(key, v)).join("&");
49
+ }
50
+ toQueryString(rawQuery) {
51
+ const query = rawQuery || {};
52
+ const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
53
+ return keys
54
+ .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))
55
+ .join("&");
56
+ }
57
+ addQueryParams(rawQuery) {
58
+ const queryString = this.toQueryString(rawQuery);
59
+ return queryString ? `?${queryString}` : "";
60
+ }
61
+ contentFormatters = {
62
+ [ContentType.Json]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
63
+ [ContentType.Text]: (input) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input),
64
+ [ContentType.FormData]: (input) => Object.keys(input || {}).reduce((formData, key) => {
65
+ const property = input[key];
66
+ formData.append(key, property instanceof Blob
67
+ ? property
68
+ : typeof property === "object" && property !== null
69
+ ? JSON.stringify(property)
70
+ : `${property}`);
71
+ return formData;
72
+ }, new FormData()),
73
+ [ContentType.UrlEncoded]: (input) => this.toQueryString(input),
74
+ };
75
+ mergeRequestParams(params1, params2) {
76
+ return {
77
+ ...this.baseApiParams,
78
+ ...params1,
79
+ ...(params2 || {}),
80
+ headers: {
81
+ ...(this.baseApiParams.headers || {}),
82
+ ...(params1.headers || {}),
83
+ ...((params2 && params2.headers) || {}),
84
+ },
85
+ };
86
+ }
87
+ createAbortSignal = (cancelToken) => {
88
+ if (this.abortControllers.has(cancelToken)) {
89
+ const abortController = this.abortControllers.get(cancelToken);
90
+ if (abortController) {
91
+ return abortController.signal;
92
+ }
93
+ return void 0;
94
+ }
95
+ const abortController = new AbortController();
96
+ this.abortControllers.set(cancelToken, abortController);
97
+ return abortController.signal;
98
+ };
99
+ abortRequest = (cancelToken) => {
100
+ const abortController = this.abortControllers.get(cancelToken);
101
+ if (abortController) {
102
+ abortController.abort();
103
+ this.abortControllers.delete(cancelToken);
104
+ }
105
+ };
106
+ request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }) => {
107
+ const secureParams = ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) &&
108
+ this.securityWorker &&
109
+ (await this.securityWorker(this.securityData))) ||
110
+ {};
111
+ const requestParams = this.mergeRequestParams(params, secureParams);
112
+ const queryString = query && this.toQueryString(query);
113
+ const payloadFormatter = this.contentFormatters[type || ContentType.Json];
114
+ const responseFormat = format || requestParams.format;
115
+ return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
116
+ ...requestParams,
117
+ headers: {
118
+ ...(requestParams.headers || {}),
119
+ ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
120
+ },
121
+ signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
122
+ body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
123
+ }).then(async (response) => {
124
+ const r = response;
125
+ r.data = null;
126
+ r.error = null;
127
+ const data = !responseFormat
128
+ ? r
129
+ : await response[responseFormat]()
130
+ .then((data) => {
131
+ if (r.ok) {
132
+ r.data = data;
133
+ }
134
+ else {
135
+ r.error = data;
136
+ }
137
+ return r;
138
+ })
139
+ .catch((e) => {
140
+ r.error = e;
141
+ return r;
142
+ });
143
+ if (cancelToken) {
144
+ this.abortControllers.delete(cancelToken);
145
+ }
146
+ if (!response.ok)
147
+ throw data;
148
+ return data;
149
+ });
150
+ };
151
+ }
152
+ exports.HttpClient = HttpClient;
153
+ /**
154
+ * @title Lago API documentation
155
+ * @version 0.0.1
156
+ * @baseUrl https://api.getlago.com/api/v1
157
+ * @externalDocs https://github.com/getlago
158
+ * @contact <tech@getlago.com>
159
+ *
160
+ * Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
161
+ */
162
+ class Api extends HttpClient {
163
+ billableMetrics = {
164
+ /**
165
+ * @description Create a new billable metric
166
+ *
167
+ * @tags billable_metrics
168
+ * @name CreateBillableMetric
169
+ * @summary Create a new billable metric
170
+ * @request POST:/billable_metrics
171
+ * @secure
172
+ */
173
+ createBillableMetric: (data, params = {}) => this.request({
174
+ path: `/billable_metrics`,
175
+ method: "POST",
176
+ body: data,
177
+ secure: true,
178
+ type: ContentType.Json,
179
+ format: "json",
180
+ ...params,
181
+ }),
182
+ /**
183
+ * @description Update an existing billable metric by code
184
+ *
185
+ * @tags billable_metrics
186
+ * @name UpdateBillableMetric
187
+ * @summary Update an existing billable metric
188
+ * @request PUT:/billable_metrics/{code}
189
+ * @secure
190
+ */
191
+ updateBillableMetric: (code, data, params = {}) => this.request({
192
+ path: `/billable_metrics/${code}`,
193
+ method: "PUT",
194
+ body: data,
195
+ secure: true,
196
+ type: ContentType.Json,
197
+ format: "json",
198
+ ...params,
199
+ }),
200
+ /**
201
+ * @description Return a single billable metric
202
+ *
203
+ * @tags billable_metrics
204
+ * @name FindBillableMetric
205
+ * @summary Find billable metric by code
206
+ * @request GET:/billable_metrics/{code}
207
+ * @secure
208
+ */
209
+ findBillableMetric: (code, params = {}) => this.request({
210
+ path: `/billable_metrics/${code}`,
211
+ method: "GET",
212
+ secure: true,
213
+ format: "json",
214
+ ...params,
215
+ }),
216
+ /**
217
+ * @description Delete a billable metric
218
+ *
219
+ * @tags billable_metrics
220
+ * @name DestroyBillableMetric
221
+ * @summary Delete a billable metric
222
+ * @request DELETE:/billable_metrics/{code}
223
+ * @secure
224
+ */
225
+ destroyBillableMetric: (code, params = {}) => this.request({
226
+ path: `/billable_metrics/${code}`,
227
+ method: "DELETE",
228
+ secure: true,
229
+ format: "json",
230
+ ...params,
231
+ }),
232
+ /**
233
+ * @description Find all billable metrics in certain organisation
234
+ *
235
+ * @tags billable_metrics
236
+ * @name FindAllBillableMetrics
237
+ * @summary Find Billable metrics
238
+ * @request GET:/billable_metrics/
239
+ * @secure
240
+ */
241
+ findAllBillableMetrics: (query, params = {}) => this.request({
242
+ path: `/billable_metrics/`,
243
+ method: "GET",
244
+ query: query,
245
+ secure: true,
246
+ format: "json",
247
+ ...params,
248
+ }),
249
+ /**
250
+ * @description Find all billable metric groups in certain organisation
251
+ *
252
+ * @tags billable_metrics
253
+ * @name FindAllBillableMetricGroups
254
+ * @summary Find Billable metric groups
255
+ * @request GET:/billable_metrics/{code}/groups
256
+ * @secure
257
+ */
258
+ findAllBillableMetricGroups: (code, query, params = {}) => this.request({
259
+ path: `/billable_metrics/${code}/groups`,
260
+ method: "GET",
261
+ query: query,
262
+ secure: true,
263
+ format: "json",
264
+ ...params,
265
+ }),
266
+ };
267
+ addOns = {
268
+ /**
269
+ * @description Create a new add-on
270
+ *
271
+ * @tags add_ons
272
+ * @name CreateAddOn
273
+ * @summary Create a new add-on
274
+ * @request POST:/add_ons
275
+ * @secure
276
+ */
277
+ createAddOn: (data, params = {}) => this.request({
278
+ path: `/add_ons`,
279
+ method: "POST",
280
+ body: data,
281
+ secure: true,
282
+ type: ContentType.Json,
283
+ format: "json",
284
+ ...params,
285
+ }),
286
+ /**
287
+ * @description Update an existing add-on by code
288
+ *
289
+ * @tags add_ons
290
+ * @name UpdateAddOn
291
+ * @summary Update an existing add-on
292
+ * @request PUT:/add_ons/{code}
293
+ * @secure
294
+ */
295
+ updateAddOn: (code, data, params = {}) => this.request({
296
+ path: `/add_ons/${code}`,
297
+ method: "PUT",
298
+ body: data,
299
+ secure: true,
300
+ type: ContentType.Json,
301
+ format: "json",
302
+ ...params,
303
+ }),
304
+ /**
305
+ * @description Return a single add-on
306
+ *
307
+ * @tags add_ons
308
+ * @name FindAddOn
309
+ * @summary Find add-on by code
310
+ * @request GET:/add_ons/{code}
311
+ * @secure
312
+ */
313
+ findAddOn: (code, params = {}) => this.request({
314
+ path: `/add_ons/${code}`,
315
+ method: "GET",
316
+ secure: true,
317
+ format: "json",
318
+ ...params,
319
+ }),
320
+ /**
321
+ * @description Delete an add-on
322
+ *
323
+ * @tags add_ons
324
+ * @name DestroyAddOn
325
+ * @summary Delete an add-on
326
+ * @request DELETE:/add_ons/{code}
327
+ * @secure
328
+ */
329
+ destroyAddOn: (code, params = {}) => this.request({
330
+ path: `/add_ons/${code}`,
331
+ method: "DELETE",
332
+ secure: true,
333
+ format: "json",
334
+ ...params,
335
+ }),
336
+ /**
337
+ * @description Find all add-ons in certain organisation
338
+ *
339
+ * @tags add_ons
340
+ * @name FindAllAddOns
341
+ * @summary Find add-ons
342
+ * @request GET:/add_ons/
343
+ * @secure
344
+ */
345
+ findAllAddOns: (query, params = {}) => this.request({
346
+ path: `/add_ons/`,
347
+ method: "GET",
348
+ query: query,
349
+ secure: true,
350
+ format: "json",
351
+ ...params,
352
+ }),
353
+ };
354
+ appliedAddOns = {
355
+ /**
356
+ * @description Apply an add-on to a customer
357
+ *
358
+ * @tags add_ons
359
+ * @name ApplyAddOn
360
+ * @summary Apply an add-on to a customer
361
+ * @request POST:/applied_add_ons
362
+ * @secure
363
+ */
364
+ applyAddOn: (data, params = {}) => this.request({
365
+ path: `/applied_add_ons`,
366
+ method: "POST",
367
+ body: data,
368
+ secure: true,
369
+ type: ContentType.Json,
370
+ format: "json",
371
+ ...params,
372
+ }),
373
+ };
374
+ coupons = {
375
+ /**
376
+ * @description Create a new coupon
377
+ *
378
+ * @tags coupons
379
+ * @name CreateCoupon
380
+ * @summary Create a new coupon
381
+ * @request POST:/coupons
382
+ * @secure
383
+ */
384
+ createCoupon: (data, params = {}) => this.request({
385
+ path: `/coupons`,
386
+ method: "POST",
387
+ body: data,
388
+ secure: true,
389
+ type: ContentType.Json,
390
+ format: "json",
391
+ ...params,
392
+ }),
393
+ /**
394
+ * @description Update an existing coupon by code
395
+ *
396
+ * @tags coupons
397
+ * @name UpdateCoupon
398
+ * @summary Update an existing coupon
399
+ * @request PUT:/coupons/{code}
400
+ * @secure
401
+ */
402
+ updateCoupon: (code, data, params = {}) => this.request({
403
+ path: `/coupons/${code}`,
404
+ method: "PUT",
405
+ body: data,
406
+ secure: true,
407
+ type: ContentType.Json,
408
+ format: "json",
409
+ ...params,
410
+ }),
411
+ /**
412
+ * @description Return a single coupon
413
+ *
414
+ * @tags coupons
415
+ * @name FindCoupon
416
+ * @summary Find coupon by code
417
+ * @request GET:/coupons/{code}
418
+ * @secure
419
+ */
420
+ findCoupon: (code, params = {}) => this.request({
421
+ path: `/coupons/${code}`,
422
+ method: "GET",
423
+ secure: true,
424
+ format: "json",
425
+ ...params,
426
+ }),
427
+ /**
428
+ * @description Delete a coupon
429
+ *
430
+ * @tags coupons
431
+ * @name DestroyCoupon
432
+ * @summary Delete a coupon
433
+ * @request DELETE:/coupons/{code}
434
+ * @secure
435
+ */
436
+ destroyCoupon: (code, params = {}) => this.request({
437
+ path: `/coupons/${code}`,
438
+ method: "DELETE",
439
+ secure: true,
440
+ format: "json",
441
+ ...params,
442
+ }),
443
+ /**
444
+ * @description Find all coupons in certain organisation
445
+ *
446
+ * @tags coupons
447
+ * @name FindAllCoupons
448
+ * @summary Find Coupons
449
+ * @request GET:/coupons/
450
+ * @secure
451
+ */
452
+ findAllCoupons: (query, params = {}) => this.request({
453
+ path: `/coupons/`,
454
+ method: "GET",
455
+ query: query,
456
+ secure: true,
457
+ format: "json",
458
+ ...params,
459
+ }),
460
+ };
461
+ appliedCoupons = {
462
+ /**
463
+ * @description Apply a coupon to a customer
464
+ *
465
+ * @tags coupons
466
+ * @name ApplyCoupon
467
+ * @summary Apply a coupon to a customer
468
+ * @request POST:/applied_coupons
469
+ * @secure
470
+ */
471
+ applyCoupon: (data, params = {}) => this.request({
472
+ path: `/applied_coupons`,
473
+ method: "POST",
474
+ body: data,
475
+ secure: true,
476
+ type: ContentType.Json,
477
+ format: "json",
478
+ ...params,
479
+ }),
480
+ /**
481
+ * @description Find all applied coupons
482
+ *
483
+ * @tags coupons
484
+ * @name FindAllAppliedCoupons
485
+ * @summary Find Applied Coupons
486
+ * @request GET:/applied_coupons/
487
+ * @secure
488
+ */
489
+ findAllAppliedCoupons: (query, params = {}) => this.request({
490
+ path: `/applied_coupons/`,
491
+ method: "GET",
492
+ query: query,
493
+ secure: true,
494
+ format: "json",
495
+ ...params,
496
+ }),
497
+ };
498
+ organizations = {
499
+ /**
500
+ * @description Update an existing organization
501
+ *
502
+ * @tags organizations
503
+ * @name UpdateOrganization
504
+ * @summary Update an existing Organization
505
+ * @request PUT:/organizations/
506
+ * @secure
507
+ */
508
+ updateOrganization: (data, params = {}) => this.request({
509
+ path: `/organizations/`,
510
+ method: "PUT",
511
+ body: data,
512
+ secure: true,
513
+ type: ContentType.Json,
514
+ format: "json",
515
+ ...params,
516
+ }),
517
+ };
518
+ customers = {
519
+ /**
520
+ * @description Create a new customer
521
+ *
522
+ * @tags customers
523
+ * @name CreateCustomer
524
+ * @summary Create a customer
525
+ * @request POST:/customers
526
+ * @secure
527
+ */
528
+ createCustomer: (data, params = {}) => this.request({
529
+ path: `/customers`,
530
+ method: "POST",
531
+ body: data,
532
+ secure: true,
533
+ type: ContentType.Json,
534
+ format: "json",
535
+ ...params,
536
+ }),
537
+ /**
538
+ * @description Return a single customer
539
+ *
540
+ * @tags customers
541
+ * @name FindCustomer
542
+ * @summary Find customer by external ID
543
+ * @request GET:/customers/{external_id}
544
+ * @secure
545
+ */
546
+ findCustomer: (externalId, params = {}) => this.request({
547
+ path: `/customers/${externalId}`,
548
+ method: "GET",
549
+ secure: true,
550
+ format: "json",
551
+ ...params,
552
+ }),
553
+ /**
554
+ * @description Return a customer current usage
555
+ *
556
+ * @tags customers
557
+ * @name FindCustomerCurrentUsage
558
+ * @summary Find customer current usage
559
+ * @request GET:/customers/{customer_external_id}/current_usage
560
+ * @secure
561
+ */
562
+ findCustomerCurrentUsage: (customerExternalId, query, params = {}) => this.request({
563
+ path: `/customers/${customerExternalId}/current_usage`,
564
+ method: "GET",
565
+ query: query,
566
+ secure: true,
567
+ format: "json",
568
+ ...params,
569
+ }),
570
+ /**
571
+ * @description Find all customers in certain organisation
572
+ *
573
+ * @tags customers
574
+ * @name FindAllCustomers
575
+ * @summary Find customers
576
+ * @request GET:/customers/
577
+ * @secure
578
+ */
579
+ findAllCustomers: (query, params = {}) => this.request({
580
+ path: `/customers/`,
581
+ method: "GET",
582
+ query: query,
583
+ secure: true,
584
+ format: "json",
585
+ ...params,
586
+ }),
587
+ };
588
+ events = {
589
+ /**
590
+ * @description Create a new event
591
+ *
592
+ * @tags events
593
+ * @name CreateEvent
594
+ * @summary Create a new event
595
+ * @request POST:/events
596
+ * @secure
597
+ */
598
+ createEvent: (data, params = {}) => this.request({
599
+ path: `/events`,
600
+ method: "POST",
601
+ body: data,
602
+ secure: true,
603
+ type: ContentType.Json,
604
+ ...params,
605
+ }),
606
+ /**
607
+ * @description Create batch events
608
+ *
609
+ * @tags events
610
+ * @name CreateBatchEvents
611
+ * @summary Create batch events
612
+ * @request POST:/events/batch
613
+ * @secure
614
+ */
615
+ createBatchEvents: (data, params = {}) => this.request({
616
+ path: `/events/batch`,
617
+ method: "POST",
618
+ body: data,
619
+ secure: true,
620
+ type: ContentType.Json,
621
+ ...params,
622
+ }),
623
+ /**
624
+ * @description Return a single event
625
+ *
626
+ * @tags events
627
+ * @name FindEvent
628
+ * @summary Find event by transaction ID
629
+ * @request GET:/events/{id}
630
+ * @secure
631
+ */
632
+ findEvent: (id, params = {}) => this.request({
633
+ path: `/events/${id}`,
634
+ method: "GET",
635
+ secure: true,
636
+ format: "json",
637
+ ...params,
638
+ }),
639
+ };
640
+ plans = {
641
+ /**
642
+ * @description Create a new plan
643
+ *
644
+ * @tags plans
645
+ * @name CreatePlan
646
+ * @summary Create a new plan
647
+ * @request POST:/plans
648
+ * @secure
649
+ */
650
+ createPlan: (data, params = {}) => this.request({
651
+ path: `/plans`,
652
+ method: "POST",
653
+ body: data,
654
+ secure: true,
655
+ type: ContentType.Json,
656
+ format: "json",
657
+ ...params,
658
+ }),
659
+ /**
660
+ * @description Update an existing plan by code
661
+ *
662
+ * @tags plans
663
+ * @name UpdatePlan
664
+ * @summary Update an existing plan
665
+ * @request PUT:/plans/{code}
666
+ * @secure
667
+ */
668
+ updatePlan: (code, data, params = {}) => this.request({
669
+ path: `/plans/${code}`,
670
+ method: "PUT",
671
+ body: data,
672
+ secure: true,
673
+ type: ContentType.Json,
674
+ format: "json",
675
+ ...params,
676
+ }),
677
+ /**
678
+ * @description Return a single plan
679
+ *
680
+ * @tags plans
681
+ * @name FindPlan
682
+ * @summary Fin plan by code
683
+ * @request GET:/plans/{code}
684
+ * @secure
685
+ */
686
+ findPlan: (code, params = {}) => this.request({
687
+ path: `/plans/${code}`,
688
+ method: "GET",
689
+ secure: true,
690
+ format: "json",
691
+ ...params,
692
+ }),
693
+ /**
694
+ * @description Delete a plan
695
+ *
696
+ * @tags plans
697
+ * @name DestroyPlan
698
+ * @summary Delete a plan
699
+ * @request DELETE:/plans/{code}
700
+ * @secure
701
+ */
702
+ destroyPlan: (code, params = {}) => this.request({
703
+ path: `/plans/${code}`,
704
+ method: "DELETE",
705
+ secure: true,
706
+ format: "json",
707
+ ...params,
708
+ }),
709
+ /**
710
+ * @description Find all plans in certain organisation
711
+ *
712
+ * @tags plans
713
+ * @name FindAllPlans
714
+ * @summary Find plans
715
+ * @request GET:/plans/
716
+ * @secure
717
+ */
718
+ findAllPlans: (query, params = {}) => this.request({
719
+ path: `/plans/`,
720
+ method: "GET",
721
+ query: query,
722
+ secure: true,
723
+ format: "json",
724
+ ...params,
725
+ }),
726
+ };
727
+ subscriptions = {
728
+ /**
729
+ * @description Assign a plan to a customer
730
+ *
731
+ * @tags subscriptions
732
+ * @name CreateSubscription
733
+ * @summary Assign a plan to a customer
734
+ * @request POST:/subscriptions
735
+ * @secure
736
+ */
737
+ createSubscription: (data, params = {}) => this.request({
738
+ path: `/subscriptions`,
739
+ method: "POST",
740
+ body: data,
741
+ secure: true,
742
+ type: ContentType.Json,
743
+ format: "json",
744
+ ...params,
745
+ }),
746
+ /**
747
+ * @description Update an existing subscription by external ID
748
+ *
749
+ * @tags subscriptions
750
+ * @name UpdateSubscription
751
+ * @summary Update an existing subscription
752
+ * @request PUT:/subscriptions/{external_id}
753
+ * @secure
754
+ */
755
+ updateSubscription: (externalId, data, params = {}) => this.request({
756
+ path: `/subscriptions/${externalId}`,
757
+ method: "PUT",
758
+ body: data,
759
+ secure: true,
760
+ type: ContentType.Json,
761
+ format: "json",
762
+ ...params,
763
+ }),
764
+ /**
765
+ * @description Terminate a subscription
766
+ *
767
+ * @tags subscriptions
768
+ * @name DestroySubscription
769
+ * @summary Terminate a subscription
770
+ * @request DELETE:/subscriptions/{external_id}
771
+ * @secure
772
+ */
773
+ destroySubscription: (externalId, params = {}) => this.request({
774
+ path: `/subscriptions/${externalId}`,
775
+ method: "DELETE",
776
+ secure: true,
777
+ format: "json",
778
+ ...params,
779
+ }),
780
+ /**
781
+ * @description Find all suscriptions for certain customer
782
+ *
783
+ * @tags subscriptions
784
+ * @name FindAllSubscriptions
785
+ * @summary Find subscriptions
786
+ * @request GET:/subscriptions/
787
+ * @secure
788
+ */
789
+ findAllSubscriptions: (query, params = {}) => this.request({
790
+ path: `/subscriptions/`,
791
+ method: "GET",
792
+ query: query,
793
+ secure: true,
794
+ format: "json",
795
+ ...params,
796
+ }),
797
+ };
798
+ webhooks = {
799
+ /**
800
+ * @description Webhook public key
801
+ *
802
+ * @tags webhooks
803
+ * @name FetchPublicKey
804
+ * @summary Fetch webhook public key
805
+ * @request GET:/webhooks/public_key/
806
+ * @secure
807
+ */
808
+ fetchPublicKey: (params = {}) => this.request({
809
+ path: `/webhooks/public_key/`,
810
+ method: "GET",
811
+ secure: true,
812
+ ...params,
813
+ }),
814
+ };
815
+ invoices = {
816
+ /**
817
+ * @description Update an existing invoice
818
+ *
819
+ * @tags invoices
820
+ * @name UpdateInvoice
821
+ * @summary Update an existing invoice status
822
+ * @request PUT:/invoices/{id}
823
+ * @secure
824
+ */
825
+ updateInvoice: (id, data, params = {}) => this.request({
826
+ path: `/invoices/${id}`,
827
+ method: "PUT",
828
+ body: data,
829
+ secure: true,
830
+ type: ContentType.Json,
831
+ format: "json",
832
+ ...params,
833
+ }),
834
+ /**
835
+ * @description Return a single invoice
836
+ *
837
+ * @tags invoices
838
+ * @name FindInvoice
839
+ * @summary Find invoice by ID
840
+ * @request GET:/invoices/{id}
841
+ * @secure
842
+ */
843
+ findInvoice: (id, params = {}) => this.request({
844
+ path: `/invoices/${id}`,
845
+ method: "GET",
846
+ secure: true,
847
+ format: "json",
848
+ ...params,
849
+ }),
850
+ /**
851
+ * @description Download an existing invoice
852
+ *
853
+ * @tags invoices
854
+ * @name DownloadInvoice
855
+ * @summary Download an existing invoice
856
+ * @request POST:/invoices/{id}/download
857
+ * @secure
858
+ */
859
+ downloadInvoice: (id, params = {}) => this.request({
860
+ path: `/invoices/${id}/download`,
861
+ method: "POST",
862
+ secure: true,
863
+ format: "json",
864
+ ...params,
865
+ }),
866
+ /**
867
+ * @description Find all invoices in certain organisation
868
+ *
869
+ * @tags invoices
870
+ * @name FindAllInvoices
871
+ * @summary Find ainvoices
872
+ * @request GET:/invoices/
873
+ * @secure
874
+ */
875
+ findAllInvoices: (query, params = {}) => this.request({
876
+ path: `/invoices/`,
877
+ method: "GET",
878
+ query: query,
879
+ secure: true,
880
+ format: "json",
881
+ ...params,
882
+ }),
883
+ };
884
+ wallets = {
885
+ /**
886
+ * @description Create a new wallet
887
+ *
888
+ * @tags wallets
889
+ * @name CreateWallet
890
+ * @summary Create a new wallet
891
+ * @request POST:/wallets
892
+ * @secure
893
+ */
894
+ createWallet: (data, params = {}) => this.request({
895
+ path: `/wallets`,
896
+ method: "POST",
897
+ body: data,
898
+ secure: true,
899
+ type: ContentType.Json,
900
+ format: "json",
901
+ ...params,
902
+ }),
903
+ /**
904
+ * @description Update an existing wallet
905
+ *
906
+ * @tags wallets
907
+ * @name UpdateWallet
908
+ * @summary Update an existing wallet
909
+ * @request PUT:/wallets/{id}
910
+ * @secure
911
+ */
912
+ updateWallet: (id, data, params = {}) => this.request({
913
+ path: `/wallets/${id}`,
914
+ method: "PUT",
915
+ body: data,
916
+ secure: true,
917
+ type: ContentType.Json,
918
+ format: "json",
919
+ ...params,
920
+ }),
921
+ /**
922
+ * @description Return a wallet
923
+ *
924
+ * @tags wallets
925
+ * @name FindWallet
926
+ * @summary Find wallet
927
+ * @request GET:/wallets/{id}
928
+ * @secure
929
+ */
930
+ findWallet: (id, params = {}) => this.request({
931
+ path: `/wallets/${id}`,
932
+ method: "GET",
933
+ secure: true,
934
+ format: "json",
935
+ ...params,
936
+ }),
937
+ /**
938
+ * @description Delete a wallet
939
+ *
940
+ * @tags wallets
941
+ * @name DestroyWallet
942
+ * @summary Delete a wallet
943
+ * @request DELETE:/wallets/{id}
944
+ * @secure
945
+ */
946
+ destroyWallet: (id, params = {}) => this.request({
947
+ path: `/wallets/${id}`,
948
+ method: "DELETE",
949
+ secure: true,
950
+ format: "json",
951
+ ...params,
952
+ }),
953
+ /**
954
+ * @description Find all wallets for certain customer
955
+ *
956
+ * @tags wallets
957
+ * @name FindAllWallets
958
+ * @summary Find wallets
959
+ * @request GET:/wallets/
960
+ * @secure
961
+ */
962
+ findAllWallets: (query, params = {}) => this.request({
963
+ path: `/wallets/`,
964
+ method: "GET",
965
+ query: query,
966
+ secure: true,
967
+ format: "json",
968
+ ...params,
969
+ }),
970
+ };
971
+ walletTransactions = {
972
+ /**
973
+ * @description Create a new wallet transaction
974
+ *
975
+ * @tags wallets
976
+ * @name CreateWalletTransaction
977
+ * @summary Create a new wallet transaction
978
+ * @request POST:/wallet_transactions
979
+ * @secure
980
+ */
981
+ createWalletTransaction: (data, params = {}) => this.request({
982
+ path: `/wallet_transactions`,
983
+ method: "POST",
984
+ body: data,
985
+ secure: true,
986
+ type: ContentType.Json,
987
+ format: "json",
988
+ ...params,
989
+ }),
990
+ };
991
+ creditNotes = {
992
+ /**
993
+ * @description Create a new credit note
994
+ *
995
+ * @tags credit_notes
996
+ * @name CreateCreditNote
997
+ * @summary Create a new Credit note
998
+ * @request POST:/credit_notes
999
+ * @secure
1000
+ */
1001
+ createCreditNote: (data, params = {}) => this.request({
1002
+ path: `/credit_notes`,
1003
+ method: "POST",
1004
+ body: data,
1005
+ secure: true,
1006
+ type: ContentType.Json,
1007
+ format: "json",
1008
+ ...params,
1009
+ }),
1010
+ /**
1011
+ * @description Update an existing credit note
1012
+ *
1013
+ * @tags credit_notes
1014
+ * @name UpdateCreditNote
1015
+ * @summary Update an existing credit note
1016
+ * @request PUT:/credit_notes/{id}
1017
+ * @secure
1018
+ */
1019
+ updateCreditNote: (id, data, params = {}) => this.request({
1020
+ path: `/credit_notes/${id}`,
1021
+ method: "PUT",
1022
+ body: data,
1023
+ secure: true,
1024
+ type: ContentType.Json,
1025
+ format: "json",
1026
+ ...params,
1027
+ }),
1028
+ /**
1029
+ * @description Return a single credit note
1030
+ *
1031
+ * @tags credit_notes
1032
+ * @name FindCreditNote
1033
+ * @summary Find credit note
1034
+ * @request GET:/credit_notes/{id}
1035
+ * @secure
1036
+ */
1037
+ findCreditNote: (id, params = {}) => this.request({
1038
+ path: `/credit_notes/${id}`,
1039
+ method: "GET",
1040
+ secure: true,
1041
+ format: "json",
1042
+ ...params,
1043
+ }),
1044
+ /**
1045
+ * @description Download an existing credit note
1046
+ *
1047
+ * @tags credit_notes
1048
+ * @name DownloadCreditNote
1049
+ * @summary Download an existing credit note
1050
+ * @request POST:/credit_notes/{id}/download
1051
+ * @secure
1052
+ */
1053
+ downloadCreditNote: (id, params = {}) => this.request({
1054
+ path: `/credit_notes/${id}/download`,
1055
+ method: "POST",
1056
+ secure: true,
1057
+ format: "json",
1058
+ ...params,
1059
+ }),
1060
+ /**
1061
+ * @description Void an existing credit note
1062
+ *
1063
+ * @tags credit_notes
1064
+ * @name VoidCreditNote
1065
+ * @summary Void existing credit note
1066
+ * @request PUT:/credit_notes/{id}/void
1067
+ * @secure
1068
+ */
1069
+ voidCreditNote: (id, params = {}) => this.request({
1070
+ path: `/credit_notes/${id}/void`,
1071
+ method: "PUT",
1072
+ secure: true,
1073
+ format: "json",
1074
+ ...params,
1075
+ }),
1076
+ /**
1077
+ * @description Find all credit notes in certain organisation
1078
+ *
1079
+ * @tags credit_notes
1080
+ * @name FindAllCreditNotes
1081
+ * @summary Find Credit notes
1082
+ * @request GET:/credit_notes/
1083
+ * @secure
1084
+ */
1085
+ findAllCreditNotes: (query, params = {}) => this.request({
1086
+ path: `/credit_notes/`,
1087
+ method: "GET",
1088
+ query: query,
1089
+ secure: true,
1090
+ format: "json",
1091
+ ...params,
1092
+ }),
1093
+ };
1094
+ }
1095
+ exports.Api = Api;