lago-javascript-client 1.36.0 → 1.43.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.
@@ -152,7 +152,7 @@ class HttpClient {
152
152
  exports.HttpClient = HttpClient;
153
153
  /**
154
154
  * @title Lago API documentation
155
- * @version 1.36.0
155
+ * @version 1.42.0
156
156
  * @license AGPLv3
157
157
  * @baseUrl https://api.getlago.com/api/v1
158
158
  * @externalDocs https://github.com/getlago
@@ -944,6 +944,74 @@ class Api extends HttpClient {
944
944
  format: "json",
945
945
  ...params,
946
946
  }),
947
+ /**
948
+ * @description This endpoint replaces all existing metadata on a credit note with the provided key-value pairs. Any existing metadata keys not included in the request will be removed.
949
+ *
950
+ * @tags credit_notes
951
+ * @name ReplaceCreditNoteMetadata
952
+ * @summary Replace credit note metadata
953
+ * @request POST:/credit_notes/{lago_id}/metadata
954
+ * @secure
955
+ */
956
+ replaceCreditNoteMetadata: (lagoId, data, params = {}) => this.request({
957
+ path: `/credit_notes/${lagoId}/metadata`,
958
+ method: "POST",
959
+ body: data,
960
+ secure: true,
961
+ type: ContentType.Json,
962
+ format: "json",
963
+ ...params,
964
+ }),
965
+ /**
966
+ * @description This endpoint merges the provided metadata with existing metadata on the credit note. Existing keys not in the request are preserved. New keys are added, existing keys are updated.
967
+ *
968
+ * @tags credit_notes
969
+ * @name MergeCreditNoteMetadata
970
+ * @summary Merge credit note metadata
971
+ * @request PATCH:/credit_notes/{lago_id}/metadata
972
+ * @secure
973
+ */
974
+ mergeCreditNoteMetadata: (lagoId, data, params = {}) => this.request({
975
+ path: `/credit_notes/${lagoId}/metadata`,
976
+ method: "PATCH",
977
+ body: data,
978
+ secure: true,
979
+ type: ContentType.Json,
980
+ format: "json",
981
+ ...params,
982
+ }),
983
+ /**
984
+ * @description This endpoint removes all metadata from a credit note.
985
+ *
986
+ * @tags credit_notes
987
+ * @name DeleteAllCreditNoteMetadata
988
+ * @summary Delete all credit note metadata
989
+ * @request DELETE:/credit_notes/{lago_id}/metadata
990
+ * @secure
991
+ */
992
+ deleteAllCreditNoteMetadata: (lagoId, params = {}) => this.request({
993
+ path: `/credit_notes/${lagoId}/metadata`,
994
+ method: "DELETE",
995
+ secure: true,
996
+ format: "json",
997
+ ...params,
998
+ }),
999
+ /**
1000
+ * @description This endpoint removes a single metadata key from a credit note.
1001
+ *
1002
+ * @tags credit_notes
1003
+ * @name DeleteCreditNoteMetadataKey
1004
+ * @summary Delete a metadata key
1005
+ * @request DELETE:/credit_notes/{lago_id}/metadata/{key}
1006
+ * @secure
1007
+ */
1008
+ deleteCreditNoteMetadataKey: (lagoId, key, params = {}) => this.request({
1009
+ path: `/credit_notes/${lagoId}/metadata/${key}`,
1010
+ method: "DELETE",
1011
+ secure: true,
1012
+ format: "json",
1013
+ ...params,
1014
+ }),
947
1015
  };
948
1016
  customers = {
949
1017
  /**
@@ -1231,6 +1299,55 @@ class Api extends HttpClient {
1231
1299
  format: "json",
1232
1300
  ...params,
1233
1301
  }),
1302
+ /**
1303
+ * @description This endpoint retrieves all payment methods of a Customer.
1304
+ *
1305
+ * @tags payment_methods
1306
+ * @name FindAllCustomersPaymentMethods
1307
+ * @summary List all customer payment methods
1308
+ * @request GET:/customers/{external_customer_id}/payment_methods
1309
+ * @secure
1310
+ */
1311
+ findAllCustomersPaymentMethods: (externalCustomerId, query, params = {}) => this.request({
1312
+ path: `/customers/${externalCustomerId}/payment_methods`,
1313
+ method: "GET",
1314
+ query: query,
1315
+ secure: true,
1316
+ format: "json",
1317
+ ...params,
1318
+ }),
1319
+ /**
1320
+ * @description Use the payment method as default when not selected a payment method
1321
+ *
1322
+ * @tags payment_methods
1323
+ * @name PaymentMethodSetAsDefault
1324
+ * @summary Set the payment method as default
1325
+ * @request PUT:/customers/{external_customer_id}/payment_methods/{lago_id}/set_as_default
1326
+ * @secure
1327
+ */
1328
+ paymentMethodSetAsDefault: (lagoId, externalCustomerId, params = {}) => this.request({
1329
+ path: `/customers/${externalCustomerId}/payment_methods/${lagoId}/set_as_default`,
1330
+ method: "PUT",
1331
+ secure: true,
1332
+ format: "json",
1333
+ ...params,
1334
+ }),
1335
+ /**
1336
+ * @description This endpoint deletes a specific payment method for a customer.
1337
+ *
1338
+ * @tags payment_methods
1339
+ * @name DestroyPaymentMethod
1340
+ * @summary Delete a payment method
1341
+ * @request DELETE:/customers/{external_customer_id}/payment_methods/{lago_id}
1342
+ * @secure
1343
+ */
1344
+ destroyPaymentMethod: (lagoId, externalCustomerId, params = {}) => this.request({
1345
+ path: `/customers/${externalCustomerId}/payment_methods/${lagoId}`,
1346
+ method: "DELETE",
1347
+ secure: true,
1348
+ format: "json",
1349
+ ...params,
1350
+ }),
1234
1351
  };
1235
1352
  events = {
1236
1353
  /**
@@ -1341,7 +1458,7 @@ class Api extends HttpClient {
1341
1458
  ...params,
1342
1459
  }),
1343
1460
  /**
1344
- * @description This endpoint is used for retrieving a specific usage measurement event that has been sent to a customer or a subscription.
1461
+ * @description This endpoint is used for retrieving a specific usage measurement event that has been sent to a customer or a subscription. Note that transaction_id is unique per external_subscription_id so multiple subscriptions can share the same transaction_id. This endpoint will only return the first event found with the given transaction_id. WARNING: If your Lago organization is configured to use the Clickhouse-based event pipeline, multiple events can share the same `transaction_id` (with different timestamps). This endpoint will only return the first event found.
1345
1462
  *
1346
1463
  * @tags events
1347
1464
  * @name FindEvent
@@ -1619,10 +1736,12 @@ class Api extends HttpClient {
1619
1736
  * @request POST:/invoices/{lago_id}/retry_payment
1620
1737
  * @secure
1621
1738
  */
1622
- retryPayment: (lagoId, params = {}) => this.request({
1739
+ retryPayment: (lagoId, data, params = {}) => this.request({
1623
1740
  path: `/invoices/${lagoId}/retry_payment`,
1624
1741
  method: "POST",
1742
+ body: data,
1625
1743
  secure: true,
1744
+ type: ContentType.Json,
1626
1745
  ...params,
1627
1746
  }),
1628
1747
  /**
@@ -1991,6 +2110,74 @@ class Api extends HttpClient {
1991
2110
  format: "json",
1992
2111
  ...params,
1993
2112
  }),
2113
+ /**
2114
+ * @description This endpoint replaces all existing metadata on a plan with the provided key-value pairs. Any existing metadata keys not included in the request will be removed.
2115
+ *
2116
+ * @tags plans
2117
+ * @name ReplacePlanMetadata
2118
+ * @summary Replace plan metadata
2119
+ * @request POST:/plans/{code}/metadata
2120
+ * @secure
2121
+ */
2122
+ replacePlanMetadata: (code, data, params = {}) => this.request({
2123
+ path: `/plans/${code}/metadata`,
2124
+ method: "POST",
2125
+ body: data,
2126
+ secure: true,
2127
+ type: ContentType.Json,
2128
+ format: "json",
2129
+ ...params,
2130
+ }),
2131
+ /**
2132
+ * @description This endpoint merges the provided metadata with existing metadata on the plan. Existing keys not in the request are preserved. New keys are added, existing keys are updated.
2133
+ *
2134
+ * @tags plans
2135
+ * @name MergePlanMetadata
2136
+ * @summary Merge plan metadata
2137
+ * @request PATCH:/plans/{code}/metadata
2138
+ * @secure
2139
+ */
2140
+ mergePlanMetadata: (code, data, params = {}) => this.request({
2141
+ path: `/plans/${code}/metadata`,
2142
+ method: "PATCH",
2143
+ body: data,
2144
+ secure: true,
2145
+ type: ContentType.Json,
2146
+ format: "json",
2147
+ ...params,
2148
+ }),
2149
+ /**
2150
+ * @description This endpoint removes all metadata from a plan.
2151
+ *
2152
+ * @tags plans
2153
+ * @name DeleteAllPlanMetadata
2154
+ * @summary Delete all plan metadata
2155
+ * @request DELETE:/plans/{code}/metadata
2156
+ * @secure
2157
+ */
2158
+ deleteAllPlanMetadata: (code, params = {}) => this.request({
2159
+ path: `/plans/${code}/metadata`,
2160
+ method: "DELETE",
2161
+ secure: true,
2162
+ format: "json",
2163
+ ...params,
2164
+ }),
2165
+ /**
2166
+ * @description This endpoint removes a single metadata key from a plan.
2167
+ *
2168
+ * @tags plans
2169
+ * @name DeletePlanMetadataKey
2170
+ * @summary Delete a metadata key
2171
+ * @request DELETE:/plans/{code}/metadata/{key}
2172
+ * @secure
2173
+ */
2174
+ deletePlanMetadataKey: (code, key, params = {}) => this.request({
2175
+ path: `/plans/${code}/metadata/${key}`,
2176
+ method: "DELETE",
2177
+ secure: true,
2178
+ format: "json",
2179
+ ...params,
2180
+ }),
1994
2181
  };
1995
2182
  subscriptions = {
1996
2183
  /**
@@ -2132,11 +2319,11 @@ class Api extends HttpClient {
2132
2319
  ...params,
2133
2320
  }),
2134
2321
  /**
2135
- * @description This endpoint allows you to create a new alert for a subscription.
2322
+ * @description This endpoint allows you to create alerts for a subscription. Send a single alert object wrapped in `alert` key to create one alert, or an array of alert objects wrapped in `alerts` key to create multiple alerts atomically.
2136
2323
  *
2137
2324
  * @tags subscriptions
2138
2325
  * @name CreateSubscriptionAlert
2139
- * @summary Create a subscription alert
2326
+ * @summary Create subscription alert(s)
2140
2327
  * @request POST:/subscriptions/{external_id}/alerts
2141
2328
  * @secure
2142
2329
  */
@@ -2149,6 +2336,21 @@ class Api extends HttpClient {
2149
2336
  format: "json",
2150
2337
  ...params,
2151
2338
  }),
2339
+ /**
2340
+ * @description This endpoint allows you to delete all alerts for a subscription.
2341
+ *
2342
+ * @tags subscriptions
2343
+ * @name DeleteAllSubscriptionAlerts
2344
+ * @summary Delete all subscription alerts
2345
+ * @request DELETE:/subscriptions/{external_id}/alerts
2346
+ * @secure
2347
+ */
2348
+ deleteAllSubscriptionAlerts: (externalId, params = {}) => this.request({
2349
+ path: `/subscriptions/${externalId}/alerts`,
2350
+ method: "DELETE",
2351
+ secure: true,
2352
+ ...params,
2353
+ }),
2152
2354
  /**
2153
2355
  * @description This endpoint enables the retrieval of a specific alert for a subscription.
2154
2356
  *
@@ -2265,6 +2467,22 @@ class Api extends HttpClient {
2265
2467
  format: "json",
2266
2468
  ...params,
2267
2469
  }),
2470
+ /**
2471
+ * @description This endpoint retrieves all fixed charges for a specific subscription.
2472
+ *
2473
+ * @tags subscriptions
2474
+ * @name FindAllSubscriptionFixedCharges
2475
+ * @summary List subscription fixed charges
2476
+ * @request GET:/subscriptions/{external_id}/fixed_charges
2477
+ * @secure
2478
+ */
2479
+ findAllSubscriptionFixedCharges: (externalId, params = {}) => this.request({
2480
+ path: `/subscriptions/${externalId}/fixed_charges`,
2481
+ method: "GET",
2482
+ secure: true,
2483
+ format: "json",
2484
+ ...params,
2485
+ }),
2268
2486
  };
2269
2487
  taxes = {
2270
2488
  /**
@@ -2439,6 +2657,74 @@ class Api extends HttpClient {
2439
2657
  format: "json",
2440
2658
  ...params,
2441
2659
  }),
2660
+ /**
2661
+ * @description This endpoint replaces all existing metadata on a wallet with the provided key-value pairs. Any existing metadata keys not included in the request will be removed.
2662
+ *
2663
+ * @tags wallets
2664
+ * @name ReplaceWalletMetadata
2665
+ * @summary Replace wallet metadata
2666
+ * @request POST:/wallets/{lago_id}/metadata
2667
+ * @secure
2668
+ */
2669
+ replaceWalletMetadata: (lagoId, data, params = {}) => this.request({
2670
+ path: `/wallets/${lagoId}/metadata`,
2671
+ method: "POST",
2672
+ body: data,
2673
+ secure: true,
2674
+ type: ContentType.Json,
2675
+ format: "json",
2676
+ ...params,
2677
+ }),
2678
+ /**
2679
+ * @description This endpoint merges the provided metadata with existing metadata on the wallet. Existing keys not in the request are preserved. New keys are added, existing keys are updated.
2680
+ *
2681
+ * @tags wallets
2682
+ * @name MergeWalletMetadata
2683
+ * @summary Merge wallet metadata
2684
+ * @request PATCH:/wallets/{lago_id}/metadata
2685
+ * @secure
2686
+ */
2687
+ mergeWalletMetadata: (lagoId, data, params = {}) => this.request({
2688
+ path: `/wallets/${lagoId}/metadata`,
2689
+ method: "PATCH",
2690
+ body: data,
2691
+ secure: true,
2692
+ type: ContentType.Json,
2693
+ format: "json",
2694
+ ...params,
2695
+ }),
2696
+ /**
2697
+ * @description This endpoint removes all metadata from a wallet.
2698
+ *
2699
+ * @tags wallets
2700
+ * @name DeleteAllWalletMetadata
2701
+ * @summary Delete all wallet metadata
2702
+ * @request DELETE:/wallets/{lago_id}/metadata
2703
+ * @secure
2704
+ */
2705
+ deleteAllWalletMetadata: (lagoId, params = {}) => this.request({
2706
+ path: `/wallets/${lagoId}/metadata`,
2707
+ method: "DELETE",
2708
+ secure: true,
2709
+ format: "json",
2710
+ ...params,
2711
+ }),
2712
+ /**
2713
+ * @description This endpoint removes a single metadata key from a wallet.
2714
+ *
2715
+ * @tags wallets
2716
+ * @name DeleteWalletMetadataKey
2717
+ * @summary Delete a metadata key
2718
+ * @request DELETE:/wallets/{lago_id}/metadata/{key}
2719
+ * @secure
2720
+ */
2721
+ deleteWalletMetadataKey: (lagoId, key, params = {}) => this.request({
2722
+ path: `/wallets/${lagoId}/metadata/${key}`,
2723
+ method: "DELETE",
2724
+ secure: true,
2725
+ format: "json",
2726
+ ...params,
2727
+ }),
2442
2728
  /**
2443
2729
  * @description This endpoint is used to list all wallet transactions.
2444
2730
  *