@frontegg/rest-api 3.1.74 → 3.1.76-alpha.9502349697

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.
Files changed (123) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +39 -0
  3. package/ContextHolder/index.d.ts +108 -27
  4. package/ContextHolder/index.js +155 -50
  5. package/FetchClient.d.ts +42 -0
  6. package/FetchClient.js +308 -0
  7. package/account-settings/index.d.ts +19 -7
  8. package/account-settings/index.js +23 -13
  9. package/applications/index.d.ts +49 -44
  10. package/applications/index.js +51 -37
  11. package/audits/index.d.ts +27 -15
  12. package/audits/index.js +27 -17
  13. package/auth/index.d.ts +817 -768
  14. package/auth/index.js +902 -721
  15. package/auth/secutiry-poilicy/index.d.ts +58 -102
  16. package/auth/secutiry-poilicy/index.js +122 -90
  17. package/auth/utils.d.ts +2 -2
  18. package/auth/utils.js +9 -8
  19. package/connectivity/index.d.ts +126 -27
  20. package/connectivity/index.js +147 -114
  21. package/directory/index.d.ts +31 -22
  22. package/directory/index.js +27 -15
  23. package/entitlements/index.d.ts +14 -8
  24. package/entitlements/index.js +12 -4
  25. package/feature-flags/index.d.ts +8 -2
  26. package/feature-flags/index.js +16 -8
  27. package/groups/index.d.ts +73 -49
  28. package/groups/index.js +64 -45
  29. package/impersonate/index.d.ts +15 -6
  30. package/impersonate/index.js +13 -5
  31. package/index.d.ts +154 -108
  32. package/index.js +109 -78
  33. package/interfaces.d.ts +10 -0
  34. package/metadata/index.d.ts +67 -7
  35. package/metadata/index.js +52 -32
  36. package/node/BaseApiClient.js +49 -0
  37. package/node/ContextHolder/index.js +155 -50
  38. package/node/FetchClient.js +326 -0
  39. package/node/account-settings/index.js +27 -16
  40. package/node/applications/index.js +51 -44
  41. package/node/audits/index.js +31 -20
  42. package/node/auth/index.js +768 -1035
  43. package/node/auth/secutiry-poilicy/index.js +125 -136
  44. package/node/auth/utils.js +9 -7
  45. package/node/connectivity/index.js +148 -187
  46. package/node/directory/index.js +29 -20
  47. package/node/entitlements/index.js +18 -5
  48. package/node/feature-flags/index.js +21 -9
  49. package/node/groups/index.js +65 -63
  50. package/node/impersonate/index.js +18 -5
  51. package/node/index.js +116 -71
  52. package/node/metadata/index.js +61 -52
  53. package/node/notifications/index.js +37 -27
  54. package/node/reports/index.js +78 -70
  55. package/node/roles/index.js +56 -51
  56. package/node/security-center/index.js +21 -9
  57. package/node/sub-tenants/index.js +90 -89
  58. package/node/subscriptions/index.js +69 -107
  59. package/node/subscriptions/invoices.js +25 -17
  60. package/node/subscriptions/managedSubscriptions.js +32 -27
  61. package/node/subscriptions/paymentMethods.js +27 -20
  62. package/node/subscriptions/paymentProviders.js +15 -6
  63. package/node/subscriptions/plans.js +17 -9
  64. package/node/subscriptions/providers/stripe/index.js +26 -21
  65. package/node/subscriptions/subscriptions.js +32 -27
  66. package/node/subscriptions/summaries.js +15 -6
  67. package/node/subscriptions/tenantConfiguration.js +17 -9
  68. package/node/subscriptions/vendorPublicConfigurations.js +15 -6
  69. package/node/teams/index.js +130 -138
  70. package/node/tenants/index.js +65 -60
  71. package/node/user-phone-numbers/index.js +32 -24
  72. package/node/users/index.js +58 -53
  73. package/node/vendor/index.js +17 -6
  74. package/notifications/index.d.ts +22 -16
  75. package/notifications/index.js +33 -22
  76. package/package.json +1 -1
  77. package/reports/index.d.ts +50 -44
  78. package/reports/index.js +75 -62
  79. package/roles/index.d.ts +44 -38
  80. package/roles/index.js +57 -41
  81. package/security-center/index.d.ts +14 -2
  82. package/security-center/index.js +15 -6
  83. package/sub-tenants/index.d.ts +57 -15
  84. package/sub-tenants/index.js +88 -68
  85. package/subscriptions/index.d.ts +56 -11
  86. package/subscriptions/index.js +58 -11
  87. package/subscriptions/invoices.d.ts +16 -13
  88. package/subscriptions/invoices.js +24 -14
  89. package/subscriptions/managedSubscriptions.d.ts +18 -15
  90. package/subscriptions/managedSubscriptions.js +33 -22
  91. package/subscriptions/paymentMethods.d.ts +16 -13
  92. package/subscriptions/paymentMethods.js +26 -17
  93. package/subscriptions/paymentProviders.d.ts +8 -5
  94. package/subscriptions/paymentProviders.js +11 -4
  95. package/subscriptions/plans.d.ts +11 -8
  96. package/subscriptions/plans.js +14 -6
  97. package/subscriptions/providers/stripe/index.d.ts +24 -21
  98. package/subscriptions/providers/stripe/index.js +27 -16
  99. package/subscriptions/subscriptions.d.ts +24 -21
  100. package/subscriptions/subscriptions.js +33 -22
  101. package/subscriptions/summaries.d.ts +7 -4
  102. package/subscriptions/summaries.js +10 -3
  103. package/subscriptions/tenantConfiguration.d.ts +6 -3
  104. package/subscriptions/tenantConfiguration.js +15 -7
  105. package/subscriptions/vendorPublicConfigurations.d.ts +5 -2
  106. package/subscriptions/vendorPublicConfigurations.js +11 -4
  107. package/teams/index.d.ts +35 -131
  108. package/teams/index.js +122 -93
  109. package/tenants/index.d.ts +25 -37
  110. package/tenants/index.js +62 -46
  111. package/tenants/interfaces.d.ts +2 -0
  112. package/user-phone-numbers/index.d.ts +32 -26
  113. package/user-phone-numbers/index.js +32 -19
  114. package/users/index.d.ts +21 -15
  115. package/users/index.js +60 -44
  116. package/vendor/index.d.ts +12 -6
  117. package/vendor/index.js +11 -4
  118. package/fetch.d.ts +0 -24
  119. package/fetch.js +0 -265
  120. package/node/fetch.js +0 -306
  121. package/node/subscriptions/providers/index.js +0 -18
  122. package/subscriptions/providers/index.d.ts +0 -1
  123. package/subscriptions/providers/index.js +0 -1
@@ -1,15 +1,25 @@
1
- import { Get } from "../fetch";
2
- import { urls } from "../constants";
3
- export async function getSubscriptionInvoices() {
4
- return Get(urls.subscriptions.billing.invoices.v1);
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class InvoicesApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getSubscriptionInvoices = async () => {
8
+ return this.get(urls.subscriptions.billing.invoices.v1);
9
+ };
10
+
11
+ this.getSubscriptionInvoice = async invoiceId => {
12
+ return this.get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
13
+ };
14
+
15
+ this.getSubscriptionInvoicePdf = async (invoiceId, outputFileName) => {
16
+ return this.get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
17
+ outputFileName
18
+ }, {
19
+ responseType: 'blob'
20
+ });
21
+ };
22
+ }
23
+
5
24
  }
6
- export async function getSubscriptionInvoice(invoiceId) {
7
- return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
8
- }
9
- export async function getSubscriptionInvoicePdf(invoiceId, outputFileName) {
10
- return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
11
- outputFileName
12
- }, {
13
- responseType: "blob"
14
- });
15
- }
25
+ ;
@@ -1,15 +1,18 @@
1
- import { ISubscriptionResponse, IUpdateManagedSubscriptionRequest } from "./interfaces";
2
- export declare function getManagedSubscription(subscriptionId: string): Promise<ISubscriptionResponse>;
3
- export declare function getManagedSubscriptions(): Promise<ISubscriptionResponse[]>;
4
- /**
5
- * Cancel tenant subscription
6
- */
7
- export declare function cancelManagedSubscription(subscriptionId: string): Promise<void>;
8
- /**
9
- * Renew tenant subscription
10
- */
11
- export declare function renewManagedSubscription(subscriptionId: string): Promise<void>;
12
- /**
13
- * Upgrade/Downgrade tenant subscription plan
14
- */
15
- export declare function updateManagedSubscription(subscriptionId: string, { paymentMethodId, planId }: IUpdateManagedSubscriptionRequest): Promise<void>;
1
+ import { ISubscriptionResponse, IUpdateManagedSubscriptionRequest } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class ManagedSubscriptionApi extends BaseApiClient {
4
+ getManagedSubscription: (subscriptionId: string) => Promise<ISubscriptionResponse>;
5
+ getManagedSubscriptions: () => Promise<ISubscriptionResponse[]>;
6
+ /**
7
+ * Cancel tenant subscription
8
+ */
9
+ cancelManagedSubscription: (subscriptionId: string) => Promise<void>;
10
+ /**
11
+ * Renew tenant subscription
12
+ */
13
+ renewManagedSubscription: (subscriptionId: string) => Promise<void>;
14
+ /**
15
+ * Upgrade/Downgrade tenant subscription plan
16
+ */
17
+ updateManagedSubscription: (subscriptionId: string, { paymentMethodId, planId }: IUpdateManagedSubscriptionRequest) => Promise<void>;
18
+ }
@@ -1,23 +1,34 @@
1
- import { Get, Put } from "../fetch";
2
- import { urls } from "../constants";
3
- export async function getManagedSubscription(subscriptionId) {
4
- return Get(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
5
- }
6
- export async function getManagedSubscriptions() {
7
- return Get(`${urls.subscriptions.managedSubscriptions.v1}`);
8
- }
9
- export async function cancelManagedSubscription(subscriptionId) {
10
- return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
11
- }
12
- export async function renewManagedSubscription(subscriptionId) {
13
- return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
14
- }
15
- export async function updateManagedSubscription(subscriptionId, {
16
- paymentMethodId,
17
- planId
18
- }) {
19
- return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, {
20
- paymentMethodId,
21
- planId
22
- });
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class ManagedSubscriptionApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getManagedSubscription = async subscriptionId => {
8
+ return this.get(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
9
+ };
10
+
11
+ this.getManagedSubscriptions = async () => {
12
+ return this.get(urls.subscriptions.managedSubscriptions.v1);
13
+ };
14
+
15
+ this.cancelManagedSubscription = async subscriptionId => {
16
+ return this.put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
17
+ };
18
+
19
+ this.renewManagedSubscription = async subscriptionId => {
20
+ return this.put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
21
+ };
22
+
23
+ this.updateManagedSubscription = async (subscriptionId, {
24
+ paymentMethodId,
25
+ planId
26
+ }) => {
27
+ return this.put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, {
28
+ paymentMethodId,
29
+ planId
30
+ });
31
+ };
32
+ }
33
+
23
34
  }
@@ -1,13 +1,16 @@
1
- import { ISubscriptionPaymentMethodResponse, ISubscriptionUpdatePaymentMethodBillingDetails } from "./interfaces";
2
- /**
3
- * Get payment methods
4
- */
5
- export declare function getPaymentMethods(): Promise<ISubscriptionPaymentMethodResponse[]>;
6
- /**
7
- * Get payment method
8
- */
9
- export declare function getPaymentMethod(paymentMethodId: string): Promise<ISubscriptionPaymentMethodResponse>;
10
- /**
11
- * Update payment method billing details
12
- */
13
- export declare function updatePaymentMethodBillingDetails(paymentMethodId: string, { email, ...address }: ISubscriptionUpdatePaymentMethodBillingDetails): Promise<ISubscriptionUpdatePaymentMethodBillingDetails>;
1
+ import { ISubscriptionPaymentMethodResponse, ISubscriptionUpdatePaymentMethodBillingDetails } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class PaymentMethodsApi extends BaseApiClient {
4
+ /**
5
+ * Get payment methods
6
+ */
7
+ getPaymentMethods: () => Promise<ISubscriptionPaymentMethodResponse[]>;
8
+ /**
9
+ * Get payment method
10
+ */
11
+ getPaymentMethod: (paymentMethodId: string) => Promise<ISubscriptionPaymentMethodResponse>;
12
+ /**
13
+ * Update payment method billing details
14
+ */
15
+ updatePaymentMethodBillingDetails: (paymentMethodId: string, { email, ...address }: ISubscriptionUpdatePaymentMethodBillingDetails) => Promise<ISubscriptionUpdatePaymentMethodBillingDetails>;
16
+ }
@@ -1,21 +1,30 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  const _excluded = ["email"];
3
- import { Get, Patch } from "../fetch";
4
- import { urls } from "../constants";
5
- export async function getPaymentMethods() {
6
- return Get(urls.subscriptions.billing.paymentMethods.v1);
7
- }
8
- export async function getPaymentMethod(paymentMethodId) {
9
- return Get(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
10
- }
11
- export async function updatePaymentMethodBillingDetails(paymentMethodId, _ref) {
12
- let {
13
- email
14
- } = _ref,
15
- address = _objectWithoutPropertiesLoose(_ref, _excluded);
3
+ import { urls } from '../constants';
4
+ import { BaseApiClient } from '../BaseApiClient';
5
+ export class PaymentMethodsApi extends BaseApiClient {
6
+ constructor(...args) {
7
+ super(...args);
8
+
9
+ this.getPaymentMethods = async () => {
10
+ return this.get(urls.subscriptions.billing.paymentMethods.v1);
11
+ };
12
+
13
+ this.getPaymentMethod = async paymentMethodId => {
14
+ return this.get(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
15
+ };
16
+
17
+ this.updatePaymentMethodBillingDetails = async (paymentMethodId, _ref) => {
18
+ let {
19
+ email
20
+ } = _ref,
21
+ address = _objectWithoutPropertiesLoose(_ref, _excluded);
22
+
23
+ return this.patch(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, {
24
+ email,
25
+ address
26
+ });
27
+ };
28
+ }
16
29
 
17
- return Patch(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, {
18
- email,
19
- address
20
- });
21
30
  }
@@ -1,5 +1,8 @@
1
- import { IPaymentProviderResponse } from "./interfaces";
2
- /**
3
- * Gets payment providers for vendor
4
- */
5
- export declare function getPaymentProviders(): Promise<IPaymentProviderResponse[]>;
1
+ import { IPaymentProviderResponse } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class PaymentProvidersApi extends BaseApiClient {
4
+ /**
5
+ * Gets payment providers for vendor
6
+ */
7
+ getPaymentProviders: () => Promise<IPaymentProviderResponse[]>;
8
+ }
@@ -1,5 +1,12 @@
1
- import { Get } from "../fetch";
2
- import { urls } from "../constants";
3
- export async function getPaymentProviders() {
4
- return Get(urls.subscriptions.paymentProviders.v1);
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class PaymentProvidersApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getPaymentProviders = async () => {
8
+ return this.get(urls.subscriptions.paymentProviders.v1);
9
+ };
10
+ }
11
+
5
12
  }
@@ -1,9 +1,12 @@
1
1
  import { IPlanResponse } from './interfaces';
2
- /**
3
- * Gets subscription plans
4
- */
5
- export declare function getSubscriptionPlans(): Promise<IPlanResponse[]>;
6
- /**
7
- * Gets subscription plan singular
8
- */
9
- export declare function getSubscriptionPlan(planId: string): Promise<IPlanResponse[]>;
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class PlansApi extends BaseApiClient {
4
+ /**
5
+ * Gets subscription plans
6
+ */
7
+ getSubscriptionPlans: () => Promise<IPlanResponse[]>;
8
+ /**
9
+ * Gets subscription plan singular
10
+ */
11
+ getSubscriptionPlan: (planId: string) => Promise<IPlanResponse[]>;
12
+ }
@@ -1,8 +1,16 @@
1
- import { Get } from '../fetch';
2
1
  import { urls } from '../constants';
3
- export async function getSubscriptionPlans() {
4
- return Get(urls.subscriptions.billing.plans.v1);
5
- }
6
- export async function getSubscriptionPlan(planId) {
7
- return Get(`${urls.subscriptions.billing.plans.v1}/${planId}`);
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class PlansApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getSubscriptionPlans = async () => {
8
+ return this.get(urls.subscriptions.billing.plans.v1);
9
+ };
10
+
11
+ this.getSubscriptionPlan = async planId => {
12
+ return this.get(`${urls.subscriptions.billing.plans.v1}/${planId}`);
13
+ };
14
+ }
15
+
8
16
  }
@@ -1,21 +1,24 @@
1
- import { ICreateStripeCustomerRequest, ICreateStripeCustomerResponse, ICreateStripeSubscriptionRequest, ICreateSubscriptionResponse, IStripeCustomerResponse, IStripePaymentProviderConfigurationResponse, ICreateStripePaymentMethodSetupRequest, ICreateStripePaymentMethodSetupResponse } from "./interfaces";
2
- /**
3
- * Creates new stripe subscription
4
- * @param request
5
- */
6
- export declare function createSubscription(request: ICreateStripeSubscriptionRequest): Promise<ICreateSubscriptionResponse>;
7
- /**
8
- * Fetch tenant mapping external stripe customer object
9
- */
10
- export declare function getStripeCustomer(tenantId: string): Promise<IStripeCustomerResponse>;
11
- /**
12
- * Create tenant mapping external stripe customer object
13
- * @param request
14
- */
15
- export declare function createStripeCustomer(request: ICreateStripeCustomerRequest): Promise<ICreateStripeCustomerResponse>;
16
- export declare function getStripePaymentProviderConfiguration(): Promise<IStripePaymentProviderConfigurationResponse>;
17
- /**
18
- * Create payment method intent secret
19
- * @param request
20
- */
21
- export declare function createStripePaymentMethodSetupIntentSecret(request: ICreateStripePaymentMethodSetupRequest): Promise<ICreateStripePaymentMethodSetupResponse>;
1
+ import { ICreateStripeCustomerRequest, ICreateStripeCustomerResponse, ICreateStripeSubscriptionRequest, ICreateSubscriptionResponse, IStripeCustomerResponse, IStripePaymentProviderConfigurationResponse, ICreateStripePaymentMethodSetupRequest, ICreateStripePaymentMethodSetupResponse } from './interfaces';
2
+ import { BaseApiClient } from '../../../BaseApiClient';
3
+ export declare class StripeProviderApi extends BaseApiClient {
4
+ /**
5
+ * Creates new stripe subscription
6
+ * @param request
7
+ */
8
+ createSubscription: (request: ICreateStripeSubscriptionRequest) => Promise<ICreateSubscriptionResponse>;
9
+ /**
10
+ * Fetch tenant mapping external stripe customer object
11
+ */
12
+ getStripeCustomer: (tenantId: string) => Promise<IStripeCustomerResponse>;
13
+ /**
14
+ * Create tenant mapping external stripe customer object
15
+ * @param request
16
+ */
17
+ createStripeCustomer: (request: ICreateStripeCustomerRequest) => Promise<ICreateStripeCustomerResponse>;
18
+ getStripePaymentProviderConfiguration: () => Promise<IStripePaymentProviderConfigurationResponse>;
19
+ /**
20
+ * Create payment method intent secret
21
+ * @param request
22
+ */
23
+ createStripePaymentMethodSetupIntentSecret: (request: ICreateStripePaymentMethodSetupRequest) => Promise<ICreateStripePaymentMethodSetupResponse>;
24
+ }
@@ -1,17 +1,28 @@
1
- import { Get, Post } from "../../../fetch";
2
- import { urls } from "../../../constants";
3
- export async function createSubscription(request) {
4
- return Post(urls.subscriptions.billing.paymentProviders.stripe.subscriptions.v1, request);
5
- }
6
- export async function getStripeCustomer(tenantId) {
7
- return Get(`${urls.subscriptions.billing.paymentProviders.stripe.customers.v1}/${tenantId}`);
8
- }
9
- export async function createStripeCustomer(request) {
10
- return Post(`${urls.subscriptions.billing.paymentProviders.stripe.customers.v1}`, request);
11
- }
12
- export async function getStripePaymentProviderConfiguration() {
13
- return Get(`${urls.subscriptions.billing.paymentProviders.stripe.publicConfigurations.v1}`);
14
- }
15
- export async function createStripePaymentMethodSetupIntentSecret(request) {
16
- return Post(`${urls.subscriptions.billing.paymentProviders.stripe.setupIntents.v1}`, request);
1
+ import { urls } from '../../../constants';
2
+ import { BaseApiClient } from '../../../BaseApiClient';
3
+ export class StripeProviderApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.createSubscription = async request => {
8
+ return this.post(urls.subscriptions.billing.paymentProviders.stripe.subscriptions.v1, request);
9
+ };
10
+
11
+ this.getStripeCustomer = async tenantId => {
12
+ return this.get(`${urls.subscriptions.billing.paymentProviders.stripe.customers.v1}/${tenantId}`);
13
+ };
14
+
15
+ this.createStripeCustomer = async request => {
16
+ return this.post(urls.subscriptions.billing.paymentProviders.stripe.customers.v1, request);
17
+ };
18
+
19
+ this.getStripePaymentProviderConfiguration = async () => {
20
+ return this.get(urls.subscriptions.billing.paymentProviders.stripe.publicConfigurations.v1);
21
+ };
22
+
23
+ this.createStripePaymentMethodSetupIntentSecret = async request => {
24
+ return this.post(urls.subscriptions.billing.paymentProviders.stripe.setupIntents.v1, request);
25
+ };
26
+ }
27
+
17
28
  }
@@ -1,21 +1,24 @@
1
- import { ISubscriptionResponse, IUpdateSubscriptionRequest } from "./interfaces";
2
- /**
3
- * Get tenant subscriptions
4
- */
5
- export declare function getSubscriptions(): Promise<ISubscriptionResponse[]>;
6
- /**
7
- * Get tenant subscription
8
- */
9
- export declare function getSubscription(subscriptionId: string): Promise<ISubscriptionResponse>;
10
- /**
11
- * Cancel tenant subscription
12
- */
13
- export declare function cancelSubscription(subscriptionId: string): Promise<void>;
14
- /**
15
- * Renew tenant subscription
16
- */
17
- export declare function renewSubscription(subscriptionId: string): Promise<void>;
18
- /**
19
- * Upgrade/Downgrade tenant subscription plan
20
- */
21
- export declare function updateSubscription(subscriptionId: string, { paymentMethodId, planId }: IUpdateSubscriptionRequest): Promise<void>;
1
+ import { ISubscriptionResponse, IUpdateSubscriptionRequest } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class SubscriptionApi extends BaseApiClient {
4
+ /**
5
+ * Get tenant subscriptions
6
+ */
7
+ getSubscriptions: () => Promise<ISubscriptionResponse[]>;
8
+ /**
9
+ * Get tenant subscription
10
+ */
11
+ getSubscription: (subscriptionId: string) => Promise<ISubscriptionResponse>;
12
+ /**
13
+ * Cancel tenant subscription
14
+ */
15
+ cancelSubscription: (subscriptionId: string) => Promise<void>;
16
+ /**
17
+ * Renew tenant subscription
18
+ */
19
+ renewSubscription: (subscriptionId: string) => Promise<void>;
20
+ /**
21
+ * Upgrade/Downgrade tenant subscription plan
22
+ */
23
+ updateSubscription: (subscriptionId: string, { paymentMethodId, planId }: IUpdateSubscriptionRequest) => Promise<void>;
24
+ }
@@ -1,23 +1,34 @@
1
- import { Get, Put } from "../fetch";
2
- import { urls } from "../constants";
3
- export async function getSubscriptions() {
4
- return Get(urls.subscriptions.billing.subscriptions.v1);
5
- }
6
- export async function getSubscription(subscriptionId) {
7
- return Get(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`);
8
- }
9
- export async function cancelSubscription(subscriptionId) {
10
- return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/cancellations/`, {});
11
- }
12
- export async function renewSubscription(subscriptionId) {
13
- return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/renewals/`, {});
14
- }
15
- export async function updateSubscription(subscriptionId, {
16
- paymentMethodId,
17
- planId
18
- }) {
19
- return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, {
20
- paymentMethodId,
21
- planId
22
- });
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class SubscriptionApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getSubscriptions = async () => {
8
+ return this.get(urls.subscriptions.billing.subscriptions.v1);
9
+ };
10
+
11
+ this.getSubscription = async subscriptionId => {
12
+ return this.get(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`);
13
+ };
14
+
15
+ this.cancelSubscription = async subscriptionId => {
16
+ return this.put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/cancellations/`, {});
17
+ };
18
+
19
+ this.renewSubscription = async subscriptionId => {
20
+ return this.put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/renewals/`, {});
21
+ };
22
+
23
+ this.updateSubscription = async (subscriptionId, {
24
+ paymentMethodId,
25
+ planId
26
+ }) => {
27
+ return this.put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, {
28
+ paymentMethodId,
29
+ planId
30
+ });
31
+ };
32
+ }
33
+
23
34
  }
@@ -1,5 +1,8 @@
1
1
  import { ISubscriptionSummariesResponse } from './interfaces';
2
- /**
3
- * Gets subscription summaries
4
- */
5
- export declare function getSubscriptionSummaries(tenantId: string): Promise<ISubscriptionSummariesResponse>;
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class SummariesApi extends BaseApiClient {
4
+ /**
5
+ * Gets subscription summaries
6
+ */
7
+ getSubscriptionSummaries: (tenantId: string) => Promise<ISubscriptionSummariesResponse>;
8
+ }
@@ -1,5 +1,12 @@
1
- import { Get } from '../fetch';
2
1
  import { urls } from '../constants';
3
- export async function getSubscriptionSummaries(tenantId) {
4
- return Get(`${urls.subscriptions.billing.summaries.v1}/${tenantId}`);
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class SummariesApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getSubscriptionSummaries = async tenantId => {
8
+ return this.get(`${urls.subscriptions.billing.summaries.v1}/${tenantId}`);
9
+ };
10
+ }
11
+
5
12
  }
@@ -1,3 +1,6 @@
1
- import { ICreateTenantConfigurationRequest, ICreateTenantConfigurationResponse, ITenantConfigurationResponse } from "./interfaces";
2
- export declare function getTenantConfiguration(tenantId: string): Promise<ITenantConfigurationResponse>;
3
- export declare function createTenantConfiguration(request: ICreateTenantConfigurationRequest): Promise<ICreateTenantConfigurationResponse>;
1
+ import { ICreateTenantConfigurationRequest, ICreateTenantConfigurationResponse, ITenantConfigurationResponse } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class SubscriptionTenantConfigApi extends BaseApiClient {
4
+ getTenantConfiguration: (tenantId: string) => Promise<ITenantConfigurationResponse>;
5
+ createTenantConfiguration: (request: ICreateTenantConfigurationRequest) => Promise<ICreateTenantConfigurationResponse>;
6
+ }
@@ -1,8 +1,16 @@
1
- import { Get, Post } from "../fetch";
2
- import { urls } from "../constants";
3
- export async function getTenantConfiguration(tenantId) {
4
- return Get(`${urls.subscriptions.billing.tenantConfiguration.v1}/${tenantId}`);
5
- }
6
- export async function createTenantConfiguration(request) {
7
- return Post(`${urls.subscriptions.billing.tenantConfiguration.v1}`, request);
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class SubscriptionTenantConfigApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getTenantConfiguration = async tenantId => {
8
+ return this.get(`${urls.subscriptions.billing.tenantConfiguration.v1}/${tenantId}`);
9
+ };
10
+
11
+ this.createTenantConfiguration = async request => {
12
+ return this.post(urls.subscriptions.billing.tenantConfiguration.v1, request);
13
+ };
14
+ }
15
+
8
16
  }
@@ -1,2 +1,5 @@
1
- import { IVendorPublicConfigurationResponse } from "./interfaces";
2
- export declare function getVendorPublicConfigurations(): Promise<IVendorPublicConfigurationResponse[]>;
1
+ import { IVendorPublicConfigurationResponse } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class VendorPublicConfigApi extends BaseApiClient {
4
+ getVendorPublicConfigurations: () => Promise<IVendorPublicConfigurationResponse[]>;
5
+ }
@@ -1,5 +1,12 @@
1
- import { Get } from "../fetch";
2
- import { urls } from "../constants";
3
- export async function getVendorPublicConfigurations() {
4
- return Get(`${urls.subscriptions.billing.configurations.vendorPublicConfigurations.v1}`);
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class VendorPublicConfigApi extends BaseApiClient {
4
+ constructor(...args) {
5
+ super(...args);
6
+
7
+ this.getVendorPublicConfigurations = async () => {
8
+ return this.get(urls.subscriptions.billing.configurations.vendorPublicConfigurations.v1);
9
+ };
10
+ }
11
+
5
12
  }