lago-javascript-client 0.39.0-beta → 0.41.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.
@@ -10,7 +10,260 @@
10
10
  * ---------------------------------------------------------------
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Api = exports.HttpClient = exports.ContentType = exports.Timezone = exports.Currency = void 0;
13
+ exports.Api = exports.HttpClient = exports.ContentType = exports.Timezone = exports.Currency = exports.Country = void 0;
14
+ /** @example "US" */
15
+ var Country;
16
+ (function (Country) {
17
+ Country["AD"] = "AD";
18
+ Country["AE"] = "AE";
19
+ Country["AF"] = "AF";
20
+ Country["AG"] = "AG";
21
+ Country["AI"] = "AI";
22
+ Country["AL"] = "AL";
23
+ Country["AM"] = "AM";
24
+ Country["AO"] = "AO";
25
+ Country["AQ"] = "AQ";
26
+ Country["AR"] = "AR";
27
+ Country["AS"] = "AS";
28
+ Country["AT"] = "AT";
29
+ Country["AU"] = "AU";
30
+ Country["AW"] = "AW";
31
+ Country["AX"] = "AX";
32
+ Country["AZ"] = "AZ";
33
+ Country["BA"] = "BA";
34
+ Country["BB"] = "BB";
35
+ Country["BD"] = "BD";
36
+ Country["BE"] = "BE";
37
+ Country["BF"] = "BF";
38
+ Country["BG"] = "BG";
39
+ Country["BH"] = "BH";
40
+ Country["BI"] = "BI";
41
+ Country["BJ"] = "BJ";
42
+ Country["BL"] = "BL";
43
+ Country["BM"] = "BM";
44
+ Country["BN"] = "BN";
45
+ Country["BO"] = "BO";
46
+ Country["BQ"] = "BQ";
47
+ Country["BR"] = "BR";
48
+ Country["BS"] = "BS";
49
+ Country["BT"] = "BT";
50
+ Country["BV"] = "BV";
51
+ Country["BW"] = "BW";
52
+ Country["BY"] = "BY";
53
+ Country["BZ"] = "BZ";
54
+ Country["CA"] = "CA";
55
+ Country["CC"] = "CC";
56
+ Country["CD"] = "CD";
57
+ Country["CF"] = "CF";
58
+ Country["CG"] = "CG";
59
+ Country["CH"] = "CH";
60
+ Country["CI"] = "CI";
61
+ Country["CK"] = "CK";
62
+ Country["CL"] = "CL";
63
+ Country["CM"] = "CM";
64
+ Country["CN"] = "CN";
65
+ Country["CO"] = "CO";
66
+ Country["CR"] = "CR";
67
+ Country["CU"] = "CU";
68
+ Country["CV"] = "CV";
69
+ Country["CW"] = "CW";
70
+ Country["CX"] = "CX";
71
+ Country["CY"] = "CY";
72
+ Country["CZ"] = "CZ";
73
+ Country["DE"] = "DE";
74
+ Country["DJ"] = "DJ";
75
+ Country["DK"] = "DK";
76
+ Country["DM"] = "DM";
77
+ Country["DO"] = "DO";
78
+ Country["DZ"] = "DZ";
79
+ Country["EC"] = "EC";
80
+ Country["EE"] = "EE";
81
+ Country["EG"] = "EG";
82
+ Country["EH"] = "EH";
83
+ Country["ER"] = "ER";
84
+ Country["ES"] = "ES";
85
+ Country["ET"] = "ET";
86
+ Country["FI"] = "FI";
87
+ Country["FJ"] = "FJ";
88
+ Country["FK"] = "FK";
89
+ Country["FM"] = "FM";
90
+ Country["FO"] = "FO";
91
+ Country["FR"] = "FR";
92
+ Country["GA"] = "GA";
93
+ Country["GB"] = "GB";
94
+ Country["GD"] = "GD";
95
+ Country["GE"] = "GE";
96
+ Country["GF"] = "GF";
97
+ Country["GG"] = "GG";
98
+ Country["GH"] = "GH";
99
+ Country["GI"] = "GI";
100
+ Country["GL"] = "GL";
101
+ Country["GM"] = "GM";
102
+ Country["GN"] = "GN";
103
+ Country["GP"] = "GP";
104
+ Country["GQ"] = "GQ";
105
+ Country["GR"] = "GR";
106
+ Country["GS"] = "GS";
107
+ Country["GT"] = "GT";
108
+ Country["GU"] = "GU";
109
+ Country["GW"] = "GW";
110
+ Country["GY"] = "GY";
111
+ Country["HK"] = "HK";
112
+ Country["HM"] = "HM";
113
+ Country["HN"] = "HN";
114
+ Country["HR"] = "HR";
115
+ Country["HT"] = "HT";
116
+ Country["HU"] = "HU";
117
+ Country["ID"] = "ID";
118
+ Country["IE"] = "IE";
119
+ Country["IL"] = "IL";
120
+ Country["IM"] = "IM";
121
+ Country["IN"] = "IN";
122
+ Country["IO"] = "IO";
123
+ Country["IQ"] = "IQ";
124
+ Country["IR"] = "IR";
125
+ Country["IS"] = "IS";
126
+ Country["IT"] = "IT";
127
+ Country["JE"] = "JE";
128
+ Country["JM"] = "JM";
129
+ Country["JO"] = "JO";
130
+ Country["JP"] = "JP";
131
+ Country["KE"] = "KE";
132
+ Country["KG"] = "KG";
133
+ Country["KH"] = "KH";
134
+ Country["KI"] = "KI";
135
+ Country["KM"] = "KM";
136
+ Country["KN"] = "KN";
137
+ Country["KP"] = "KP";
138
+ Country["KR"] = "KR";
139
+ Country["KW"] = "KW";
140
+ Country["KY"] = "KY";
141
+ Country["KZ"] = "KZ";
142
+ Country["LA"] = "LA";
143
+ Country["LB"] = "LB";
144
+ Country["LC"] = "LC";
145
+ Country["LI"] = "LI";
146
+ Country["LK"] = "LK";
147
+ Country["LR"] = "LR";
148
+ Country["LS"] = "LS";
149
+ Country["LT"] = "LT";
150
+ Country["LU"] = "LU";
151
+ Country["LV"] = "LV";
152
+ Country["LY"] = "LY";
153
+ Country["MA"] = "MA";
154
+ Country["MC"] = "MC";
155
+ Country["MD"] = "MD";
156
+ Country["ME"] = "ME";
157
+ Country["MF"] = "MF";
158
+ Country["MG"] = "MG";
159
+ Country["MH"] = "MH";
160
+ Country["MK"] = "MK";
161
+ Country["ML"] = "ML";
162
+ Country["MM"] = "MM";
163
+ Country["MN"] = "MN";
164
+ Country["MO"] = "MO";
165
+ Country["MP"] = "MP";
166
+ Country["MQ"] = "MQ";
167
+ Country["MR"] = "MR";
168
+ Country["MS"] = "MS";
169
+ Country["MT"] = "MT";
170
+ Country["MU"] = "MU";
171
+ Country["MV"] = "MV";
172
+ Country["MW"] = "MW";
173
+ Country["MX"] = "MX";
174
+ Country["MY"] = "MY";
175
+ Country["MZ"] = "MZ";
176
+ Country["NA"] = "NA";
177
+ Country["NC"] = "NC";
178
+ Country["NE"] = "NE";
179
+ Country["NF"] = "NF";
180
+ Country["NG"] = "NG";
181
+ Country["NI"] = "NI";
182
+ Country["NL"] = "NL";
183
+ Country["NO"] = "NO";
184
+ Country["NP"] = "NP";
185
+ Country["NR"] = "NR";
186
+ Country["NU"] = "NU";
187
+ Country["NZ"] = "NZ";
188
+ Country["OM"] = "OM";
189
+ Country["PA"] = "PA";
190
+ Country["PE"] = "PE";
191
+ Country["PF"] = "PF";
192
+ Country["PG"] = "PG";
193
+ Country["PH"] = "PH";
194
+ Country["PK"] = "PK";
195
+ Country["PL"] = "PL";
196
+ Country["PM"] = "PM";
197
+ Country["PN"] = "PN";
198
+ Country["PR"] = "PR";
199
+ Country["PS"] = "PS";
200
+ Country["PT"] = "PT";
201
+ Country["PW"] = "PW";
202
+ Country["PY"] = "PY";
203
+ Country["QA"] = "QA";
204
+ Country["RE"] = "RE";
205
+ Country["RO"] = "RO";
206
+ Country["RS"] = "RS";
207
+ Country["RU"] = "RU";
208
+ Country["RW"] = "RW";
209
+ Country["SA"] = "SA";
210
+ Country["SB"] = "SB";
211
+ Country["SC"] = "SC";
212
+ Country["SD"] = "SD";
213
+ Country["SE"] = "SE";
214
+ Country["SG"] = "SG";
215
+ Country["SH"] = "SH";
216
+ Country["SI"] = "SI";
217
+ Country["SJ"] = "SJ";
218
+ Country["SK"] = "SK";
219
+ Country["SL"] = "SL";
220
+ Country["SM"] = "SM";
221
+ Country["SN"] = "SN";
222
+ Country["SO"] = "SO";
223
+ Country["SR"] = "SR";
224
+ Country["SS"] = "SS";
225
+ Country["ST"] = "ST";
226
+ Country["SV"] = "SV";
227
+ Country["SX"] = "SX";
228
+ Country["SY"] = "SY";
229
+ Country["SZ"] = "SZ";
230
+ Country["TC"] = "TC";
231
+ Country["TD"] = "TD";
232
+ Country["TF"] = "TF";
233
+ Country["TG"] = "TG";
234
+ Country["TH"] = "TH";
235
+ Country["TJ"] = "TJ";
236
+ Country["TK"] = "TK";
237
+ Country["TL"] = "TL";
238
+ Country["TM"] = "TM";
239
+ Country["TN"] = "TN";
240
+ Country["TO"] = "TO";
241
+ Country["TR"] = "TR";
242
+ Country["TT"] = "TT";
243
+ Country["TV"] = "TV";
244
+ Country["TW"] = "TW";
245
+ Country["TZ"] = "TZ";
246
+ Country["UA"] = "UA";
247
+ Country["UG"] = "UG";
248
+ Country["UM"] = "UM";
249
+ Country["US"] = "US";
250
+ Country["UY"] = "UY";
251
+ Country["UZ"] = "UZ";
252
+ Country["VA"] = "VA";
253
+ Country["VC"] = "VC";
254
+ Country["VE"] = "VE";
255
+ Country["VG"] = "VG";
256
+ Country["VI"] = "VI";
257
+ Country["VN"] = "VN";
258
+ Country["VU"] = "VU";
259
+ Country["WF"] = "WF";
260
+ Country["WS"] = "WS";
261
+ Country["YE"] = "YE";
262
+ Country["YT"] = "YT";
263
+ Country["ZA"] = "ZA";
264
+ Country["ZM"] = "ZM";
265
+ Country["ZW"] = "ZW";
266
+ })(Country = exports.Country || (exports.Country = {}));
14
267
  /** @example "USD" */
15
268
  var Currency;
16
269
  (function (Currency) {
@@ -398,7 +651,7 @@ class HttpClient {
398
651
  ...(requestParams.headers || {}),
399
652
  ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
400
653
  },
401
- signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
654
+ signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
402
655
  body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
403
656
  }).then(async (response) => {
404
657
  const r = response;
@@ -432,7 +685,7 @@ class HttpClient {
432
685
  exports.HttpClient = HttpClient;
433
686
  /**
434
687
  * @title Lago API documentation
435
- * @version 0.39.0-beta
688
+ * @version 0.41.0-beta
436
689
  * @license AGPLv3
437
690
  * @baseUrl https://api.getlago.com/api/v1
438
691
  * @externalDocs https://github.com/getlago
@@ -1459,9 +1712,10 @@ class Api extends HttpClient {
1459
1712
  * @request DELETE:/subscriptions/{external_id}
1460
1713
  * @secure
1461
1714
  */
1462
- destroySubscription: (externalId, params = {}) => this.request({
1715
+ destroySubscription: (externalId, query, params = {}) => this.request({
1463
1716
  path: `/subscriptions/${externalId}`,
1464
1717
  method: "DELETE",
1718
+ query: query,
1465
1719
  secure: true,
1466
1720
  format: "json",
1467
1721
  ...params,
@@ -1469,7 +1723,7 @@ class Api extends HttpClient {
1469
1723
  };
1470
1724
  taxes = {
1471
1725
  /**
1472
- * @description Create a tax
1726
+ * @description This endpoint creates a new tax representing a customizable tax rate applicable to either the organization or a specific customer.
1473
1727
  *
1474
1728
  * @tags taxes
1475
1729
  * @name CreateTax
@@ -1487,11 +1741,11 @@ class Api extends HttpClient {
1487
1741
  ...params,
1488
1742
  }),
1489
1743
  /**
1490
- * @description Find all taxes in certain organization
1744
+ * @description This endpoint retrieves all existing taxes representing a customizable tax rate applicable to either the organization or a specific customer.
1491
1745
  *
1492
1746
  * @tags taxes
1493
1747
  * @name FindAllTaxes
1494
- * @summary Find taxes
1748
+ * @summary List all taxes
1495
1749
  * @request GET:/taxes
1496
1750
  * @secure
1497
1751
  */
@@ -1504,11 +1758,11 @@ class Api extends HttpClient {
1504
1758
  ...params,
1505
1759
  }),
1506
1760
  /**
1507
- * @description Update an existing tax by code
1761
+ * @description This endpoint updates an existing tax representing a customizable tax rate applicable to either the organization or a specific customer.
1508
1762
  *
1509
1763
  * @tags taxes
1510
1764
  * @name UpdateTax
1511
- * @summary Update an existing tax
1765
+ * @summary Update a tax
1512
1766
  * @request PUT:/taxes/{code}
1513
1767
  * @secure
1514
1768
  */
@@ -1522,11 +1776,11 @@ class Api extends HttpClient {
1522
1776
  ...params,
1523
1777
  }),
1524
1778
  /**
1525
- * @description Return a single tax
1779
+ * @description This endpoint retrieves an existing tax representing a customizable tax rate applicable to either the organization or a specific customer. The tax is identified by its unique code.
1526
1780
  *
1527
1781
  * @tags taxes
1528
1782
  * @name FindTax
1529
- * @summary Find tax by code
1783
+ * @summary Retrieve a Tax
1530
1784
  * @request GET:/taxes/{code}
1531
1785
  * @secure
1532
1786
  */
@@ -1538,7 +1792,7 @@ class Api extends HttpClient {
1538
1792
  ...params,
1539
1793
  }),
1540
1794
  /**
1541
- * @description Delete a tax
1795
+ * @description This endpoint is used to delete a tax.
1542
1796
  *
1543
1797
  * @tags taxes
1544
1798
  * @name DestroyTax
@@ -1695,5 +1949,92 @@ class Api extends HttpClient {
1695
1949
  ...params,
1696
1950
  }),
1697
1951
  };
1952
+ webhookEndpoints = {
1953
+ /**
1954
+ * @description This endpoint is used to create a webhook endpoint.
1955
+ *
1956
+ * @tags webhook_endpoints
1957
+ * @name CreateWebhookEndpoint
1958
+ * @summary Create a webhook_endpoint
1959
+ * @request POST:/webhook_endpoints
1960
+ * @secure
1961
+ */
1962
+ createWebhookEndpoint: (data, params = {}) => this.request({
1963
+ path: `/webhook_endpoints`,
1964
+ method: "POST",
1965
+ body: data,
1966
+ secure: true,
1967
+ type: ContentType.Json,
1968
+ format: "json",
1969
+ ...params,
1970
+ }),
1971
+ /**
1972
+ * @description This endpoint is used to list all webhook endpoints.
1973
+ *
1974
+ * @tags webhook_endpoints
1975
+ * @name FindAllWebhookEndpoints
1976
+ * @summary List all webhook endpoints
1977
+ * @request GET:/webhook_endpoints
1978
+ * @secure
1979
+ */
1980
+ findAllWebhookEndpoints: (query, params = {}) => this.request({
1981
+ path: `/webhook_endpoints`,
1982
+ method: "GET",
1983
+ query: query,
1984
+ secure: true,
1985
+ format: "json",
1986
+ ...params,
1987
+ }),
1988
+ /**
1989
+ * @description This endpoint is used to update an existing webhook endpoint.
1990
+ *
1991
+ * @tags webhook_endpoints
1992
+ * @name UpdateWebhookEndpoint
1993
+ * @summary Update a webhook endpoint
1994
+ * @request PUT:/webhook_endpoints/{lago_id}
1995
+ * @secure
1996
+ */
1997
+ updateWebhookEndpoint: (lagoId, data, params = {}) => this.request({
1998
+ path: `/webhook_endpoints/${lagoId}`,
1999
+ method: "PUT",
2000
+ body: data,
2001
+ secure: true,
2002
+ type: ContentType.Json,
2003
+ format: "json",
2004
+ ...params,
2005
+ }),
2006
+ /**
2007
+ * @description This endpoint is used to retrieve an existing webhook endpoint.
2008
+ *
2009
+ * @tags webhook_endpoints
2010
+ * @name FindWebhookEndpoint
2011
+ * @summary Retrieve a webhook endpoint
2012
+ * @request GET:/webhook_endpoints/{lago_id}
2013
+ * @secure
2014
+ */
2015
+ findWebhookEndpoint: (lagoId, params = {}) => this.request({
2016
+ path: `/webhook_endpoints/${lagoId}`,
2017
+ method: "GET",
2018
+ secure: true,
2019
+ format: "json",
2020
+ ...params,
2021
+ }),
2022
+ /**
2023
+ * @description This endpoint is used to delete an existing webhook endpoint.
2024
+ *
2025
+ * @tags webhook_endpoints
2026
+ * @name DestroyWebhookEndpoint
2027
+ * @summary Delete a webhook endpoint
2028
+ * @request DELETE:/webhook_endpoints/{lago_id}
2029
+ * @secure
2030
+ */
2031
+ destroyWebhookEndpoint: (lagoId, params = {}) => this.request({
2032
+ path: `/webhook_endpoints/${lagoId}`,
2033
+ method: "DELETE",
2034
+ secure: true,
2035
+ format: "json",
2036
+ ...params,
2037
+ }),
2038
+ };
1698
2039
  }
1699
2040
  exports.Api = Api;