@warriorteam/redai-zalo-sdk 1.1.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/LICENSE +21 -0
- package/README.md +448 -0
- package/dist/clients/base-client.d.ts +67 -0
- package/dist/clients/base-client.d.ts.map +1 -0
- package/dist/clients/base-client.js +297 -0
- package/dist/clients/base-client.js.map +1 -0
- package/dist/clients/zalo-client.d.ts +131 -0
- package/dist/clients/zalo-client.d.ts.map +1 -0
- package/dist/clients/zalo-client.js +215 -0
- package/dist/clients/zalo-client.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/services/article.service.d.ts +144 -0
- package/dist/services/article.service.d.ts.map +1 -0
- package/dist/services/article.service.js +518 -0
- package/dist/services/article.service.js.map +1 -0
- package/dist/services/auth.service.d.ts +55 -0
- package/dist/services/auth.service.d.ts.map +1 -0
- package/dist/services/auth.service.js +269 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/consultation.service.d.ts +73 -0
- package/dist/services/consultation.service.d.ts.map +1 -0
- package/dist/services/consultation.service.js +208 -0
- package/dist/services/consultation.service.js.map +1 -0
- package/dist/services/general-message.service.d.ts +85 -0
- package/dist/services/general-message.service.d.ts.map +1 -0
- package/dist/services/general-message.service.js +248 -0
- package/dist/services/general-message.service.js.map +1 -0
- package/dist/services/group-management.service.d.ts +220 -0
- package/dist/services/group-management.service.d.ts.map +1 -0
- package/dist/services/group-management.service.js +562 -0
- package/dist/services/group-management.service.js.map +1 -0
- package/dist/services/group-message.service.d.ts +102 -0
- package/dist/services/group-message.service.d.ts.map +1 -0
- package/dist/services/group-message.service.js +233 -0
- package/dist/services/group-message.service.js.map +1 -0
- package/dist/services/message-management.service.d.ts +135 -0
- package/dist/services/message-management.service.d.ts.map +1 -0
- package/dist/services/message-management.service.js +237 -0
- package/dist/services/message-management.service.js.map +1 -0
- package/dist/services/oa.service.d.ts +67 -0
- package/dist/services/oa.service.d.ts.map +1 -0
- package/dist/services/oa.service.js +223 -0
- package/dist/services/oa.service.js.map +1 -0
- package/dist/services/promotion.service.d.ts +114 -0
- package/dist/services/promotion.service.d.ts.map +1 -0
- package/dist/services/promotion.service.js +247 -0
- package/dist/services/promotion.service.js.map +1 -0
- package/dist/services/tag.service.d.ts +144 -0
- package/dist/services/tag.service.d.ts.map +1 -0
- package/dist/services/tag.service.js +184 -0
- package/dist/services/tag.service.js.map +1 -0
- package/dist/services/transaction.service.d.ts +110 -0
- package/dist/services/transaction.service.d.ts.map +1 -0
- package/dist/services/transaction.service.js +231 -0
- package/dist/services/transaction.service.js.map +1 -0
- package/dist/services/user-management.service.d.ts +117 -0
- package/dist/services/user-management.service.d.ts.map +1 -0
- package/dist/services/user-management.service.js +239 -0
- package/dist/services/user-management.service.js.map +1 -0
- package/dist/services/user.service.d.ts +84 -0
- package/dist/services/user.service.d.ts.map +1 -0
- package/dist/services/user.service.js +323 -0
- package/dist/services/user.service.js.map +1 -0
- package/dist/services/video-upload.service.d.ts +83 -0
- package/dist/services/video-upload.service.d.ts.map +1 -0
- package/dist/services/video-upload.service.js +267 -0
- package/dist/services/video-upload.service.js.map +1 -0
- package/dist/services/zns.service.d.ts +116 -0
- package/dist/services/zns.service.d.ts.map +1 -0
- package/dist/services/zns.service.js +234 -0
- package/dist/services/zns.service.js.map +1 -0
- package/dist/types/article.d.ts +352 -0
- package/dist/types/article.d.ts.map +1 -0
- package/dist/types/article.js +70 -0
- package/dist/types/article.js.map +1 -0
- package/dist/types/auth.d.ts +233 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +39 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/common.d.ts +237 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +42 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/group.d.ts +523 -0
- package/dist/types/group.d.ts.map +1 -0
- package/dist/types/group.js +6 -0
- package/dist/types/group.js.map +1 -0
- package/dist/types/message.d.ts +333 -0
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/message.js +17 -0
- package/dist/types/message.js.map +1 -0
- package/dist/types/oa.d.ts +285 -0
- package/dist/types/oa.d.ts.map +1 -0
- package/dist/types/oa.js +25 -0
- package/dist/types/oa.js.map +1 -0
- package/dist/types/social.d.ts +427 -0
- package/dist/types/social.d.ts.map +1 -0
- package/dist/types/social.js +6 -0
- package/dist/types/social.js.map +1 -0
- package/dist/types/user-management.d.ts +280 -0
- package/dist/types/user-management.d.ts.map +1 -0
- package/dist/types/user-management.js +6 -0
- package/dist/types/user-management.js.map +1 -0
- package/dist/types/user.d.ts +365 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +17 -0
- package/dist/types/user.js.map +1 -0
- package/dist/types/webhook.d.ts +1972 -0
- package/dist/types/webhook.d.ts.map +1 -0
- package/dist/types/webhook.js +419 -0
- package/dist/types/webhook.js.map +1 -0
- package/dist/types/zns.d.ts +277 -0
- package/dist/types/zns.d.ts.map +1 -0
- package/dist/types/zns.js +6 -0
- package/dist/types/zns.js.map +1 -0
- package/dist/zalo-sdk.d.ts +228 -0
- package/dist/zalo-sdk.d.ts.map +1 -0
- package/dist/zalo-sdk.js +307 -0
- package/dist/zalo-sdk.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserManagementService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for managing Zalo OA users
|
|
6
|
+
* Provides comprehensive user management capabilities including:
|
|
7
|
+
* - User profile management
|
|
8
|
+
* - User tagging and segmentation
|
|
9
|
+
* - User notes and interactions
|
|
10
|
+
* - User analytics and insights
|
|
11
|
+
*/
|
|
12
|
+
class UserManagementService {
|
|
13
|
+
constructor(client) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
this.apiUrl = "https://openapi.zalo.me/v3.0/oa";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get user profile information
|
|
19
|
+
* @param accessToken OA access token
|
|
20
|
+
* @param userId User ID
|
|
21
|
+
* @returns User profile
|
|
22
|
+
*/
|
|
23
|
+
async getUserProfile(accessToken, userId) {
|
|
24
|
+
try {
|
|
25
|
+
const response = await this.client.apiGet(`${this.apiUrl}/getprofile`, accessToken, {
|
|
26
|
+
user_id: userId,
|
|
27
|
+
});
|
|
28
|
+
return response;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw this.handleUserManagementError(error, "Failed to get user profile");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get list of users who follow the OA
|
|
36
|
+
* @param accessToken OA access token
|
|
37
|
+
* @param offset Offset for pagination
|
|
38
|
+
* @param count Number of users to retrieve
|
|
39
|
+
* @returns User list
|
|
40
|
+
*/
|
|
41
|
+
async getFollowersList(accessToken, offset = 0, count = 50) {
|
|
42
|
+
try {
|
|
43
|
+
const response = await this.client.apiGet(`${this.apiUrl}/getfollowers`, accessToken, {
|
|
44
|
+
offset,
|
|
45
|
+
count,
|
|
46
|
+
});
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw this.handleUserManagementError(error, "Failed to get followers list");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Search users by phone number
|
|
55
|
+
* @param accessToken OA access token
|
|
56
|
+
* @param phoneNumber Phone number to search
|
|
57
|
+
* @returns User profile if found
|
|
58
|
+
*/
|
|
59
|
+
async searchUserByPhone(accessToken, phoneNumber) {
|
|
60
|
+
try {
|
|
61
|
+
const response = await this.client.apiGet(`${this.apiUrl}/searchuser`, accessToken, {
|
|
62
|
+
phone: phoneNumber,
|
|
63
|
+
});
|
|
64
|
+
return response.data;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
throw this.handleUserManagementError(error, "Failed to search user by phone");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get user tags
|
|
72
|
+
* @param accessToken OA access token
|
|
73
|
+
* @param userId User ID
|
|
74
|
+
* @returns User tags
|
|
75
|
+
*/
|
|
76
|
+
async getUserTags(accessToken, userId) {
|
|
77
|
+
try {
|
|
78
|
+
const response = await this.client.apiGet(`${this.apiUrl}/tag/gettagsofuser`, accessToken, {
|
|
79
|
+
user_id: userId,
|
|
80
|
+
});
|
|
81
|
+
return response.data;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw this.handleUserManagementError(error, "Failed to get user tags");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Tag user with specific tags
|
|
89
|
+
* @param accessToken OA access token
|
|
90
|
+
* @param userId User ID
|
|
91
|
+
* @param tagNames Array of tag names
|
|
92
|
+
* @returns Tag result
|
|
93
|
+
*/
|
|
94
|
+
async tagUser(accessToken, userId, tagNames) {
|
|
95
|
+
try {
|
|
96
|
+
const response = await this.client.apiPost(`${this.apiUrl}/tag/taguser`, accessToken, {
|
|
97
|
+
user_id: userId,
|
|
98
|
+
tag_names: tagNames,
|
|
99
|
+
});
|
|
100
|
+
return response;
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw this.handleUserManagementError(error, "Failed to tag user");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Remove tags from user
|
|
108
|
+
* @param accessToken OA access token
|
|
109
|
+
* @param userId User ID
|
|
110
|
+
* @param tagNames Array of tag names to remove
|
|
111
|
+
* @returns Untag result
|
|
112
|
+
*/
|
|
113
|
+
async untagUser(accessToken, userId, tagNames) {
|
|
114
|
+
try {
|
|
115
|
+
const response = await this.client.apiPost(`${this.apiUrl}/tag/rmtaguser`, accessToken, {
|
|
116
|
+
user_id: userId,
|
|
117
|
+
tag_names: tagNames,
|
|
118
|
+
});
|
|
119
|
+
return response;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
throw this.handleUserManagementError(error, "Failed to untag user");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get all available tags
|
|
127
|
+
* @param accessToken OA access token
|
|
128
|
+
* @returns List of all tags
|
|
129
|
+
*/
|
|
130
|
+
async getAllTags(accessToken) {
|
|
131
|
+
try {
|
|
132
|
+
const response = await this.client.apiGet(`${this.apiUrl}/tag/gettagsofoa`, accessToken);
|
|
133
|
+
return response;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
throw this.handleUserManagementError(error, "Failed to get all tags");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Create new tag
|
|
141
|
+
* @param accessToken OA access token
|
|
142
|
+
* @param tagName Tag name
|
|
143
|
+
* @returns Created tag
|
|
144
|
+
*/
|
|
145
|
+
async createTag(accessToken, tagName) {
|
|
146
|
+
try {
|
|
147
|
+
const response = await this.client.apiPost(`${this.apiUrl}/tag/create`, accessToken, {
|
|
148
|
+
tag_name: tagName,
|
|
149
|
+
});
|
|
150
|
+
return response;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
throw this.handleUserManagementError(error, "Failed to create tag");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Delete tag
|
|
158
|
+
* @param accessToken OA access token
|
|
159
|
+
* @param tagName Tag name to delete
|
|
160
|
+
* @returns Deletion result
|
|
161
|
+
*/
|
|
162
|
+
async deleteTag(accessToken, tagName) {
|
|
163
|
+
try {
|
|
164
|
+
const response = await this.client.apiPost(`${this.apiUrl}/tag/delete`, accessToken, {
|
|
165
|
+
tag_name: tagName,
|
|
166
|
+
});
|
|
167
|
+
return response;
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
throw this.handleUserManagementError(error, "Failed to delete tag");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Add note to user
|
|
175
|
+
* @param accessToken OA access token
|
|
176
|
+
* @param userId User ID
|
|
177
|
+
* @param note Note content
|
|
178
|
+
* @returns Note result
|
|
179
|
+
*/
|
|
180
|
+
async addUserNote(accessToken, userId, note) {
|
|
181
|
+
try {
|
|
182
|
+
const response = await this.client.apiPost(`${this.apiUrl}/user/addnote`, accessToken, {
|
|
183
|
+
user_id: userId,
|
|
184
|
+
note,
|
|
185
|
+
});
|
|
186
|
+
return response;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
throw this.handleUserManagementError(error, "Failed to add user note");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get user notes
|
|
194
|
+
* @param accessToken OA access token
|
|
195
|
+
* @param userId User ID
|
|
196
|
+
* @returns User notes
|
|
197
|
+
*/
|
|
198
|
+
async getUserNotes(accessToken, userId) {
|
|
199
|
+
try {
|
|
200
|
+
const response = await this.client.apiGet(`${this.apiUrl}/user/getnotes`, accessToken, {
|
|
201
|
+
user_id: userId,
|
|
202
|
+
});
|
|
203
|
+
return response.data;
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
throw this.handleUserManagementError(error, "Failed to get user notes");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get user interaction history
|
|
211
|
+
* @param accessToken OA access token
|
|
212
|
+
* @param userId User ID
|
|
213
|
+
* @param offset Offset for pagination
|
|
214
|
+
* @param count Number of interactions to retrieve
|
|
215
|
+
* @returns User interactions
|
|
216
|
+
*/
|
|
217
|
+
async getUserInteractions(accessToken, userId, offset = 0, count = 50) {
|
|
218
|
+
try {
|
|
219
|
+
const response = await this.client.apiGet(`${this.apiUrl}/user/getinteractions`, accessToken, {
|
|
220
|
+
user_id: userId,
|
|
221
|
+
offset,
|
|
222
|
+
count,
|
|
223
|
+
});
|
|
224
|
+
return response;
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
throw this.handleUserManagementError(error, "Failed to get user interactions");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
handleUserManagementError(error, defaultMessage) {
|
|
231
|
+
if (error.response?.data) {
|
|
232
|
+
const errorData = error.response.data;
|
|
233
|
+
return new Error(`${defaultMessage}: ${errorData.message || errorData.error || "Unknown error"}`);
|
|
234
|
+
}
|
|
235
|
+
return new Error(`${defaultMessage}: ${error.message || "Unknown error"}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.UserManagementService = UserManagementService;
|
|
239
|
+
//# sourceMappingURL=user-management.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-management.service.js","sourceRoot":"","sources":["../../src/services/user-management.service.ts"],"names":[],"mappings":";;;AAUA;;;;;;;GAOG;AACH,MAAa,qBAAqB;IAGhC,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAF9B,WAAM,GAAG,iCAAiC,CAAC;IAEV,CAAC;IAEnD;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAClB,WAAmB,EACnB,MAAc;QAEd,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACvC,GAAG,IAAI,CAAC,MAAM,aAAa,EAC3B,WAAW,EACX;gBACE,OAAO,EAAE,MAAM;aAChB,CACF,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CACpB,WAAmB,EACnB,SAAiB,CAAC,EAClB,QAAgB,EAAE;QAElB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM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4
|
+
import { ZaloClient } from "../clients/zalo-client";
|
|
5
|
+
import { UserInfo, UserListRequest, UserListResponse, UserLabel, CreateLabelRequest, UserLabelRequest, UpdateUserRequest } from "../types/user";
|
|
6
|
+
/**
|
|
7
|
+
* User management service for handling user operations
|
|
8
|
+
*/
|
|
9
|
+
export declare class UserService {
|
|
10
|
+
private readonly client;
|
|
11
|
+
constructor(client: ZaloClient);
|
|
12
|
+
/**
|
|
13
|
+
* Get user information by user ID
|
|
14
|
+
*/
|
|
15
|
+
getUserInfo(accessToken: string, userId: string): Promise<UserInfo>;
|
|
16
|
+
/**
|
|
17
|
+
* Get list of users with pagination and filters
|
|
18
|
+
*/
|
|
19
|
+
getUserList(accessToken: string, request: UserListRequest): Promise<UserListResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Get all users with automatic pagination
|
|
22
|
+
*/
|
|
23
|
+
getAllUsers(accessToken: string, filters?: {
|
|
24
|
+
tag_name?: string;
|
|
25
|
+
last_interaction_period?: string;
|
|
26
|
+
is_follower?: boolean;
|
|
27
|
+
}): Promise<UserInfo[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Update user information
|
|
30
|
+
*/
|
|
31
|
+
updateUser(accessToken: string, request: UpdateUserRequest): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Get user tags/labels
|
|
34
|
+
*/
|
|
35
|
+
getUserTags(accessToken: string, userId: string): Promise<UserLabel[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Add tag to user
|
|
38
|
+
*/
|
|
39
|
+
addTagToUser(accessToken: string, request: UserLabelRequest): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Remove tag from user
|
|
42
|
+
*/
|
|
43
|
+
removeTagFromUser(accessToken: string, request: UserLabelRequest): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new user label
|
|
46
|
+
*/
|
|
47
|
+
createLabel(accessToken: string, request: CreateLabelRequest): Promise<UserLabel>;
|
|
48
|
+
/**
|
|
49
|
+
* Get all available labels
|
|
50
|
+
*/
|
|
51
|
+
getLabels(accessToken: string): Promise<UserLabel[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Delete a label
|
|
54
|
+
*/
|
|
55
|
+
deleteLabel(accessToken: string, labelId: string): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Get users by tag
|
|
58
|
+
*/
|
|
59
|
+
getUsersByTag(accessToken: string, tagName: string, offset?: number, count?: number): Promise<UserListResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Get followers only
|
|
62
|
+
*/
|
|
63
|
+
getFollowers(accessToken: string, offset?: number, count?: number): Promise<UserListResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Get users by interaction period
|
|
66
|
+
*/
|
|
67
|
+
getUsersByInteraction(accessToken: string, period: "TODAY" | "YESTERDAY" | "L7D" | "L30D", offset?: number, count?: number): Promise<UserListResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Bulk tag operations
|
|
70
|
+
*/
|
|
71
|
+
bulkAddTag(accessToken: string, userIds: string[], labelId: string): Promise<{
|
|
72
|
+
success: string[];
|
|
73
|
+
failed: string[];
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Bulk remove tag operations
|
|
77
|
+
*/
|
|
78
|
+
bulkRemoveTag(accessToken: string, userIds: string[], labelId: string): Promise<{
|
|
79
|
+
success: string[];
|
|
80
|
+
failed: string[];
|
|
81
|
+
}>;
|
|
82
|
+
private handleError;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=user.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.service.d.ts","sourceRoot":"","sources":["../../src/services/user.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACl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EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;IA4BnB;;OAEG;IACU,aAAa,CACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,gBAAgB,CAAC;IAQ5B;;OAEG;IACU,YAAY,CACvB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,gBAAgB,CAAC;IAQ5B;;OAEG;IACU,qBAAqB,CAChC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,KAAK,GAAG,MAAM,EAC9C,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,gBAAgB,CAAC;IAQ5B;;OAEG;IACU,UAAU,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAqBnD;;OAEG;IACU,aAAa,CACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAqBnD,OAAO,CAAC,WAAW;CAKpB"}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* User management service for Zalo API
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UserService = void 0;
|
|
7
|
+
const common_1 = require("../types/common");
|
|
8
|
+
/**
|
|
9
|
+
* User management service for handling user operations
|
|
10
|
+
*/
|
|
11
|
+
class UserService {
|
|
12
|
+
constructor(client) {
|
|
13
|
+
this.client = client;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get user information by user ID
|
|
17
|
+
*/
|
|
18
|
+
async getUserInfo(accessToken, userId) {
|
|
19
|
+
try {
|
|
20
|
+
const endpoint = this.client.endpoints.user.info;
|
|
21
|
+
const params = { user_id: userId };
|
|
22
|
+
const result = await this.client.apiGet(endpoint, accessToken, params);
|
|
23
|
+
if (result.error !== 0) {
|
|
24
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to get user information", result.error, result);
|
|
25
|
+
}
|
|
26
|
+
if (!result.data) {
|
|
27
|
+
throw new common_1.ZaloSDKError("No user data received", -1);
|
|
28
|
+
}
|
|
29
|
+
return result.data;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
this.handleError(error, "Failed to get user info");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get list of users with pagination and filters
|
|
40
|
+
*/
|
|
41
|
+
async getUserList(accessToken, request) {
|
|
42
|
+
try {
|
|
43
|
+
const endpoint = this.client.endpoints.user.list;
|
|
44
|
+
const params = {
|
|
45
|
+
offset: request.offset,
|
|
46
|
+
count: Math.min(request.count, 50), // Max 50 users per request
|
|
47
|
+
...(request.tag_name && { tag_name: request.tag_name }),
|
|
48
|
+
...(request.last_interaction_period && {
|
|
49
|
+
last_interaction_period: request.last_interaction_period,
|
|
50
|
+
}),
|
|
51
|
+
...(request.is_follower !== undefined && {
|
|
52
|
+
is_follower: request.is_follower,
|
|
53
|
+
}),
|
|
54
|
+
};
|
|
55
|
+
const result = await this.client.apiGet(endpoint, accessToken, params);
|
|
56
|
+
if (result.error !== 0) {
|
|
57
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to get user list", result.error, result);
|
|
58
|
+
}
|
|
59
|
+
if (!result.data) {
|
|
60
|
+
throw new common_1.ZaloSDKError("No user list data received", -1);
|
|
61
|
+
}
|
|
62
|
+
return result.data;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
this.handleError(error, "Failed to get user list");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get all users with automatic pagination
|
|
73
|
+
*/
|
|
74
|
+
async getAllUsers(accessToken, filters) {
|
|
75
|
+
const users = [];
|
|
76
|
+
let offset = 0;
|
|
77
|
+
const count = 50; // Max per request
|
|
78
|
+
try {
|
|
79
|
+
while (true) {
|
|
80
|
+
const userListResponse = await this.getUserList(accessToken, {
|
|
81
|
+
offset,
|
|
82
|
+
count,
|
|
83
|
+
...filters,
|
|
84
|
+
});
|
|
85
|
+
// Get detailed info for each user
|
|
86
|
+
const userIds = userListResponse.users.map((u) => u.user_id);
|
|
87
|
+
const userInfoPromises = userIds.map((userId) => this.getUserInfo(accessToken, userId));
|
|
88
|
+
const userInfos = await Promise.all(userInfoPromises);
|
|
89
|
+
users.push(...userInfos);
|
|
90
|
+
// Check if we have more users
|
|
91
|
+
if (userListResponse.users.length < count) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
offset += count;
|
|
95
|
+
}
|
|
96
|
+
return users;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
this.handleError(error, "Failed to get all users");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Update user information
|
|
107
|
+
*/
|
|
108
|
+
async updateUser(accessToken, request) {
|
|
109
|
+
try {
|
|
110
|
+
const endpoint = this.client.endpoints.user.update;
|
|
111
|
+
const result = await this.client.apiPost(endpoint, accessToken, request);
|
|
112
|
+
if (result.error !== 0) {
|
|
113
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to update user", result.error, result);
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
throw new common_1.ZaloSDKError(`Failed to update user: ${error.message}`, -1, error);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get user tags/labels
|
|
126
|
+
*/
|
|
127
|
+
async getUserTags(accessToken, userId) {
|
|
128
|
+
try {
|
|
129
|
+
const endpoint = this.client.endpoints.user.tags;
|
|
130
|
+
const params = { user_id: userId };
|
|
131
|
+
const result = await this.client.apiGet(endpoint, accessToken, params);
|
|
132
|
+
if (result.error !== 0) {
|
|
133
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to get user tags", result.error, result);
|
|
134
|
+
}
|
|
135
|
+
return result.data?.tags || [];
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
throw new common_1.ZaloSDKError(`Failed to get user tags: ${error.message}`, -1, error);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Add tag to user
|
|
146
|
+
*/
|
|
147
|
+
async addTagToUser(accessToken, request) {
|
|
148
|
+
try {
|
|
149
|
+
const endpoint = this.client.endpoints.user.addTag;
|
|
150
|
+
const result = await this.client.apiPost(endpoint, accessToken, request);
|
|
151
|
+
if (result.error !== 0) {
|
|
152
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to add tag to user", result.error, result);
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
throw new common_1.ZaloSDKError(`Failed to add tag to user: ${error.message}`, -1, error);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Remove tag from user
|
|
165
|
+
*/
|
|
166
|
+
async removeTagFromUser(accessToken, request) {
|
|
167
|
+
try {
|
|
168
|
+
const endpoint = this.client.endpoints.user.removeTag;
|
|
169
|
+
const result = await this.client.apiPost(endpoint, accessToken, request);
|
|
170
|
+
if (result.error !== 0) {
|
|
171
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to remove tag from user", result.error, result);
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
throw new common_1.ZaloSDKError(`Failed to remove tag from user: ${error.message}`, -1, error);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Create a new user label
|
|
184
|
+
*/
|
|
185
|
+
async createLabel(accessToken, request) {
|
|
186
|
+
try {
|
|
187
|
+
const endpoint = "/v3.0/oa/tag/create";
|
|
188
|
+
const result = await this.client.apiPost(endpoint, accessToken, request);
|
|
189
|
+
if (result.error !== 0) {
|
|
190
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to create label", result.error, result);
|
|
191
|
+
}
|
|
192
|
+
if (!result.data) {
|
|
193
|
+
throw new common_1.ZaloSDKError("No label data received", -1);
|
|
194
|
+
}
|
|
195
|
+
return result.data;
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
throw new common_1.ZaloSDKError(`Failed to create label: ${error.message}`, -1, error);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get all available labels
|
|
206
|
+
*/
|
|
207
|
+
async getLabels(accessToken) {
|
|
208
|
+
try {
|
|
209
|
+
const endpoint = "/v3.0/oa/tag/getall";
|
|
210
|
+
const result = await this.client.apiGet(endpoint, accessToken);
|
|
211
|
+
if (result.error !== 0) {
|
|
212
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to get labels", result.error, result);
|
|
213
|
+
}
|
|
214
|
+
return result.data?.tags || [];
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
throw new common_1.ZaloSDKError(`Failed to get labels: ${error.message}`, -1, error);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Delete a label
|
|
225
|
+
*/
|
|
226
|
+
async deleteLabel(accessToken, labelId) {
|
|
227
|
+
try {
|
|
228
|
+
const endpoint = "/v3.0/oa/tag/delete";
|
|
229
|
+
const request = { label_id: labelId };
|
|
230
|
+
const result = await this.client.apiPost(endpoint, accessToken, request);
|
|
231
|
+
if (result.error !== 0) {
|
|
232
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to delete label", result.error, result);
|
|
233
|
+
}
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
238
|
+
throw error;
|
|
239
|
+
}
|
|
240
|
+
throw new common_1.ZaloSDKError(`Failed to delete label: ${error.message}`, -1, error);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get users by tag
|
|
245
|
+
*/
|
|
246
|
+
async getUsersByTag(accessToken, tagName, offset = 0, count = 50) {
|
|
247
|
+
return this.getUserList(accessToken, {
|
|
248
|
+
offset,
|
|
249
|
+
count,
|
|
250
|
+
tag_name: tagName,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get followers only
|
|
255
|
+
*/
|
|
256
|
+
async getFollowers(accessToken, offset = 0, count = 50) {
|
|
257
|
+
return this.getUserList(accessToken, {
|
|
258
|
+
offset,
|
|
259
|
+
count,
|
|
260
|
+
is_follower: true,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get users by interaction period
|
|
265
|
+
*/
|
|
266
|
+
async getUsersByInteraction(accessToken, period, offset = 0, count = 50) {
|
|
267
|
+
return this.getUserList(accessToken, {
|
|
268
|
+
offset,
|
|
269
|
+
count,
|
|
270
|
+
last_interaction_period: period,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Bulk tag operations
|
|
275
|
+
*/
|
|
276
|
+
async bulkAddTag(accessToken, userIds, labelId) {
|
|
277
|
+
const results = {
|
|
278
|
+
success: [],
|
|
279
|
+
failed: [],
|
|
280
|
+
};
|
|
281
|
+
for (const userId of userIds) {
|
|
282
|
+
try {
|
|
283
|
+
await this.addTagToUser(accessToken, {
|
|
284
|
+
user_id: userId,
|
|
285
|
+
label_id: labelId,
|
|
286
|
+
});
|
|
287
|
+
results.success.push(userId);
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
results.failed.push(userId);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return results;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Bulk remove tag operations
|
|
297
|
+
*/
|
|
298
|
+
async bulkRemoveTag(accessToken, userIds, labelId) {
|
|
299
|
+
const results = {
|
|
300
|
+
success: [],
|
|
301
|
+
failed: [],
|
|
302
|
+
};
|
|
303
|
+
for (const userId of userIds) {
|
|
304
|
+
try {
|
|
305
|
+
await this.removeTagFromUser(accessToken, {
|
|
306
|
+
user_id: userId,
|
|
307
|
+
label_id: labelId,
|
|
308
|
+
});
|
|
309
|
+
results.success.push(userId);
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
results.failed.push(userId);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return results;
|
|
316
|
+
}
|
|
317
|
+
handleError(error, message) {
|
|
318
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
319
|
+
throw new common_1.ZaloSDKError(`${message}: ${errorMessage}`, -1, error);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
exports.UserService = UserService;
|
|
323
|
+
//# sourceMappingURL=user.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/services/user.service.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAYH,4CAA6D;AAE7D;;GAEG;AACH,MAAa,WAAW;IACtB,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;OAEG;IACI,KAAK,CAAC,WAAW,CACtB,WAAmB,EACnB,MAAc;QAEd,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;YACjD,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;YAEnC,MAAM,MAAM,GAA2B,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAC7D,QAAQ,EACR,WAAW,EACX,MAAM,CACP,CAAC;YAEF,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;gBACvB,MAAM,IAAI,qBAAY,CACpB,MAAM,CAAC,OAAO,IAAI,gCAAgC,EAClD,MAAM,CAAC,KAAK,EACZ,MAAM,CACP,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjB,MAAM,IAAI,qBAAY,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC,CAAC;YACtD,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,qBAAY,EAAE,CAAC;gBAClC,MA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