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