@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
package/roles/index.d.ts CHANGED
@@ -1,39 +1,45 @@
1
1
  import { IRole, IRolePermission, IRolePermissionCategory, IAddRole, IDeleteRole, IUpdateRole, IAttachPermissionsToRole, IAttachPermissionToRoles, IAddRoleV2 } from './interfaces';
2
- /**
3
- * Gets tenant related roles
4
- */
5
- export declare function getRoles(): Promise<IRole[]>;
6
- /**
7
- * Adds tenant related roles
8
- * @param body: IAddRole
9
- */
10
- export declare function addRole(body: IAddRole): Promise<IRole>;
11
- /**
12
- * Deletes role given role ID
13
- */
14
- export declare function deleteRole({ roleId }: IDeleteRole): Promise<void>;
15
- /**
16
- * Updates role using a given role ID and IUpdateRole object
17
- */
18
- export declare function updateRole({ roleId, ...body }: IUpdateRole): Promise<IRole>;
19
- /**
20
- * Attaches permissions to role given a role ID
21
- */
22
- export declare function attachPermissionsToRole({ roleId, ...body }: IAttachPermissionsToRole): Promise<IRole>;
23
- /**
24
- * Gets all vendor permissions
25
- */
26
- export declare function getPermissions(): Promise<IRolePermission[]>;
27
- /**
28
- * Associate permission to roles
29
- */
30
- export declare function attachPermissionToRoles({ permissionId, ...body }: IAttachPermissionToRoles): Promise<IRolePermission>;
31
- /**
32
- * Gets all vendor categories including the permissions
33
- */
34
- export declare function getPermissionCategories(): Promise<IRolePermissionCategory[]>;
35
- /**
36
- * Adds tenant related roles v2
37
- * @param body: IAddRoleV2
38
- */
39
- export declare function addRoleV2(body: IAddRoleV2): Promise<IRole>;
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class RolesApi extends BaseApiClient {
4
+ constructor(appName: string);
5
+ /**
6
+ * Gets tenant related roles
7
+ */
8
+ getRoles: () => Promise<IRole[]>;
9
+ /**
10
+ * Adds tenant related roles
11
+ * @param body - IAddRole
12
+ */
13
+ addRole: (body: IAddRole) => Promise<IRole>;
14
+ /**
15
+ * Deletes role given role ID
16
+ */
17
+ deleteRole: ({ roleId }: IDeleteRole) => Promise<void>;
18
+ /**
19
+ * Updates role using a given role ID and IUpdateRole object
20
+ */
21
+ updateRole: ({ roleId, ...body }: IUpdateRole) => Promise<IRole>;
22
+ /**
23
+ * Attaches permissions to role given a role ID
24
+ */
25
+ attachPermissionsToRole: ({ roleId, ...body }: IAttachPermissionsToRole) => Promise<IRole>;
26
+ /**
27
+ * Gets all vendor permissions
28
+ */
29
+ getPermissions: () => Promise<IRolePermission[]>;
30
+ /**
31
+ * Associate permission to roles
32
+ */
33
+ attachPermissionToRoles: ({ permissionId, ...body }: IAttachPermissionToRoles) => Promise<IRolePermission>;
34
+ /**
35
+ * Gets all vendor categories including the permissions
36
+ */
37
+ getPermissionCategories: () => Promise<IRolePermissionCategory[]>;
38
+ /**
39
+ * Adds tenant related roles v2
40
+ * @param body - IAddRoleV2
41
+ */
42
+ addRoleV2: (body: IAddRoleV2) => Promise<IRole>;
43
+ }
44
+ declare const _default: RolesApi;
45
+ export default _default;
package/roles/index.js CHANGED
@@ -2,49 +2,65 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  const _excluded = ["roleId"],
3
3
  _excluded2 = ["roleId"],
4
4
  _excluded3 = ["permissionId"];
5
- import { Delete, Get, Patch, Post, Put } from '../fetch';
6
5
  import { urls } from '../constants';
7
- export async function getRoles() {
8
- return Get(urls.identity.roles.v1);
9
- }
10
- export async function addRole(body) {
11
- return Post(urls.identity.roles.v1, body);
12
- }
13
- export async function deleteRole({
14
- roleId
15
- }) {
16
- return Delete(`${urls.identity.roles.v1}/${roleId}`);
17
- }
18
- export async function updateRole(_ref) {
19
- let {
20
- roleId
21
- } = _ref,
22
- body = _objectWithoutPropertiesLoose(_ref, _excluded);
6
+ import { BaseApiClient } from '../BaseApiClient';
7
+ export class RolesApi extends BaseApiClient {
8
+ constructor(appName) {
9
+ super(appName);
23
10
 
24
- return Patch(`${urls.identity.roles.v1}/${roleId}`, body);
25
- }
26
- export async function attachPermissionsToRole(_ref2) {
27
- let {
28
- roleId
29
- } = _ref2,
30
- body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
11
+ this.getRoles = async () => {
12
+ return this.get(urls.identity.roles.v1);
13
+ };
31
14
 
32
- return Put(`${urls.identity.roles.v1}/${roleId}/permissions`, body);
33
- }
34
- export async function getPermissions() {
35
- return Get(urls.identity.permissions.v1);
36
- }
37
- export async function attachPermissionToRoles(_ref3) {
38
- let {
39
- permissionId
40
- } = _ref3,
41
- body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
15
+ this.addRole = async body => {
16
+ return this.post(urls.identity.roles.v1, body);
17
+ };
18
+
19
+ this.deleteRole = async ({
20
+ roleId
21
+ }) => {
22
+ return this.delete(`${urls.identity.roles.v1}/${roleId}`);
23
+ };
24
+
25
+ this.updateRole = async _ref => {
26
+ let {
27
+ roleId
28
+ } = _ref,
29
+ body = _objectWithoutPropertiesLoose(_ref, _excluded);
30
+
31
+ return this.patch(`${urls.identity.roles.v1}/${roleId}`, body);
32
+ };
33
+
34
+ this.attachPermissionsToRole = async _ref2 => {
35
+ let {
36
+ roleId
37
+ } = _ref2,
38
+ body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
39
+
40
+ return this.put(`${urls.identity.roles.v1}/${roleId}/permissions`, body);
41
+ };
42
+
43
+ this.getPermissions = async () => {
44
+ return this.get(urls.identity.permissions.v1);
45
+ };
46
+
47
+ this.attachPermissionToRoles = async _ref3 => {
48
+ let {
49
+ permissionId
50
+ } = _ref3,
51
+ body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
52
+
53
+ return this.put(`${urls.identity.permissions.v1}/${permissionId}/roles`, body);
54
+ };
55
+
56
+ this.getPermissionCategories = async () => {
57
+ return this.get(`${urls.identity.permissions.v1}/categories`);
58
+ };
59
+
60
+ this.addRoleV2 = async body => {
61
+ return this.post(urls.identity.roles.v2, body);
62
+ };
63
+ }
42
64
 
43
- return Put(`${urls.identity.permissions.v1}/${permissionId}/roles`, body);
44
- }
45
- export async function getPermissionCategories() {
46
- return Get(`${urls.identity.permissions.v1}/categories`);
47
65
  }
48
- export async function addRoleV2(body) {
49
- return Post(urls.identity.roles.v2, body);
50
- }
66
+ export default new RolesApi('default');
@@ -1,3 +1,15 @@
1
1
  import { GetInsightsResponse, GetRecommendationsResponse } from './interfaces';
2
- export declare function getRecommendations(): Promise<GetRecommendationsResponse>;
3
- export declare function getInsights(): Promise<GetInsightsResponse>;
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class SecurityCenterApi extends BaseApiClient {
4
+ constructor(appName: string);
5
+ /**
6
+ * Get security center recommendations.
7
+ */
8
+ getRecommendations: () => Promise<GetRecommendationsResponse>;
9
+ /**
10
+ * Get security center insights.
11
+ */
12
+ getInsights: () => Promise<GetInsightsResponse>;
13
+ }
14
+ declare const _default: SecurityCenterApi;
15
+ export default _default;
@@ -1,8 +1,17 @@
1
- import { Get } from '../fetch';
2
1
  import { urls } from '../constants';
3
- export async function getRecommendations() {
4
- return Get(urls.securityCenter.recommendations.v1);
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class SecurityCenterApi extends BaseApiClient {
4
+ constructor(appName) {
5
+ super(appName);
6
+
7
+ this.getRecommendations = async () => {
8
+ return this.get(urls.securityCenter.recommendations.v1);
9
+ };
10
+
11
+ this.getInsights = async () => {
12
+ return this.get(urls.securityCenter.insights.v1);
13
+ };
14
+ }
15
+
5
16
  }
6
- export async function getInsights() {
7
- return Get(urls.securityCenter.insights.v1);
8
- }
17
+ export default new SecurityCenterApi('default');
@@ -1,15 +1,57 @@
1
- import { PaginationResult, UserJwtOptions } from "../interfaces";
2
- import { AddUsersToSubTenantRequest, AddUserToSubTenantsRequest, CreateSubTenantRequest, CreateSubTenantResponse, ILoadAllUsers, ISubTenantUser, RemoveUserFromSubTenantsRequest, UpdateSubAccountAccessRequestDto, UpdateSubTenantHierarchySettingsRequest, UpdateSubTenantManagementRequest, UpdateSubTenantRequest, UpdateSubTenantRequestParams, UpdateUserRolesForSubTenantsRequestDto } from "./interfaces";
3
- export declare function loadAllUsers(params: ILoadAllUsers): Promise<PaginationResult<ISubTenantUser>>;
4
- export declare function addUserToTenantAndSubTenants(body: AddUserToSubTenantsRequest): Promise<void>;
5
- export declare function removeUserFromTenantAndSubTenants(body: RemoveUserFromSubTenantsRequest, options?: UserJwtOptions): Promise<void>;
6
- export declare function addUserRolesForSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions): Promise<void>;
7
- export declare function removeUserRolesFromSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions): Promise<void>;
8
- export declare function setUserRolesForSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions): Promise<void>;
9
- export declare function createSubTenant(body: CreateSubTenantRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
10
- export declare function deleteSubTenant(tenantId: string, options?: UserJwtOptions): Promise<void>;
11
- export declare function updateSubTenant({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantRequest, options?: UserJwtOptions): Promise<void>;
12
- export declare function updateSubTenantManagement({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantManagementRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
13
- export declare function updateSubTenantHierarchySettings({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantHierarchySettingsRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
14
- export declare function updateSubAccountAccess(userId: string, body: UpdateSubAccountAccessRequestDto, options?: UserJwtOptions): Promise<void>;
15
- export declare function addUsersToSubTenant(body: AddUsersToSubTenantRequest, options?: UserJwtOptions): Promise<void>;
1
+ import { PaginationResult, UserJwtOptions } from '../interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ import { AddUsersToSubTenantRequest, AddUserToSubTenantsRequest, CreateSubTenantRequest, CreateSubTenantResponse, ILoadAllUsers, ISubTenantUser, RemoveUserFromSubTenantsRequest, UpdateSubAccountAccessRequestDto, UpdateSubTenantHierarchySettingsRequest, UpdateSubTenantManagementRequest, UpdateSubTenantRequest, UpdateSubTenantRequestParams, UpdateUserRolesForSubTenantsRequestDto } from './interfaces';
4
+ export declare class SubTenantsApi extends BaseApiClient {
5
+ constructor(appName: string);
6
+ /**
7
+ * Loads all users based on given parameters.
8
+ */
9
+ loadAllUsers: (params: ILoadAllUsers) => Promise<PaginationResult<ISubTenantUser>>;
10
+ /**
11
+ * Adds a user to a tenant and its sub-tenants.
12
+ */
13
+ addUserToTenantAndSubTenants: (body: AddUserToSubTenantsRequest) => Promise<void>;
14
+ /**
15
+ * Removes a user from a tenant and its sub-tenants.
16
+ */
17
+ removeUserFromTenantAndSubTenants: (body: RemoveUserFromSubTenantsRequest, options?: UserJwtOptions | undefined) => Promise<void>;
18
+ /**
19
+ * Adds user roles for sub-tenants.
20
+ */
21
+ addUserRolesForSubTenants: (userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
22
+ /**
23
+ * Removes user roles from sub-tenants.
24
+ */
25
+ removeUserRolesFromSubTenants: (userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
26
+ /**
27
+ * Sets user roles for sub-tenants.
28
+ */
29
+ setUserRolesForSubTenants: (userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
30
+ /**
31
+ * Creates a new sub-tenant.
32
+ */
33
+ createSubTenant: (body: CreateSubTenantRequest, options?: UserJwtOptions | undefined) => Promise<CreateSubTenantResponse>;
34
+ /**
35
+ * Deletes a sub-tenant.
36
+ */
37
+ deleteSubTenant: (tenantId: string, options?: UserJwtOptions | undefined) => Promise<void>;
38
+ /**
39
+ * Updates sub-tenant information.
40
+ */
41
+ updateSubTenant: ({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantRequest, options?: UserJwtOptions | undefined) => Promise<void>;
42
+ /**
43
+ * Updates sub-tenant management information.
44
+ */
45
+ updateSubTenantManagement: ({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantManagementRequest, options?: UserJwtOptions | undefined) => Promise<CreateSubTenantResponse>;
46
+ updateSubTenantHierarchySettings({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantHierarchySettingsRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
47
+ /**
48
+ * Updates sub-account access.
49
+ */
50
+ updateSubAccountAccess: (userId: string, body: UpdateSubAccountAccessRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
51
+ /**
52
+ * Adds multiple users to a sub-tenant.
53
+ */
54
+ addUsersToSubTenant: (body: AddUsersToSubTenantRequest, options?: UserJwtOptions | undefined) => Promise<void>;
55
+ }
56
+ declare const _default: SubTenantsApi;
57
+ export default _default;
@@ -1,69 +1,89 @@
1
- import { Delete, extractHeadersFromOptions, Get, Patch, Post, Put } from "../fetch";
2
- import { urls } from "../constants";
3
- export async function loadAllUsers(params) {
4
- return Get(urls.identity.subTenants.v1, params);
1
+ import { urls } from '../constants';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export class SubTenantsApi extends BaseApiClient {
4
+ constructor(appName) {
5
+ super(appName);
6
+
7
+ this.loadAllUsers = async params => {
8
+ return this.get(urls.identity.subTenants.v1, params);
9
+ };
10
+
11
+ this.addUserToTenantAndSubTenants = async body => {
12
+ return this.post(urls.identity.subTenants.v1, body);
13
+ };
14
+
15
+ this.removeUserFromTenantAndSubTenants = async (body, options) => {
16
+ return this.delete(urls.identity.subTenants.v1, body, {
17
+ headers: this.extractHeadersFromOptions(options)
18
+ });
19
+ };
20
+
21
+ this.addUserRolesForSubTenants = async (userId, body, options) => {
22
+ return this.post(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
23
+ headers: this.extractHeadersFromOptions(options)
24
+ });
25
+ };
26
+
27
+ this.removeUserRolesFromSubTenants = async (userId, body, options) => {
28
+ return this.delete(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
29
+ headers: this.extractHeadersFromOptions(options)
30
+ });
31
+ };
32
+
33
+ this.setUserRolesForSubTenants = async (userId, body, options) => {
34
+ return this.patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
35
+ headers: this.extractHeadersFromOptions(options)
36
+ });
37
+ };
38
+
39
+ this.createSubTenant = async (body, options) => {
40
+ return this.post(urls.tenants.subTenants.v1, body, {
41
+ headers: this.extractHeadersFromOptions(options)
42
+ });
43
+ };
44
+
45
+ this.deleteSubTenant = async (tenantId, options) => {
46
+ return this.delete(`${urls.tenants.subTenants.v1}/${tenantId}`, undefined, {
47
+ headers: this.extractHeadersFromOptions(options)
48
+ });
49
+ };
50
+
51
+ this.updateSubTenant = async ({
52
+ tenantId
53
+ }, body, options) => {
54
+ return this.patch(`${urls.tenants.subTenants.v1}/${tenantId}`, body, {
55
+ headers: this.extractHeadersFromOptions(options)
56
+ });
57
+ };
58
+
59
+ this.updateSubTenantManagement = async ({
60
+ tenantId
61
+ }, body, options) => {
62
+ return this.put(`${urls.tenants.subTenants.v1}/${tenantId}/management`, body, {
63
+ headers: this.extractHeadersFromOptions(options)
64
+ });
65
+ };
66
+
67
+ this.updateSubAccountAccess = async (userId, body, options) => {
68
+ return this.put(`${urls.identity.subTenants.v1}/${userId}/access`, body, {
69
+ headers: this.extractHeadersFromOptions(options)
70
+ });
71
+ };
72
+
73
+ this.addUsersToSubTenant = async (body, options) => {
74
+ return this.post(`${urls.identity.subTenants.v2}/`, body, {
75
+ headers: this.extractHeadersFromOptions(options)
76
+ });
77
+ };
78
+ }
79
+
80
+ updateSubTenantHierarchySettings({
81
+ tenantId
82
+ }, body, options) {
83
+ return this.put(`${urls.tenants.subTenants.v1}/${tenantId}/hierarchy-settings`, body, {
84
+ headers: this.extractHeadersFromOptions(options)
85
+ });
86
+ }
87
+
5
88
  }
6
- export async function addUserToTenantAndSubTenants(body) {
7
- return Post(urls.identity.subTenants.v1, body);
8
- }
9
- export async function removeUserFromTenantAndSubTenants(body, options) {
10
- return Delete(urls.identity.subTenants.v1, body, {
11
- headers: extractHeadersFromOptions(options)
12
- });
13
- }
14
- export async function addUserRolesForSubTenants(userId, body, options) {
15
- return Post(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
16
- headers: extractHeadersFromOptions(options)
17
- });
18
- }
19
- export async function removeUserRolesFromSubTenants(userId, body, options) {
20
- return Delete(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
21
- headers: extractHeadersFromOptions(options)
22
- });
23
- }
24
- export async function setUserRolesForSubTenants(userId, body, options) {
25
- return Patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
26
- headers: extractHeadersFromOptions(options)
27
- });
28
- }
29
- export async function createSubTenant(body, options) {
30
- return Post(urls.tenants.subTenants.v1, body, {
31
- headers: extractHeadersFromOptions(options)
32
- });
33
- }
34
- export async function deleteSubTenant(tenantId, options) {
35
- return Delete(`${urls.tenants.subTenants.v1}/${tenantId}`, undefined, {
36
- headers: extractHeadersFromOptions(options)
37
- });
38
- }
39
- export async function updateSubTenant({
40
- tenantId
41
- }, body, options) {
42
- return Patch(`${urls.tenants.subTenants.v1}/${tenantId}`, body, {
43
- headers: extractHeadersFromOptions(options)
44
- });
45
- }
46
- export async function updateSubTenantManagement({
47
- tenantId
48
- }, body, options) {
49
- return Put(`${urls.tenants.subTenants.v1}/${tenantId}/management`, body, {
50
- headers: extractHeadersFromOptions(options)
51
- });
52
- }
53
- export async function updateSubTenantHierarchySettings({
54
- tenantId
55
- }, body, options) {
56
- return Put(`${urls.tenants.subTenants.v1}/${tenantId}/hierarchy-settings`, body, {
57
- headers: extractHeadersFromOptions(options)
58
- });
59
- }
60
- export async function updateSubAccountAccess(userId, body, options) {
61
- return Put(`${urls.identity.subTenants.v1}/${userId}/access`, body, {
62
- headers: extractHeadersFromOptions(options)
63
- });
64
- }
65
- export async function addUsersToSubTenant(body, options) {
66
- return Post(`${urls.identity.subTenants.v2}/`, body, {
67
- headers: extractHeadersFromOptions(options)
68
- });
69
- }
89
+ export default new SubTenantsApi('default');
@@ -1,11 +1,56 @@
1
- export * from "./subscriptions";
2
- export * from "./managedSubscriptions";
3
- export * from "./plans";
4
- export * from "./invoices";
5
- export * from "./paymentMethods";
6
- export * from "./providers";
7
- export * from "./summaries";
8
- export * from "./tenantConfiguration";
9
- export * from "./paymentProviders";
10
- export * from "./vendorPublicConfigurations";
11
- export * from "./enums";
1
+ import { BaseApiClient } from '../BaseApiClient';
2
+ export declare class SubscriptionsApi extends BaseApiClient {
3
+ constructor(appName: string);
4
+ private readonly invoicesApi;
5
+ private readonly managedSubscriptionApi;
6
+ private readonly paymentMethodsApi;
7
+ private readonly paymentProvidersApi;
8
+ private readonly plansApi;
9
+ private readonly subscriptionApi;
10
+ private readonly summariesApi;
11
+ private readonly subscriptionTenantConfigApi;
12
+ private readonly vendorPublicConfigApi;
13
+ private readonly stripeProviderApi;
14
+ /** InvoicesApi **/
15
+ getSubscriptionInvoices: () => Promise<import("./interfaces").ISubscriptionInvoiceResponse[]>;
16
+ getSubscriptionInvoice: (invoiceId: string) => Promise<import("./interfaces").ISubscriptionInvoiceResponse>;
17
+ getSubscriptionInvoicePdf: (invoiceId: string, outputFileName?: string | undefined) => Promise<void>;
18
+ /** ManagedSubscriptionApi **/
19
+ getManagedSubscription: (subscriptionId: string) => Promise<import("./interfaces").ISubscriptionResponse>;
20
+ getManagedSubscriptions: () => Promise<import("./interfaces").ISubscriptionResponse[]>;
21
+ cancelManagedSubscription: (subscriptionId: string) => Promise<void>;
22
+ renewManagedSubscription: (subscriptionId: string) => Promise<void>;
23
+ updateManagedSubscription: (subscriptionId: string, { paymentMethodId, planId }: import("./interfaces").IUpdateManagedSubscriptionRequest) => Promise<void>;
24
+ /** PaymentMethodsApi **/
25
+ getPaymentMethods: () => Promise<import("./interfaces").ISubscriptionPaymentMethodResponse[]>;
26
+ getPaymentMethod: (paymentMethodId: string) => Promise<import("./interfaces").ISubscriptionPaymentMethodResponse>;
27
+ updatePaymentMethodBillingDetails: (paymentMethodId: string, { email, ...address }: import("./interfaces").ISubscriptionUpdatePaymentMethodBillingDetails) => Promise<import("./interfaces").ISubscriptionUpdatePaymentMethodBillingDetails>;
28
+ /** PaymentProvidersApi **/
29
+ getPaymentProviders: () => Promise<import("./interfaces").IPaymentProviderResponse[]>;
30
+ /** PlansApi **/
31
+ getSubscriptionPlans: () => Promise<import("./interfaces").IPlanResponse[]>;
32
+ getSubscriptionPlan: (planId: string) => Promise<import("./interfaces").IPlanResponse[]>;
33
+ /** SubscriptionApi **/
34
+ getSubscriptions: () => Promise<import("./interfaces").ISubscriptionResponse[]>;
35
+ getSubscription: (subscriptionId: string) => Promise<import("./interfaces").ISubscriptionResponse>;
36
+ cancelSubscription: (subscriptionId: string) => Promise<void>;
37
+ renewSubscription: (subscriptionId: string) => Promise<void>;
38
+ updateSubscription: (subscriptionId: string, { paymentMethodId, planId }: import("./interfaces").IUpdateSubscriptionRequest) => Promise<void>;
39
+ /** SummariesApi **/
40
+ getSubscriptionSummaries: (tenantId: string) => Promise<import("./interfaces").ISubscriptionSummariesResponse>;
41
+ /** SubscriptionTenantConfigApi **/
42
+ getTenantConfiguration: (tenantId: string) => Promise<import("./interfaces").ITenantConfigurationResponse>;
43
+ createTenantConfiguration: (request: import("./interfaces").ICreateTenantConfigurationRequest) => Promise<import("./interfaces").ICreateTenantConfigurationResponse>;
44
+ /** VendorPublicConfigApi **/
45
+ getVendorPublicConfigurations: () => Promise<import("./interfaces").IVendorPublicConfigurationResponse[]>;
46
+ /** StripeProviderApi **/
47
+ createSubscription: (request: import("./interfaces").ICreateStripeSubscriptionRequest) => Promise<import("./interfaces").ICreateSubscriptionResponse>;
48
+ getStripeCustomer: (tenantId: string) => Promise<import("./interfaces").IStripeCustomerResponse>;
49
+ createStripeCustomer: (request: import("./interfaces").ICreateStripeCustomerRequest) => Promise<import("./interfaces").ICreateStripeCustomerResponse>;
50
+ getStripePaymentProviderConfiguration: () => Promise<import("./interfaces").IStripePaymentProviderConfigurationResponse>;
51
+ createStripePaymentMethodSetupIntentSecret: (request: import("./interfaces").ICreateStripePaymentMethodSetupRequest) => Promise<import("./interfaces").ICreateStripePaymentMethodSetupResponse>;
52
+ }
53
+ declare const _default: SubscriptionsApi;
54
+ export default _default;
55
+ export * from './interfaces';
56
+ export * from './enums';
@@ -1,11 +1,58 @@
1
- export * from "./subscriptions";
2
- export * from "./managedSubscriptions";
3
- export * from "./plans";
4
- export * from "./invoices";
5
- export * from "./paymentMethods";
6
- export * from "./providers";
7
- export * from "./summaries";
8
- export * from "./tenantConfiguration";
9
- export * from "./paymentProviders";
10
- export * from "./vendorPublicConfigurations";
11
- export * from "./enums";
1
+ import { BaseApiClient } from '../BaseApiClient';
2
+ import { InvoicesApi } from './invoices';
3
+ import { ManagedSubscriptionApi } from './managedSubscriptions';
4
+ import { PaymentMethodsApi } from './paymentMethods';
5
+ import { PaymentProvidersApi } from './paymentProviders';
6
+ import { PlansApi } from './plans';
7
+ import { SubscriptionApi } from './subscriptions';
8
+ import { SummariesApi } from './summaries';
9
+ import { SubscriptionTenantConfigApi } from './tenantConfiguration';
10
+ import { VendorPublicConfigApi } from './vendorPublicConfigurations';
11
+ import { StripeProviderApi } from './providers/stripe';
12
+ export class SubscriptionsApi extends BaseApiClient {
13
+ constructor(appName) {
14
+ super(appName);
15
+ this.invoicesApi = new InvoicesApi(this.appName);
16
+ this.managedSubscriptionApi = new ManagedSubscriptionApi(this.appName);
17
+ this.paymentMethodsApi = new PaymentMethodsApi(this.appName);
18
+ this.paymentProvidersApi = new PaymentProvidersApi(this.appName);
19
+ this.plansApi = new PlansApi(this.appName);
20
+ this.subscriptionApi = new SubscriptionApi(this.appName);
21
+ this.summariesApi = new SummariesApi(this.appName);
22
+ this.subscriptionTenantConfigApi = new SubscriptionTenantConfigApi(this.appName);
23
+ this.vendorPublicConfigApi = new VendorPublicConfigApi(this.appName);
24
+ this.stripeProviderApi = new StripeProviderApi(this.appName);
25
+ this.getSubscriptionInvoices = this.invoicesApi.getSubscriptionInvoices.bind(this.invoicesApi);
26
+ this.getSubscriptionInvoice = this.invoicesApi.getSubscriptionInvoice.bind(this.invoicesApi);
27
+ this.getSubscriptionInvoicePdf = this.invoicesApi.getSubscriptionInvoicePdf.bind(this.invoicesApi);
28
+ this.getManagedSubscription = this.managedSubscriptionApi.getManagedSubscription.bind(this.managedSubscriptionApi);
29
+ this.getManagedSubscriptions = this.managedSubscriptionApi.getManagedSubscriptions.bind(this.managedSubscriptionApi);
30
+ this.cancelManagedSubscription = this.managedSubscriptionApi.cancelManagedSubscription.bind(this.managedSubscriptionApi);
31
+ this.renewManagedSubscription = this.managedSubscriptionApi.renewManagedSubscription.bind(this.managedSubscriptionApi);
32
+ this.updateManagedSubscription = this.managedSubscriptionApi.updateManagedSubscription.bind(this.managedSubscriptionApi);
33
+ this.getPaymentMethods = this.paymentMethodsApi.getPaymentMethods.bind(this.paymentMethodsApi);
34
+ this.getPaymentMethod = this.paymentMethodsApi.getPaymentMethod.bind(this.paymentMethodsApi);
35
+ this.updatePaymentMethodBillingDetails = this.paymentMethodsApi.updatePaymentMethodBillingDetails.bind(this.paymentMethodsApi);
36
+ this.getPaymentProviders = this.paymentProvidersApi.getPaymentProviders.bind(this.paymentProvidersApi);
37
+ this.getSubscriptionPlans = this.plansApi.getSubscriptionPlans.bind(this.plansApi);
38
+ this.getSubscriptionPlan = this.plansApi.getSubscriptionPlan.bind(this.plansApi);
39
+ this.getSubscriptions = this.subscriptionApi.getSubscriptions.bind(this.subscriptionApi);
40
+ this.getSubscription = this.subscriptionApi.getSubscription.bind(this.subscriptionApi);
41
+ this.cancelSubscription = this.subscriptionApi.cancelSubscription.bind(this.subscriptionApi);
42
+ this.renewSubscription = this.subscriptionApi.renewSubscription.bind(this.subscriptionApi);
43
+ this.updateSubscription = this.subscriptionApi.updateSubscription.bind(this.subscriptionApi);
44
+ this.getSubscriptionSummaries = this.summariesApi.getSubscriptionSummaries.bind(this.summariesApi);
45
+ this.getTenantConfiguration = this.subscriptionTenantConfigApi.getTenantConfiguration.bind(this.subscriptionTenantConfigApi);
46
+ this.createTenantConfiguration = this.subscriptionTenantConfigApi.createTenantConfiguration.bind(this.subscriptionTenantConfigApi);
47
+ this.getVendorPublicConfigurations = this.vendorPublicConfigApi.getVendorPublicConfigurations.bind(this.vendorPublicConfigApi);
48
+ this.createSubscription = this.stripeProviderApi.createSubscription.bind(this.stripeProviderApi);
49
+ this.getStripeCustomer = this.stripeProviderApi.getStripeCustomer.bind(this.stripeProviderApi);
50
+ this.createStripeCustomer = this.stripeProviderApi.createStripeCustomer.bind(this.stripeProviderApi);
51
+ this.getStripePaymentProviderConfiguration = this.stripeProviderApi.getStripePaymentProviderConfiguration.bind(this.stripeProviderApi);
52
+ this.createStripePaymentMethodSetupIntentSecret = this.stripeProviderApi.createStripePaymentMethodSetupIntentSecret.bind(this.stripeProviderApi);
53
+ }
54
+
55
+ }
56
+ export default new SubscriptionsApi('default');
57
+ export * from './interfaces';
58
+ export * from './enums';
@@ -1,13 +1,16 @@
1
- import { ISubscriptionInvoiceResponse } from "./interfaces";
2
- /**
3
- * Get subscription invoices
4
- */
5
- export declare function getSubscriptionInvoices(): Promise<ISubscriptionInvoiceResponse[]>;
6
- /**
7
- * Get subscription invoice
8
- */
9
- export declare function getSubscriptionInvoice(invoiceId: string): Promise<ISubscriptionInvoiceResponse>;
10
- /**
11
- * Get subscription invoice pdf file
12
- */
13
- export declare function getSubscriptionInvoicePdf(invoiceId: string, outputFileName?: string): Promise<void>;
1
+ import { ISubscriptionInvoiceResponse } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class InvoicesApi extends BaseApiClient {
4
+ /**
5
+ * Get subscription invoices
6
+ */
7
+ getSubscriptionInvoices: () => Promise<ISubscriptionInvoiceResponse[]>;
8
+ /**
9
+ * Get subscription invoice
10
+ */
11
+ getSubscriptionInvoice: (invoiceId: string) => Promise<ISubscriptionInvoiceResponse>;
12
+ /**
13
+ * Get subscription invoice pdf file
14
+ */
15
+ getSubscriptionInvoicePdf: (invoiceId: string, outputFileName?: string | undefined) => Promise<void>;
16
+ }