chore: initialize dependencies and zca-js project files
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
||||
require('../models/AutoReply.cjs');
|
||||
require('../models/Board.cjs');
|
||||
var Enum = require('../models/Enum.cjs');
|
||||
require('../models/FriendEvent.cjs');
|
||||
require('../models/Group.cjs');
|
||||
require('../models/GroupEvent.cjs');
|
||||
require('../models/Reaction.cjs');
|
||||
require('../models/Reminder.cjs');
|
||||
require('../models/ZBusiness.cjs');
|
||||
var utils = require('../utils.cjs');
|
||||
|
||||
const getAvatarUrlProfileFactory = utils.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 = Enum.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.ZaloApiError("Failed to encrypt params");
|
||||
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
||||
method: "GET",
|
||||
});
|
||||
return utils.resolve(response);
|
||||
};
|
||||
});
|
||||
|
||||
exports.getAvatarUrlProfileFactory = getAvatarUrlProfileFactory;
|
||||
Reference in New Issue
Block a user