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.
@@ -128,6 +128,14 @@ export class HttpClient {
128
128
  if (r.ok) {
129
129
  r.data = data;
130
130
  }
131
+ else if (responseFormat === "text") {
132
+ try {
133
+ r.error = JSON.parse(data);
134
+ }
135
+ catch {
136
+ r.error = data;
137
+ }
138
+ }
131
139
  else {
132
140
  r.error = data;
133
141
  }
@@ -148,7 +156,7 @@ export class HttpClient {
148
156
  }
149
157
  /**
150
158
  * @title Lago API documentation
151
- * @version 1.49.0
159
+ * @version 1.52.0
152
160
  * @license AGPLv3 (https://github.com/getlago/lago-openapi/blob/main/LICENSE)
153
161
  * @baseUrl https://api.getlago.com/api/v1
154
162
  * @externalDocs https://github.com/getlago
@@ -1844,6 +1852,22 @@ export class Api extends HttpClient {
1844
1852
  format: "json",
1845
1853
  ...params,
1846
1854
  }),
1855
+ /**
1856
+ * @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.
1857
+ *
1858
+ * @tags invoices
1859
+ * @name DeleteInvoice
1860
+ * @summary Delete a draft invoice
1861
+ * @request DELETE:/invoices/{lago_id}
1862
+ * @secure
1863
+ */
1864
+ deleteInvoice: (lagoId, params = {}) => this.request({
1865
+ path: `/invoices/${lagoId}`,
1866
+ method: "DELETE",
1867
+ secure: true,
1868
+ format: "json",
1869
+ ...params,
1870
+ }),
1847
1871
  /**
1848
1872
  * @description This endpoint is used for downloading a specific invoice PDF document.
1849
1873
  *
@@ -3518,12 +3542,30 @@ export class Api extends HttpClient {
3518
3542
  * @name FetchPublicKey
3519
3543
  * @summary Retrieve webhook public key
3520
3544
  * @request GET:/webhooks/public_key
3545
+ * @deprecated
3521
3546
  * @secure
3522
3547
  */
3523
3548
  fetchPublicKey: (params = {}) => this.request({
3524
3549
  path: `/webhooks/public_key`,
3525
3550
  method: "GET",
3526
3551
  secure: true,
3552
+ format: "text",
3553
+ ...params,
3554
+ }),
3555
+ /**
3556
+ * @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.
3557
+ *
3558
+ * @tags webhooks
3559
+ * @name FetchJsonPublicKey
3560
+ * @summary Retrieve webhook public key (JSON)
3561
+ * @request GET:/webhooks/json_public_key
3562
+ * @secure
3563
+ */
3564
+ fetchJsonPublicKey: (params = {}) => this.request({
3565
+ path: `/webhooks/json_public_key`,
3566
+ method: "GET",
3567
+ secure: true,
3568
+ format: "json",
3527
3569
  ...params,
3528
3570
  }),
3529
3571
  };