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.
@@ -474,6 +474,23 @@ class Api extends HttpClient {
474
474
  format: "json",
475
475
  ...params,
476
476
  }),
477
+ /**
478
+ * @description Returns usages.
479
+ *
480
+ * @tags analytics
481
+ * @name FindAllUsages
482
+ * @summary List usage
483
+ * @request GET:/analytics/usage
484
+ * @secure
485
+ */
486
+ findAllUsages: (query, params = {}) => this.request({
487
+ path: `/analytics/usage`,
488
+ method: "GET",
489
+ query: query,
490
+ secure: true,
491
+ format: "json",
492
+ ...params,
493
+ }),
477
494
  };
478
495
  appliedCoupons = {
479
496
  /**
@@ -617,6 +634,109 @@ class Api extends HttpClient {
617
634
  ...params,
618
635
  }),
619
636
  };
637
+ features = {
638
+ /**
639
+ * @description This endpoint creates a new feature representing an entitlement component of your application.
640
+ *
641
+ * @tags features
642
+ * @name CreateFeature
643
+ * @summary Create a feature
644
+ * @request POST:/features
645
+ * @secure
646
+ */
647
+ createFeature: (data, params = {}) => this.request({
648
+ path: `/features`,
649
+ method: "POST",
650
+ body: data,
651
+ secure: true,
652
+ type: ContentType.Json,
653
+ format: "json",
654
+ ...params,
655
+ }),
656
+ /**
657
+ * @description This endpoint retrieves all existing features that represent entitlement components of your application.
658
+ *
659
+ * @tags features
660
+ * @name FindAllFeatures
661
+ * @summary List all features
662
+ * @request GET:/features
663
+ * @secure
664
+ */
665
+ findAllFeatures: (query, params = {}) => this.request({
666
+ path: `/features`,
667
+ method: "GET",
668
+ query: query,
669
+ secure: true,
670
+ format: "json",
671
+ ...params,
672
+ }),
673
+ /**
674
+ * @description This endpoint updates an existing feature representing an entitlement component of your application.
675
+ *
676
+ * @tags features
677
+ * @name UpdateFeature
678
+ * @summary Update a feature
679
+ * @request PUT:/features/{code}
680
+ * @secure
681
+ */
682
+ updateFeature: (code, data, params = {}) => this.request({
683
+ path: `/features/${code}`,
684
+ method: "PUT",
685
+ body: data,
686
+ secure: true,
687
+ type: ContentType.Json,
688
+ format: "json",
689
+ ...params,
690
+ }),
691
+ /**
692
+ * @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.
693
+ *
694
+ * @tags features
695
+ * @name DestroyFeature
696
+ * @summary Delete a feature
697
+ * @request DELETE:/features/{code}
698
+ * @secure
699
+ */
700
+ destroyFeature: (code, params = {}) => this.request({
701
+ path: `/features/${code}`,
702
+ method: "DELETE",
703
+ secure: true,
704
+ format: "json",
705
+ ...params,
706
+ }),
707
+ /**
708
+ * @description This endpoint retrieves an existing feature that represents an entitlement component of your application. The feature is identified by its unique code.
709
+ *
710
+ * @tags features
711
+ * @name FindFeature
712
+ * @summary Retrieve a feature
713
+ * @request GET:/features/{code}
714
+ * @secure
715
+ */
716
+ findFeature: (code, params = {}) => this.request({
717
+ path: `/features/${code}`,
718
+ method: "GET",
719
+ secure: true,
720
+ format: "json",
721
+ ...params,
722
+ }),
723
+ /**
724
+ * @description Delete privilege from feature. Deleting a privilege removes it from all plans and subscriptions.
725
+ *
726
+ * @tags features
727
+ * @name DeleteFeaturePrivilege
728
+ * @summary Delete a privilege. Deleting a privilege removes it from all plans and subscriptions.
729
+ * @request DELETE:/features/{code}/privileges/{privilege_code}
730
+ * @secure
731
+ */
732
+ deleteFeaturePrivilege: (code, privilegeCode, params = {}) => this.request({
733
+ path: `/features/${code}/privileges/${privilegeCode}`,
734
+ method: "DELETE",
735
+ secure: true,
736
+ format: "json",
737
+ ...params,
738
+ }),
739
+ };
620
740
  coupons = {
621
741
  /**
622
742
  * @description This endpoint is used to create a coupon that can be then attached to a customer to create a discount.
@@ -942,6 +1062,23 @@ class Api extends HttpClient {
942
1062
  format: "json",
943
1063
  ...params,
944
1064
  }),
1065
+ /**
1066
+ * @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.
1067
+ *
1068
+ * @tags customers
1069
+ * @name FindCustomerProjectedUsage
1070
+ * @summary Retrieve customer current and projected usage
1071
+ * @request GET:/customers/{external_customer_id}/projected_usage
1072
+ * @secure
1073
+ */
1074
+ findCustomerProjectedUsage: (externalCustomerId, query, params = {}) => this.request({
1075
+ path: `/customers/${externalCustomerId}/projected_usage`,
1076
+ method: "GET",
1077
+ query: query,
1078
+ secure: true,
1079
+ format: "json",
1080
+ ...params,
1081
+ }),
945
1082
  /**
946
1083
  * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
947
1084
  *
@@ -1479,6 +1616,22 @@ class Api extends HttpClient {
1479
1616
  format: "json",
1480
1617
  ...params,
1481
1618
  }),
1619
+ /**
1620
+ * @description This endpoint retrieves a specific payment request by its ID.
1621
+ *
1622
+ * @tags payment_requests
1623
+ * @name FindPaymentRequest
1624
+ * @summary Retrieve a payment request
1625
+ * @request GET:/payment_requests/{lago_id}
1626
+ * @secure
1627
+ */
1628
+ findPaymentRequest: (lagoId, params = {}) => this.request({
1629
+ path: `/payment_requests/${lagoId}`,
1630
+ method: "GET",
1631
+ secure: true,
1632
+ format: "json",
1633
+ ...params,
1634
+ }),
1482
1635
  };
1483
1636
  payments = {
1484
1637
  /**
@@ -1619,6 +1772,106 @@ class Api extends HttpClient {
1619
1772
  format: "json",
1620
1773
  ...params,
1621
1774
  }),
1775
+ /**
1776
+ * @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.
1777
+ *
1778
+ * @tags entitlements
1779
+ * @name CreateEntitlement
1780
+ * @summary Create an entitlement
1781
+ * @request POST:/plans/{code}/entitlements
1782
+ * @secure
1783
+ */
1784
+ createEntitlement: (code, data, params = {}) => this.request({
1785
+ path: `/plans/${code}/entitlements`,
1786
+ method: "POST",
1787
+ body: data,
1788
+ secure: true,
1789
+ type: ContentType.Json,
1790
+ format: "json",
1791
+ ...params,
1792
+ }),
1793
+ /**
1794
+ * @description This endpoint retrieves all entitlements for a specific plan.
1795
+ *
1796
+ * @tags entitlements
1797
+ * @name FindAllEntitlements
1798
+ * @summary List all entitlements
1799
+ * @request GET:/plans/{code}/entitlements
1800
+ * @secure
1801
+ */
1802
+ findAllEntitlements: (code, params = {}) => this.request({
1803
+ path: `/plans/${code}/entitlements`,
1804
+ method: "GET",
1805
+ secure: true,
1806
+ format: "json",
1807
+ ...params,
1808
+ }),
1809
+ /**
1810
+ * @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.
1811
+ *
1812
+ * @tags entitlements
1813
+ * @name UpdateEntitlement
1814
+ * @summary Partial update of an entitlement
1815
+ * @request PATCH:/plans/{code}/entitlements
1816
+ * @secure
1817
+ */
1818
+ updateEntitlement: (code, data, params = {}) => this.request({
1819
+ path: `/plans/${code}/entitlements`,
1820
+ method: "PATCH",
1821
+ body: data,
1822
+ secure: true,
1823
+ type: ContentType.Json,
1824
+ format: "json",
1825
+ ...params,
1826
+ }),
1827
+ /**
1828
+ * @description This endpoint retrieves a specific entitlement for a plan.
1829
+ *
1830
+ * @tags entitlements
1831
+ * @name FindEntitlement
1832
+ * @summary Retrieve an entitlement
1833
+ * @request GET:/plans/{code}/entitlements/{feature_code}
1834
+ * @secure
1835
+ */
1836
+ findEntitlement: (code, featureCode, params = {}) => this.request({
1837
+ path: `/plans/${code}/entitlements/${featureCode}`,
1838
+ method: "GET",
1839
+ secure: true,
1840
+ format: "json",
1841
+ ...params,
1842
+ }),
1843
+ /**
1844
+ * @description This endpoint deletes an existing entitlement by removing the feature from the plan.
1845
+ *
1846
+ * @tags entitlements
1847
+ * @name DestroyEntitlement
1848
+ * @summary Delete an entitlement
1849
+ * @request DELETE:/plans/{code}/entitlements/{feature_code}
1850
+ * @secure
1851
+ */
1852
+ destroyEntitlement: (code, featureCode, params = {}) => this.request({
1853
+ path: `/plans/${code}/entitlements/${featureCode}`,
1854
+ method: "DELETE",
1855
+ secure: true,
1856
+ format: "json",
1857
+ ...params,
1858
+ }),
1859
+ /**
1860
+ * @description This endpoint removes a specific privilege and its value from an entitlement. The privilege remains untouched on the original feature.
1861
+ *
1862
+ * @tags entitlements
1863
+ * @name RemoveEntitlementPrivilege
1864
+ * @summary Remove a privilege from an entitlement
1865
+ * @request DELETE:/plans/{code}/entitlements/{feature_code}/privileges/{privilege_code}
1866
+ * @secure
1867
+ */
1868
+ removeEntitlementPrivilege: (code, featureCode, privilegeCode, params = {}) => this.request({
1869
+ path: `/plans/${code}/entitlements/${featureCode}/privileges/${privilegeCode}`,
1870
+ method: "DELETE",
1871
+ secure: true,
1872
+ format: "json",
1873
+ ...params,
1874
+ }),
1622
1875
  };
1623
1876
  subscriptions = {
1624
1877
  /**
@@ -1826,6 +2079,72 @@ class Api extends HttpClient {
1826
2079
  format: "json",
1827
2080
  ...params,
1828
2081
  }),
2082
+ /**
2083
+ * @description This endpoint retrieves all entitlements for a specific subscription, including both plan entitlements and any subscription-specific overrides.
2084
+ *
2085
+ * @tags entitlements
2086
+ * @name FindAllSubscriptionEntitlements
2087
+ * @summary List all subscription entitlements
2088
+ * @request GET:/subscriptions/{external_id}/entitlements
2089
+ * @secure
2090
+ */
2091
+ findAllSubscriptionEntitlements: (externalId, params = {}) => this.request({
2092
+ path: `/subscriptions/${externalId}/entitlements`,
2093
+ method: "GET",
2094
+ secure: true,
2095
+ format: "json",
2096
+ ...params,
2097
+ }),
2098
+ /**
2099
+ * @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.
2100
+ *
2101
+ * @tags entitlements
2102
+ * @name UpdateSubscriptionEntitlements
2103
+ * @summary Update subscription entitlements
2104
+ * @request PATCH:/subscriptions/{external_id}/entitlements
2105
+ * @secure
2106
+ */
2107
+ updateSubscriptionEntitlements: (externalId, data, params = {}) => this.request({
2108
+ path: `/subscriptions/${externalId}/entitlements`,
2109
+ method: "PATCH",
2110
+ body: data,
2111
+ secure: true,
2112
+ type: ContentType.Json,
2113
+ format: "json",
2114
+ ...params,
2115
+ }),
2116
+ /**
2117
+ * @description This endpoint removes a specific feature entitlement from a subscription. The entitlement remains available from the plan.
2118
+ *
2119
+ * @tags entitlements
2120
+ * @name DestroySubscriptionEntitlement
2121
+ * @summary Remove an entitlement from a subscription
2122
+ * @request DELETE:/subscriptions/{external_id}/entitlements/{feature_code}
2123
+ * @secure
2124
+ */
2125
+ destroySubscriptionEntitlement: (externalId, featureCode, params = {}) => this.request({
2126
+ path: `/subscriptions/${externalId}/entitlements/${featureCode}`,
2127
+ method: "DELETE",
2128
+ secure: true,
2129
+ format: "json",
2130
+ ...params,
2131
+ }),
2132
+ /**
2133
+ * @description This endpoint removes a specific privilege from a subscription entitlement. The privilege entitlement remains available from the plan.
2134
+ *
2135
+ * @tags entitlements
2136
+ * @name DestroySubscriptionEntitlementPrivilege
2137
+ * @summary Remove a privilege from a subscription entitlement override
2138
+ * @request DELETE:/subscriptions/{external_id}/entitlements/{feature_code}/privileges/{privilege_code}
2139
+ * @secure
2140
+ */
2141
+ destroySubscriptionEntitlementPrivilege: (externalId, featureCode, privilegeCode, params = {}) => this.request({
2142
+ path: `/subscriptions/${externalId}/entitlements/${featureCode}/privileges/${privilegeCode}`,
2143
+ method: "DELETE",
2144
+ secure: true,
2145
+ format: "json",
2146
+ ...params,
2147
+ }),
1829
2148
  };
1830
2149
  taxes = {
1831
2150
  /**