lago-javascript-client 1.49.0 → 1.52.0

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.
@@ -131,6 +131,14 @@ class HttpClient {
131
131
  if (r.ok) {
132
132
  r.data = data;
133
133
  }
134
+ else if (responseFormat === "text") {
135
+ try {
136
+ r.error = JSON.parse(data);
137
+ }
138
+ catch {
139
+ r.error = data;
140
+ }
141
+ }
134
142
  else {
135
143
  r.error = data;
136
144
  }
@@ -152,7 +160,7 @@ class HttpClient {
152
160
  exports.HttpClient = HttpClient;
153
161
  /**
154
162
  * @title Lago API documentation
155
- * @version 1.49.0
163
+ * @version 1.52.0
156
164
  * @license AGPLv3 (https://github.com/getlago/lago-openapi/blob/main/LICENSE)
157
165
  * @baseUrl https://api.getlago.com/api/v1
158
166
  * @externalDocs https://github.com/getlago
@@ -1848,6 +1856,22 @@ class Api extends HttpClient {
1848
1856
  format: "json",
1849
1857
  ...params,
1850
1858
  }),
1859
+ /**
1860
+ * @description This endpoint is used for permanently deleting a `draft` invoice. Deleting a draft invoice removes it entirely: it never becomes accounts receivable, consumes no invoice number, and disappears from every list, export, and analytics surface. Only invoices in the `draft` status can be deleted; for a `finalized` invoice, void it instead.
1861
+ *
1862
+ * @tags invoices
1863
+ * @name DeleteInvoice
1864
+ * @summary Delete a draft invoice
1865
+ * @request DELETE:/invoices/{lago_id}
1866
+ * @secure
1867
+ */
1868
+ deleteInvoice: (lagoId, params = {}) => this.request({
1869
+ path: `/invoices/${lagoId}`,
1870
+ method: "DELETE",
1871
+ secure: true,
1872
+ format: "json",
1873
+ ...params,
1874
+ }),
1851
1875
  /**
1852
1876
  * @description This endpoint is used for downloading a specific invoice PDF document.
1853
1877
  *
@@ -3522,12 +3546,30 @@ class Api extends HttpClient {
3522
3546
  * @name FetchPublicKey
3523
3547
  * @summary Retrieve webhook public key
3524
3548
  * @request GET:/webhooks/public_key
3549
+ * @deprecated
3525
3550
  * @secure
3526
3551
  */
3527
3552
  fetchPublicKey: (params = {}) => this.request({
3528
3553
  path: `/webhooks/public_key`,
3529
3554
  method: "GET",
3530
3555
  secure: true,
3556
+ format: "text",
3557
+ ...params,
3558
+ }),
3559
+ /**
3560
+ * @description This endpoint is used to retrieve the public key used to verify the webhooks signature, wrapped in a JSON object. Prefer this endpoint over the deprecated GET /webhooks/public_key.
3561
+ *
3562
+ * @tags webhooks
3563
+ * @name FetchJsonPublicKey
3564
+ * @summary Retrieve webhook public key (JSON)
3565
+ * @request GET:/webhooks/json_public_key
3566
+ * @secure
3567
+ */
3568
+ fetchJsonPublicKey: (params = {}) => this.request({
3569
+ path: `/webhooks/json_public_key`,
3570
+ method: "GET",
3571
+ secure: true,
3572
+ format: "json",
3531
3573
  ...params,
3532
3574
  }),
3533
3575
  };