@easyedu/js-lsm-api 1.33.0 → 1.35.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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @easyedu/js-lsm-api@1.33.0
1
+ # @easyedu/js-lsm-api@1.35.0
2
2
 
3
3
  A TypeScript SDK client for the sbzw93t49b.execute-api.us-east-2.amazonaws.com API.
4
4
 
@@ -146,6 +146,7 @@ All URIs are relative to *https://sbzw93t49b.execute-api.us-east-2.amazonaws.com
146
146
  *RoleApi* | [**updateRole**](docs/RoleApi.md#updaterole) | **PUT** /roles/{roleId} | Update a custom role name and description
147
147
  *RoleApi* | [**updateRolePermissions**](docs/RoleApi.md#updaterolepermissions) | **PUT** /roles/{roleId}/permissions | Replace all permissions for a custom role
148
148
  *UserApi* | [**getAuthCheck**](docs/UserApi.md#getauthcheck) | **GET** /auth/check | Check if a user is logged in
149
+ *UserApi* | [**getCurrentUserPermissions**](docs/UserApi.md#getcurrentuserpermissions) | **GET** /users/current/permissions | Get the current user\'s permissions
149
150
  *UserApi* | [**getUser**](docs/UserApi.md#getuser) | **GET** /users/{userId} | Get a user by id
150
151
  *UserApi* | [**postLogin**](docs/UserApi.md#postlogin) | **POST** /auth/login | Post a new login
151
152
  *UserApi* | [**postLogout**](docs/UserApi.md#postlogout) | **POST** /auth/logout | Logout a user
@@ -369,7 +370,7 @@ and is automatically generated by the
369
370
  [OpenAPI Generator](https://openapi-generator.tech) project:
370
371
 
371
372
  - API version: `1.0.0`
372
- - Package version: `1.33.0`
373
+ - Package version: `1.35.0`
373
374
  - Generator version: `7.21.0`
374
375
  - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
375
376
 
@@ -43,6 +43,20 @@ export declare class UserApi extends runtime.BaseAPI {
43
43
  * Check if a user is logged in
44
44
  */
45
45
  getAuthCheck(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
46
+ /**
47
+ * Creates request options for getCurrentUserPermissions without sending the request
48
+ */
49
+ getCurrentUserPermissionsRequestOpts(): Promise<runtime.RequestOpts>;
50
+ /**
51
+ * Returns an array of permission key strings for the authenticated user\'s current portal
52
+ * Get the current user\'s permissions
53
+ */
54
+ getCurrentUserPermissionsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>>;
55
+ /**
56
+ * Returns an array of permission key strings for the authenticated user\'s current portal
57
+ * Get the current user\'s permissions
58
+ */
59
+ getCurrentUserPermissions(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>>;
46
60
  /**
47
61
  * Creates request options for getUser without sending the request
48
62
  */
@@ -63,6 +63,43 @@ class UserApi extends runtime.BaseAPI {
63
63
  yield this.getAuthCheckRaw(initOverrides);
64
64
  });
65
65
  }
66
+ /**
67
+ * Creates request options for getCurrentUserPermissions without sending the request
68
+ */
69
+ getCurrentUserPermissionsRequestOpts() {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const queryParameters = {};
72
+ const headerParameters = {};
73
+ let urlPath = `/users/current/permissions`;
74
+ return {
75
+ path: urlPath,
76
+ method: 'GET',
77
+ headers: headerParameters,
78
+ query: queryParameters,
79
+ };
80
+ });
81
+ }
82
+ /**
83
+ * Returns an array of permission key strings for the authenticated user\'s current portal
84
+ * Get the current user\'s permissions
85
+ */
86
+ getCurrentUserPermissionsRaw(initOverrides) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const requestOptions = yield this.getCurrentUserPermissionsRequestOpts();
89
+ const response = yield this.request(requestOptions, initOverrides);
90
+ return new runtime.JSONApiResponse(response);
91
+ });
92
+ }
93
+ /**
94
+ * Returns an array of permission key strings for the authenticated user\'s current portal
95
+ * Get the current user\'s permissions
96
+ */
97
+ getCurrentUserPermissions(initOverrides) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ const response = yield this.getCurrentUserPermissionsRaw(initOverrides);
100
+ return yield response.value();
101
+ });
102
+ }
66
103
  /**
67
104
  * Creates request options for getUser without sending the request
68
105
  */
@@ -43,6 +43,20 @@ export declare class UserApi extends runtime.BaseAPI {
43
43
  * Check if a user is logged in
44
44
  */
45
45
  getAuthCheck(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
46
+ /**
47
+ * Creates request options for getCurrentUserPermissions without sending the request
48
+ */
49
+ getCurrentUserPermissionsRequestOpts(): Promise<runtime.RequestOpts>;
50
+ /**
51
+ * Returns an array of permission key strings for the authenticated user\'s current portal
52
+ * Get the current user\'s permissions
53
+ */
54
+ getCurrentUserPermissionsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>>;
55
+ /**
56
+ * Returns an array of permission key strings for the authenticated user\'s current portal
57
+ * Get the current user\'s permissions
58
+ */
59
+ getCurrentUserPermissions(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>>;
46
60
  /**
47
61
  * Creates request options for getUser without sending the request
48
62
  */
@@ -60,6 +60,43 @@ export class UserApi extends runtime.BaseAPI {
60
60
  yield this.getAuthCheckRaw(initOverrides);
61
61
  });
62
62
  }
63
+ /**
64
+ * Creates request options for getCurrentUserPermissions without sending the request
65
+ */
66
+ getCurrentUserPermissionsRequestOpts() {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const queryParameters = {};
69
+ const headerParameters = {};
70
+ let urlPath = `/users/current/permissions`;
71
+ return {
72
+ path: urlPath,
73
+ method: 'GET',
74
+ headers: headerParameters,
75
+ query: queryParameters,
76
+ };
77
+ });
78
+ }
79
+ /**
80
+ * Returns an array of permission key strings for the authenticated user\'s current portal
81
+ * Get the current user\'s permissions
82
+ */
83
+ getCurrentUserPermissionsRaw(initOverrides) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const requestOptions = yield this.getCurrentUserPermissionsRequestOpts();
86
+ const response = yield this.request(requestOptions, initOverrides);
87
+ return new runtime.JSONApiResponse(response);
88
+ });
89
+ }
90
+ /**
91
+ * Returns an array of permission key strings for the authenticated user\'s current portal
92
+ * Get the current user\'s permissions
93
+ */
94
+ getCurrentUserPermissions(initOverrides) {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ const response = yield this.getCurrentUserPermissionsRaw(initOverrides);
97
+ return yield response.value();
98
+ });
99
+ }
63
100
  /**
64
101
  * Creates request options for getUser without sending the request
65
102
  */
@@ -51,18 +51,6 @@ export interface GetPortal {
51
51
  * @memberof GetPortal
52
52
  */
53
53
  headerTextColor: string;
54
- /**
55
- * The user's current active role (mapped from base_type for backwards compatibility)
56
- * @type {GetPortalSelectedUserRoleEnum}
57
- * @memberof GetPortal
58
- */
59
- selectedUserRole?: GetPortalSelectedUserRoleEnum;
60
- /**
61
- * The user's base role (mapped from base_type for backwards compatibility)
62
- * @type {GetPortalBaseUserRoleEnum}
63
- * @memberof GetPortal
64
- */
65
- baseUserRole?: GetPortalBaseUserRoleEnum;
66
54
  /**
67
55
  * The user's highest-privilege role base type for this portal
68
56
  * @type {GetPortalBaseTypeEnum}
@@ -70,24 +58,6 @@ export interface GetPortal {
70
58
  */
71
59
  baseType?: GetPortalBaseTypeEnum;
72
60
  }
73
- /**
74
- * @export
75
- */
76
- export declare const GetPortalSelectedUserRoleEnum: {
77
- readonly Admin: "Admin";
78
- readonly Instructor: "Instructor";
79
- readonly Learner: "Learner";
80
- };
81
- export type GetPortalSelectedUserRoleEnum = typeof GetPortalSelectedUserRoleEnum[keyof typeof GetPortalSelectedUserRoleEnum];
82
- /**
83
- * @export
84
- */
85
- export declare const GetPortalBaseUserRoleEnum: {
86
- readonly Admin: "Admin";
87
- readonly Instructor: "Instructor";
88
- readonly Learner: "Learner";
89
- };
90
- export type GetPortalBaseUserRoleEnum = typeof GetPortalBaseUserRoleEnum[keyof typeof GetPortalBaseUserRoleEnum];
91
61
  /**
92
62
  * @export
93
63
  */
@@ -11,22 +11,6 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
- /**
15
- * @export
16
- */
17
- export const GetPortalSelectedUserRoleEnum = {
18
- Admin: 'Admin',
19
- Instructor: 'Instructor',
20
- Learner: 'Learner'
21
- };
22
- /**
23
- * @export
24
- */
25
- export const GetPortalBaseUserRoleEnum = {
26
- Admin: 'Admin',
27
- Instructor: 'Instructor',
28
- Learner: 'Learner'
29
- };
30
14
  /**
31
15
  * @export
32
16
  */
@@ -69,8 +53,6 @@ export function GetPortalFromJSONTyped(json, ignoreDiscriminator) {
69
53
  'logoUrl': json['logo_url'],
70
54
  'headerBackgroundColor': json['header_background_color'],
71
55
  'headerTextColor': json['header_text_color'],
72
- 'selectedUserRole': json['selected_user_role'] == null ? undefined : json['selected_user_role'],
73
- 'baseUserRole': json['base_user_role'] == null ? undefined : json['base_user_role'],
74
56
  'baseType': json['base_type'] == null ? undefined : json['base_type'],
75
57
  };
76
58
  }
@@ -88,8 +70,6 @@ export function GetPortalToJSONTyped(value, ignoreDiscriminator = false) {
88
70
  'logo_url': value['logoUrl'],
89
71
  'header_background_color': value['headerBackgroundColor'],
90
72
  'header_text_color': value['headerTextColor'],
91
- 'selected_user_role': value['selectedUserRole'],
92
- 'base_user_role': value['baseUserRole'],
93
73
  'base_type': value['baseType'],
94
74
  };
95
75
  }
@@ -51,18 +51,6 @@ export interface GetPortal {
51
51
  * @memberof GetPortal
52
52
  */
53
53
  headerTextColor: string;
54
- /**
55
- * The user's current active role (mapped from base_type for backwards compatibility)
56
- * @type {GetPortalSelectedUserRoleEnum}
57
- * @memberof GetPortal
58
- */
59
- selectedUserRole?: GetPortalSelectedUserRoleEnum;
60
- /**
61
- * The user's base role (mapped from base_type for backwards compatibility)
62
- * @type {GetPortalBaseUserRoleEnum}
63
- * @memberof GetPortal
64
- */
65
- baseUserRole?: GetPortalBaseUserRoleEnum;
66
54
  /**
67
55
  * The user's highest-privilege role base type for this portal
68
56
  * @type {GetPortalBaseTypeEnum}
@@ -70,24 +58,6 @@ export interface GetPortal {
70
58
  */
71
59
  baseType?: GetPortalBaseTypeEnum;
72
60
  }
73
- /**
74
- * @export
75
- */
76
- export declare const GetPortalSelectedUserRoleEnum: {
77
- readonly Admin: "Admin";
78
- readonly Instructor: "Instructor";
79
- readonly Learner: "Learner";
80
- };
81
- export type GetPortalSelectedUserRoleEnum = typeof GetPortalSelectedUserRoleEnum[keyof typeof GetPortalSelectedUserRoleEnum];
82
- /**
83
- * @export
84
- */
85
- export declare const GetPortalBaseUserRoleEnum: {
86
- readonly Admin: "Admin";
87
- readonly Instructor: "Instructor";
88
- readonly Learner: "Learner";
89
- };
90
- export type GetPortalBaseUserRoleEnum = typeof GetPortalBaseUserRoleEnum[keyof typeof GetPortalBaseUserRoleEnum];
91
61
  /**
92
62
  * @export
93
63
  */
@@ -13,28 +13,12 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.GetPortalBaseTypeEnum = exports.GetPortalBaseUserRoleEnum = exports.GetPortalSelectedUserRoleEnum = void 0;
16
+ exports.GetPortalBaseTypeEnum = void 0;
17
17
  exports.instanceOfGetPortal = instanceOfGetPortal;
18
18
  exports.GetPortalFromJSON = GetPortalFromJSON;
19
19
  exports.GetPortalFromJSONTyped = GetPortalFromJSONTyped;
20
20
  exports.GetPortalToJSON = GetPortalToJSON;
21
21
  exports.GetPortalToJSONTyped = GetPortalToJSONTyped;
22
- /**
23
- * @export
24
- */
25
- exports.GetPortalSelectedUserRoleEnum = {
26
- Admin: 'Admin',
27
- Instructor: 'Instructor',
28
- Learner: 'Learner'
29
- };
30
- /**
31
- * @export
32
- */
33
- exports.GetPortalBaseUserRoleEnum = {
34
- Admin: 'Admin',
35
- Instructor: 'Instructor',
36
- Learner: 'Learner'
37
- };
38
22
  /**
39
23
  * @export
40
24
  */
@@ -77,8 +61,6 @@ function GetPortalFromJSONTyped(json, ignoreDiscriminator) {
77
61
  'logoUrl': json['logo_url'],
78
62
  'headerBackgroundColor': json['header_background_color'],
79
63
  'headerTextColor': json['header_text_color'],
80
- 'selectedUserRole': json['selected_user_role'] == null ? undefined : json['selected_user_role'],
81
- 'baseUserRole': json['base_user_role'] == null ? undefined : json['base_user_role'],
82
64
  'baseType': json['base_type'] == null ? undefined : json['base_type'],
83
65
  };
84
66
  }
@@ -96,8 +78,6 @@ function GetPortalToJSONTyped(value, ignoreDiscriminator = false) {
96
78
  'logo_url': value['logoUrl'],
97
79
  'header_background_color': value['headerBackgroundColor'],
98
80
  'header_text_color': value['headerTextColor'],
99
- 'selected_user_role': value['selectedUserRole'],
100
- 'base_user_role': value['baseUserRole'],
101
81
  'base_type': value['baseType'],
102
82
  };
103
83
  }
package/docs/GetPortal.md CHANGED
@@ -12,8 +12,6 @@ Name | Type
12
12
  `logoUrl` | string
13
13
  `headerBackgroundColor` | string
14
14
  `headerTextColor` | string
15
- `selectedUserRole` | string
16
- `baseUserRole` | string
17
15
  `baseType` | string
18
16
 
19
17
  ## Example
@@ -29,8 +27,6 @@ const example = {
29
27
  "logoUrl": null,
30
28
  "headerBackgroundColor": null,
31
29
  "headerTextColor": null,
32
- "selectedUserRole": null,
33
- "baseUserRole": null,
34
30
  "baseType": null,
35
31
  } satisfies GetPortal
36
32
 
package/docs/UserApi.md CHANGED
@@ -5,6 +5,7 @@ All URIs are relative to *https://sbzw93t49b.execute-api.us-east-2.amazonaws.com
5
5
  | Method | HTTP request | Description |
6
6
  |------------- | ------------- | -------------|
7
7
  | [**getAuthCheck**](UserApi.md#getauthcheck) | **GET** /auth/check | Check if a user is logged in |
8
+ | [**getCurrentUserPermissions**](UserApi.md#getcurrentuserpermissions) | **GET** /users/current/permissions | Get the current user\&#39;s permissions |
8
9
  | [**getUser**](UserApi.md#getuser) | **GET** /users/{userId} | Get a user by id |
9
10
  | [**postLogin**](UserApi.md#postlogin) | **POST** /auth/login | Post a new login |
10
11
  | [**postLogout**](UserApi.md#postlogout) | **POST** /auth/logout | Logout a user |
@@ -72,6 +73,66 @@ No authorization required
72
73
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
73
74
 
74
75
 
76
+ ## getCurrentUserPermissions
77
+
78
+ > Array&lt;string&gt; getCurrentUserPermissions()
79
+
80
+ Get the current user\&#39;s permissions
81
+
82
+ Returns an array of permission key strings for the authenticated user\&#39;s current portal
83
+
84
+ ### Example
85
+
86
+ ```ts
87
+ import {
88
+ Configuration,
89
+ UserApi,
90
+ } from '@easyedu/js-lsm-api';
91
+ import type { GetCurrentUserPermissionsRequest } from '@easyedu/js-lsm-api';
92
+
93
+ async function example() {
94
+ console.log("🚀 Testing @easyedu/js-lsm-api SDK...");
95
+ const api = new UserApi();
96
+
97
+ try {
98
+ const data = await api.getCurrentUserPermissions();
99
+ console.log(data);
100
+ } catch (error) {
101
+ console.error(error);
102
+ }
103
+ }
104
+
105
+ // Run the test
106
+ example().catch(console.error);
107
+ ```
108
+
109
+ ### Parameters
110
+
111
+ This endpoint does not need any parameter.
112
+
113
+ ### Return type
114
+
115
+ **Array<string>**
116
+
117
+ ### Authorization
118
+
119
+ No authorization required
120
+
121
+ ### HTTP request headers
122
+
123
+ - **Content-Type**: Not defined
124
+ - **Accept**: `application/json`
125
+
126
+
127
+ ### HTTP response details
128
+ | Status code | Description | Response headers |
129
+ |-------------|-------------|------------------|
130
+ | **200** | List of permission keys | - |
131
+ | **401** | Unauthorized | - |
132
+
133
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
134
+
135
+
75
136
  ## getUser
76
137
 
77
138
  > GetUser getUser(userId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyedu/js-lsm-api",
3
- "version": "1.33.0",
3
+ "version": "1.35.0",
4
4
  "description": "OpenAPI client for @easyedu/js-lsm-api",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -99,6 +99,45 @@ export class UserApi extends runtime.BaseAPI {
99
99
  await this.getAuthCheckRaw(initOverrides);
100
100
  }
101
101
 
102
+ /**
103
+ * Creates request options for getCurrentUserPermissions without sending the request
104
+ */
105
+ async getCurrentUserPermissionsRequestOpts(): Promise<runtime.RequestOpts> {
106
+ const queryParameters: any = {};
107
+
108
+ const headerParameters: runtime.HTTPHeaders = {};
109
+
110
+
111
+ let urlPath = `/users/current/permissions`;
112
+
113
+ return {
114
+ path: urlPath,
115
+ method: 'GET',
116
+ headers: headerParameters,
117
+ query: queryParameters,
118
+ };
119
+ }
120
+
121
+ /**
122
+ * Returns an array of permission key strings for the authenticated user\'s current portal
123
+ * Get the current user\'s permissions
124
+ */
125
+ async getCurrentUserPermissionsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>> {
126
+ const requestOptions = await this.getCurrentUserPermissionsRequestOpts();
127
+ const response = await this.request(requestOptions, initOverrides);
128
+
129
+ return new runtime.JSONApiResponse<any>(response);
130
+ }
131
+
132
+ /**
133
+ * Returns an array of permission key strings for the authenticated user\'s current portal
134
+ * Get the current user\'s permissions
135
+ */
136
+ async getCurrentUserPermissions(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>> {
137
+ const response = await this.getCurrentUserPermissionsRaw(initOverrides);
138
+ return await response.value();
139
+ }
140
+
102
141
  /**
103
142
  * Creates request options for getUser without sending the request
104
143
  */
@@ -55,18 +55,6 @@ export interface GetPortal {
55
55
  * @memberof GetPortal
56
56
  */
57
57
  headerTextColor: string;
58
- /**
59
- * The user's current active role (mapped from base_type for backwards compatibility)
60
- * @type {GetPortalSelectedUserRoleEnum}
61
- * @memberof GetPortal
62
- */
63
- selectedUserRole?: GetPortalSelectedUserRoleEnum;
64
- /**
65
- * The user's base role (mapped from base_type for backwards compatibility)
66
- * @type {GetPortalBaseUserRoleEnum}
67
- * @memberof GetPortal
68
- */
69
- baseUserRole?: GetPortalBaseUserRoleEnum;
70
58
  /**
71
59
  * The user's highest-privilege role base type for this portal
72
60
  * @type {GetPortalBaseTypeEnum}
@@ -76,26 +64,6 @@ export interface GetPortal {
76
64
  }
77
65
 
78
66
 
79
- /**
80
- * @export
81
- */
82
- export const GetPortalSelectedUserRoleEnum = {
83
- Admin: 'Admin',
84
- Instructor: 'Instructor',
85
- Learner: 'Learner'
86
- } as const;
87
- export type GetPortalSelectedUserRoleEnum = typeof GetPortalSelectedUserRoleEnum[keyof typeof GetPortalSelectedUserRoleEnum];
88
-
89
- /**
90
- * @export
91
- */
92
- export const GetPortalBaseUserRoleEnum = {
93
- Admin: 'Admin',
94
- Instructor: 'Instructor',
95
- Learner: 'Learner'
96
- } as const;
97
- export type GetPortalBaseUserRoleEnum = typeof GetPortalBaseUserRoleEnum[keyof typeof GetPortalBaseUserRoleEnum];
98
-
99
67
  /**
100
68
  * @export
101
69
  */
@@ -139,8 +107,6 @@ export function GetPortalFromJSONTyped(json: any, ignoreDiscriminator: boolean):
139
107
  'logoUrl': json['logo_url'],
140
108
  'headerBackgroundColor': json['header_background_color'],
141
109
  'headerTextColor': json['header_text_color'],
142
- 'selectedUserRole': json['selected_user_role'] == null ? undefined : json['selected_user_role'],
143
- 'baseUserRole': json['base_user_role'] == null ? undefined : json['base_user_role'],
144
110
  'baseType': json['base_type'] == null ? undefined : json['base_type'],
145
111
  };
146
112
  }
@@ -162,8 +128,6 @@ export function GetPortalToJSONTyped(value?: GetPortal | null, ignoreDiscriminat
162
128
  'logo_url': value['logoUrl'],
163
129
  'header_background_color': value['headerBackgroundColor'],
164
130
  'header_text_color': value['headerTextColor'],
165
- 'selected_user_role': value['selectedUserRole'],
166
- 'base_user_role': value['baseUserRole'],
167
131
  'base_type': value['baseType'],
168
132
  };
169
133
  }