update lại thư mục cấu trúc mới của server nodejs và python
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
||||
var utils = require('../utils.cjs');
|
||||
|
||||
const editNoteFactory = utils.apiFactory()((api, ctx, utils) => {
|
||||
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group_board[0]}/api/board/topic/updatev2`);
|
||||
/**
|
||||
* Edit an existing note in a group
|
||||
*
|
||||
* @param options Options for editing the note
|
||||
* @param groupId Group ID to create note from
|
||||
*
|
||||
* @throws {ZaloApiError}
|
||||
*/
|
||||
return async function editNote(options, groupId) {
|
||||
const params = {
|
||||
grid: groupId,
|
||||
type: 0,
|
||||
color: -16777216,
|
||||
emoji: "",
|
||||
startTime: -1,
|
||||
duration: -1,
|
||||
params: JSON.stringify({
|
||||
title: options.title,
|
||||
}),
|
||||
topicId: options.topicId,
|
||||
repeat: 0,
|
||||
imei: ctx.imei,
|
||||
pinAct: options.pinAct ? 1 : 2,
|
||||
};
|
||||
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
||||
if (!encryptedParams)
|
||||
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
||||
const response = await utils.request(serviceURL, {
|
||||
method: "POST",
|
||||
body: new URLSearchParams({
|
||||
params: encryptedParams,
|
||||
}),
|
||||
});
|
||||
return utils.resolve(response, (result) => {
|
||||
const data = result.data;
|
||||
if (typeof data.params == "string") {
|
||||
data.params = JSON.parse(data.params);
|
||||
}
|
||||
return data;
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
exports.editNoteFactory = editNoteFactory;
|
||||
Reference in New Issue
Block a user