lago-javascript-client 1.52.0 → 1.53.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.
@@ -160,7 +160,7 @@ class HttpClient {
160
160
  exports.HttpClient = HttpClient;
161
161
  /**
162
162
  * @title Lago API documentation
163
- * @version 1.52.0
163
+ * @version 1.53.0
164
164
  * @license AGPLv3 (https://github.com/getlago/lago-openapi/blob/main/LICENSE)
165
165
  * @baseUrl https://api.getlago.com/api/v1
166
166
  * @externalDocs https://github.com/getlago
@@ -1259,7 +1259,7 @@ class Api extends HttpClient {
1259
1259
  ...params,
1260
1260
  }),
1261
1261
  /**
1262
- * @description This endpoint is used to update an existing wallet with prepaid credits.
1262
+ * @description This endpoint is used to update an existing wallet with prepaid credits. A terminated wallet cannot be updated and returns a `422` error.
1263
1263
  *
1264
1264
  * @tags wallets
1265
1265
  * @name UpdateCustomerWallet
@@ -1719,7 +1719,7 @@ class Api extends HttpClient {
1719
1719
  };
1720
1720
  fees = {
1721
1721
  /**
1722
- * @description This endpoint is used for retrieving all fees that has been issued.
1722
+ * @description This endpoint is used for retrieving all fees that have been issued.
1723
1723
  *
1724
1724
  * @tags fees
1725
1725
  * @name FindAllFees
@@ -1823,7 +1823,7 @@ class Api extends HttpClient {
1823
1823
  ...params,
1824
1824
  }),
1825
1825
  /**
1826
- * @description This endpoint is used for updating an existing invoice.
1826
+ * @description This endpoint is used for updating an existing invoice. A voided invoice cannot be updated and returns a `405` error.
1827
1827
  *
1828
1828
  * @tags invoices
1829
1829
  * @name UpdateInvoice
@@ -2022,7 +2022,145 @@ class Api extends HttpClient {
2022
2022
  ...params,
2023
2023
  }),
2024
2024
  };
2025
+ orderForms = {
2026
+ /**
2027
+ * @description This endpoint is used to list all existing order forms. This is a premium feature.
2028
+ *
2029
+ * @tags order_forms
2030
+ * @name FindAllOrderForms
2031
+ * @summary List all order forms
2032
+ * @request GET:/order_forms
2033
+ * @secure
2034
+ */
2035
+ findAllOrderForms: (query, params = {}) => this.request({
2036
+ path: `/order_forms`,
2037
+ method: "GET",
2038
+ query: query,
2039
+ secure: true,
2040
+ format: "json",
2041
+ ...params,
2042
+ }),
2043
+ /**
2044
+ * @description This endpoint retrieves a specific order form. This is a premium feature.
2045
+ *
2046
+ * @tags order_forms
2047
+ * @name FindOrderForm
2048
+ * @summary Retrieve an order form
2049
+ * @request GET:/order_forms/{lago_id}
2050
+ * @secure
2051
+ */
2052
+ findOrderForm: (lagoId, params = {}) => this.request({
2053
+ path: `/order_forms/${lagoId}`,
2054
+ method: "GET",
2055
+ secure: true,
2056
+ format: "json",
2057
+ ...params,
2058
+ }),
2059
+ /**
2060
+ * @description This endpoint records the customer's signature on an order form, and creates the order that carries the quoted deal out. Only a `generated` order form can be signed, so a `422` is returned once the order form has been signed, has expired or has been voided. An `execute_at` landing on or after the day the quoted deal stops being executable is rejected as well, so the order can never be scheduled past the term it bills. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2061
+ *
2062
+ * @tags order_forms
2063
+ * @name MarkOrderFormAsSigned
2064
+ * @summary Mark an order form as signed
2065
+ * @request POST:/order_forms/{lago_id}/mark_as_signed
2066
+ * @secure
2067
+ */
2068
+ markOrderFormAsSigned: (lagoId, data, params = {}) => this.request({
2069
+ path: `/order_forms/${lagoId}/mark_as_signed`,
2070
+ method: "POST",
2071
+ body: data,
2072
+ secure: true,
2073
+ type: ContentType.Json,
2074
+ format: "json",
2075
+ ...params,
2076
+ }),
2077
+ /**
2078
+ * @description This endpoint voids an order form, with the `manual` reason, and cascades to the quote version it was generated from, which is voided with the `cascade_of_voided` reason. Only a `generated` order form can be voided, so a `422` is returned once the order form has been signed, has expired or has already been voided. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2079
+ *
2080
+ * @tags order_forms
2081
+ * @name VoidOrderForm
2082
+ * @summary Void an order form
2083
+ * @request POST:/order_forms/{lago_id}/void
2084
+ * @secure
2085
+ */
2086
+ voidOrderForm: (lagoId, params = {}) => this.request({
2087
+ path: `/order_forms/${lagoId}/void`,
2088
+ method: "POST",
2089
+ secure: true,
2090
+ format: "json",
2091
+ ...params,
2092
+ }),
2093
+ };
2094
+ orders = {
2095
+ /**
2096
+ * @description This endpoint is used to list all existing orders. This is a premium feature.
2097
+ *
2098
+ * @tags orders
2099
+ * @name FindAllOrders
2100
+ * @summary List all orders
2101
+ * @request GET:/orders
2102
+ * @secure
2103
+ */
2104
+ findAllOrders: (query, params = {}) => this.request({
2105
+ path: `/orders`,
2106
+ method: "GET",
2107
+ query: query,
2108
+ secure: true,
2109
+ format: "json",
2110
+ ...params,
2111
+ }),
2112
+ /**
2113
+ * @description This endpoint retrieves a specific order, along with the `billing_snapshot` its execution applies and the `execution_record` of what it produced. This is a premium feature.
2114
+ *
2115
+ * @tags orders
2116
+ * @name FindOrder
2117
+ * @summary Retrieve an order
2118
+ * @request GET:/orders/{lago_id}
2119
+ * @secure
2120
+ */
2121
+ findOrder: (lagoId, params = {}) => this.request({
2122
+ path: `/orders/${lagoId}`,
2123
+ method: "GET",
2124
+ secure: true,
2125
+ format: "json",
2126
+ ...params,
2127
+ }),
2128
+ /**
2129
+ * @description This endpoint carries out an order on demand, without waiting for its `execute_at` schedule. It runs synchronously, so the response carries the resulting status and, when the execution fails, the reason it failed. An `execute_in_lago` order applies the quoted deal, creating the subscriptions, coupons, wallets or one-off invoice it describes; an `order_only` order is simply marked as executed. What the execution produced is listed in `execution_record`. Executing is idempotent: an order that has already been executed is returned untouched. An order whose previous execution failed is executed again, and a `422` is returned when the order carries no execution mode and none is provided in the body. Restating an `execution_mode` that differs from the one stored on the order updates it first, which only succeeds while the order is still `created`: a `failed` order can be retried, but not switched to another mode. That update also re-validates the order's own `execute_at` against the day the quoted deal stops being executable, so a `422` is possible even though no date was sent. An order carrying no `execute_at` is not bounded that way, and a deal whose term has passed then only fails when the execution runs. A `404` is not limited to an unknown order: when the execution cannot find a catalog record the quote pinned, such as a deleted plan, charge, coupon or the subscription being amended, the missing resource is reported as a `404` and the order is left `failed`. Concurrency is reported two ways. A mode change losing the race on the quote comes back as a `422` validation error, while the execution itself losing it comes back as a `422` carrying a lock code, because a scheduled execution relies on that error to be retried. This is a premium feature.
2130
+ *
2131
+ * @tags orders
2132
+ * @name ExecuteOrder
2133
+ * @summary Execute an order
2134
+ * @request POST:/orders/{lago_id}/execute
2135
+ * @secure
2136
+ */
2137
+ executeOrder: (lagoId, data, params = {}) => this.request({
2138
+ path: `/orders/${lagoId}/execute`,
2139
+ method: "POST",
2140
+ body: data,
2141
+ secure: true,
2142
+ type: ContentType.Json,
2143
+ format: "json",
2144
+ ...params,
2145
+ }),
2146
+ };
2025
2147
  organizations = {
2148
+ /**
2149
+ * @description This endpoint retrieves your own organization's settings.
2150
+ *
2151
+ * @tags organizations
2152
+ * @name FindOrganization
2153
+ * @summary Retrieve your organization
2154
+ * @request GET:/organizations
2155
+ * @secure
2156
+ */
2157
+ findOrganization: (params = {}) => this.request({
2158
+ path: `/organizations`,
2159
+ method: "GET",
2160
+ secure: true,
2161
+ format: "json",
2162
+ ...params,
2163
+ }),
2026
2164
  /**
2027
2165
  * @description This endpoint is used to update your own organization's settings.
2028
2166
  *
@@ -2699,6 +2837,126 @@ class Api extends HttpClient {
2699
2837
  ...params,
2700
2838
  }),
2701
2839
  };
2840
+ quotes = {
2841
+ /**
2842
+ * @description This endpoint is used to list all existing quotes. Quotes are ordered by creation date, from the most recent to the oldest. This is a premium feature.
2843
+ *
2844
+ * @tags quotes
2845
+ * @name FindAllQuotes
2846
+ * @summary List all quotes
2847
+ * @request GET:/quotes
2848
+ * @secure
2849
+ */
2850
+ findAllQuotes: (query, params = {}) => this.request({
2851
+ path: `/quotes`,
2852
+ method: "GET",
2853
+ query: query,
2854
+ secure: true,
2855
+ format: "json",
2856
+ ...params,
2857
+ }),
2858
+ /**
2859
+ * @description This endpoint retrieves a specific quote, along with its owners and its current version. This is a premium feature.
2860
+ *
2861
+ * @tags quotes
2862
+ * @name FindQuote
2863
+ * @summary Retrieve a quote
2864
+ * @request GET:/quotes/{lago_id}
2865
+ * @secure
2866
+ */
2867
+ findQuote: (lagoId, params = {}) => this.request({
2868
+ path: `/quotes/${lagoId}`,
2869
+ method: "GET",
2870
+ secure: true,
2871
+ format: "json",
2872
+ ...params,
2873
+ }),
2874
+ /**
2875
+ * @description This endpoint is used to list all the versions of a specific quote, from the most recent to the oldest. The `content` and `billing_items` of each version are omitted; retrieve a version to get them. This is a premium feature.
2876
+ *
2877
+ * @tags quotes
2878
+ * @name FindAllQuoteVersions
2879
+ * @summary List all versions of a quote
2880
+ * @request GET:/quotes/{lago_id}/versions
2881
+ * @secure
2882
+ */
2883
+ findAllQuoteVersions: (lagoId, query, params = {}) => this.request({
2884
+ path: `/quotes/${lagoId}/versions`,
2885
+ method: "GET",
2886
+ query: query,
2887
+ secure: true,
2888
+ format: "json",
2889
+ ...params,
2890
+ }),
2891
+ };
2892
+ quoteVersions = {
2893
+ /**
2894
+ * @description This endpoint retrieves a specific quote version, along with its document `content` and its `billing_items`. This is a premium feature.
2895
+ *
2896
+ * @tags quotes
2897
+ * @name FindQuoteVersion
2898
+ * @summary Retrieve a quote version
2899
+ * @request GET:/quote_versions/{lago_id}
2900
+ * @secure
2901
+ */
2902
+ findQuoteVersion: (lagoId, params = {}) => this.request({
2903
+ path: `/quote_versions/${lagoId}`,
2904
+ method: "GET",
2905
+ secure: true,
2906
+ format: "json",
2907
+ ...params,
2908
+ }),
2909
+ /**
2910
+ * @description This endpoint approves a quote version and generates the order form to send to the customer for signature. Only a `draft` version can be approved, and its `billing_items` must be complete: approval validates them against the catalog and against the customer, and returns a `422` when the deal cannot be executed as quoted. The `expires_at` of the generated order form is bounded by the deal's own term, so a signing window reaching beyond the day the deal stops being executable is rejected. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2911
+ *
2912
+ * @tags quotes
2913
+ * @name ApproveQuoteVersion
2914
+ * @summary Approve a quote version
2915
+ * @request POST:/quote_versions/{lago_id}/approve
2916
+ * @secure
2917
+ */
2918
+ approveQuoteVersion: (lagoId, data, params = {}) => this.request({
2919
+ path: `/quote_versions/${lagoId}/approve`,
2920
+ method: "POST",
2921
+ body: data,
2922
+ secure: true,
2923
+ type: ContentType.Json,
2924
+ format: "json",
2925
+ ...params,
2926
+ }),
2927
+ /**
2928
+ * @description This endpoint voids a quote version, which makes it definitive: a voided version can neither be edited nor approved again. Only a `draft` version can be voided through this endpoint, and the resulting `void_reason` is `manual`. An `approved` version is voided by Lago itself, through the order form generated from it. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2929
+ *
2930
+ * @tags quotes
2931
+ * @name VoidQuoteVersion
2932
+ * @summary Void a quote version
2933
+ * @request POST:/quote_versions/{lago_id}/void
2934
+ * @secure
2935
+ */
2936
+ voidQuoteVersion: (lagoId, params = {}) => this.request({
2937
+ path: `/quote_versions/${lagoId}/void`,
2938
+ method: "POST",
2939
+ secure: true,
2940
+ format: "json",
2941
+ ...params,
2942
+ }),
2943
+ /**
2944
+ * @description This endpoint copies a quote version into a new `draft` version of the same quote, so that the deal can be renegotiated. Any version of the quote can be cloned, but a quote can only carry one active version: the draft the quote currently holds, if any, is voided with the `superseded` reason. Cloning is therefore rejected with a `422` once a version of the quote has been approved. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2945
+ *
2946
+ * @tags quotes
2947
+ * @name CloneQuoteVersion
2948
+ * @summary Clone a quote version
2949
+ * @request POST:/quote_versions/{lago_id}/clone
2950
+ * @secure
2951
+ */
2952
+ cloneQuoteVersion: (lagoId, params = {}) => this.request({
2953
+ path: `/quote_versions/${lagoId}/clone`,
2954
+ method: "POST",
2955
+ secure: true,
2956
+ format: "json",
2957
+ ...params,
2958
+ }),
2959
+ };
2702
2960
  subscriptions = {
2703
2961
  /**
2704
2962
  * @description This endpoint assigns a plan to a customer, creating or modifying a subscription. Ideal for initial subscriptions or plan changes (upgrades/downgrades).
@@ -3317,7 +3575,7 @@ class Api extends HttpClient {
3317
3575
  ...params,
3318
3576
  }),
3319
3577
  /**
3320
- * @description This endpoint is used to update an existing wallet with prepaid credits.
3578
+ * @description This endpoint is used to update an existing wallet with prepaid credits. A terminated wallet cannot be updated and returns a `422` error.
3321
3579
  *
3322
3580
  * @tags wallets
3323
3581
  * @name UpdateWallet