lago-javascript-client 1.32.0 → 1.33.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.
@@ -470,6 +470,23 @@ export class Api extends HttpClient {
470
470
  format: "json",
471
471
  ...params,
472
472
  }),
473
+ /**
474
+ * @description Returns usages.
475
+ *
476
+ * @tags analytics
477
+ * @name FindAllUsages
478
+ * @summary List usage
479
+ * @request GET:/analytics/usage
480
+ * @secure
481
+ */
482
+ findAllUsages: (query, params = {}) => this.request({
483
+ path: `/analytics/usage`,
484
+ method: "GET",
485
+ query: query,
486
+ secure: true,
487
+ format: "json",
488
+ ...params,
489
+ }),
473
490
  };
474
491
  appliedCoupons = {
475
492
  /**
@@ -613,6 +630,109 @@ export class Api extends HttpClient {
613
630
  ...params,
614
631
  }),
615
632
  };
633
+ features = {
634
+ /**
635
+ * @description This endpoint creates a new feature representing an entitlement component of your application.
636
+ *
637
+ * @tags features
638
+ * @name CreateFeature
639
+ * @summary Create a feature
640
+ * @request POST:/features
641
+ * @secure
642
+ */
643
+ createFeature: (data, params = {}) => this.request({
644
+ path: `/features`,
645
+ method: "POST",
646
+ body: data,
647
+ secure: true,
648
+ type: ContentType.Json,
649
+ format: "json",
650
+ ...params,
651
+ }),
652
+ /**
653
+ * @description This endpoint retrieves all existing features that represent entitlement components of your application.
654
+ *
655
+ * @tags features
656
+ * @name FindAllFeatures
657
+ * @summary List all features
658
+ * @request GET:/features
659
+ * @secure
660
+ */
661
+ findAllFeatures: (query, params = {}) => this.request({
662
+ path: `/features`,
663
+ method: "GET",
664
+ query: query,
665
+ secure: true,
666
+ format: "json",
667
+ ...params,
668
+ }),
669
+ /**
670
+ * @description This endpoint updates an existing feature representing an entitlement component of your application.
671
+ *
672
+ * @tags features
673
+ * @name UpdateFeature
674
+ * @summary Update a feature
675
+ * @request PUT:/features/{code}
676
+ * @secure
677
+ */
678
+ updateFeature: (code, data, params = {}) => this.request({
679
+ path: `/features/${code}`,
680
+ method: "PUT",
681
+ body: data,
682
+ secure: true,
683
+ type: ContentType.Json,
684
+ format: "json",
685
+ ...params,
686
+ }),
687
+ /**
688
+ * @description This endpoint deletes an existing feature representing an entitlement component of your application. Deleting a feature will remove it from all plans and subscriptions.
689
+ *
690
+ * @tags features
691
+ * @name DestroyFeature
692
+ * @summary Delete a feature
693
+ * @request DELETE:/features/{code}
694
+ * @secure
695
+ */
696
+ destroyFeature: (code, params = {}) => this.request({
697
+ path: `/features/${code}`,
698
+ method: "DELETE",
699
+ secure: true,
700
+ format: "json",
701
+ ...params,
702
+ }),
703
+ /**
704
+ * @description This endpoint retrieves an existing feature that represents an entitlement component of your application. The feature is identified by its unique code.
705
+ *
706
+ * @tags features
707
+ * @name FindFeature
708
+ * @summary Retrieve a feature
709
+ * @request GET:/features/{code}
710
+ * @secure
711
+ */
712
+ findFeature: (code, params = {}) => this.request({
713
+ path: `/features/${code}`,
714
+ method: "GET",
715
+ secure: true,
716
+ format: "json",
717
+ ...params,
718
+ }),
719
+ /**
720
+ * @description Delete privilege from feature. Deleting a privilege removes it from all plans and subscriptions.
721
+ *
722
+ * @tags features
723
+ * @name DeleteFeaturePrivilege
724
+ * @summary Delete a privilege. Deleting a privilege removes it from all plans and subscriptions.
725
+ * @request DELETE:/features/{code}/privileges/{privilege_code}
726
+ * @secure
727
+ */
728
+ deleteFeaturePrivilege: (code, privilegeCode, params = {}) => this.request({
729
+ path: `/features/${code}/privileges/${privilegeCode}`,
730
+ method: "DELETE",
731
+ secure: true,
732
+ format: "json",
733
+ ...params,
734
+ }),
735
+ };
616
736
  coupons = {
617
737
  /**
618
738
  * @description This endpoint is used to create a coupon that can be then attached to a customer to create a discount.
@@ -938,6 +1058,23 @@ export class Api extends HttpClient {
938
1058
  format: "json",
939
1059
  ...params,
940
1060
  }),
1061
+ /**
1062
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within the current period. It also returns the projected usage for the current period based on the current usage.
1063
+ *
1064
+ * @tags customers
1065
+ * @name FindCustomerProjectedUsage
1066
+ * @summary Retrieve customer current and projected usage
1067
+ * @request GET:/customers/{external_customer_id}/projected_usage
1068
+ * @secure
1069
+ */
1070
+ findCustomerProjectedUsage: (externalCustomerId, query, params = {}) => this.request({
1071
+ path: `/customers/${externalCustomerId}/projected_usage`,
1072
+ method: "GET",
1073
+ query: query,
1074
+ secure: true,
1075
+ format: "json",
1076
+ ...params,
1077
+ }),
941
1078
  /**
942
1079
  * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
943
1080
  *
@@ -1475,6 +1612,22 @@ export class Api extends HttpClient {
1475
1612
  format: "json",
1476
1613
  ...params,
1477
1614
  }),
1615
+ /**
1616
+ * @description This endpoint retrieves a specific payment request by its ID.
1617
+ *
1618
+ * @tags payment_requests
1619
+ * @name FindPaymentRequest
1620
+ * @summary Retrieve a payment request
1621
+ * @request GET:/payment_requests/{lago_id}
1622
+ * @secure
1623
+ */
1624
+ findPaymentRequest: (lagoId, params = {}) => this.request({
1625
+ path: `/payment_requests/${lagoId}`,
1626
+ method: "GET",
1627
+ secure: true,
1628
+ format: "json",
1629
+ ...params,
1630
+ }),
1478
1631
  };
1479
1632
  payments = {
1480
1633
  /**
@@ -1615,6 +1768,106 @@ export class Api extends HttpClient {
1615
1768
  format: "json",
1616
1769
  ...params,
1617
1770
  }),
1771
+ /**
1772
+ * @description This endpoint creates a new entitlement by adding a feature to a plan. The feature must exist and all privileges must be valid for the feature.
1773
+ *
1774
+ * @tags entitlements
1775
+ * @name CreateEntitlement
1776
+ * @summary Create an entitlement
1777
+ * @request POST:/plans/{code}/entitlements
1778
+ * @secure
1779
+ */
1780
+ createEntitlement: (code, data, params = {}) => this.request({
1781
+ path: `/plans/${code}/entitlements`,
1782
+ method: "POST",
1783
+ body: data,
1784
+ secure: true,
1785
+ type: ContentType.Json,
1786
+ format: "json",
1787
+ ...params,
1788
+ }),
1789
+ /**
1790
+ * @description This endpoint retrieves all entitlements for a specific plan.
1791
+ *
1792
+ * @tags entitlements
1793
+ * @name FindAllEntitlements
1794
+ * @summary List all entitlements
1795
+ * @request GET:/plans/{code}/entitlements
1796
+ * @secure
1797
+ */
1798
+ findAllEntitlements: (code, params = {}) => this.request({
1799
+ path: `/plans/${code}/entitlements`,
1800
+ method: "GET",
1801
+ secure: true,
1802
+ format: "json",
1803
+ ...params,
1804
+ }),
1805
+ /**
1806
+ * @description This endpoint updates an existing entitlement by modifying privilege values. Notice that the update is partial. All new privileges or features are added. If there is already a value, it's overridden. All feature and privileges not part of the payload are ignored. To remove privileges or feature, use the delete endpoints. All privileges must be valid for the feature.
1807
+ *
1808
+ * @tags entitlements
1809
+ * @name UpdateEntitlement
1810
+ * @summary Partial update of an entitlement
1811
+ * @request PATCH:/plans/{code}/entitlements
1812
+ * @secure
1813
+ */
1814
+ updateEntitlement: (code, data, params = {}) => this.request({
1815
+ path: `/plans/${code}/entitlements`,
1816
+ method: "PATCH",
1817
+ body: data,
1818
+ secure: true,
1819
+ type: ContentType.Json,
1820
+ format: "json",
1821
+ ...params,
1822
+ }),
1823
+ /**
1824
+ * @description This endpoint retrieves a specific entitlement for a plan.
1825
+ *
1826
+ * @tags entitlements
1827
+ * @name FindEntitlement
1828
+ * @summary Retrieve an entitlement
1829
+ * @request GET:/plans/{code}/entitlements/{feature_code}
1830
+ * @secure
1831
+ */
1832
+ findEntitlement: (code, featureCode, params = {}) => this.request({
1833
+ path: `/plans/${code}/entitlements/${featureCode}`,
1834
+ method: "GET",
1835
+ secure: true,
1836
+ format: "json",
1837
+ ...params,
1838
+ }),
1839
+ /**
1840
+ * @description This endpoint deletes an existing entitlement by removing the feature from the plan.
1841
+ *
1842
+ * @tags entitlements
1843
+ * @name DestroyEntitlement
1844
+ * @summary Delete an entitlement
1845
+ * @request DELETE:/plans/{code}/entitlements/{feature_code}
1846
+ * @secure
1847
+ */
1848
+ destroyEntitlement: (code, featureCode, params = {}) => this.request({
1849
+ path: `/plans/${code}/entitlements/${featureCode}`,
1850
+ method: "DELETE",
1851
+ secure: true,
1852
+ format: "json",
1853
+ ...params,
1854
+ }),
1855
+ /**
1856
+ * @description This endpoint removes a specific privilege and its value from an entitlement. The privilege remains untouched on the original feature.
1857
+ *
1858
+ * @tags entitlements
1859
+ * @name RemoveEntitlementPrivilege
1860
+ * @summary Remove a privilege from an entitlement
1861
+ * @request DELETE:/plans/{code}/entitlements/{feature_code}/privileges/{privilege_code}
1862
+ * @secure
1863
+ */
1864
+ removeEntitlementPrivilege: (code, featureCode, privilegeCode, params = {}) => this.request({
1865
+ path: `/plans/${code}/entitlements/${featureCode}/privileges/${privilegeCode}`,
1866
+ method: "DELETE",
1867
+ secure: true,
1868
+ format: "json",
1869
+ ...params,
1870
+ }),
1618
1871
  };
1619
1872
  subscriptions = {
1620
1873
  /**
@@ -1822,6 +2075,72 @@ export class Api extends HttpClient {
1822
2075
  format: "json",
1823
2076
  ...params,
1824
2077
  }),
2078
+ /**
2079
+ * @description This endpoint retrieves all entitlements for a specific subscription, including both plan entitlements and any subscription-specific overrides.
2080
+ *
2081
+ * @tags entitlements
2082
+ * @name FindAllSubscriptionEntitlements
2083
+ * @summary List all subscription entitlements
2084
+ * @request GET:/subscriptions/{external_id}/entitlements
2085
+ * @secure
2086
+ */
2087
+ findAllSubscriptionEntitlements: (externalId, params = {}) => this.request({
2088
+ path: `/subscriptions/${externalId}/entitlements`,
2089
+ method: "GET",
2090
+ secure: true,
2091
+ format: "json",
2092
+ ...params,
2093
+ }),
2094
+ /**
2095
+ * @description This endpoint allows partial updates to subscription entitlements. New entitlements are added, provided values are overridden, but entitlements not included in the payload are ignored.
2096
+ *
2097
+ * @tags entitlements
2098
+ * @name UpdateSubscriptionEntitlements
2099
+ * @summary Update subscription entitlements
2100
+ * @request PATCH:/subscriptions/{external_id}/entitlements
2101
+ * @secure
2102
+ */
2103
+ updateSubscriptionEntitlements: (externalId, data, params = {}) => this.request({
2104
+ path: `/subscriptions/${externalId}/entitlements`,
2105
+ method: "PATCH",
2106
+ body: data,
2107
+ secure: true,
2108
+ type: ContentType.Json,
2109
+ format: "json",
2110
+ ...params,
2111
+ }),
2112
+ /**
2113
+ * @description This endpoint removes a specific feature entitlement from a subscription. The entitlement remains available from the plan.
2114
+ *
2115
+ * @tags entitlements
2116
+ * @name DestroySubscriptionEntitlement
2117
+ * @summary Remove an entitlement from a subscription
2118
+ * @request DELETE:/subscriptions/{external_id}/entitlements/{feature_code}
2119
+ * @secure
2120
+ */
2121
+ destroySubscriptionEntitlement: (externalId, featureCode, params = {}) => this.request({
2122
+ path: `/subscriptions/${externalId}/entitlements/${featureCode}`,
2123
+ method: "DELETE",
2124
+ secure: true,
2125
+ format: "json",
2126
+ ...params,
2127
+ }),
2128
+ /**
2129
+ * @description This endpoint removes a specific privilege from a subscription entitlement. The privilege entitlement remains available from the plan.
2130
+ *
2131
+ * @tags entitlements
2132
+ * @name DestroySubscriptionEntitlementPrivilege
2133
+ * @summary Remove a privilege from a subscription entitlement override
2134
+ * @request DELETE:/subscriptions/{external_id}/entitlements/{feature_code}/privileges/{privilege_code}
2135
+ * @secure
2136
+ */
2137
+ destroySubscriptionEntitlementPrivilege: (externalId, featureCode, privilegeCode, params = {}) => this.request({
2138
+ path: `/subscriptions/${externalId}/entitlements/${featureCode}/privileges/${privilegeCode}`,
2139
+ method: "DELETE",
2140
+ secure: true,
2141
+ format: "json",
2142
+ ...params,
2143
+ }),
1825
2144
  };
1826
2145
  taxes = {
1827
2146
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/mod.js",
4
4
  "name": "lago-javascript-client",
5
5
  "sideEffects": false,
6
- "version": "v1.32.0",
6
+ "version": "v1.33.0",
7
7
  "description": "Lago JavaScript API Client",
8
8
  "repository": {
9
9
  "type": "git",