update lại thư mục cấu trúc mới của server nodejs và python

This commit is contained in:
Victor Phan
2026-07-21 09:13:52 +07:00
parent 7625bdd37b
commit 58b1dcd170
1555 changed files with 0 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
'use strict';
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
var utils = require('../utils.cjs');
const getStickersDetailFactory = utils.apiFactory()((api, ctx, utils$1) => {
const serviceURL = utils$1.makeURL(`${api.zpwServiceMap.sticker}/api/message/sticker/sticker_detail`);
/**
* Get stickers detail by sticker IDs
*
* @param stickerIds Sticker IDs to search for
*
* @throws {ZaloApiError}
*/
return async function getStickersDetail(stickerIds) {
if (!stickerIds)
throw new ZaloApiError.ZaloApiError("Missing sticker id");
if (!Array.isArray(stickerIds))
stickerIds = [stickerIds];
if (stickerIds.length == 0)
throw new ZaloApiError.ZaloApiError("Missing sticker id");
const stickers = [];
const tasks = stickerIds.map((stickerId) => getStickerDetail(stickerId));
const tasksResult = await Promise.allSettled(tasks);
tasksResult.forEach((result) => {
if (result.status === "fulfilled")
stickers.push(result.value);
});
return stickers;
};
async function getStickerDetail(stickerId) {
const params = {
sid: stickerId,
};
const encryptedParams = utils$1.encodeAES(JSON.stringify(params));
if (!encryptedParams)
throw new ZaloApiError.ZaloApiError("Failed to encrypt message");
const response = await utils$1.request(utils$1.makeURL(serviceURL, {
params: encryptedParams,
}));
return utils.resolveResponse(ctx, response);
}
});
exports.getStickersDetailFactory = getStickersDetailFactory;