tale-js-sdk 0.1.3 → 1.0.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/dist/acl/index.d.ts +232 -102
- package/dist/acl/index.js +431 -489
- package/dist/acl/types.d.ts +95 -161
- package/dist/auth/types.d.ts +3 -3
- package/dist/common/types.d.ts +66 -57
- package/dist/common/types.js +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/rbac/index.d.ts +464 -2
- package/dist/rbac/index.js +1123 -2
- package/dist/rbac/types.d.ts +73 -304
- package/dist/user/index.d.ts +165 -2
- package/dist/user/index.js +451 -0
- package/dist/user/types.d.ts +70 -17
- package/dist/user-group/types.d.ts +22 -19
- package/package.json +14 -12
package/dist/rbac/types.d.ts
CHANGED
|
@@ -1,255 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
role_config?: Record<string, any>;
|
|
7
|
-
description?: string;
|
|
8
|
-
remark?: string;
|
|
9
|
-
created_at?: string;
|
|
10
|
-
updated_at?: string;
|
|
11
|
-
privileges?: Privilege[];
|
|
12
|
-
}
|
|
13
|
-
export interface Privilege {
|
|
14
|
-
privilege_id: string;
|
|
15
|
-
privilege_name: string;
|
|
16
|
-
privilege_type?: string;
|
|
17
|
-
privilege_property?: Record<string, any>;
|
|
18
|
-
privilege_config?: Record<string, any>;
|
|
19
|
-
resource_ids?: string[];
|
|
20
|
-
description?: string;
|
|
21
|
-
remark?: string;
|
|
22
|
-
created_at?: string;
|
|
23
|
-
updated_at?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface UserGroup {
|
|
26
|
-
group_id: string;
|
|
27
|
-
group_name: string;
|
|
28
|
-
description?: string;
|
|
29
|
-
type?: string;
|
|
30
|
-
remark?: string;
|
|
31
|
-
created_at?: string;
|
|
32
|
-
updated_at?: string;
|
|
33
|
-
member_count?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface PaginatedResponse<T> {
|
|
36
|
-
content: T[];
|
|
37
|
-
pageable: {
|
|
38
|
-
sort: Sort;
|
|
39
|
-
offset: number;
|
|
40
|
-
pageNumber: number;
|
|
41
|
-
pageSize: number;
|
|
42
|
-
paged: boolean;
|
|
43
|
-
unpaged: boolean;
|
|
44
|
-
};
|
|
45
|
-
last: boolean;
|
|
46
|
-
totalPages: number;
|
|
47
|
-
totalElements: number;
|
|
48
|
-
size: number;
|
|
49
|
-
number: number;
|
|
50
|
-
sort: Sort;
|
|
51
|
-
first: boolean;
|
|
52
|
-
numberOfElements: number;
|
|
53
|
-
empty: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface Sort {
|
|
56
|
-
empty: boolean;
|
|
57
|
-
sorted: boolean;
|
|
58
|
-
unsorted: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface CommonOptions {
|
|
61
|
-
baseUrl?: string;
|
|
62
|
-
appKey?: string;
|
|
63
|
-
appSecret?: string;
|
|
64
|
-
appToken?: string;
|
|
65
|
-
}
|
|
66
|
-
export interface RBACOptions extends CommonOptions {
|
|
67
|
-
include_privileges?: boolean;
|
|
68
|
-
include_assignments?: boolean;
|
|
69
|
-
assignment_expires_at?: string;
|
|
70
|
-
}
|
|
1
|
+
import type { CommonOptions, Role, Privilege } from "../common/types.js";
|
|
2
|
+
export type { Role, Privilege };
|
|
3
|
+
/**
|
|
4
|
+
* Request for creating a role
|
|
5
|
+
*/
|
|
71
6
|
export interface CreateRoleRequest {
|
|
72
7
|
role_name: string;
|
|
73
8
|
role_type?: string;
|
|
74
|
-
role_property?: Record<string,
|
|
75
|
-
role_config?: Record<string,
|
|
9
|
+
role_property?: Record<string, unknown>;
|
|
10
|
+
role_config?: Record<string, unknown>;
|
|
76
11
|
privilege_ids?: string[];
|
|
77
12
|
remark?: string;
|
|
78
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Request for updating a role
|
|
16
|
+
*/
|
|
79
17
|
export interface UpdateRoleRequest {
|
|
80
18
|
role_name?: string;
|
|
81
19
|
role_type?: string;
|
|
82
|
-
role_property?: Record<string,
|
|
83
|
-
role_config?: Record<string,
|
|
20
|
+
role_property?: Record<string, unknown>;
|
|
21
|
+
role_config?: Record<string, unknown>;
|
|
84
22
|
privilege_ids?: string[];
|
|
85
23
|
remark?: string;
|
|
86
24
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
role_type?: string;
|
|
91
|
-
sort_by?: string;
|
|
92
|
-
sort_direction?: 'asc' | 'desc';
|
|
93
|
-
}
|
|
94
|
-
export interface CreateRoleResponse {
|
|
95
|
-
role: Role;
|
|
96
|
-
message?: string;
|
|
97
|
-
}
|
|
98
|
-
export interface CreateRoleJson {
|
|
99
|
-
data: CreateRoleResponse;
|
|
100
|
-
code: number;
|
|
101
|
-
msg: string;
|
|
102
|
-
}
|
|
103
|
-
export interface UpdateRoleResponse {
|
|
104
|
-
role: Role;
|
|
105
|
-
message?: string;
|
|
106
|
-
}
|
|
107
|
-
export interface UpdateRoleJson {
|
|
108
|
-
data: UpdateRoleResponse;
|
|
109
|
-
code: number;
|
|
110
|
-
msg: string;
|
|
111
|
-
}
|
|
112
|
-
export interface DeleteRoleResponse {
|
|
113
|
-
deleted: boolean;
|
|
114
|
-
role_id: string;
|
|
115
|
-
}
|
|
116
|
-
export interface DeleteRoleJson {
|
|
117
|
-
data: DeleteRoleResponse;
|
|
118
|
-
code: number;
|
|
119
|
-
msg: string;
|
|
120
|
-
}
|
|
121
|
-
export interface GetRoleResponse {
|
|
122
|
-
role: Role;
|
|
123
|
-
}
|
|
124
|
-
export interface GetRoleJson {
|
|
125
|
-
data: GetRoleResponse;
|
|
126
|
-
code: number;
|
|
127
|
-
msg: string;
|
|
128
|
-
}
|
|
129
|
-
export interface ListRolesJson {
|
|
130
|
-
data: PaginatedResponse<Role>;
|
|
131
|
-
code: number;
|
|
132
|
-
msg: string;
|
|
133
|
-
}
|
|
25
|
+
/**
|
|
26
|
+
* Request for creating a privilege
|
|
27
|
+
*/
|
|
134
28
|
export interface CreatePrivilegeRequest {
|
|
135
29
|
privilege_name: string;
|
|
136
30
|
privilege_type?: string;
|
|
137
|
-
privilege_property?: Record<string,
|
|
138
|
-
privilege_config?: Record<string,
|
|
31
|
+
privilege_property?: Record<string, unknown>;
|
|
32
|
+
privilege_config?: Record<string, unknown>;
|
|
139
33
|
resource_ids?: string[];
|
|
140
34
|
remark?: string;
|
|
141
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Request for updating a privilege
|
|
38
|
+
*/
|
|
142
39
|
export interface UpdatePrivilegeRequest {
|
|
143
40
|
privilege_name?: string;
|
|
144
41
|
privilege_type?: string;
|
|
145
|
-
privilege_property?: Record<string,
|
|
146
|
-
privilege_config?: Record<string,
|
|
42
|
+
privilege_property?: Record<string, unknown>;
|
|
43
|
+
privilege_config?: Record<string, unknown>;
|
|
147
44
|
resource_ids?: string[];
|
|
148
45
|
remark?: string;
|
|
149
46
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
privilege_type?: string;
|
|
154
|
-
sort_by?: string;
|
|
155
|
-
sort_direction?: 'asc' | 'desc';
|
|
156
|
-
}
|
|
157
|
-
export interface CreatePrivilegeResponse {
|
|
158
|
-
privilege: Privilege;
|
|
159
|
-
message?: string;
|
|
160
|
-
}
|
|
161
|
-
export interface CreatePrivilegeJson {
|
|
162
|
-
data: CreatePrivilegeResponse;
|
|
163
|
-
code: number;
|
|
164
|
-
msg: string;
|
|
165
|
-
}
|
|
166
|
-
export interface UpdatePrivilegeResponse {
|
|
167
|
-
privilege: Privilege;
|
|
168
|
-
message?: string;
|
|
169
|
-
}
|
|
170
|
-
export interface UpdatePrivilegeJson {
|
|
171
|
-
data: UpdatePrivilegeResponse;
|
|
172
|
-
code: number;
|
|
173
|
-
msg: string;
|
|
174
|
-
}
|
|
175
|
-
export interface DeletePrivilegeResponse {
|
|
176
|
-
deleted: boolean;
|
|
177
|
-
privilege_id: string;
|
|
178
|
-
}
|
|
179
|
-
export interface DeletePrivilegeJson {
|
|
180
|
-
data: DeletePrivilegeResponse;
|
|
181
|
-
code: number;
|
|
182
|
-
msg: string;
|
|
183
|
-
}
|
|
184
|
-
export interface GetPrivilegeResponse {
|
|
185
|
-
privilege: Privilege;
|
|
186
|
-
}
|
|
187
|
-
export interface GetPrivilegeJson {
|
|
188
|
-
data: GetPrivilegeResponse;
|
|
189
|
-
code: number;
|
|
190
|
-
msg: string;
|
|
191
|
-
}
|
|
192
|
-
export interface ListPrivilegesJson {
|
|
193
|
-
data: PaginatedResponse<Privilege>;
|
|
194
|
-
code: number;
|
|
195
|
-
msg: string;
|
|
196
|
-
}
|
|
197
|
-
export interface PropertyResponse {
|
|
198
|
-
property: Record<string, any>;
|
|
199
|
-
}
|
|
200
|
-
export interface PropertyJson {
|
|
201
|
-
data: PropertyResponse;
|
|
202
|
-
code: number;
|
|
203
|
-
msg: string;
|
|
204
|
-
}
|
|
205
|
-
export interface ConfigResponse {
|
|
206
|
-
config: Record<string, any>;
|
|
207
|
-
}
|
|
208
|
-
export interface ConfigJson {
|
|
209
|
-
data: ConfigResponse;
|
|
210
|
-
code: number;
|
|
211
|
-
msg: string;
|
|
212
|
-
}
|
|
213
|
-
export interface UpdatePropertyRequest {
|
|
214
|
-
property: Record<string, any>;
|
|
215
|
-
}
|
|
216
|
-
export interface UpdatePropertyJson {
|
|
217
|
-
data: PropertyResponse;
|
|
218
|
-
code: number;
|
|
219
|
-
msg: string;
|
|
220
|
-
}
|
|
221
|
-
export interface UpdateConfigRequest {
|
|
222
|
-
config: Record<string, any>;
|
|
223
|
-
}
|
|
224
|
-
export interface UpdateConfigJson {
|
|
225
|
-
data: ConfigResponse;
|
|
226
|
-
code: number;
|
|
227
|
-
msg: string;
|
|
228
|
-
}
|
|
229
|
-
export interface RoleAssignment {
|
|
230
|
-
assignment_id?: string;
|
|
231
|
-
user_id: string;
|
|
232
|
-
role_id: string;
|
|
233
|
-
role: Role;
|
|
234
|
-
started_at?: string;
|
|
235
|
-
expired_at?: string;
|
|
236
|
-
assignment_type?: string;
|
|
237
|
-
assignment_ref?: string;
|
|
238
|
-
remark?: string;
|
|
239
|
-
created_at?: string;
|
|
240
|
-
}
|
|
241
|
-
export interface PrivilegeAssignment {
|
|
242
|
-
assignment_id?: string;
|
|
243
|
-
user_id: string;
|
|
244
|
-
privilege_id: string;
|
|
245
|
-
privilege: Privilege;
|
|
246
|
-
started_at?: string;
|
|
247
|
-
expired_at?: string;
|
|
248
|
-
assignment_type?: string;
|
|
249
|
-
assignment_ref?: string;
|
|
250
|
-
remark?: string;
|
|
251
|
-
created_at?: string;
|
|
252
|
-
}
|
|
47
|
+
/**
|
|
48
|
+
* Request for assigning roles to a user
|
|
49
|
+
*/
|
|
253
50
|
export interface UserRoleAssignmentRequest {
|
|
254
51
|
role_ids: string[];
|
|
255
52
|
started_at?: string;
|
|
@@ -258,6 +55,15 @@ export interface UserRoleAssignmentRequest {
|
|
|
258
55
|
assignment_ref?: string;
|
|
259
56
|
remark?: string;
|
|
260
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Request for unassigning roles from a user
|
|
60
|
+
*/
|
|
61
|
+
export interface UserRoleUnassignmentRequest {
|
|
62
|
+
role_ids: string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Request for assigning privileges to a user
|
|
66
|
+
*/
|
|
261
67
|
export interface UserPrivilegeAssignmentRequest {
|
|
262
68
|
privilege_ids: string[];
|
|
263
69
|
started_at?: string;
|
|
@@ -266,91 +72,54 @@ export interface UserPrivilegeAssignmentRequest {
|
|
|
266
72
|
assignment_ref?: string;
|
|
267
73
|
remark?: string;
|
|
268
74
|
}
|
|
269
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Request for unassigning privileges from a user
|
|
77
|
+
*/
|
|
78
|
+
export interface UserPrivilegeUnassignmentRequest {
|
|
270
79
|
privilege_ids: string[];
|
|
271
|
-
remark?: string;
|
|
272
80
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
export interface
|
|
81
|
+
/**
|
|
82
|
+
* Request for assigning privileges to a role
|
|
83
|
+
*/
|
|
84
|
+
export interface RolePrivilegeAssignmentRequest {
|
|
277
85
|
privilege_ids: string[];
|
|
86
|
+
remark?: string;
|
|
278
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Request for unassigning privileges from a role
|
|
90
|
+
*/
|
|
279
91
|
export interface RolePrivilegeUnassignmentRequest {
|
|
280
92
|
privilege_ids: string[];
|
|
281
93
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
export interface AssignRolesJson {
|
|
287
|
-
data: AssignRolesResponse;
|
|
288
|
-
code: number;
|
|
289
|
-
msg: string;
|
|
290
|
-
}
|
|
291
|
-
export interface UnassignRolesResponse {
|
|
292
|
-
unassigned: boolean;
|
|
293
|
-
unassigned_count: number;
|
|
294
|
-
}
|
|
295
|
-
export interface UnassignRolesJson {
|
|
296
|
-
data: UnassignRolesResponse;
|
|
297
|
-
code: number;
|
|
298
|
-
msg: string;
|
|
299
|
-
}
|
|
300
|
-
export interface AssignPrivilegesResponse {
|
|
301
|
-
privileges: Privilege[];
|
|
302
|
-
message?: string;
|
|
303
|
-
}
|
|
304
|
-
export interface AssignPrivilegesJson {
|
|
305
|
-
data: AssignPrivilegesResponse;
|
|
306
|
-
code: number;
|
|
307
|
-
msg: string;
|
|
308
|
-
}
|
|
309
|
-
export interface UnassignPrivilegesResponse {
|
|
310
|
-
unassigned: boolean;
|
|
311
|
-
unassigned_count: number;
|
|
94
|
+
/**
|
|
95
|
+
* Options for RBAC operations
|
|
96
|
+
*/
|
|
97
|
+
export interface RbacOptions extends CommonOptions {
|
|
312
98
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
data: GetUserRolesResponse;
|
|
323
|
-
code: number;
|
|
324
|
-
msg: string;
|
|
325
|
-
}
|
|
326
|
-
export interface GetUserPrivilegesResponse {
|
|
327
|
-
privileges: Privilege[];
|
|
99
|
+
/**
|
|
100
|
+
* Request for listing roles
|
|
101
|
+
*/
|
|
102
|
+
export interface ListRolesRequest {
|
|
103
|
+
page?: number;
|
|
104
|
+
size?: number;
|
|
105
|
+
role_type?: string;
|
|
106
|
+
sort_by?: string;
|
|
107
|
+
sort_direction?: "asc" | "desc";
|
|
328
108
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Request for listing privileges
|
|
111
|
+
*/
|
|
112
|
+
export interface ListPrivilegesRequest {
|
|
113
|
+
page?: number;
|
|
114
|
+
size?: number;
|
|
115
|
+
privilege_type?: string;
|
|
116
|
+
sort_by?: string;
|
|
117
|
+
sort_direction?: "asc" | "desc";
|
|
333
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Privilege and role pair
|
|
121
|
+
*/
|
|
334
122
|
export interface PrivilegeRolePair {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
role_id: string;
|
|
338
|
-
role_name: string;
|
|
339
|
-
resource_id: string;
|
|
340
|
-
}
|
|
341
|
-
export interface ResourcePermissionCheck {
|
|
342
|
-
user_id: string;
|
|
343
|
-
resource_id: string;
|
|
344
|
-
privilege_name: string;
|
|
345
|
-
has_permission: boolean;
|
|
346
|
-
granted_by_roles: string[];
|
|
347
|
-
granted_by_privileges: string[];
|
|
348
|
-
}
|
|
349
|
-
export interface GetResourcePrivilegeRolesResponse {
|
|
350
|
-
privilege_role_pairs: PrivilegeRolePair[];
|
|
351
|
-
}
|
|
352
|
-
export interface GetResourcePrivilegeRolesJson {
|
|
353
|
-
data: GetResourcePrivilegeRolesResponse;
|
|
354
|
-
code: number;
|
|
355
|
-
msg: string;
|
|
123
|
+
privilege: Privilege;
|
|
124
|
+
role: Role;
|
|
356
125
|
}
|
package/dist/user/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CreateUserRequest, AppInfo, User, Role, Privilege, UserGroup, UserLoginMethod, CreateUserResponse, CreateUserJson, CreateUserOptions, GetUserRequest, DeleteUserResponse, DeleteUserJson, CommonOptions, ListUsersRequest, UserAttribute, UserListItem,
|
|
2
|
-
export type { CreateUserRequest, AppInfo, User, Role, Privilege, UserGroup, UserLoginMethod, CreateUserResponse, CreateUserJson, CreateUserOptions, GetUserRequest, DeleteUserResponse, DeleteUserJson, CommonOptions, ListUsersRequest, UserAttribute, UserListItem,
|
|
1
|
+
import type { CreateUserRequest, AppInfo, User, Role, Privilege, UserGroup, UserLoginMethod, CreateUserResponse, CreateUserJson, CreateUserOptions, GetUserRequest, DeleteUserResponse, DeleteUserJson, CommonOptions, ListUsersRequest, UserAttribute, UserListItem, ListUsersResponse, ListUsersJson, UpdateUserRequest, UpdateUserResponse, UpdateUserJson, UpdateUserPasswordRequest, UpdateUserPasswordResponse, UpdateUserPasswordJson, UploadAvatarResponse, UploadAvatarJson, AvatarPresignedUrlResponse, AvatarPresignedUrlJson, UpdateUserFrozenStatusRequest, UserFrozenStatusResponse, UpdateUserFrozenStatusJson, GetUserFrozenStatusJson } from "./types.js";
|
|
2
|
+
export type { CreateUserRequest, AppInfo, User, Role, Privilege, UserGroup, UserLoginMethod, CreateUserResponse, CreateUserJson, CreateUserOptions, GetUserRequest, DeleteUserResponse, DeleteUserJson, CommonOptions, ListUsersRequest, UserAttribute, UserListItem, ListUsersResponse, ListUsersJson, UpdateUserRequest, UpdateUserResponse, UpdateUserJson, UpdateUserPasswordRequest, UpdateUserPasswordResponse, UpdateUserPasswordJson, UploadAvatarResponse, UploadAvatarJson, AvatarPresignedUrlResponse, AvatarPresignedUrlJson, UpdateUserFrozenStatusRequest, UserFrozenStatusResponse, UpdateUserFrozenStatusJson, GetUserFrozenStatusJson, };
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new user in the Tale application.
|
|
5
5
|
*
|
|
@@ -102,3 +102,166 @@ export declare function deleteUser(userId: string, options?: CommonOptions): Pro
|
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
104
|
export declare function listUsers(options?: ListUsersRequest & CommonOptions): Promise<ListUsersResponse>;
|
|
105
|
+
/**
|
|
106
|
+
* Updates user information by user ID or open ID.
|
|
107
|
+
*
|
|
108
|
+
* @param userId - User ID (open_id) to update
|
|
109
|
+
* @param userData - User data to update
|
|
110
|
+
* @param options - Optional configuration for the request
|
|
111
|
+
* @returns Promise resolving to the update result
|
|
112
|
+
* @throws {ConfigurationError} When required environment variables are missing
|
|
113
|
+
* @throws {ApiError} When API request fails or returns invalid response
|
|
114
|
+
* @throws {NetworkError} When network request fails
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* import { updateUser } from '@tale/client';
|
|
119
|
+
*
|
|
120
|
+
* try {
|
|
121
|
+
* const result = await updateUser('user_open_id_here', {
|
|
122
|
+
* nick_name: 'John Doe',
|
|
123
|
+
* email: 'john@example.com'
|
|
124
|
+
* });
|
|
125
|
+
* console.log('User updated:', result.success);
|
|
126
|
+
* } catch (error) {
|
|
127
|
+
* console.error('Failed to update user:', error.message);
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function updateUser(userId: string, userData: UpdateUserRequest, options?: CommonOptions): Promise<UpdateUserResponse>;
|
|
132
|
+
/**
|
|
133
|
+
* Updates user password.
|
|
134
|
+
*
|
|
135
|
+
* @param passwordData - Password data including user_id and encrypted password
|
|
136
|
+
* @param options - Optional configuration for the request
|
|
137
|
+
* @returns Promise resolving to the update result
|
|
138
|
+
* @throws {ConfigurationError} When required environment variables are missing
|
|
139
|
+
* @throws {ApiError} When API request fails or returns invalid response
|
|
140
|
+
* @throws {NetworkError} When network request fails
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* import { updateUserPassword } from '@tale/client';
|
|
145
|
+
*
|
|
146
|
+
* try {
|
|
147
|
+
* const result = await updateUserPassword({
|
|
148
|
+
* user_id: 'user_open_id_here',
|
|
149
|
+
* password_encrypted: 'encrypted_password_here'
|
|
150
|
+
* });
|
|
151
|
+
* console.log('Password updated:', result.success);
|
|
152
|
+
* } catch (error) {
|
|
153
|
+
* console.error('Failed to update password:', error.message);
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export declare function updateUserPassword(passwordData: UpdateUserPasswordRequest, options?: CommonOptions): Promise<UpdateUserPasswordResponse>;
|
|
158
|
+
/**
|
|
159
|
+
* Uploads user avatar image.
|
|
160
|
+
*
|
|
161
|
+
* @param file - File object to upload as avatar
|
|
162
|
+
* @param userId - User ID (open_id) of the user
|
|
163
|
+
* @param options - Optional configuration for the request
|
|
164
|
+
* @returns Promise resolving to the upload result with avatar OSS key
|
|
165
|
+
* @throws {ConfigurationError} When required environment variables are missing
|
|
166
|
+
* @throws {ApiError} When API request fails or returns invalid response
|
|
167
|
+
* @throws {NetworkError} When network request fails
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* import { uploadAvatar } from '@tale/client';
|
|
172
|
+
*
|
|
173
|
+
* try {
|
|
174
|
+
* const fileInput = document.querySelector('input[type="file"]');
|
|
175
|
+
* const file = fileInput.files[0];
|
|
176
|
+
* const result = await uploadAvatar(file, 'user_open_id_here');
|
|
177
|
+
* console.log('Avatar uploaded:', result.avatar_oss_key);
|
|
178
|
+
* } catch (error) {
|
|
179
|
+
* console.error('Failed to upload avatar:', error.message);
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export declare function uploadAvatar(file: File, userId: string, options?: CommonOptions): Promise<UploadAvatarResponse>;
|
|
184
|
+
/**
|
|
185
|
+
* Gets presigned URL for avatar access.
|
|
186
|
+
*
|
|
187
|
+
* @param ossKey - OSS key of the avatar
|
|
188
|
+
* @param options - Optional configuration for the request
|
|
189
|
+
* @returns Promise resolving to presigned URL information
|
|
190
|
+
* @throws {ConfigurationError} When required environment variables are missing
|
|
191
|
+
* @throws {ApiError} When API request fails or returns invalid response
|
|
192
|
+
* @throws {NetworkError} When network request fails
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* import { getAvatarPresignedUrl } from '@tale/client';
|
|
197
|
+
*
|
|
198
|
+
* try {
|
|
199
|
+
* const result = await getAvatarPresignedUrl('avatars/user123.jpg');
|
|
200
|
+
* console.log('Presigned URL:', result.presignedUrl);
|
|
201
|
+
* console.log('Expires in:', result.expireTimeInSeconds, 'seconds');
|
|
202
|
+
* } catch (error) {
|
|
203
|
+
* console.error('Failed to get presigned URL:', error.message);
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare function getAvatarPresignedUrl(ossKey: string, options?: CommonOptions): Promise<AvatarPresignedUrlResponse>;
|
|
208
|
+
/**
|
|
209
|
+
* Updates user frozen status (freeze or unfreeze a user account).
|
|
210
|
+
*
|
|
211
|
+
* @param userId - User ID (open_id) to update frozen status
|
|
212
|
+
* @param frozenData - Frozen status data including is_frozen flag and optional remark
|
|
213
|
+
* @param options - Optional configuration for the request
|
|
214
|
+
* @returns Promise resolving to the updated frozen status information
|
|
215
|
+
* @throws {ConfigurationError} When required environment variables are missing
|
|
216
|
+
* @throws {ApiError} When API request fails or returns invalid response
|
|
217
|
+
* @throws {NetworkError} When network request fails
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* import { updateUserFrozenStatus } from '@tale/client';
|
|
222
|
+
*
|
|
223
|
+
* try {
|
|
224
|
+
* // Freeze a user account
|
|
225
|
+
* const result = await updateUserFrozenStatus('user_open_id_here', {
|
|
226
|
+
* is_frozen: true,
|
|
227
|
+
* remark: 'Violated community guidelines'
|
|
228
|
+
* });
|
|
229
|
+
* console.log('User frozen:', result.is_frozen);
|
|
230
|
+
*
|
|
231
|
+
* // Unfreeze a user account
|
|
232
|
+
* const unfrozenResult = await updateUserFrozenStatus('user_open_id_here', {
|
|
233
|
+
* is_frozen: false,
|
|
234
|
+
* remark: 'Account reactivated'
|
|
235
|
+
* });
|
|
236
|
+
* console.log('User unfrozen:', !unfrozenResult.is_frozen);
|
|
237
|
+
* } catch (error) {
|
|
238
|
+
* console.error('Failed to update frozen status:', error.message);
|
|
239
|
+
* }
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export declare function updateUserFrozenStatus(userId: string, frozenData: UpdateUserFrozenStatusRequest, options?: CommonOptions): Promise<UserFrozenStatusResponse>;
|
|
243
|
+
/**
|
|
244
|
+
* Gets user frozen status by user ID.
|
|
245
|
+
*
|
|
246
|
+
* @param userId - User ID (open_id) to query frozen status
|
|
247
|
+
* @param options - Optional configuration for the request
|
|
248
|
+
* @returns Promise resolving to the user frozen status information
|
|
249
|
+
* @throws {ConfigurationError} When required environment variables are missing
|
|
250
|
+
* @throws {ApiError} When API request fails or returns invalid response
|
|
251
|
+
* @throws {NetworkError} When network request fails
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* import { getUserFrozenStatus } from '@tale/client';
|
|
256
|
+
*
|
|
257
|
+
* try {
|
|
258
|
+
* const status = await getUserFrozenStatus('user_open_id_here');
|
|
259
|
+
* console.log('User is frozen:', status.is_frozen);
|
|
260
|
+
* console.log('Remark:', status.remark);
|
|
261
|
+
* console.log('Last updated:', status.updated_at);
|
|
262
|
+
* } catch (error) {
|
|
263
|
+
* console.error('Failed to get frozen status:', error.message);
|
|
264
|
+
* }
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
export declare function getUserFrozenStatus(userId: string, options?: CommonOptions): Promise<UserFrozenStatusResponse>;
|