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.
@@ -156,7 +156,7 @@ export class HttpClient {
156
156
  }
157
157
  /**
158
158
  * @title Lago API documentation
159
- * @version 1.52.0
159
+ * @version 1.53.0
160
160
  * @license AGPLv3 (https://github.com/getlago/lago-openapi/blob/main/LICENSE)
161
161
  * @baseUrl https://api.getlago.com/api/v1
162
162
  * @externalDocs https://github.com/getlago
@@ -1255,7 +1255,7 @@ export class Api extends HttpClient {
1255
1255
  ...params,
1256
1256
  }),
1257
1257
  /**
1258
- * @description This endpoint is used to update an existing wallet with prepaid credits.
1258
+ * @description This endpoint is used to update an existing wallet with prepaid credits. A terminated wallet cannot be updated and returns a `422` error.
1259
1259
  *
1260
1260
  * @tags wallets
1261
1261
  * @name UpdateCustomerWallet
@@ -1715,7 +1715,7 @@ export class Api extends HttpClient {
1715
1715
  };
1716
1716
  fees = {
1717
1717
  /**
1718
- * @description This endpoint is used for retrieving all fees that has been issued.
1718
+ * @description This endpoint is used for retrieving all fees that have been issued.
1719
1719
  *
1720
1720
  * @tags fees
1721
1721
  * @name FindAllFees
@@ -1819,7 +1819,7 @@ export class Api extends HttpClient {
1819
1819
  ...params,
1820
1820
  }),
1821
1821
  /**
1822
- * @description This endpoint is used for updating an existing invoice.
1822
+ * @description This endpoint is used for updating an existing invoice. A voided invoice cannot be updated and returns a `405` error.
1823
1823
  *
1824
1824
  * @tags invoices
1825
1825
  * @name UpdateInvoice
@@ -2018,7 +2018,145 @@ export class Api extends HttpClient {
2018
2018
  ...params,
2019
2019
  }),
2020
2020
  };
2021
+ orderForms = {
2022
+ /**
2023
+ * @description This endpoint is used to list all existing order forms. This is a premium feature.
2024
+ *
2025
+ * @tags order_forms
2026
+ * @name FindAllOrderForms
2027
+ * @summary List all order forms
2028
+ * @request GET:/order_forms
2029
+ * @secure
2030
+ */
2031
+ findAllOrderForms: (query, params = {}) => this.request({
2032
+ path: `/order_forms`,
2033
+ method: "GET",
2034
+ query: query,
2035
+ secure: true,
2036
+ format: "json",
2037
+ ...params,
2038
+ }),
2039
+ /**
2040
+ * @description This endpoint retrieves a specific order form. This is a premium feature.
2041
+ *
2042
+ * @tags order_forms
2043
+ * @name FindOrderForm
2044
+ * @summary Retrieve an order form
2045
+ * @request GET:/order_forms/{lago_id}
2046
+ * @secure
2047
+ */
2048
+ findOrderForm: (lagoId, params = {}) => this.request({
2049
+ path: `/order_forms/${lagoId}`,
2050
+ method: "GET",
2051
+ secure: true,
2052
+ format: "json",
2053
+ ...params,
2054
+ }),
2055
+ /**
2056
+ * @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.
2057
+ *
2058
+ * @tags order_forms
2059
+ * @name MarkOrderFormAsSigned
2060
+ * @summary Mark an order form as signed
2061
+ * @request POST:/order_forms/{lago_id}/mark_as_signed
2062
+ * @secure
2063
+ */
2064
+ markOrderFormAsSigned: (lagoId, data, params = {}) => this.request({
2065
+ path: `/order_forms/${lagoId}/mark_as_signed`,
2066
+ method: "POST",
2067
+ body: data,
2068
+ secure: true,
2069
+ type: ContentType.Json,
2070
+ format: "json",
2071
+ ...params,
2072
+ }),
2073
+ /**
2074
+ * @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.
2075
+ *
2076
+ * @tags order_forms
2077
+ * @name VoidOrderForm
2078
+ * @summary Void an order form
2079
+ * @request POST:/order_forms/{lago_id}/void
2080
+ * @secure
2081
+ */
2082
+ voidOrderForm: (lagoId, params = {}) => this.request({
2083
+ path: `/order_forms/${lagoId}/void`,
2084
+ method: "POST",
2085
+ secure: true,
2086
+ format: "json",
2087
+ ...params,
2088
+ }),
2089
+ };
2090
+ orders = {
2091
+ /**
2092
+ * @description This endpoint is used to list all existing orders. This is a premium feature.
2093
+ *
2094
+ * @tags orders
2095
+ * @name FindAllOrders
2096
+ * @summary List all orders
2097
+ * @request GET:/orders
2098
+ * @secure
2099
+ */
2100
+ findAllOrders: (query, params = {}) => this.request({
2101
+ path: `/orders`,
2102
+ method: "GET",
2103
+ query: query,
2104
+ secure: true,
2105
+ format: "json",
2106
+ ...params,
2107
+ }),
2108
+ /**
2109
+ * @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.
2110
+ *
2111
+ * @tags orders
2112
+ * @name FindOrder
2113
+ * @summary Retrieve an order
2114
+ * @request GET:/orders/{lago_id}
2115
+ * @secure
2116
+ */
2117
+ findOrder: (lagoId, params = {}) => this.request({
2118
+ path: `/orders/${lagoId}`,
2119
+ method: "GET",
2120
+ secure: true,
2121
+ format: "json",
2122
+ ...params,
2123
+ }),
2124
+ /**
2125
+ * @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.
2126
+ *
2127
+ * @tags orders
2128
+ * @name ExecuteOrder
2129
+ * @summary Execute an order
2130
+ * @request POST:/orders/{lago_id}/execute
2131
+ * @secure
2132
+ */
2133
+ executeOrder: (lagoId, data, params = {}) => this.request({
2134
+ path: `/orders/${lagoId}/execute`,
2135
+ method: "POST",
2136
+ body: data,
2137
+ secure: true,
2138
+ type: ContentType.Json,
2139
+ format: "json",
2140
+ ...params,
2141
+ }),
2142
+ };
2021
2143
  organizations = {
2144
+ /**
2145
+ * @description This endpoint retrieves your own organization's settings.
2146
+ *
2147
+ * @tags organizations
2148
+ * @name FindOrganization
2149
+ * @summary Retrieve your organization
2150
+ * @request GET:/organizations
2151
+ * @secure
2152
+ */
2153
+ findOrganization: (params = {}) => this.request({
2154
+ path: `/organizations`,
2155
+ method: "GET",
2156
+ secure: true,
2157
+ format: "json",
2158
+ ...params,
2159
+ }),
2022
2160
  /**
2023
2161
  * @description This endpoint is used to update your own organization's settings.
2024
2162
  *
@@ -2695,6 +2833,126 @@ export class Api extends HttpClient {
2695
2833
  ...params,
2696
2834
  }),
2697
2835
  };
2836
+ quotes = {
2837
+ /**
2838
+ * @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.
2839
+ *
2840
+ * @tags quotes
2841
+ * @name FindAllQuotes
2842
+ * @summary List all quotes
2843
+ * @request GET:/quotes
2844
+ * @secure
2845
+ */
2846
+ findAllQuotes: (query, params = {}) => this.request({
2847
+ path: `/quotes`,
2848
+ method: "GET",
2849
+ query: query,
2850
+ secure: true,
2851
+ format: "json",
2852
+ ...params,
2853
+ }),
2854
+ /**
2855
+ * @description This endpoint retrieves a specific quote, along with its owners and its current version. This is a premium feature.
2856
+ *
2857
+ * @tags quotes
2858
+ * @name FindQuote
2859
+ * @summary Retrieve a quote
2860
+ * @request GET:/quotes/{lago_id}
2861
+ * @secure
2862
+ */
2863
+ findQuote: (lagoId, params = {}) => this.request({
2864
+ path: `/quotes/${lagoId}`,
2865
+ method: "GET",
2866
+ secure: true,
2867
+ format: "json",
2868
+ ...params,
2869
+ }),
2870
+ /**
2871
+ * @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.
2872
+ *
2873
+ * @tags quotes
2874
+ * @name FindAllQuoteVersions
2875
+ * @summary List all versions of a quote
2876
+ * @request GET:/quotes/{lago_id}/versions
2877
+ * @secure
2878
+ */
2879
+ findAllQuoteVersions: (lagoId, query, params = {}) => this.request({
2880
+ path: `/quotes/${lagoId}/versions`,
2881
+ method: "GET",
2882
+ query: query,
2883
+ secure: true,
2884
+ format: "json",
2885
+ ...params,
2886
+ }),
2887
+ };
2888
+ quoteVersions = {
2889
+ /**
2890
+ * @description This endpoint retrieves a specific quote version, along with its document `content` and its `billing_items`. This is a premium feature.
2891
+ *
2892
+ * @tags quotes
2893
+ * @name FindQuoteVersion
2894
+ * @summary Retrieve a quote version
2895
+ * @request GET:/quote_versions/{lago_id}
2896
+ * @secure
2897
+ */
2898
+ findQuoteVersion: (lagoId, params = {}) => this.request({
2899
+ path: `/quote_versions/${lagoId}`,
2900
+ method: "GET",
2901
+ secure: true,
2902
+ format: "json",
2903
+ ...params,
2904
+ }),
2905
+ /**
2906
+ * @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.
2907
+ *
2908
+ * @tags quotes
2909
+ * @name ApproveQuoteVersion
2910
+ * @summary Approve a quote version
2911
+ * @request POST:/quote_versions/{lago_id}/approve
2912
+ * @secure
2913
+ */
2914
+ approveQuoteVersion: (lagoId, data, params = {}) => this.request({
2915
+ path: `/quote_versions/${lagoId}/approve`,
2916
+ method: "POST",
2917
+ body: data,
2918
+ secure: true,
2919
+ type: ContentType.Json,
2920
+ format: "json",
2921
+ ...params,
2922
+ }),
2923
+ /**
2924
+ * @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.
2925
+ *
2926
+ * @tags quotes
2927
+ * @name VoidQuoteVersion
2928
+ * @summary Void a quote version
2929
+ * @request POST:/quote_versions/{lago_id}/void
2930
+ * @secure
2931
+ */
2932
+ voidQuoteVersion: (lagoId, params = {}) => this.request({
2933
+ path: `/quote_versions/${lagoId}/void`,
2934
+ method: "POST",
2935
+ secure: true,
2936
+ format: "json",
2937
+ ...params,
2938
+ }),
2939
+ /**
2940
+ * @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.
2941
+ *
2942
+ * @tags quotes
2943
+ * @name CloneQuoteVersion
2944
+ * @summary Clone a quote version
2945
+ * @request POST:/quote_versions/{lago_id}/clone
2946
+ * @secure
2947
+ */
2948
+ cloneQuoteVersion: (lagoId, params = {}) => this.request({
2949
+ path: `/quote_versions/${lagoId}/clone`,
2950
+ method: "POST",
2951
+ secure: true,
2952
+ format: "json",
2953
+ ...params,
2954
+ }),
2955
+ };
2698
2956
  subscriptions = {
2699
2957
  /**
2700
2958
  * @description This endpoint assigns a plan to a customer, creating or modifying a subscription. Ideal for initial subscriptions or plan changes (upgrades/downgrades).
@@ -3313,7 +3571,7 @@ export class Api extends HttpClient {
3313
3571
  ...params,
3314
3572
  }),
3315
3573
  /**
3316
- * @description This endpoint is used to update an existing wallet with prepaid credits.
3574
+ * @description This endpoint is used to update an existing wallet with prepaid credits. A terminated wallet cannot be updated and returns a `422` error.
3317
3575
  *
3318
3576
  * @tags wallets
3319
3577
  * @name UpdateWallet