n8n-nodes-wechat-work
Version:
76 lines • 2.51 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const WechatWorkRequestUtils_1 = __importDefault(require("../../../help/utils/WechatWorkRequestUtils"));
const DeptUpdateOperate = {
name: '更新部门',
value: 'dept:updateDept',
description: '更新一个部门的信息',
options: [
{
displayName: '部门ID',
name: 'id',
type: 'number',
default: 0,
required: true,
},
{
displayName: '部门名称',
name: 'name',
type: 'string',
default: '',
description: '部门名称。长度限制为1~64个UTF-8字符,字符不能包括\:*?"<>|',
},
{
displayName: '英文名称',
name: 'name_en',
type: 'string',
default: '',
description: '需要在管理后台开启多语言支持才能生效。长度限制为1~64个字符,字符不能包括\:*?"<>|',
},
{
displayName: '父部门ID',
name: 'parentid',
type: 'number',
default: 0,
},
{
displayName: '次序值',
name: 'order',
type: 'number',
default: 0,
description: '在父部门中的次序值。order值大的排序靠前。有效的值范围是[0, 2^32)',
},
],
async call(index) {
const id = this.getNodeParameter('id', index);
const name = this.getNodeParameter('name', index, '');
const name_en = this.getNodeParameter('name_en', index, '');
const parentid = this.getNodeParameter('parentid', index, 0);
const order = this.getNodeParameter('order', index, 0);
const body = {
id,
};
if (name) {
body.name = name;
}
if (name_en) {
body.name_en = name_en;
}
if (parentid) {
body.parentid = parentid;
}
if (order) {
body.order = order;
}
return WechatWorkRequestUtils_1.default.request.call(this, {
method: 'POST',
url: `/cgi-bin/department/update`,
body,
});
},
};
exports.default = DeptUpdateOperate;
//# sourceMappingURL=DeptUpdateOperate.js.map