update lại thư mục cấu trúc mới của server nodejs và python
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
||||
import { AvatarSize } from "../models/index.js";
|
||||
import { apiFactory } from "../utils.js";
|
||||
export const getAvatarUrlProfileFactory = apiFactory()((api, _ctx, utils) => {
|
||||
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/avatar-url`);
|
||||
/**
|
||||
* Get avatar url profile
|
||||
*
|
||||
* @param friendId friend id(s)
|
||||
* @param avatarSize Avatar size (default: AvatarSize.Large)
|
||||
*
|
||||
* @throws {ZaloApiError}
|
||||
*/
|
||||
return async function getAvatarUrlProfile(friendIds, avatarSize = AvatarSize.Large) {
|
||||
if (!Array.isArray(friendIds))
|
||||
friendIds = [friendIds];
|
||||
const params = {
|
||||
friend_ids: friendIds,
|
||||
avatar_size: avatarSize,
|
||||
srcReq: -1,
|
||||
};
|
||||
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
||||
if (!encryptedParams)
|
||||
throw new ZaloApiError("Failed to encrypt params");
|
||||
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
||||
method: "GET",
|
||||
});
|
||||
return utils.resolve(response);
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user