lago-javascript-client 0.19.4-alpha → 0.20.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.
@@ -859,12 +859,44 @@ export class Api extends HttpClient {
859
859
  format: "json",
860
860
  ...params,
861
861
  }),
862
+ /**
863
+ * @description Refresh a draft invoice
864
+ *
865
+ * @tags invoices
866
+ * @name RefreshInvoice
867
+ * @summary Refresh a draft invoice
868
+ * @request PUT:/invoices/{id}/refresh
869
+ * @secure
870
+ */
871
+ refreshInvoice: (id, params = {}) => this.request({
872
+ path: `/invoices/${id}/refresh`,
873
+ method: "PUT",
874
+ secure: true,
875
+ format: "json",
876
+ ...params,
877
+ }),
878
+ /**
879
+ * @description Finalize a draft invoice
880
+ *
881
+ * @tags invoices
882
+ * @name FinalizeInvoice
883
+ * @summary Finalize a draft invoice
884
+ * @request PUT:/invoices/{id}/finalize
885
+ * @secure
886
+ */
887
+ finalizeInvoice: (id, params = {}) => this.request({
888
+ path: `/invoices/${id}/finalize`,
889
+ method: "PUT",
890
+ secure: true,
891
+ format: "json",
892
+ ...params,
893
+ }),
862
894
  /**
863
895
  * @description Find all invoices in certain organisation
864
896
  *
865
897
  * @tags invoices
866
898
  * @name FindAllInvoices
867
- * @summary Find ainvoices
899
+ * @summary Find all invoices
868
900
  * @request GET:/invoices/
869
901
  * @secure
870
902
  */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/mod.js",
4
4
  "types": "./types/mod.d.ts",
5
5
  "name": "lago-javascript-client",
6
- "version": "v0.19.4-alpha",
6
+ "version": "v0.20.0-beta",
7
7
  "description": "Lago JavaScript API Client",
8
8
  "repository": {
9
9
  "type": "git",
@@ -863,12 +863,44 @@ class Api extends HttpClient {
863
863
  format: "json",
864
864
  ...params,
865
865
  }),
866
+ /**
867
+ * @description Refresh a draft invoice
868
+ *
869
+ * @tags invoices
870
+ * @name RefreshInvoice
871
+ * @summary Refresh a draft invoice
872
+ * @request PUT:/invoices/{id}/refresh
873
+ * @secure
874
+ */
875
+ refreshInvoice: (id, params = {}) => this.request({
876
+ path: `/invoices/${id}/refresh`,
877
+ method: "PUT",
878
+ secure: true,
879
+ format: "json",
880
+ ...params,
881
+ }),
882
+ /**
883
+ * @description Finalize a draft invoice
884
+ *
885
+ * @tags invoices
886
+ * @name FinalizeInvoice
887
+ * @summary Finalize a draft invoice
888
+ * @request PUT:/invoices/{id}/finalize
889
+ * @secure
890
+ */
891
+ finalizeInvoice: (id, params = {}) => this.request({
892
+ path: `/invoices/${id}/finalize`,
893
+ method: "PUT",
894
+ secure: true,
895
+ format: "json",
896
+ ...params,
897
+ }),
866
898
  /**
867
899
  * @description Find all invoices in certain organisation
868
900
  *
869
901
  * @tags invoices
870
902
  * @name FindAllInvoices
871
- * @summary Find ainvoices
903
+ * @summary Find all invoices
872
904
  * @request GET:/invoices/
873
905
  * @secure
874
906
  */
@@ -242,10 +242,10 @@ export interface AppliedCouponInput {
242
242
  export interface BillingConfigurationOrganization {
243
243
  /** @example "text" */
244
244
  invoice_footer?: string;
245
- /** @example 25 */
246
- vat_rate?: number;
247
245
  /** @example 5 */
248
246
  invoice_grace_period?: number;
247
+ /** @example 25 */
248
+ vat_rate?: number;
249
249
  }
250
250
  export interface OrganizationObject {
251
251
  /** @example "183da83c-c007-4fbb-afcd-b00c07c41ffe" */
@@ -311,14 +311,14 @@ export interface OrganizationInput {
311
311
  export interface BillingConfigurationCustomer {
312
312
  /** @example 3 */
313
313
  invoice_grace_period?: number;
314
- /** @example 25 */
315
- vat_rate?: number;
316
314
  /** Payment provider type */
317
315
  payment_provider?: "stripe" | "gocardless";
318
316
  /** @example 123456 */
319
317
  provider_customer_id?: string;
320
318
  /** @example true */
321
319
  sync_with_provider?: boolean;
320
+ /** @example 25 */
321
+ vat_rate?: number;
322
322
  [key: string]: any;
323
323
  }
324
324
  export interface CustomerObject {
@@ -723,9 +723,8 @@ export interface InvoiceObject {
723
723
  number?: string;
724
724
  /** @example "2022-09-14T16:35:31.000Z" */
725
725
  issuing_date?: string;
726
- /** Invoice type */
727
726
  invoice_type?: "subscription" | "add_on" | "credit";
728
- /** Status */
727
+ status?: "draft" | "finalized";
729
728
  payment_status?: "pending" | "succeeded" | "failed";
730
729
  /** @example 1200 */
731
730
  amount_cents?: number;
@@ -1603,12 +1602,32 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1603
1602
  * @secure
1604
1603
  */
1605
1604
  downloadInvoice: (id: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiResponseUnauthorized | ApiResponseNotFound>>;
1605
+ /**
1606
+ * @description Refresh a draft invoice
1607
+ *
1608
+ * @tags invoices
1609
+ * @name RefreshInvoice
1610
+ * @summary Refresh a draft invoice
1611
+ * @request PUT:/invoices/{id}/refresh
1612
+ * @secure
1613
+ */
1614
+ refreshInvoice: (id: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiResponseUnauthorized | ApiResponseNotFound>>;
1615
+ /**
1616
+ * @description Finalize a draft invoice
1617
+ *
1618
+ * @tags invoices
1619
+ * @name FinalizeInvoice
1620
+ * @summary Finalize a draft invoice
1621
+ * @request PUT:/invoices/{id}/finalize
1622
+ * @secure
1623
+ */
1624
+ finalizeInvoice: (id: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiResponseUnauthorized | ApiResponseNotFound>>;
1606
1625
  /**
1607
1626
  * @description Find all invoices in certain organisation
1608
1627
  *
1609
1628
  * @tags invoices
1610
1629
  * @name FindAllInvoices
1611
- * @summary Find ainvoices
1630
+ * @summary Find all invoices
1612
1631
  * @request GET:/invoices/
1613
1632
  * @secure
1614
1633
  */
@@ -1638,6 +1657,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1638
1657
  * @example "2022-08-09T00:00:00.000Z"
1639
1658
  */
1640
1659
  issuing_date_to?: string;
1660
+ /**
1661
+ * Status (draft or finalized)
1662
+ * @example "draft"
1663
+ */
1664
+ status?: string;
1641
1665
  }, params?: RequestParams) => Promise<HttpResponse<Invoices, ApiResponseUnauthorized>>;
1642
1666
  };
1643
1667
  wallets: {
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Lago
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,115 +0,0 @@
1
- # Lago JavaScript Client
2
-
3
- This is a JavaScript wrapper for Lago API. Works in Cloudflare Workers, Deno, and Node.js. Generated from [the Lago Swagger document](https://swagger.getlago.com/#/).
4
-
5
- [![PyPI version](https://badge.fury.io/js/lago-javascript-client.svg)](https://badge.fury.io/js/lago-javascript-client)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html)
7
-
8
- ## Installation
9
-
10
- For npm users:
11
-
12
- ```bash
13
- npm install lago-javascript-client
14
- ```
15
-
16
- ```typescript
17
- // npm
18
- import { Client, getLagoError } from 'lago-javascript-client';
19
-
20
- // Deno
21
- import { Client, getLagoError } from 'https://deno.land/x/lago/mod.ts';
22
-
23
- const lagoClient = Client('__YOUR_API_KEY__');
24
-
25
- try {
26
- const { data } = await lagoClient.billableMetrics.createBillableMetric(billableMetric);
27
- } catch (error) {
28
- const lagoError = await getLagoError<typeof lagoClient.billableMetrics.createBillableMetric>(error);
29
- }
30
- ```
31
-
32
- ## Compatibility
33
-
34
- This SDK uses the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and natively supported Node.js version >= 18. For other Node versions:
35
-
36
- 1. Ideally, run Node with the [`--experimental-fetch` flag](https://nodejs.org/docs/latest-v16.x/api/cli.html#--experimental-fetch)
37
-
38
- 1. Otherwise, polyfill the Fetch API by doing both:
39
-
40
- 1. [Patching globalThis](https://github.com/node-fetch/node-fetch#providing-global-access)
41
-
42
- 1. [Pass a Fetch instance](https://github.com/node-fetch/node-fetch#loading-and-configuring-the-module) to the Lago client
43
-
44
- ```typescript
45
- import { Client } from 'lago-javascript-client';
46
- import fetch from 'node-fetch';
47
-
48
- const lagoClient = Client("api_key", { customFetch: fetch });
49
- ```
50
-
51
- ## Usage
52
-
53
- Check the [Lago API reference](https://doc.getlago.com/docs/api/intro)
54
-
55
- ### Error handling
56
-
57
- Use the get `getLagoError<>()` utility function to extract the error object and TypeScript type:
58
-
59
- ```typescript
60
- try {
61
- const { data } = await lagoClient.billableMetrics.createBillableMetric(billableMetric);
62
- } catch (error) {
63
- const lagoError = await getLagoError<typeof lagoClient.billableMetrics.createBillableMetric>(error);
64
- }
65
- ```
66
-
67
- ## Development
68
-
69
- Uses [dnt](https://github.com/denoland/dnt) to build and test for Deno and Node.
70
-
71
- ### Release new version
72
-
73
- Change the affected fields in `scripts/build_npm.ts` and commit to GitHub. GitHub Actions will build and deploy to npm.
74
-
75
- ### Dependencies
76
-
77
- Requires [Deno](https://deno.land/) and [Node.js >= 18](https://nodejs.org/en/)
78
-
79
- ### Generate client from Swagger
80
-
81
- ```bash
82
- deno task generate:swagger
83
- ```
84
-
85
- ### Run tests
86
-
87
- ```bash
88
- deno task test
89
- ```
90
-
91
- ### Build
92
-
93
- ```bash
94
- deno task build
95
- ```
96
-
97
- ### Publish to npm
98
-
99
- ```bash
100
- deno task build
101
- cd npm
102
- npm publish
103
- ```
104
-
105
- ## Documentation
106
-
107
- The Lago documentation is available at [doc.getlago.com](https://doc.getlago.com/docs/api/intro).
108
-
109
- ## Contributing
110
-
111
- The contribution documentation is available [here](https://github.com/getlago/lago-javascript-client/blob/main/CONTRIBUTING.md)
112
-
113
- ## License
114
-
115
- Lago Node.js client is distributed under [AGPL-3.0](LICENSE).