How to use addRequest method in wpt

Best JavaScript code snippet using wpt

asc.teamlab.js

Source:asc.teamlab.js Github

copy

Full Screen

...253 var start = function(params, options) {254 return helper.start(params, options);255 };256257 function addRequest(eventname, params, type, url, data, options) {258 return returnValue(helper.request(259 eventname,260 params,261 type,262 url,263 data,264 options265 ));266 }267268 /* <common> */269 var getQuotas = function (params, options) {270 return addRequest(271 customEvents.getQuotas,272 params,273 GET,274 'settings/quota.json',275 null,276 options277 );278 };279280 var recalculateQuota = function (params, options) {281 return addRequest(282 null,283 params,284 GET,285 'settings/recalculatequota.json',286 null,287 options288 );289 };290291 var checkRecalculateQuota = function (params, options) {292 return addRequest(293 null,294 params,295 GET,296 'settings/checkrecalculatequota.json',297 null,298 options299 );300 };301302 /* </common> */303304 /* <people> */305306 var remindPwd = function (params, email, options) {307 return addRequest(308 null,309 params,310 ADD,311 'people/password.json',312 { email: email },313 options314 );315 };316317 var thirdPartyLinkAccount = function (params, data, options) {318 return addRequest(319 null,320 params,321 UPDATE,322 'people/thirdparty/linkaccount.json',323 data,324 options325 );326 };327328 var thirdPartyUnLinkAccount = function (params, data, options) {329 return addRequest(330 customEvents.thirdPartyUnLinkAccount,331 params,332 REMOVE,333 'people/thirdparty/unlinkaccount.json',334 data,335 options336 );337 };338339 var addProfile = function (params, data, options) {340 addRequest(341 null,342 params,343 ADD,344 'people.json',345 data,346 options347 );348 return true;349 };350351 var addImportUser = function (data, options) {352 addRequest(353 null,354 null,355 ADD,356 'people/import/save.json',357 data,358 options359 );360 return true;361 };362363 var getImportStatus = function (options) {364 addRequest(365 null,366 null,367 GET,368 'people/import/status.json',369 null,370 options371 );372 return true;373 };374375 var getProfile = function (params, id, options) {376 return addRequest(377 null,378 params,379 GET,380 'people/' + id + '.json',381 null,382 options383 );384 };385386 var getProfiles = function (params, options) {387 var status = null;388 if (options && typeof options === 'object' && options.hasOwnProperty('filter')) {389 status = options.filter.hasOwnProperty('status') ? options.filter.status : status;390 }391392 var query = getQuery(options),393 url = 'people' + (status !== null ? '/status/' + status : '') + '.json';394395 if (query) {396 if (options.filter) {397 options.filter.query = query;398399 } else {400 options.filter = { query: query };401 }402 url = 'people' + (status !== null ? '/status/' + status : '') + '/search.json';403 }404405 return addRequest(406 null,407 params,408 GET,409 url,410 null,411 options412 );413 };414415 var getProfilesByFilter = function (params, options) {416 return addRequest(417 null,418 params,419 GET,420 'people/filter.json',421 null,422 options423 );424 };425426 var getSimpleProfilesByFilter = function (params, options) {427 return addRequest(428 null,429 params,430 GET,431 'people/simple/filter.json',432 null,433 options434 );435 };436437 var addGroup = function (params, data, options) {438 addRequest(439 null,440 params,441 ADD,442 'group.json',443 data,444 options445 );446 return true;447 };448449 var getGroup = function (params, id, options) {450 return addRequest(451 null,452 params,453 GET,454 'group/' + id + '.json',455 null,456 options457 );458 };459460 var getGroups = function (params, options) {461 return addRequest(462 null,463 params,464 GET,465 'group.json',466 null,467 options468 );469 };470471 var updateGroup = function (params, id, data, options) {472 return addRequest(473 null,474 params,475 UPDATE,476 'group/' + id + '.json',477 data,478 options479 );480 };481482 var deleteGroup = function (params, id, options) {483 return addRequest(484 null,485 params,486 REMOVE,487 'group/' + id + '.json',488 null,489 options490 );491 };492493 var updateProfile = function (params, id, data, options) {494 addRequest(495 null,496 params,497 UPDATE,498 'people/' + id + '.json',499 data,500 options501 );502 };503504 var updateUserType = function (params, type, data, options) {505 return addRequest(506 null,507 params,508 UPDATE,509 'people/type/' + type + '.json',510 data,511 options512 );513 };514515 var updateUserStatus = function (params, status, data, options) {516 return addRequest(517 null,518 params,519 UPDATE,520 'people/status/' + status + '.json',521 data,522 options523 );524 };525 526 var getUserPhoto = function (params, id, options) {527 return addRequest(528 null,529 params,530 GET,531 'people/' + id + '/photo.json',532 null,533 options534 );535 };536537 var updateUserPhoto = function (params, id, data, options) {538 return addRequest(539 null,540 params,541 UPDATE,542 'people/' + id + '/photo.json',543 data,544 options545 );546 };547548 var removeUserPhoto = function (params, id, options) {549 return addRequest(550 null,551 params,552 REMOVE,553 'people/' + id + '/photo.json',554 null,555 options556 );557 };558 559 var createUserPhotoThumbnails = function (params, id, data, options) {560 return addRequest(561 null,562 params,563 ADD,564 'people/' + id + '/photo/thumbnails.json',565 data,566 options567 );568 };569570 var sendInvite = function (params, data, options) {571 return addRequest(572 null,573 params,574 UPDATE,575 'people/invite.json',576 data,577 options578 );579 };580581 var removeUser = function (params, id, options) {582 return addRequest(583 null,584 params,585 REMOVE,586 'people/' + id + '.json',587 null,588 options589 );590 };591592 var removeUsers = function (params, data, options) {593 return addRequest(594 null,595 params,596 UPDATE,597 'people/delete.json',598 data,599 options600 );601 };602603 var getUserGroups = function (id, options) {604 return addRequest(605 null,606 null,607 GET,608 'group/user/' + id + '.json',609 null,610 options611 );612 };613614 var removeSelf = function (params, options) {615 return addRequest(616 null,617 params,618 UPDATE,619 'people/self/delete.json',620 null,621 options622 );623 };624625 var joinAffiliate = function (params, options) {626 return addRequest(627 null,628 params,629 UPDATE,630 'people/self/joinaffiliate.json',631 null,632 options633 );634 };635636 /* </people> */637638 /* <community> */639 var addCmtBlog = function (params, data, options) {640 addRequest(641 null,642 params,643 ADD,644 'community/blog.json',645 data,646 options647 );648 return true;649 };650651 var getCmtBlog = function (params, id, options) {652 return addRequest(653 null,654 params,655 GET,656 'community/blog/' + id + '.json',657 null,658 options659 );660 };661662 var getCmtBlogs = function (params, options) {663 var query = getQuery(options);664 return addRequest(665 null,666 params,667 GET,668 'community/blog' + (query ? '/@search/' + query : '') + '.json',669 null,670 options671 );672 };673674 var addCmtForumTopic = function (params, threadid, data, options) {675 addRequest(676 null,677 params,678 ADD,679 'community/forum/' + threadid + '.json',680 data,681 options682 );683 return true;684 };685686 var getCmtForumTopic = function (params, id, options) {687 return addRequest(688 null,689 params,690 GET,691 'community/forum/topic/' + id + '.json',692 null,693 options694 );695 };696697 var getCmtForumTopics = function (params, options) {698 var query = getQuery(options);699 return addRequest(700 null,701 params,702 GET,703 'community/forum' + (query ? '/@search/' + query : '/topic/recent') + '.json',704 null,705 options706 );707 };708709 var getCmtForumCategories = function (params, options) {710 return addRequest(711 null,712 params,713 GET,714 'community/forum.json',715 null,716 options717 );718 };719720 var addCmtForumToCategory = function (params, data, options) {721 return addRequest(722 null,723 params,724 ADD,725 'community/forum.json',726 data,727 options728 );729 };730731 var addCmtEvent = function (params, data, options) {732 addRequest(733 null,734 params,735 ADD,736 'community/event.json',737 data,738 options739 );740 return true;741 };742743 var getCmtEvent = function (params, id, options) {744 return addRequest(745 null,746 params,747 GET,748 'community/event/' + id + '.json',749 null,750 options751 );752 };753754 var getCmtEvents = function (params, options) {755 var query = getQuery(options);756 return addRequest(757 null,758 params,759 GET,760 'community/event' + (query ? '/@search/' + query : '') + '.json',761 null,762 options763 );764 };765766 var addCmtBookmark = function (params, data, options) {767 addRequest(768 null,769 params,770 ADD,771 'community/bookmark.json',772 data,773 options774 );775 return true;776 };777778 var getCmtBookmark = function (params, id, options) {779 return addRequest(780 null,781 params,782 GET,783 'community/bookmark/' + id + '.json',784 null,785 options786 );787 };788789 var getCmtBookmarks = function (params, options) {790 var query = getQuery(options);791 return addRequest(792 null,793 params,794 GET,795 'community/bookmark' + (query ? '/@search/' + query : '/top/recent') + '.json',796 null,797 options798 );799 };800801 var addCmtForumTopicPost = function (params, id, data, options) {802 addRequest(803 null,804 params,805 ADD,806 'community/forum/topic/' + id + '.json',807 data,808 options809 );810 return true;811 };812813 var addCmtBlogComment = function (params, id, data, options) {814 addRequest(815 null,816 params,817 ADD,818 'community/blog/' + id + '/comment.json',819 data,820 options821 );822 return true;823 };824825 var getCmtBlogComments = function (params, id, options) {826 return addRequest(827 null,828 params,829 GET,830 'community/blog/' + id + '/comment.json',831 null,832 options833 );834 };835836 var addCmtEventComment = function (params, id, data, options) {837 addRequest(838 null,839 params,840 ADD,841 'community/event/' + id + '/comment.json',842 data,843 options844 );845 return true;846 };847848 var getCmtEventComments = function (params, id, options) {849 return addRequest(850 null,851 params,852 GET,853 'community/event/' + id + '/comment.json',854 null,855 options856 );857 };858859 var subscribeCmtEventComment = function (params, id, data, options) {860 addRequest(861 null,862 params,863 ADD,864 'community/event/' + id + '/subscribe.json',865 data,866 options867 );868 return true;869 };870871 var addCmtBookmarkComment = function (params, id, data, options) {872 addRequest(873 null,874 params,875 ADD,876 'community/bookmark/' + id + '/comment.json',877 data,878 options879 );880 return true;881 };882883 var getCmtBookmarkComments = function (params, id, options) {884 return addRequest(885 null,886 params,887 GET,888 'community/bookmark/' + id + '/comment.json',889 null,890 options891 );892 };893894 var subscribeCmtBirthday = function (params, data, options) {895 addRequest(896 null,897 params,898 ADD,899 'community/birthday.json',900 data,901 options902 );903 return true;904 };905906 var getCmtPreview = function (params, data, options) {907 return addRequest(908 null,909 params,910 ADD,911 'community/preview.json',912 data,913 options914 );915 };916 /* </community> */917918 /* <projects> */919920 var subscribeProject = function (params, id, options) {921 addRequest(922 null,923 params,924 UPDATE,925 'project/' + id + '/follow.json',926 id,927 options928 );929 return true;930 };931932 var getFeeds = function (params, options) {933 return addRequest(934 null,935 params,936 GET,937 'feed/filter.json',938 null,939 options940 );941 };942943 var getNewFeedsCount = function (params, options) {944 return addRequest(945 null,946 params,947 GET,948 'feed/newfeedscount.json',949 null,950 options951 );952 };953954 var readFeeds = function (params, options) {955 return addRequest(956 null,957 params,958 UPDATE,959 'feed/read.json',960 null,961 options962 );963 };964965 var updatePrjSettings = function (data, options) {966 return addRequest(967 null,968 {},969 UPDATE,970 'project/settings.json',971 data,972 options973 );974 }975976 var getPrjSettings = function (options) {977 return addRequest(978 null,979 {},980 GET,981 'project/settings.json',982 null,983 options984 );985 }986987 var getPrjStatuses = function (options) {988 return addRequest(989 null,990 {},991 GET,992 'project/status.json',993 null,994 options995 );996 }997998 var removePrjStatus = function (id, options) {999 addRequest(1000 null,1001 null,1002 REMOVE,1003 'project/status/' + id + '.json',1004 id,1005 options1006 );1007 return true;1008 };10091010 var addPrjStatus = function (data, options) {1011 addRequest(1012 null,1013 null,1014 ADD,1015 'project/status.json',1016 { status: data },1017 options1018 );1019 return true;1020 };10211022 var updatePrjStatus = function (data, options) {1023 addRequest(1024 null,1025 null,1026 UPDATE,1027 'project/status.json',1028 { newStatus: data },1029 options1030 );1031 return true;1032 };10331034 var updatePrjStatuses = function (data, options) {1035 addRequest(1036 null,1037 null,1038 UPDATE,1039 'project/statuses.json',1040 { statuses: data },1041 options1042 );1043 return true;1044 };10451046 var getPrjTags = function (params, options) {1047 return addRequest(1048 null,1049 params,1050 'get',1051 'project/tag.json',1052 null,1053 options1054 );1055 };10561057 var getPrjSecurityinfo = function (params, options) {1058 return addRequest(1059 null,1060 params,1061 'get',1062 'project/securityinfo.json',1063 null,1064 options1065 );1066 };10671068 var getPrjTagsByName = function (params, name, data, options) {1069 return addRequest(1070 null,1071 params,1072 'get',1073 'project/tag/search.json',1074 data,1075 options1076 );1077 };10781079 var getPrjComments = function (params, type, id, options) {1080 var fn = null;1081 switch (type.toLowerCase()) {1082 case 'discussion':1083 fn = getPrjDiscussionComments;1084 break;1085 }1086 if (typeof fn === 'function') {1087 return returnValue(fn(params, id, options));1088 }1089 return false;1090 };10911092 var addPrjSubtask = function (params, id, data, options) {1093 addRequest(1094 customEvents.addSubtask,1095 params,1096 ADD,1097 'project/task/' + id + '.json',1098 data,1099 options1100 );1101 return true;1102 };11031104 var copyPrjSubtask = function (params, taskid, id, options) {1105 addRequest(1106 customEvents.addSubtask,1107 params,1108 ADD,1109 'project/task/' + taskid + '/' + id + '/copy.json',1110 null,1111 options1112 );1113 return true;1114 };11151116 var updatePrjSubtask = function (params, parentid, id, data, options) {1117 var updateStatus = false;1118 for (var fld in data) {1119 if (data.hasOwnProperty(fld)) {1120 switch (fld) {1121 case 'status':1122 updateStatus = true;1123 break;1124 }1125 }1126 }11271128 addRequest(1129 customEvents.updateSubtask,1130 params,1131 UPDATE,1132 'project/task/' + parentid + '/' + id + (updateStatus ? '/status' : '') + '.json',1133 data,1134 options1135 );1136 return true;1137 };11381139 var removePrjSubtask = function (params, parentid, id, options) {1140 addRequest(1141 customEvents.removeSubtask,1142 params,1143 REMOVE,1144 'project/task/' + parentid + '/' + id + '.json',1145 id,1146 options1147 );1148 return true;1149 };11501151 var addPrjTask = function (params, id, data, options) {1152 addRequest(1153 customEvents.addPrjTask,1154 params,1155 ADD,1156 'project/' + id + '/task.json',1157 data,1158 options1159 );1160 return true;1161 };11621163 var copyPrjTask = function (params, id, data, options) {1164 addRequest(1165 customEvents.copyPrjTask,1166 params,1167 ADD,1168 'project/task/' + data.copyFrom + '/copy.json',1169 data,1170 options1171 );1172 return true;1173 };11741175 var addPrjTaskByMessage = function (params, prjId, messageId, options) {1176 addRequest(1177 null,1178 params,1179 ADD,1180 'project/' + prjId + '/task/' + messageId + '.json',1181 null,1182 options1183 );1184 };11851186 var updatePrjTask = function (params, id, data, options) {1187 var updateStatus = false,1188 updateMilestone = false,1189 event = customEvents.updatePrjTask;11901191 for (var fld in data) {1192 if (data.hasOwnProperty(fld)) {1193 switch (fld) {1194 case 'status':1195 updateStatus = true;1196 event = customEvents.updatePrjTaskStatus;1197 break;1198 case 'newMilestoneID':1199 updateMilestone = true;1200 data.milestoneid = data.newMilestoneID;1201 break;1202 }1203 }1204 }12051206 addRequest(1207 event,1208 params,1209 UPDATE,1210 'project/task/' + id + (updateStatus ? '/status' : '') + (updateMilestone ? '/milestone' : '') + '.json',1211 data,1212 options1213 );1214 return true;1215 };12161217 var updatePrjTasksMilestone = function (data, options) {1218 addRequest(1219 null,1220 null,1221 UPDATE,1222 'project/task/milestone.json',1223 data,1224 options1225 );1226 return true;1227 };12281229 var updatePrjTasksStatus = function(data, options) {1230 addRequest(1231 customEvents.updatePrjTasksStatus,1232 null,1233 UPDATE,1234 'project/task/status.json',1235 data,1236 options1237 );1238 return true;1239 }12401241 var removePrjTask = function (params, id, options) {1242 addRequest(1243 customEvents.removePrjTask,1244 params,1245 REMOVE,1246 'project/task/' + id + '.json',1247 id,1248 options1249 );1250 return true;1251 };12521253 var removePrjTasks = function (data, options) {1254 addRequest(1255 customEvents.removePrjTasks,1256 null,1257 REMOVE,1258 'project/task.json',1259 data,1260 options1261 );1262 return true;1263 };12641265 var getPrjTask = function (params, id, options) {1266 return addRequest(1267 null,1268 params,1269 GET,1270 'project/task/' + id + '.json',1271 null,1272 options1273 );1274 };12751276 var getPrjTasksById = function (params, ids, options) {1277 return addRequest(1278 null,1279 params,1280 GET,1281 'project/task.json',1282 ids,1283 options1284 );1285 };12861287 var getPrjTasks = function (params, options) {1288 if (options && typeof options === 'object' && options.hasOwnProperty('filter')) {1289 var filter = options.filter;1290 filter.simple = true;1291 }12921293 return addRequest(1294 null,1295 params,1296 GET,1297 'project/task/filter.json',1298 null,1299 options1300 );1301 };13021303 var getPrjTasksSimpleFilter = function (params, options) {1304 return addRequest(1305 null,1306 params,1307 GET,1308 'project/task/filter/simple.json',1309 null,1310 options1311 );1312 };13131314 var getPrjTaskFiles = function (params, id, options) {1315 return addRequest(1316 null,1317 params,1318 GET,1319 'project/task/' + id + '/files.json',1320 null,1321 options1322 );1323 };13241325 var subscribeToPrjTask = function (params, id, options) {1326 return addRequest(1327 null,1328 params,1329 UPDATE,1330 'project/task/' + id + '/subscribe.json',1331 id,1332 options1333 );1334 };13351336 var notifyPrjTaskResponsible = function (params, id, options) {1337 return addRequest(1338 null,1339 params,1340 GET,1341 'project/task/' + id + '/notify.json',1342 null,1343 options1344 );1345 };13461347 var addPrjTaskLink = function (params, id, data, options) {1348 addRequest(1349 null,1350 params,1351 ADD,1352 'project/task/' + id + '/link.json',1353 data,1354 options1355 );1356 return true;1357 };13581359 var removePrjTaskLink = function (params, id, data, options) {1360 addRequest(1361 null,1362 params,1363 REMOVE,1364 'project/task/' + id + '/link.json',1365 data,1366 options1367 );1368 return true;1369 };13701371 var getPrjTeam = function (params, ids, options) {1372 var isId = ids && (typeof ids === 'number' || typeof ids === 'string');1373 return addRequest(1374 null,1375 params,1376 isId ? GET : ADD,1377 'project' + (isId ? '/' + ids : '') + '/team.json',1378 isId ? null : { ids: ids },1379 options1380 );1381 };13821383 var getProjectTeamExcluded = function (ids, options) {1384 return addRequest(1385 null,1386 null,1387 GET,1388 'project/' + ids + '/teamExcluded.json',1389 { projectid: ids },1390 options1391 );1392 };13931394 var updatePrjTeam = function (params, id, data, options) {1395 return addRequest(1396 customEvents.updatePrjTeam,1397 params,1398 UPDATE,1399 'project/' + id + '/team.json',1400 data,1401 options1402 );1403 };14041405 var setTeamSecurity = function (params, id, data, options) {1406 return addRequest(1407 null,1408 params,1409 UPDATE,1410 'project/' + id + '/team/security.json',1411 data,1412 options1413 );1414 };14151416 var getPrjProjectFolder = function (params, id, options) {1417 return addRequest(1418 null,1419 params,1420 GET,1421 'project/' + id + '/files.json',1422 null,1423 options1424 );1425 };14261427 var addPrjEntityFiles = function (params, id, type, data, options) {1428 options = options || {};1429 if (typeof options === 'function') {1430 options = { success: options };1431 }1432 if (!options.hasOwnProperty('filter')) {1433 options.filter = {};1434 }1435 if (!options.filter.hasOwnProperty('entityType')) {1436 options.filter.entityType = type;1437 }14381439 addRequest(1440 null,1441 params,1442 ADD,1443 'project/' + id + '/entityfiles.json',1444 isArray(data) ? { files: data } : data,1445 options1446 );1447 return true;1448 };14491450 var removePrjEntityFiles = function (params, id, type, data, options) {1451 options = options || {};1452 if (typeof options === 'function') {1453 options = { success: options };1454 }1455 if (!options.hasOwnProperty('filter')) {1456 options.filter = {};1457 }1458 if (!options.filter.hasOwnProperty('entityType')) {1459 options.filter.entityType = type;1460 }14611462 addRequest(1463 null,1464 params,1465 REMOVE,1466 'project/' + id + '/entityfiles' + (isArray(data) ? 'many' : '') + '.json',1467 isArray(data) ? { files: data } : { entityType: type, fileid: data },1468 options1469 );1470 return true;1471 };14721473 var getPrjEntityFiles = function (params, id, type, options) {1474 options = options || {};1475 if (typeof options === 'function') {1476 options = { success: options };1477 }1478 if (!options.hasOwnProperty('filter')) {1479 options.filter = {};1480 }1481 if (!options.filter.hasOwnProperty('entityType')) {1482 options.filter.entityType = type;1483 }14841485 return addRequest(1486 null,1487 params,1488 GET,1489 'project/' + id + '/entityfiles.json',1490 null,1491 options1492 );1493 };14941495 var addPrjMilestone = function (params, id, data, options) {1496 addRequest(1497 customEvents.addPrjMilestone,1498 params,1499 ADD,1500 'project/' + id + '/milestone.json',1501 data,1502 options1503 );1504 return true;1505 };15061507 var updatePrjMilestone = function (params, id, data, options) {1508 var fldInd = 0,1509 updateItem = null,1510 event = customEvents.updatePrjMilestone;1511 for (var fld in data) {1512 if (data.hasOwnProperty(fld)) {1513 fldInd++;1514 switch (fld) {1515 case 'status':1516 event = customEvents.updatePrjMilestoneStatus;1517 updateItem = 'status';1518 break;1519 }1520 }1521 }1522 if (fldInd > 1) {1523 updateItem = null;1524 }15251526 addRequest(1527 event,1528 params,1529 UPDATE,1530 'project/milestone/' + id + (updateItem ? '/' + updateItem : '') + '.json',1531 data,1532 options1533 );1534 return true;1535 };15361537 var removePrjMilestone = function (id, options) {1538 addRequest(1539 customEvents.removePrjMilestone,1540 null,1541 REMOVE,1542 'project/milestone/' + id + '.json',1543 id,1544 options1545 );1546 return true;1547 };15481549 var removePrjMilestones = function (data, options) {1550 addRequest(1551 null,1552 null,1553 REMOVE,1554 'project/milestone.json',1555 data,1556 options1557 );1558 return true;1559 };15601561 var getPrjMilestone = function (params, id, options) {1562 return addRequest(1563 null,1564 params,1565 GET,1566 'project/milestone/' + id + '.json',1567 null,1568 options1569 );1570 };15711572 var getPrjMilestones = function (params, id, options) {1573 if (arguments.length < 3) {1574 options = arguments[1];1575 id = null;1576 }1577 var type = null;15781579 var _id = id, _type = type;1580 switch (id) {1581 case 'late':1582 _type = id;1583 _id = null;1584 break;1585 }15861587 if (id instanceof Date) {1588 _type = id.getFullYear() + '/' + (id.getMonth() + 1);1589 _id = null;1590 }15911592 id = _id;1593 type = _type;15941595 if (options && typeof options === 'object' && options.hasOwnProperty('filter')) {1596 var filter = options.filter;1597 filter.simple = true;1598 for (var fld in filter) {1599 switch (fld) {1600 case 'participant':1601 case 'tag':1602 case 'projectId':1603 case 'status':1604 case 'deadlineStart':1605 case 'deadlineStop':1606 case 'sortBy':1607 case 'sortOrder':1608 type = type || 'filter';1609 break;1610 }1611 }1612 }16131614 return addRequest(1615 null,1616 params,1617 GET,1618 'project' + (id ? '/' + id : '') + '/milestone' + (type ? '/' + type : '') + '.json',1619 null,1620 options1621 );1622 };16231624 var addPrjDiscussion = function (params, id, data, options) {1625 addRequest(1626 null,1627 params,1628 ADD,1629 'project/' + id + '/message.json',1630 data,1631 options1632 );1633 return true;1634 };16351636 var updatePrjDiscussion = function (params, id, data, options) {1637 addRequest(1638 null,1639 params,1640 UPDATE,1641 'project/message/' + id + '.json',1642 data,1643 options1644 );1645 return true;1646 };16471648 var updatePrjDiscussionStatus = function (params, id, data, options) {1649 addRequest(1650 null,1651 params,1652 UPDATE,1653 'project/message/' + id + '/status.json',1654 data,1655 options1656 );1657 return true;1658 };16591660 var removePrjDiscussion = function (params, id, options) {1661 addRequest(1662 null,1663 params,1664 REMOVE,1665 'project/message/' + id + '.json',1666 id,1667 options1668 );1669 return true;1670 };16711672 var getPrjDiscussion = function (params, id, options) {1673 return addRequest(1674 null,1675 params,1676 GET,1677 'project/message/' + id + '.json',1678 null,1679 options1680 );1681 };16821683 var getPrjDiscussions = function (params, options) {1684 var type = null;1685 if (options && typeof options === 'object' && options.hasOwnProperty('filter')) {1686 var filter = options.filter;1687 filter.simple = true;1688 for (var fld in filter) {1689 switch (fld) {1690 case 'participant':1691 case 'tag':1692 case 'projectId':1693 case 'sortBy':1694 case 'sortOrder':1695 type = type || 'filter';1696 break;1697 }1698 }1699 }17001701 return addRequest(1702 null,1703 params,1704 GET,1705 'project/message' + (type ? '/' + type : '') + '.json',1706 null,1707 options1708 );1709 };17101711 var subscribeToPrjDiscussion = function (params, id, options) {1712 return addRequest(1713 null,1714 params,1715 UPDATE,1716 'project/message/' + id + '/subscribe.json',1717 id,1718 options1719 );1720 };17211722 var getSubscribesToPrjDiscussion = function (params, id, options) {1723 return addRequest(1724 null,1725 params,1726 GET,1727 'project/message/' + id + '/subscribes.json',1728 id,1729 options1730 );1731 };17321733 var addPrjProject = function (params, data, options) {1734 addRequest(1735 null,1736 params,1737 ADD,1738 'project/withSecurity.json',1739 data,1740 options1741 );1742 return true;1743 };17441745 var updatePrjProject = function (params, id, data, options) {1746 var fldInd = 0,1747 updateItem = null;1748 for (var fld in data) {1749 if (data.hasOwnProperty(fld)) {1750 fldInd++;1751 switch (fld) {1752 case 'tags':1753 updateItem = 'tag';1754 break;1755 case 'status':1756 updateItem = 'status';1757 break;1758 }1759 }1760 }1761 if (fldInd > 1) {1762 updateItem = "withSecurityInfo";1763 }17641765 addRequest(1766 null,1767 params,1768 UPDATE,1769 'project/' + id + (updateItem ? '/' + updateItem : '') + '.json',1770 data,1771 options1772 );1773 return true;1774 };17751776 var updatePrjProjectStatus = function (params, id, data, options) {1777 addRequest(1778 customEvents.updatePrjProjectStatus,1779 params,1780 UPDATE,1781 'project/' + id + '/status.json',1782 data,1783 options1784 );1785 return true;1786 };17871788 var updatePrjProjectTags = function (id, data, options) {1789 addRequest(1790 null,1791 null,1792 UPDATE,1793 'project/' + id + '/tags.json',1794 data,1795 options1796 );1797 return true;1798 };17991800 var removeCaldavProjectCalendar = function (id, team){1801 var url = ASC.Resources.Master.ApiPath + "calendar/caldavprojcal.json";1802 var deleteData = {1803 calendarId: "Project_" + id,1804 team: team1805 };1806 jq.ajax({1807 type: 'delete',1808 url: url,1809 data: deleteData,1810 complete: function (d) { }1811 });1812 };18131814 var getCalendarCaldavUrl = function (calendarId) {1815 jq.ajax({1816 type: "get",1817 url: ASC.Resources.Master.ApiPath + "calendar/"+ calendarId + "/caldavurl.json",1818 complete: function (d) {1819 var data = jq.evalJSON(d.responseText);1820 if (data.status != 0) {1821 console.log('Get caldav url error');1822 }1823 }1824 });1825 };18261827 var removePrjProject = function (id, options) {1828 getPrjTeam({}, id,1829 function (params, team) {1830 removeCaldavProjectCalendar(id, jq.map(team, function (user) { return user.id; }));1831 }1832 );1833 addRequest(1834 customEvents.removePrjProject,1835 null,1836 REMOVE,1837 'project/' + id + '.json',1838 id,1839 options1840 );1841 return true;1842 };18431844 var removePrjProjects = function (data, options) {1845 for (var i = 0; i < data.projectids.length; i++) {1846 (function () {1847 var projectid = data.projectids[i];1848 getPrjTeam({}, projectid,1849 function (params, team) {1850 removeCaldavProjectCalendar(projectid, jq.map(team, function (user) { return user.id; }));1851 }1852 );1853 }());1854 }1855 addRequest(1856 customEvents.removePrjProjects,1857 null,1858 REMOVE,1859 'project.json',1860 data,1861 options1862 );1863 return true;1864 };18651866 var followingPrjProject = function (params, id, data, options) {1867 return addRequest(1868 null,1869 params,1870 UPDATE,1871 'project/' + id + '/follow.json',1872 data,1873 options1874 );1875 };18761877 var getPrjProject = function (params, id, options) {1878 return addRequest(1879 customEvents.getPrjProject,1880 params,1881 GET,1882 'project/' + id + '.json',1883 null,1884 options1885 );1886 };18871888 var getPrjProjects = function (params, type, options) {1889 if (arguments.length < 4) {1890 options = type;1891 type = null;1892 }18931894 var filter = null;1895 if (options && typeof options === 'object' && options.hasOwnProperty('filter')) {1896 filter = options.filter;1897 filter.simple = true;1898 for (var fld in filter) {1899 switch (fld) {1900 case 'tag':1901 case 'follow':1902 case 'status':1903 case 'participant':1904 case 'sortBy':1905 case 'sortOrder':1906 type = type || 'filter';1907 break;1908 }1909 }1910 }19111912 var query = getQuery(options);19131914 return addRequest(1915 null,1916 params,1917 GET,1918 'project' + (type ? '/' + type : '') + (query ? '/@search/' + query : '') + '.json',1919 null,1920 options1921 );1922 };19231924 var getPrjSelfProjects = function (params, options) {1925 return getPrjProjects(params, '@self', options);1926 };19271928 var getPrjFollowProjects = function (params, options) {1929 return getPrjProjects(params, '@follow', options);1930 };19311932 var getProjectsForCrmContact = function (params, contactid, options) {1933 return addRequest(1934 null,1935 params,1936 GET,1937 'project/contact/' + contactid + '.json',1938 null,1939 options1940 );1941 };19421943 var addProjectForCrmContact = function (params, projectid, data, options) {1944 return addRequest(1945 null,1946 params,1947 ADD,1948 'project/' + projectid + '/contact.json',1949 data,1950 options1951 );1952 };19531954 var removeProjectFromCrmContact = function (params, projectid, data, options) {1955 return addRequest(1956 null,1957 params,1958 REMOVE,1959 'project/' + projectid + '/contact.json',1960 data,1961 options1962 );1963 };19641965 var addPrjTaskComment = function (params, id, data, options) {1966 if (!data.parentid) {1967 data.parentid = '00000000-0000-0000-0000-000000000000';1968 }19691970 addRequest(1971 null,1972 params,1973 ADD,1974 'project/task/' + id + '/comment.json',1975 data,1976 options1977 );1978 return true;1979 };19801981 var getPrjTaskComments = function (params, id, options) {1982 return addRequest(1983 null,1984 params,1985 GET,1986 'project/task/' + id + '/comment.json',1987 null,1988 options1989 );1990 };19911992 var addPrjDiscussionComment = function (params, id, data, options) {1993 if (!data.parentid) {1994 data.parentid = '00000000-0000-0000-0000-000000000000';1995 }19961997 addRequest(1998 null,1999 params,2000 ADD,2001 'project/message/' + id + '/comment.json',2002 data,2003 options2004 );2005 return true;2006 };20072008 var getPrjDiscussionComments = function (params, id, options) {2009 return addRequest(2010 null,2011 params,2012 GET,2013 'project/message/' + id + '/comment.json',2014 null,2015 options2016 );2017 };20182019 var getPrjDiscussionPreview = function (params, htmltext, options) {2020 return addRequest(2021 null,2022 params,2023 ADD,2024 'project/message/discussion/preview.json',2025 { htmltext: htmltext },2026 options2027 );2028 };20292030 var getPrjCommentPreview = function (params, commentid, htmltext, options) {2031 return addRequest(2032 null,2033 params,2034 ADD,2035 'project/comment/preview.json',2036 { commentid: commentid, htmltext: htmltext },2037 options2038 );2039 };2040 var getWikiCommentPreview = function (params, commentid, htmltext, options) {2041 return addRequest(2042 null,2043 params,2044 ADD,2045 'community/wiki/comment/preview.json',2046 { commentid: commentid, htmltext: htmltext },2047 options2048 );2049 };20502051 var getBlogCommentPreview = function (params, commentid, htmltext, options) {2052 return addRequest(2053 null,2054 params,2055 ADD,2056 'community/blog/comment/preview.json',2057 { commentid: commentid, htmltext: htmltext },2058 options2059 );2060 };2061 var getNewsCommentPreview = function (params, commentid, htmltext, options) {2062 return addRequest(2063 null,2064 params,2065 ADD,2066 'community/event/comment/preview.json',2067 { commentid: commentid, htmltext: htmltext },2068 options2069 );2070 };2071 var getBookmarksCommentPreview = function (params, commentid, htmltext, options) {2072 return addRequest(2073 null,2074 params,2075 ADD,2076 'community/bookmark/comment/preview.json',2077 { commentid: commentid, htmltext: htmltext },2078 options2079 );2080 };208120822083 var removePrjComment = function (params, id, options) {2084 addRequest(2085 null,2086 params,2087 REMOVE,2088 'project/comment/' + id + '.json',2089 null,2090 options2091 );2092 return true;2093 };20942095 var removeWikiComment = function (params, id, options) {2096 addRequest(2097 null,2098 params,2099 REMOVE,2100 'community/wiki/comment/' + id + '.json',2101 null,2102 options2103 );2104 return true;2105 };21062107 var removeBlogComment = function (params, id, options) {2108 addRequest(2109 null,2110 params,2111 REMOVE,2112 'community/blog/comment/' + id + '.json',2113 null,2114 options2115 );2116 return true;2117 };21182119 var removeNewsComment = function (params, id, options) {2120 addRequest(2121 null,2122 params,2123 REMOVE,2124 'community/event/comment/' + id + '.json',2125 null,2126 options2127 );2128 return true;2129 };21302131 var removeBookmarksComment = function (params, id, options) {2132 addRequest(2133 null,2134 params,2135 REMOVE,2136 'community/bookmark/comment/' + id + '.json',2137 null,2138 options2139 );2140 return true;2141 };21422143 var addPrjComment = function (params, data, options) {2144 addRequest(2145 customEvents.addPrjComment,2146 params,2147 ADD,2148 'project/comment.json',2149 data,2150 options2151 );2152 return true;2153 };21542155 var addWikiComment = function (params, data, options) {2156 addRequest(2157 null,2158 params,2159 ADD,2160 'community/wiki/comment.json',2161 data,2162 options2163 );2164 return true;2165 };21662167 var addBlogComment = function (params, data, options) {2168 addRequest(2169 null,2170 params,2171 ADD,2172 'community/blog/comment.json',2173 data,2174 options2175 );2176 return true;2177 };21782179 var addNewsComment = function (params, data, options) {2180 addRequest(2181 null,2182 params,2183 ADD,2184 'community/event/comment.json',2185 data,2186 options2187 );2188 return true;2189 };21902191 var addBookmarksComment = function (params, data, options) {2192 addRequest(2193 null,2194 params,2195 ADD,2196 'community/bookmark/comment.json',2197 data,2198 options2199 );2200 return true;2201 };220222032204 var updatePrjComment = function (params, commentid, data, options) {2205 addRequest(2206 null,2207 params,2208 UPDATE,2209 'project/comment/' + commentid + '.json',2210 data,2211 options2212 );2213 return true;2214 };22152216 var updateWikiComment = function (params, commentid, data, options) {2217 addRequest(2218 null,2219 params,2220 UPDATE,2221 'community/wiki/comment/' + commentid + '.json',2222 data,2223 options2224 );2225 return true;2226 };22272228 var updateBlogComment = function (params, commentid, data, options) {2229 addRequest(2230 null,2231 params,2232 UPDATE,2233 'community/blog/comment/' + commentid + '.json',2234 data,2235 options2236 );2237 return true;2238 };22392240 var updateNewsComment = function (params, commentid, data, options) {2241 addRequest(2242 null,2243 params,2244 UPDATE,2245 'community/event/comment/' + commentid + '.json',2246 data,2247 options2248 );2249 return true;2250 };22512252 var updateBookmarksComment = function (params, commentid, data, options) {2253 addRequest(2254 null,2255 params,2256 UPDATE,2257 'community/bookmark/comment/' + commentid + '.json',2258 data,2259 options2260 );2261 return true;2262 };22632264 var fckeRemoveCommentComplete = function (params, data, options) {2265 addRequest(2266 null,2267 params,2268 UPDATE,2269 'portal/fcke/comment/removecomplete.json',2270 data,2271 options2272 );2273 return true;2274 };22752276 var fckeCancelCommentComplete = function (params, data, options) {2277 addRequest(2278 null,2279 params,2280 UPDATE,2281 'portal/fcke/comment/cancelcomplete.json',2282 data,2283 options2284 );2285 return true;2286 };22872288 var fckeEditCommentComplete = function (params, data, options) {2289 addRequest(2290 null,2291 params,2292 UPDATE,2293 'portal/fcke/comment/editcomplete.json',2294 data,2295 options2296 );2297 return true;2298 };22992300 var getShortenLink = function (params, link, options) {2301 return addRequest(2302 null,2303 params,2304 UPDATE,2305 'portal/getshortenlink.json',2306 { link: link },2307 options2308 );2309 };23102311 var updatePortalName = function (params, alias, options) {2312 addRequest(2313 null,2314 params,2315 UPDATE,2316 'portal/portalrename.json',2317 { alias: alias },2318 options2319 );2320 return true;2321 };232223232324 var addPrjProjectTeamPerson = function (params, id, data, options) {2325 addRequest(2326 null,2327 params,2328 ADD,2329 'project/' + id + '/team.json',2330 data,2331 options2332 );2333 return true;2334 };23352336 var removePrjProjectTeamPerson = function (params, id, data, options) {2337 removeCaldavProjectCalendar(id, params.userId);2338 addRequest(2339 customEvents.removePrjTeam,2340 params,2341 REMOVE,2342 'project/' + id + '/team.json',2343 data,2344 options2345 );2346 return true;2347 };23482349 var getPrjProjectTeamPersons = function (params, id, options) {2350 return addRequest(2351 null,2352 params,2353 GET,2354 'project/' + id + '/team.json',2355 null,2356 options2357 );2358 };23592360 var getPrjProjectFiles = function (params, id, options) {2361 return addRequest(2362 null,2363 params,2364 GET,2365 'project/' + id + '/entityfiles.json',2366 null,2367 options2368 );2369 };23702371 // tasks index for gantt2372 var getPrjGanttIndex = function (params, id, options) {2373 return addRequest(2374 null,2375 params,2376 GET,2377 'project/' + id + '/order.json',2378 null,2379 options2380 );2381 };23822383 var setPrjGanttIndex = function (params, id, data, options) {2384 addRequest(2385 null,2386 params,2387 UPDATE,2388 'project/' + id + '/order.json',2389 data,2390 options2391 );2392 return true;2393 };23942395 // time-traking23962397 var addPrjTime = function (params, taskid, data, options) {2398 addRequest(2399 null,2400 params,2401 ADD,2402 'project/task/' + taskid + '/time.json',2403 data,2404 options2405 );2406 return true;2407 };24082409 var getPrjTime = function (params, options) {2410 return getPrjTaskTime(params, null, options);2411 };24122413 var getPrjTimeById = function (params, projectId, options) {2414 return addRequest(2415 null,2416 params,2417 GET,2418 'project/' + projectId + '/time/total.json',2419 null,2420 options2421 );2422 };24232424 var getPrjTaskTime = function (params, taskid, options) {24252426 if (!taskid || !options) {2427 var filter = null, _taskid = null, _options = null;2428 for (var i = 2, n = arguments.length; i < n; i++) {2429 _options = _options || (typeof arguments[i] === 'function' || typeof arguments[i] === 'object' ? arguments[i] : _options);2430 _taskid = _taskid || (isFinite(+arguments[i]) ? +arguments[i] : _taskid);2431 }24322433 options = _options;2434 taskid = _taskid;2435 }2436 if (options && typeof options === 'object' && options.hasOwnProperty('filter')) {2437 filter = options.filter;2438 }24392440 return addRequest(2441 null,2442 params,2443 GET,2444 'project' + (taskid ? '/task/' + taskid : '') + '/time' + (filter ? '/filter' : '') + '.json',2445 null,2446 options2447 );2448 };2449 2450 var getTotalTimeByFilter = function (params, options) {2451 var data = null;2452 if (options && typeof options === 'object' && options.hasOwnProperty('filter')) {2453 data = options.filter;2454 }2455 return addRequest(2456 null,2457 params,2458 GET,2459 'project/time/filter/total.json',2460 null,2461 options2462 );2463 };24642465 var updatePrjTime = function (params, id, data, options) {2466 addRequest(2467 customEvents.updatePrjTime,2468 params,2469 UPDATE,2470 'project/time/' + id + '.json',2471 data,2472 options2473 );2474 return true;2475 };24762477 var changePaymentStatus = function (params, data, options) {2478 addRequest(2479 null,2480 params,2481 UPDATE,2482 'project/time/times/status.json',2483 data,2484 options2485 );2486 return true;2487 };24882489 var removePrjTime = function (params, data, options) {2490 addRequest(2491 customEvents.removePrjTime,2492 params,2493 REMOVE,2494 'project/time/times/remove.json',2495 data,2496 options2497 );2498 return true;2499 };25002501 // project templates25022503 var getPrjTemplates = function (params, options) {2504 addRequest(2505 null,2506 params,2507 GET,2508 'project/template.json',2509 null,2510 options2511 );2512 return true;2513 };25142515 var getPrjTemplate = function (params, id, options) {2516 addRequest(2517 null,2518 params,2519 GET,2520 'project/template/' + id + '.json',2521 null,2522 options2523 );2524 return true;2525 };25262527 var updatePrjTemplate = function (params, id, data, options) {2528 addRequest(2529 null,2530 params,2531 UPDATE,2532 'project/template/' + id + '.json',2533 data,2534 options2535 );2536 return true;2537 };25382539 var createPrjTemplate = function (params, data, options) {2540 addRequest(2541 null,2542 params,2543 ADD,2544 'project/template.json',2545 data,2546 options2547 );2548 return true;2549 };25502551 var removePrjTemplate = function (params, id, options) {2552 addRequest(2553 null,2554 params,2555 REMOVE,2556 'project/template/' + id + '.json',2557 null,2558 options2559 );2560 return true;2561 };25622563 //activities2564 var getPrjActivities = function (params, options) {2565 return addRequest(2566 null,2567 params,2568 GET,2569 'project/activities/filter.json',2570 null,2571 options2572 );2573 };25742575 //import2576 var checkPrjImportQuota = function (params, data, options) {2577 return addRequest(2578 null,2579 params,2580 ADD,2581 'project/import/quota.json',2582 data,2583 options2584 );2585 };2586 var addPrjImport = function (params, data, options) {2587 return addRequest(2588 null,2589 params,2590 ADD,2591 'project/import.json',2592 data,2593 options2594 );2595 };2596 var getPrjImport = function (params, options) {2597 return addRequest(2598 null,2599 params,2600 GET,2601 'project/import.json',2602 null,2603 options2604 );2605 };2606 var getPrjImportProjects = function (params, data, options) {2607 return addRequest(2608 null,2609 params,2610 ADD,2611 'project/import/projects.json',2612 data,2613 options2614 );2615 };2616 //reports2617 var getPrjReportTemplate = function (params, id, options) {2618 return addRequest(2619 null,2620 params,2621 GET,2622 'project/report/' + id + '.json',2623 null,2624 options2625 );2626 };2627 var addPrjReportTemplate = function (params, data, options) {2628 return addRequest(2629 null,2630 params,2631 ADD,2632 'project/report.json',2633 data,2634 options2635 );2636 };2637 var updatePrjReportTemplate = function (params, id, data, options) {2638 return addRequest(2639 null,2640 params,2641 UPDATE,2642 'project/report/' + id + '.json',2643 data,2644 options2645 );2646 };2647 var deletePrjReportTemplate = function (params, id, options) {2648 return addRequest(2649 null,2650 params,2651 REMOVE,2652 'project/report/' + id + '.json',2653 null,2654 options2655 );2656 };26572658 var generateProjectsReport = function (data, options) {2659 addRequest(2660 null,2661 null,2662 ADD,2663 'project/report/create.json',2664 data,2665 options2666 );2667 };26682669 var terminateProjectsReport = function (options) {2670 addRequest(2671 null,2672 null,2673 GET,2674 'project/report/terminate.json',2675 null,2676 options2677 );2678 };26792680 var getProjectsReportStatus = function (options) {2681 addRequest(2682 null,2683 null,2684 GET,2685 'project/report/status.json',2686 null,2687 options2688 );2689 };26902691 var getProjectsReports = function (options) {2692 addRequest(2693 null,2694 null,2695 GET,2696 'project/report/files.json',2697 null,2698 options2699 );2700 };27012702 var removeProjectsReport = function (id, options) {2703 return addRequest(2704 null,2705 null,2706 REMOVE,2707 'project/report/files/' + id + '.json',2708 null,2709 options2710 );2711 };27122713 // upload files2714 var uploadFilesToPrjEntity = function (params, entityId, data, options) {2715 return helper.uploader(2716 null,2717 params,2718 'file',2719 'project/' + entityId + '/entityfiles/upload.tml',2720 data,2721 options2722 );2723 };27242725 var addPrjTag = function (params, data, options) {2726 addRequest(2727 null,2728 params,2729 ADD,2730 'project/tag.json',2731 data,2732 options2733 );2734 return true;2735 };27362737 /* </projects> */27382739 /* <documents> */2740 var createDocUploadFile = function (params, id, data, options) {2741 return helper.uploader(2742 null,2743 params,2744 'file',2745 'files/' + id + '/upload.tml',2746 data,2747 options2748 );2749 };27502751 var addDocFile = function (params, id, type, data, options) {2752 addRequest(2753 null,2754 params,2755 ADD,2756 'files/' + id + (type ? '/' + type : '') + '.json',2757 data,2758 options2759 );2760 return true;2761 };27622763 var updateFileStream = function (params, data, options) {2764 return addRequest(2765 null,2766 params,2767 UPDATE,2768 'files/' + params.fileId + '/update.json?encrypted=' + params.encrypted + '&forcesave=' + params.forcesave,2769 data,2770 options2771 );2772 };27732774 var getDocFile = function (params, id, options) {2775 return addRequest(2776 null,2777 params,2778 GET,2779 'files/file/' + id + '.json',2780 null,2781 options2782 );2783 };27842785 var addDocFolder = function (params, id, data, options) {2786 addRequest(2787 null,2788 params,2789 ADD,2790 'files/' + id + '.json',2791 data,2792 options2793 );2794 return true;2795 };27962797 var getDocFolder = function (params, id, options) {2798 return addRequest(2799 customEvents.getDocFolder,2800 params,2801 GET,2802 'files/' + id + '.json',2803 null,2804 options2805 );2806 };28072808 var removeDocFile = function (params, id, options) {2809 return addRequest(2810 null,2811 params,2812 REMOVE,2813 'files/file/' + id + '.json',2814 null,2815 options2816 );2817 };28182819 var createDocUploadSession = function (params, id, data, options) {2820 return addRequest(2821 null,2822 params,2823 ADD,2824 'files/' + id + '/upload/create_session.json',2825 data,2826 options2827 );2828 };28292830 var getFolderPath = function (id, options) {2831 return addRequest(2832 null,2833 null,2834 GET,2835 'files/folder/' + id + '/path.json',2836 null,2837 options2838 );2839 };28402841 var getFileSecurityInfo = function (id, options) {2842 return addRequest(2843 null,2844 null,2845 GET,2846 'files/file/' + id + '/share.json',2847 null,2848 options2849 );2850 };28512852 var generateSharedLink = function (id, data, options) {2853 return addRequest(2854 null,2855 null,2856 UPDATE,2857 'files/' + id + '/sharedlink.json',2858 data,2859 options2860 );2861 };28622863 var copyBatchItems = function (data, options) {2864 return addRequest(2865 null,2866 null,2867 UPDATE,2868 'files/fileops/copy.json',2869 data,2870 options2871 );2872 };28732874 var getOperationStatuses = function (options) {2875 return addRequest(2876 null,2877 null,2878 GET,2879 'files/fileops.json',2880 null,2881 options2882 );2883 };28842885 var saveDocServiceUrl = function (docServiceUrl, docServiceUrlInternal, docServiceUrlPortal, options) {2886 return addRequest(2887 null,2888 null,2889 UPDATE,2890 'files/docservice.json',2891 {2892 docServiceUrl: docServiceUrl,2893 docServiceUrlInternal: docServiceUrlInternal,2894 docServiceUrlPortal: docServiceUrlPortal,2895 },2896 options2897 );2898 };28992900 var filesStoreOriginal = function (set, options) {2901 return addRequest(2902 null,2903 null,2904 UPDATE,2905 "files/storeoriginal.json",2906 {2907 set: set2908 },2909 options2910 );2911 };29122913 var hideConfirmConvert = function (save, options) {2914 return addRequest(2915 null,2916 null,2917 UPDATE,2918 "files/hideconfirmconvert.json",2919 {2920 save: save2921 },2922 options2923 );2924 };29252926 var filesDisplayRecent = function (set, options) {2927 return addRequest(2928 null,2929 null,2930 UPDATE,2931 "files/displayrecent.json",2932 {2933 set: set2934 },2935 options2936 );2937 };29382939 var filesDisplayFavorites = function (set, options) {2940 return addRequest(2941 null,2942 null,2943 UPDATE,2944 "files/settings/favorites.json",2945 {2946 set: set2947 },2948 options2949 );2950 };29512952 var addFilesFavorites = function (params, data, options) {2953 addRequest(2954 null,2955 params,2956 ADD,2957 'files/favorites.json',2958 data,2959 options2960 );2961 return true;2962 };29632964 var removeFilesFavorites = function (params, data, options) {2965 addRequest(2966 null,2967 params,2968 REMOVE,2969 'files/favorites.json',2970 data,2971 options2972 );2973 return true;2974 };29752976 var filesDisplayTemplates = function (set, options) {2977 return addRequest(2978 null,2979 null,2980 UPDATE,2981 "files/settings/templates.json",2982 {2983 set: set2984 },2985 options2986 );2987 };29882989 var addFilesTemplates = function (params, data, options) {2990 addRequest(2991 null,2992 params,2993 ADD,2994 'files/templates.json',2995 data,2996 options2997 );2998 return true;2999 };30003001 var removeFilesTemplates = function (params, data, options) {3002 addRequest(3003 null,3004 params,3005 REMOVE,3006 'files/templates.json',3007 data,3008 options3009 );3010 return true;3011 };30123013 var createThumbnails = function (params, data, options) {3014 addRequest(3015 null,3016 params,3017 ADD,3018 'files/thumbnails.json',3019 data,3020 options3021 );3022 return true;3023 };30243025 var createFile = function (params, folderId, data, options) {3026 addRequest(3027 null,3028 params,3029 ADD,3030 'files/' + folderId + '/file.json',3031 {3032 title: data.fileTitle,3033 templateId: data.templateId3034 },3035 options3036 );3037 return true;3038 };30393040 var filesDownloadTarGz = function (set, options) {3041 return addRequest(3042 null,3043 null,3044 UPDATE,3045 "files/settings/downloadtargz.json",3046 {3047 set: set3048 },3049 options3050 );3051 };30523053 var copyDocFileAs = function (params, id, data, options) {3054 return addRequest(3055 null,3056 params,3057 ADD,3058 'files/file/' + id + '/copyas.json',3059 data,3060 options3061 );3062 };30633064 /* </documents> */30653066 /* <crm> */3067 var createCrmUploadFile = function (params, type, id, data, options) {3068 return helper.uploader(3069 null,3070 params,3071 'file',3072 'crm/' + type + '/' + id + '/files/upload.tml',3073 data,3074 options3075 );3076 };30773078 var getCrmContactInfo = function (params, contactid, options) {3079 addRequest(3080 null,3081 params,3082 GET,3083 'crm/contact/' + contactid + '/data.json',3084 null,3085 options3086 );3087 return true;3088 };30893090 var addCrmContactInfo = function (params, contactid, data, options) {3091 addRequest(3092 null,3093 params,3094 ADD,3095 'crm/contact/' + contactid + '/data.json',3096 data,3097 options3098 );3099 return true;3100 };31013102 var updateCrmContactInfo = function (params, contactid, data, options) {3103 addRequest(3104 null,3105 params,3106 UPDATE,3107 'crm/contact/' + contactid + '/data/' + data.id + '.json',3108 data,3109 options3110 );3111 return true;3112 };31133114 var deleteCrmContactInfo = function (params, contactid, id, options) {3115 addRequest(3116 null,3117 params,3118 REMOVE,3119 'crm/contact/' + contactid + '/data/' + id + '.json',3120 null,3121 options3122 );3123 return true;3124 };31253126 var addCrmContactData = function (params, id, data, options) {3127 addRequest(3128 null,3129 params,3130 ADD,3131 'crm/contact/' + id + '/batch.json',3132 isArray(data) ? { data: data } : data,3133 options3134 );3135 return true;3136 };31373138 var updateCrmContactData = function (params, id, data, options) {3139 addRequest(3140 null,3141 params,3142 UPDATE,3143 'crm/contact/' + id + '/batch.json',3144 isArray(data) ? { data: data } : data,3145 options3146 );3147 return true;3148 };31493150 var addCrmContactTwitter = function (params, contactid, data, options) {3151 addRequest(3152 null,3153 params,3154 ADD,3155 'crm/contact/' + contactid + '/data.json',3156 data,3157 options3158 );3159 return true;3160 };31613162 var addCrmEntityNote = function (params, type, id, data, options) {3163 addRequest(3164 null,3165 params,3166 ADD,3167 'crm/' + type + '/' + id + '/files/text.json',3168 data,3169 options3170 );3171 return true;3172 };31733174 var addCrmContact = function (params, isCompany, data, options) {3175 if (isCompany === true) {3176 return addCrmCompany(params, data, options);3177 } else {3178 return addCrmPerson(params, data, options);3179 }3180 };31813182 var addCrmCompany = function (params, data, options) {3183 addRequest(3184 null,3185 params,3186 ADD,3187 'crm/contact/company' + (isArray(data) ? '/quick' : '') + '.json',3188 isArray(data) ? { data: data } : data,3189 options3190 );3191 return true;3192 };31933194 var updateCrmCompany = function (params, id, data, options) {3195 addRequest(3196 null,3197 params,3198 UPDATE,3199 'crm/contact/company/' + id + '.json',3200 data,3201 options3202 );3203 return true;3204 };32053206 var updateCrmCompanyContactStatus = function (params, id, data, options) {3207 addRequest(3208 null,3209 params,3210 UPDATE,3211 'crm/contact/company/' + id + '/status.json',3212 data,3213 options3214 );3215 return true;3216 };32173218 var updateCrmPersonContactStatus = function (params, id, data, options) {3219 addRequest(3220 null,3221 params,3222 UPDATE,3223 'crm/contact/person/' + id + '/status.json',3224 data,3225 options3226 );3227 return true;3228 };32293230 var updateCrmContactContactStatus = function (params, id, data, options) {3231 addRequest(3232 null,3233 params,3234 UPDATE,3235 'crm/contact/' + id + '/status.json',3236 data,3237 options3238 );3239 return true;3240 };32413242 var addCrmPerson = function (params, data, options) {3243 addRequest(3244 null,3245 params,3246 ADD,3247 'crm/contact/person' + (isArray(data) ? '/quick' : '') + '.json',3248 isArray(data) ? { data: data } : data,3249 options3250 );3251 return true;3252 };32533254 var updateCrmPerson = function (params, id, data, options) {3255 addRequest(3256 null,3257 params,3258 UPDATE,3259 'crm/contact/person/' + id + '.json',3260 data,3261 options3262 );3263 return true;3264 };32653266 var removeCrmContact = function (params, ids, options) {3267 var isNumberOrString = ids && (typeof ids === 'number' || typeof ids === 'string');3268 var isObject = ids && typeof ids === 'object';3269 addRequest(3270 null,3271 params,3272 isNumberOrString ? REMOVE : UPDATE,3273 'crm/contact' + (isNumberOrString ? '/' + ids : '') + '.json',3274 isObject ? { contactids: ids } : null,3275 options3276 );3277 return true;3278 };32793280 var mergeCrmContacts = function (params, data, options) {3281 addRequest(3282 null,3283 params,3284 UPDATE,3285 'crm/contact/merge.json',3286 data,3287 options3288 );3289 return true;3290 };32913292 var getCrmContactsForProject = function (params, id, options) {3293 return addRequest(3294 customEvents.getCrmContactsForProject,3295 params,3296 GET,3297 'crm/contact/project/' + id + '.json',3298 null,3299 options3300 );3301 };33023303 var addCrmTag = function (params, type, ids, tagname, options) {3304 addRequest(3305 null,3306 params,3307 ADD,3308 'crm/' + type + (typeof ids === 'object' ? '/taglist' : '/' + ids + '/tag') + '.json',3309 { entityid: ids, tagName: tagname },3310 options3311 );3312 return true;3313 };33143315 var addCrmContactTagToGroup = function (params, type, id, tagname, options) {3316 addRequest(3317 null,3318 params,3319 ADD,3320 'crm/' + type + '/' + id + '/tag/group.json',3321 { entityid: id, entityType: type, tagName: tagname },3322 options3323 );3324 return true;3325 };33263327 var deleteCrmContactTagFromGroup = function (params, type, id, tagname, options) {3328 addRequest(3329 null,3330 params,3331 REMOVE,3332 'crm/' + type + '/' + id + '/tag/group.json',3333 { entityid: id, entityType: type, tagName: tagname },3334 options3335 );3336 return true;3337 };33383339 var removeCrmTag = function (params, type, id, tagname, options) {3340 addRequest(3341 null,3342 params,3343 REMOVE,3344 'crm/' + type + '/' + id + '/tag.json',3345 { tagName: tagname },3346 options3347 );3348 return true;3349 };33503351 var getCrmTags = function (params, type, id, options) {3352 return addRequest(3353 null,3354 params,3355 GET,3356 'crm/' + type + '/' + id + '/tag.json',3357 null,3358 options3359 );3360 };33613362 var getCrmEntityTags = function (params, type, options) {3363 addRequest(3364 null,3365 params,3366 GET,3367 'crm/' + type + '/tag.json',3368 null,3369 options3370 );3371 return true;3372 };33733374 var addCrmEntityTag = function (params, type, tagname, options) {3375 addRequest(3376 null,3377 params,3378 ADD,3379 'crm/' + type + '/tag.json',3380 { entityType: type, tagName: tagname },3381 options3382 );3383 return true;3384 };33853386 var removeCrmEntityTag = function (params, type, tagname, options) {3387 addRequest(3388 null,3389 params,3390 REMOVE,3391 'crm/' + type + '/tag.json',3392 { tagName: tagname },3393 options3394 );3395 return true;3396 };33973398 var removeCrmUnusedTag = function (params, type, options) {3399 addRequest(3400 null,3401 params,3402 REMOVE,3403 'crm/' + type + '/tag/unused.json',3404 null,3405 options3406 );3407 return true;3408 };34093410 var getCrmCustomFields = function (params, type, options) {3411 addRequest(3412 null,3413 params,3414 GET,3415 'crm/' + type + '/customfield/definitions.json',3416 null,3417 options3418 );3419 return true;3420 };34213422 var addCrmCustomField = function (params, type, data, options) {3423 addRequest(3424 null,3425 params,3426 ADD,3427 'crm/' + type + '/customfield.json',3428 data,3429 options3430 );3431 return true;3432 };34333434 var updateCrmCustomField = function (params, type, id, data, options) {3435 addRequest(3436 null,3437 params,3438 UPDATE,3439 'crm/' + type + '/customfield/' + id + '.json',3440 data,3441 options3442 );3443 return true;3444 };34453446 var removeCrmCustomField = function (params, type, id, options) {3447 addRequest(3448 null,3449 params,3450 REMOVE,3451 'crm/' + type + '/customfield/' + id + '.json',3452 null,3453 options3454 );3455 return true;3456 };34573458 var reorderCrmCustomFields = function (params, type, ids, options) {3459 addRequest(3460 null,3461 params,3462 UPDATE,3463 'crm/' + type + '/customfield/reorder.json',3464 { fieldids: ids, entityType: type },3465 options3466 );3467 return true;3468 };34693470 var getCrmDealMilestones = function (params, options) {3471 addRequest(3472 null,3473 params,3474 GET,3475 'crm/opportunity/stage.json',3476 null,3477 options3478 );3479 return true;3480 };34813482 var addCrmDealMilestone = function (params, data, options) {3483 addRequest(3484 null,3485 params,3486 ADD,3487 'crm/opportunity/stage.json',3488 data,3489 options3490 );3491 return true;3492 };34933494 var updateCrmDealMilestone = function (params, id, data, options) {3495 addRequest(3496 null,3497 params,3498 UPDATE,3499 'crm/opportunity/stage/' + id + '.json',3500 data,3501 options3502 );3503 return true;3504 };35053506 var updateCrmDealMilestoneColor = function (params, id, data, options) {3507 addRequest(3508 null,3509 params,3510 UPDATE,3511 'crm/opportunity/stage/' + id + '/color.json',3512 data,3513 options3514 );3515 return true;3516 };35173518 var removeCrmDealMilestone = function (params, id, options) {3519 addRequest(3520 null,3521 params,3522 REMOVE,3523 'crm/opportunity/stage/' + id + '.json',3524 null,3525 options3526 );3527 return true;3528 };35293530 var reorderCrmDealMilestones = function (params, ids, options) {3531 addRequest(3532 null,3533 params,3534 UPDATE,3535 'crm/opportunity/stage/reorder.json',3536 { ids: ids },3537 options3538 );3539 return true;3540 };35413542 var addCrmContactStatus = function (params, data, options) {3543 addRequest(3544 null,3545 params,3546 ADD,3547 'crm/contact/status.json',3548 data,3549 options3550 );3551 return true;3552 };35533554 var updateCrmContactStatus = function (params, id, data, options) {3555 addRequest(3556 null,3557 params,3558 UPDATE,3559 'crm/contact/status/' + id + '.json',3560 data,3561 options3562 );3563 return true;3564 };35653566 var updateCrmContactStatusColor = function (params, id, data, options) {3567 addRequest(3568 null,3569 params,3570 UPDATE,3571 'crm/contact/status/' + id + '/color.json',3572 data,3573 options3574 );3575 return true;3576 };35773578 var removeCrmContactStatus = function (params, id, options) {3579 addRequest(3580 null,3581 params,3582 REMOVE,3583 'crm/contact/status/' + id + '.json',3584 null,3585 options3586 );3587 return true;3588 };358935903591 var addCrmContactType = function (params, data, options) {3592 addRequest(3593 null,3594 params,3595 ADD,3596 'crm/contact/type.json',3597 data,3598 options3599 );3600 return true;3601 };36023603 var updateCrmContactType = function (params, id, data, options) {3604 addRequest(3605 null,3606 params,3607 UPDATE,3608 'crm/contact/type/' + id + '.json',3609 data,3610 options3611 );3612 return true;3613 };36143615 var removeCrmContactType = function (params, id, options) {3616 addRequest(3617 null,3618 params,3619 REMOVE,3620 'crm/contact/type/' + id + '.json',3621 null,3622 options3623 );3624 return true;3625 };36263627 var getCrmListItem = function (params, type, options) {3628 var path = "";3629 switch (type) {3630 case 1:3631 //ContactStatus3632 path = 'crm/contact/status.json';3633 break;3634 case 2:3635 //TaskCategory3636 path = 'crm/task/category.json';3637 break;3638 case 3:3639 //HistoryCategory3640 path = 'crm/history/category.json';3641 break;3642 case 4:3643 //ContactType3644 path = 'crm/contact/type.json';3645 break;3646 default:3647 return false;3648 }36493650 addRequest(3651 null,3652 params,3653 GET,3654 path,3655 null,3656 options3657 );3658 return true;3659 };36603661 var addCrmListItem = function (params, type, data, options) {3662 var path = "";3663 switch (type) {3664 case 1:3665 //ContactStatus3666 path = 'crm/contact/status.json';3667 break;3668 case 2:3669 //TaskCategory3670 path = 'crm/task/category.json';3671 break;3672 case 3:3673 //HistoryCategory3674 path = 'crm/history/category.json';3675 break;3676 case 4:3677 //ContactType3678 path = 'crm/contact/type.json';3679 break;3680 default:3681 return false;3682 }36833684 addRequest(3685 null,3686 params,3687 ADD,3688 path,3689 data,3690 options3691 );3692 return true;3693 };36943695 var updateCrmListItem = function (params, type, id, data, options) {3696 var path = "";3697 switch (type) {3698 case 1:3699 //ContactStatus3700 path = 'crm/contact/status/' + id + '.json';3701 break;3702 case 2:3703 //TaskCategory3704 path = 'crm/task/category/' + id + '.json';3705 break;3706 case 3:3707 //HistoryCategory3708 path = 'crm/history/category/' + id + '.json';3709 break;3710 case 4:3711 //ContactType3712 path = 'crm/contact/type/' + id + '.json';3713 break;3714 default:3715 return false;3716 }37173718 addRequest(3719 null,3720 params,3721 UPDATE,3722 path,3723 data,3724 options3725 );3726 return true;3727 };37283729 var updateCrmListItemIcon = function (params, type, id, data, options) {3730 var path = "";3731 switch (type) {3732 case 2:3733 //TaskCategory3734 path = 'crm/task/category/' + id + '/icon.json';3735 break;3736 case 3:3737 //HistoryCategory3738 path = 'crm/history/category/' + id + '/icon.json';3739 break;3740 default:3741 return false;3742 }37433744 addRequest(3745 null,3746 params,3747 UPDATE,3748 path,3749 data,3750 options3751 );3752 return true;3753 };37543755 var removeCrmListItem = function (params, type, id, toid, options) {3756 var path = "",3757 data = {3758 newcategoryid: toid3759 };3760 switch (type) {3761 case 1:3762 //ContactStatus3763 path = 'crm/contact/status/' + id + '.json';3764 break;3765 case 2:3766 //TaskCategory3767 path = 'crm/task/category/' + id + '.json';3768 break;3769 case 3:3770 //HistoryCategory3771 path = 'crm/history/category/' + id + '.json';3772 break;3773 case 4:3774 //ContactType3775 path = 'crm/contact/type/' + id + '.json';3776 break;3777 default:3778 return false;3779 }37803781 addRequest(3782 null,3783 params,3784 REMOVE,3785 path,3786 data,3787 options3788 );3789 return true;3790 };37913792 var reorderCrmListItems = function (params, type, titles, options) {3793 var path = "";3794 switch (type) {3795 case 1:3796 //ContactStatus3797 path = 'crm/contact/status/reorder.json';3798 break;3799 case 2:3800 //TaskCategory3801 path = 'crm/task/category/reorder.json';3802 break;3803 case 3:3804 //HistoryCategory3805 path = 'crm/history/category/reorder.json';3806 break;3807 case 4:3808 //ContactType3809 path = 'crm/contact/type/reorder.json';3810 break;3811 default:3812 return false;3813 }38143815 addRequest(3816 null,3817 params,3818 UPDATE,3819 path,3820 { titles: titles },3821 options3822 );3823 return true;3824 };38253826 var addCrmTask = function (params, data, options) {3827 addRequest(3828 null,3829 params,3830 ADD,3831 'crm/task.json',3832 data,3833 options3834 );3835 return true;3836 };38373838 var addCrmTaskGroup = function (params, data, options) {3839 addRequest(3840 null,3841 params,3842 ADD,3843 'crm/contact/task/group.json',3844 data,3845 options3846 );3847 return true;3848 };38493850 var getCrmTask = function (params, id, options) {3851 return addRequest(3852 null,3853 params,3854 GET,3855 'crm/task/' + id + '.json',3856 null,3857 options3858 );3859 };38603861 var updateCrmTask = function (params, id, data, options) {3862 var isUpdateStatusAction = data.hasOwnProperty('isClosed');38633864 if (isUpdateStatusAction) {3865 addRequest(3866 null,3867 params,3868 UPDATE,3869 !!data.isClosed ? 'crm/task/' + id + '/close.json' : 'crm/task/' + id + '/reopen.json',3870 data,3871 options3872 );3873 } else {3874 addRequest(3875 null,3876 params,3877 UPDATE,3878 'crm/task/' + id + '.json',3879 data,3880 options3881 );3882 }38833884 return true;3885 };38863887 var removeCrmTask = function (params, id, options) {3888 addRequest(3889 null,3890 params,3891 REMOVE,3892 'crm/task/' + id + '.json',3893 null,3894 options3895 );3896 return true;3897 };38983899 var addCrmContactForProject = function (params, type, entityid, id, data, options) {3900 addRequest(3901 customEvents.addCrmContactForProject,3902 params,3903 ADD,3904 'crm/contact/' + id + '/project/' + entityid + '.json',3905 data,3906 options3907 );3908 };39093910 var addCrmContactsForProject = function (params, projectid, data, options) {3911 addRequest(3912 null,3913 params,3914 ADD,3915 'crm/contact/project/' + projectid + '.json',3916 data,3917 options3918 );3919 };39203921 var removeCrmContactFromProject = function (params, type, entityid, id, options) {3922 addRequest(3923 customEvents.removeCrmContactFromProject,3924 params,3925 REMOVE,3926 'crm/contact/' + id + '/project/' + entityid + '.json',3927 null,3928 options3929 );3930 };39313932 var addCrmDealForContact = function (params, contactid, opportunityid, options) {3933 addRequest(3934 null,3935 params,3936 ADD,3937 'crm/contact/' + contactid + '/opportunity/' + opportunityid + '.json',3938 {3939 contactid: contactid,3940 opportunityid: opportunityid3941 },3942 options3943 );3944 };39453946 var removeCrmDealFromContact = function (params, contactid, opportunityid, options) {3947 addRequest(3948 null,3949 params,3950 REMOVE,3951 'crm/contact/' + contactid + '/opportunity/' + opportunityid + '.json',3952 {3953 contactid: contactid,3954 opportunityid: opportunityid3955 },3956 options3957 );3958 };39593960 var addCrmContactMember = function (params, type, entityid, id, data, options) {3961 addRequest(3962 null,3963 params,3964 ADD,3965 'crm/' + type + '/' + entityid + '/contact' + (type === 'opportunity' ? '/' + id : '') + '.json',3966 data,3967 options3968 );3969 };39703971 var removeCrmContactMember = function (params, type, entityid, id, options) {3972 addRequest(3973 null,3974 params,3975 REMOVE,3976 'crm/' + type + '/' + entityid + '/contact/' + id + '.json',3977 null,3978 options3979 );3980 };39813982 var getCrmContactMembers = function (params, type, id, options) {3983 return addRequest(3984 null,3985 params,3986 GET,3987 'crm/' + type + '/' + id + '/contact.json',3988 null,3989 options3990 );3991 };39923993 var addCrmPersonMember = function (params, type, entityid, id, data, options) {3994 addRequest(3995 null,3996 params,3997 ADD,3998 'crm/contact/' + type + '/' + entityid + '/person.json',3999 data,4000 options4001 );4002 };40034004 var removeCrmPersonMember = function (params, type, entityid, id, options) {4005 addRequest(4006 null,4007 params,4008 REMOVE,4009 'crm/contact/' + type + '/' + entityid + '/person.json',4010 { personid: id },4011 options4012 );4013 };40144015 var getCrmPersonMembers = function (params, type, id, options) {4016 return addRequest(4017 null,4018 params,4019 GET,4020 'crm/contact/' + type + '/' + id + '/person.json',4021 null,4022 options4023 );4024 };40254026 var getCrmEntityMembers = function (params, type, id, options) {4027 var fn = null;4028 switch (type) {4029 case 'company':4030 fn = getCrmPersonMembers;4031 break;4032 default:4033 fn = getCrmContactMembers;4034 break;4035 }4036 if (fn) {4037 return returnValue(fn(params, type, id, options));4038 }4039 return false;4040 };40414042 var addCrmEntityMember = function (params, type, entityid, id, data, options) {4043 var fn = null;4044 switch (type) {4045 case 'company':4046 fn = addCrmPersonMember;4047 break;4048 case 'project':4049 fn = addCrmContactForProject;4050 break;4051 default:4052 fn = addCrmContactMember;4053 break;4054 }4055 if (fn) {4056 return returnValue(fn(params, type, entityid, id, data, options));4057 }4058 return false;4059 };40604061 var removeCrmEntityMember = function (params, type, entityid, id, options) {4062 var fn = null;4063 switch (type) {4064 case 'company':4065 fn = removeCrmPersonMember;4066 break;4067 case 'project':4068 fn = removeCrmContactFromProject;4069 break;4070 default:4071 fn = removeCrmContactMember;4072 break;4073 }4074 if (fn) {4075 return returnValue(fn(params, type, entityid, id, options));4076 }4077 return false;4078 };40794080 var getCrmCases = function (params, options) {4081 return addRequest(4082 null,4083 params,4084 GET,4085 'crm/case/filter.json',4086 null,4087 options4088 );4089 };40904091 var getCrmCasesByPrefix = function (params, options) {4092 return addRequest(4093 null,4094 params,4095 GET,4096 'crm/case/byprefix.json',4097 null,4098 options4099 );4100 };41014102 var removeCrmCase = function (params, ids, options) {4103 var isNumberOrString = ids && (typeof ids === 'number' || typeof ids === 'string'),4104 isObject = ids && typeof ids === 'object';4105 addRequest(4106 null,4107 params,4108 isNumberOrString ? REMOVE : UPDATE,4109 'crm/case' + (isNumberOrString ? '/' + ids : '') + '.json',4110 isObject ? { casesids: ids } : null,4111 options4112 );4113 return true;4114 };41154116 var updateCrmCase = function (params, id, data, options) {4117 var isUpdateStatusAction = data.hasOwnProperty('isClosed');41184119 if (isUpdateStatusAction) {4120 addRequest(4121 null,4122 params,4123 UPDATE,4124 !!data.isClosed ? 'crm/case/' + id + '/close.json' : 'crm/case/' + id + '/reopen.json',4125 data,4126 options4127 );4128 } else {4129 addRequest(4130 null,4131 params,4132 UPDATE,4133 'crm/case/' + id + '.json',4134 data,4135 options4136 );4137 }4138 return true;4139 };41404141 var getCrmContacts = function (params, options) {4142 return addRequest(4143 null,4144 params,4145 GET,4146 'crm/contact/filter.json',4147 null,4148 options4149 );4150 };41514152 var getCrmSimpleContacts = function (params, options) {4153 return addRequest(4154 null,4155 params,4156 GET,4157 'crm/contact/simple/filter.json',4158 null,4159 options4160 );4161 };41624163 var getCrmContactsForMail = function (params, data, options) {4164 return addRequest(4165 null,4166 params,4167 GET,4168 'crm/contact/mail.json',4169 typeof data === 'number' || typeof data === 'string' ? { contactids: [data] } : data,4170 options4171 );4172 };41734174 var getCrmContactsByPrefix = function (params, options) {4175 return addRequest(4176 null,4177 params,4178 GET,4179 'crm/contact/byprefix.json',4180 null,4181 options4182 );4183 };41844185 var getCrmContact = function (params, id, options) {4186 return addRequest(4187 null,4188 params,4189 GET,4190 'crm/contact/' + id + '.json',4191 null,4192 options4193 );4194 };41954196 var getCrmTasks = function (params, options) {4197 return addRequest(4198 null,4199 params,4200 GET,4201 'crm/task/filter.json',4202 null,4203 options4204 );4205 };42064207 var getCrmOpportunity = function (params, id, options) {4208 return addRequest(4209 null,4210 params,4211 GET,4212 'crm/opportunity/' + id + '.json',4213 null,4214 options4215 );4216 };42174218 var getCrmCase = function (params, id, options) {4219 return addRequest(4220 null,4221 params,4222 GET,4223 'crm/case/' + id + '.json',4224 null,4225 options4226 );4227 };42284229 var getContactsByContactInfo = function (params, data, options) {4230 return addRequest(4231 null,4232 params,4233 GET,4234 'crm/contact/bycontactinfo.json',4235 data,4236 options4237 );4238 };42394240 var getCrmOpportunities = function (params, options) {4241 return addRequest(4242 null,4243 params,4244 GET,4245 'crm/opportunity/filter.json',4246 null,4247 options4248 );4249 };42504251 var getCrmOpportunitiesByContact = function (params, id, options) {4252 return addRequest(4253 null,4254 params,4255 GET,4256 'crm/opportunity/bycontact/' + id + '.json',4257 null,4258 options4259 );4260 };42614262 var getCrmOpportunitiesByPrefix = function (params, options) {4263 return addRequest(4264 null,4265 params,4266 GET,4267 'crm/opportunity/byprefix.json',4268 null,4269 options4270 );4271 };42724273 var removeCrmOpportunity = function (params, ids, options) {4274 var isNumberOrString = ids && (typeof ids === 'number' || typeof ids === 'string'),4275 isObject = ids && typeof ids === 'object';4276 addRequest(4277 null,4278 params,4279 isNumberOrString ? REMOVE : UPDATE,4280 'crm/opportunity' + (isNumberOrString ? '/' + ids : '') + '.json',4281 isObject ? { opportunityids: ids } : null,4282 options4283 );4284 return true;4285 };42864287 var updateCrmOpportunityMilestone = function (params, opportunityid, stageid, options) {4288 addRequest(4289 null,4290 params,4291 UPDATE,4292 'crm/opportunity/' + opportunityid + '/stage/' + stageid + '.json',4293 { opportunityid: opportunityid, stageid: stageid },4294 options4295 );4296 };42974298 var getCrmCurrencyConvertion = function (params, data, options) {4299 addRequest(4300 null,4301 params,4302 GET,4303 'crm/settings/currency/convert.json',4304 data,4305 options4306 );4307 };43084309 var getCrmCurrencySummaryTable = function (params, currency, options) {4310 addRequest(4311 null,4312 params,4313 GET,4314 'crm/settings/currency/summarytable.json',4315 { currency: currency },4316 options4317 );4318 };43194320 var updateCrmCurrency = function (params, currency, options) {4321 addRequest(4322 null,4323 params,4324 UPDATE,4325 'crm/settings/currency.json',4326 { currency: currency },4327 options4328 );4329 };43304331 var setCrmCurrencyRates = function (params, currency, rates, options) {4332 addRequest(4333 null,4334 params,4335 ADD,4336 'crm/currency/setrates.json',4337 { currency: currency, rates: rates },4338 options4339 );4340 };43414342 var addCrmCurrencyRates = function (params, rates, options) {4343 addRequest(4344 null,4345 params,4346 ADD,4347 'crm/currency/addrates.json',4348 { rates: rates },4349 options4350 );4351 };43524353 var updateCRMContactStatusSettings = function (params, changeContactStatusGroupAuto, options) {4354 addRequest(4355 null,4356 params,4357 UPDATE,4358 'crm/contact/status/settings.json',4359 { changeContactStatusGroupAuto: changeContactStatusGroupAuto },4360 options4361 );4362 };43634364 var updateCRMContactTagSettings = function (params, addTagToContactGroupAuto, options) {4365 addRequest(4366 null,4367 params,4368 UPDATE,4369 'crm/contact/tag/settings.json',4370 { addTagToContactGroupAuto: addTagToContactGroupAuto },4371 options4372 );4373 };43744375 var updateCRMContactMailToHistorySettings = function (params, writeMailToHistoryAuto, options) {4376 addRequest(4377 null,4378 params,4379 UPDATE,4380 'crm/contact/mailtohistory/settings.json',4381 { writeMailToHistoryAuto: writeMailToHistoryAuto },4382 options4383 );4384 };43854386 var updateOrganisationSettingsCompanyName = function (params, companyName, options) {4387 addRequest(4388 null,4389 params,4390 UPDATE,4391 'crm/settings/organisation/base.json',4392 { companyName: companyName },4393 options4394 );4395 };43964397 var updateOrganisationSettingsAddresses = function (params, data, options) {4398 addRequest(4399 null,4400 params,4401 UPDATE,4402 'crm/settings/organisation/address.json',4403 data,4404 options4405 );4406 };44074408 var updateOrganisationSettingsLogo = function (params, data, options) {4409 addRequest(4410 null,4411 params,4412 UPDATE,4413 'crm/settings/organisation/logo.json',4414 data,4415 options4416 );4417 };44184419 var getOrganisationSettingsLogo = function (params, logoid, options) {4420 addRequest(4421 null,4422 params,4423 GET,4424 'crm/settings/organisation/logo.json',4425 { id: logoid },4426 options4427 );4428 };44294430 var updateWebToLeadFormKey = function (params, options) {4431 return addRequest(4432 null,4433 params,4434 UPDATE,4435 'crm/settings/webformkey/change.json',4436 null,4437 options4438 );4439 };44404441 var sendSMTPMailToContacts = function (params, data, options) {4442 addRequest(4443 null,4444 params,4445 ADD,4446 'crm/contact/mailsmtp/send.json',4447 data,4448 options4449 );4450 };44514452 var getPreviewSMTPMailToContacts = function (params, data, options) {4453 addRequest(4454 null,4455 params,4456 ADD,4457 'crm/contact/mailsmtp/preview.json',4458 data,4459 options4460 );4461 };44624463 var getStatusSMTPMailToContacts = function (params, options) {4464 addRequest(4465 null,4466 params,4467 GET,4468 'crm/contact/mailsmtp/status.json',4469 null,4470 options4471 );4472 };44734474 var cancelSMTPMailToContacts = function (params, options) {4475 addRequest(4476 null,4477 params,4478 UPDATE,4479 'crm/contact/mailsmtp/cancel.json',4480 null,4481 options4482 );4483 };44844485 var addCrmHistoryEvent = function (params, data, options) {4486 addRequest(4487 null,4488 params,4489 ADD,4490 'crm/history.json',4491 data,4492 options4493 );4494 };44954496 var removeCrmHistoryEvent = function (params, id, options) {4497 addRequest(4498 null,4499 params,4500 REMOVE,4501 'crm/history/' + id + '.json',4502 null,4503 options4504 );4505 };45064507 var getCrmHistoryEvents = function (params, options) {4508 return addRequest(4509 null,4510 params,4511 GET,4512 'crm/history/filter.json',4513 null,4514 options4515 );4516 };45174518 var removeCrmFile = function (params, id, options) {4519 addRequest(4520 null,4521 params,4522 REMOVE,4523 'crm/files/' + id + '.json',4524 null,4525 options4526 );4527 return true;4528 };45294530 var getCrmFolder = function (params, id, options) {4531 return addRequest(4532 null,4533 params,4534 GET,4535 'crm/files/' + id + '.json',4536 null,4537 options4538 );4539 };45404541 var getCrmContactRights = function (params, id, options) {4542 return addRequest(4543 null,4544 params,4545 GET,4546 'crm/contact/' + id + '/access.json',4547 null,4548 options4549 );4550 };45514552 var updateCrmContactRights = function (params, id, data, options) {4553 if (!data || !options) {4554 options = data;4555 data = id;4556 id = null;4557 }45584559 addRequest(4560 null,4561 params,4562 UPDATE,4563 'crm/contact' + (id ? '/' + id : '') + '/access.json',4564 data,4565 options4566 );4567 return true;4568 };45694570 var updateCrmCaseRights = function (params, id, data, options) {4571 if (!data || !options) {4572 options = data;4573 data = id;4574 id = null;4575 }45764577 addRequest(4578 null,4579 params,4580 UPDATE,4581 'crm/case' + (id ? '/' + id : '') + '/access.json',4582 data,4583 options4584 );4585 return true;4586 };45874588 var updateCrmOpportunityRights = function (params, id, data, options) {4589 if (!data || !options) {4590 options = data;4591 data = id;4592 id = null;4593 }45944595 addRequest(4596 null,4597 params,4598 UPDATE,4599 'crm/opportunity' + (id ? '/' + id : '') + '/access.json',4600 data,4601 options4602 );4603 return true;4604 };46054606 var addCrmEntityFiles = function (params, id, type, data, options) {4607 if (data && typeof data === 'object' && !data.hasOwnProperty('entityType')) {4608 data.entityType = type;4609 }46104611 addRequest(4612 null,4613 params,4614 ADD,4615 'crm' + (type ? '/' + type : '') + '/' + id + '/files.json',4616 isArray(data) ? { entityType: type, entityid: id, fileids: data } : data,4617 options4618 );4619 return true;4620 };46214622 var removeCrmEntityFiles = function (params, id, options) {4623 addRequest(4624 null,4625 params,4626 REMOVE,4627 'crm/files/' + id + '.json',4628 null,4629 options4630 );4631 return true;4632 };46334634 var getCrmEntityFiles = function (params, id, type, options) {4635 return addRequest(4636 null,4637 params,4638 GET,4639 'crm' + (type ? '/' + type : '') + '/' + id + '/files.json',4640 null,4641 options4642 );4643 };46444645 var getCrmTaskCategories = function (params, options) {4646 return addRequest(4647 null,4648 params,4649 GET,4650 'crm/task/category.json',4651 null,4652 options4653 );4654 };46554656 var addCrmEntityTaskTemplateContainer = function (params, data, options) {4657 addRequest(4658 null,4659 params,4660 ADD,4661 'crm/' + data.entityType + '/tasktemplatecontainer.json',4662 data,4663 options4664 );4665 return true;4666 };46674668 var updateCrmEntityTaskTemplateContainer = function (params, id, data, options) {4669 addRequest(4670 null,4671 params,4672 UPDATE,4673 'crm/tasktemplatecontainer/' + id + '.json',4674 data,4675 options4676 );4677 return true;4678 };46794680 var removeCrmEntityTaskTemplateContainer = function (params, id, options) {4681 addRequest(4682 null,4683 params,4684 REMOVE,4685 'crm/tasktemplatecontainer/' + id + '.json',4686 null,4687 options4688 );4689 return true;4690 };46914692 var getCrmEntityTaskTemplateContainer = function (params, id, options) {4693 return addRequest(4694 null,4695 params,4696 GET,4697 'crm/tasktemplatecontainer/' + id + '.json',4698 null,4699 options4700 );4701 };47024703 var getCrmEntityTaskTemplateContainers = function (params, type, options) {4704 return addRequest(4705 null,4706 params,4707 GET,4708 'crm/' + type + '/tasktemplatecontainer.json',4709 null,4710 options4711 );4712 };47134714 var addCrmEntityTaskTemplate = function (params, data, options) {4715 addRequest(4716 null,4717 params,4718 ADD,4719 'crm/tasktemplatecontainer/' + data.containerid + '/tasktemplate.json',4720 data,4721 options4722 );4723 return true;4724 };47254726 var updateCrmEntityTaskTemplate = function (params, data, options) {4727 addRequest(4728 null,4729 params,4730 UPDATE,4731 'crm/tasktemplatecontainer/' + data.containerid + '/tasktemplate.json',4732 data,4733 options4734 );4735 return true;4736 };47374738 var removeCrmEntityTaskTemplate = function (params, id, options) {4739 addRequest(4740 null,4741 params,4742 REMOVE,4743 'crm/tasktemplatecontainer/tasktemplate/' + id + '.json',4744 null,4745 options4746 );4747 return true;4748 };47494750 var getCrmEntityTaskTemplate = function (params, id, options) {4751 return addRequest(4752 null,4753 params,4754 GET,4755 'crm/tasktemplatecontainer/tasktemplate/' + id + '.json',4756 null,4757 options4758 );4759 };47604761 var getCrmEntityTaskTemplates = function (params, containerid, options) {4762 return addRequest(4763 null,4764 params,4765 GET,4766 'crm/tasktemplatecontainer/' + containerid + '/tasktemplate.json',4767 null,4768 options4769 );4770 };47714772 var getCrmInvoices = function (params, options) {4773 return addRequest(4774 null,4775 params,4776 GET,4777 'crm/invoice/filter.json',4778 null,4779 options4780 );4781 };47824783 var getCrmEntityInvoices = function (params, type, id, options) {4784 return addRequest(4785 null,4786 params,4787 GET,4788 'crm/' + type + '/invoicelist/' + id + '.json',4789 null,4790 options4791 );4792 };47934794 var updateCrmInvoicesStatusBatch = function (params, status, ids, options) {4795 return addRequest(4796 null,4797 params,4798 UPDATE,4799 'crm/invoice/status/' + status + '.json',4800 { invoiceids: ids },4801 options4802 );4803 };48044805 var getCrmInvoiceByNumber = function (params, number, options) {4806 return addRequest(4807 null,4808 params,4809 GET,4810 'crm/invoice/bynumber.json',4811 { number: number },4812 options4813 );4814 };48154816 var getCrmInvoiceByNumberExistence = function (params, number, options) {4817 return addRequest(4818 null,4819 params,4820 GET,4821 'crm/invoice/bynumber/exist.json',4822 { number: number },4823 options4824 );4825 };48264827 var getCrmInvoiceItems = function (params, options) {4828 return addRequest(4829 null,4830 params,4831 GET,4832 'crm/invoiceitem/filter.json',4833 null,4834 options4835 );4836 };48374838 var addCrmInvoiceItem = function (params, data, options) {4839 addRequest(4840 null,4841 params,4842 ADD,4843 'crm/invoiceitem.json',4844 data,4845 options4846 );4847 return true;4848 };48494850 var updateCrmInvoiceItem = function (params, id, data, options) {4851 addRequest(4852 null,4853 params,4854 UPDATE,4855 'crm/invoiceitem/' + id + '.json',4856 data,4857 options4858 );4859 return true;4860 };48614862 var removeCrmInvoiceItem = function (params, ids, options) {4863 addRequest(4864 null,4865 params,4866 REMOVE,4867 'crm/invoiceitem' + (ids && (typeof ids === 'number' || typeof ids === 'string') ? '/' + ids : '') + '.json',4868 ids && typeof ids === 'object' ? { ids: ids } : null,4869 options4870 );4871 return true;4872 };48734874 var getCrmInvoiceTaxes = function (params, options) {4875 return addRequest(4876 null,4877 params,4878 GET,4879 'crm/invoice/tax.json',4880 null,4881 options4882 );4883 };48844885 var addCrmInvoiceTax = function (params, data, options) {4886 addRequest(4887 null,4888 params,4889 ADD,4890 'crm/invoice/tax.json',4891 data,4892 options4893 );4894 return true;4895 };48964897 var updateCrmInvoiceTax = function (params, id, data, options) {4898 addRequest(4899 null,4900 params,4901 UPDATE,4902 'crm/invoice/tax/' + id + '.json',4903 data,4904 options4905 );4906 return true;4907 };49084909 var removeCrmInvoiceTax = function (params, id, options) {4910 addRequest(4911 null,4912 params,4913 REMOVE,4914 'crm/invoice/tax/' + id + '.json',4915 null,4916 options4917 );4918 return true;4919 };49204921 var getCrmInvoice = function (params, id, options) {4922 return addRequest(4923 null,4924 params,4925 GET,4926 'crm/invoice/' + id + '.json',4927 null,4928 options4929 );4930 };49314932 var getCrmInvoiceSample = function (params, options) {4933 return addRequest(4934 null,4935 params,4936 GET,4937 'crm/invoice/sample.json',4938 null,4939 options4940 );4941 };49424943 var getCrmInvoiceJsonData = function (params, id, options) {4944 return addRequest(4945 null,4946 params,4947 GET,4948 'crm/invoice/jsondata/' + id + '.json',4949 null,4950 options4951 );4952 };49534954 var addCrmInvoice = function (params, data, options) {4955 addRequest(4956 null,4957 params,4958 ADD,4959 'crm/invoice.json',4960 data,4961 options4962 );4963 return true;4964 };49654966 var updateCrmInvoice = function (params, id, data, options) {4967 addRequest(4968 null,4969 params,4970 UPDATE,4971 'crm/invoice/' + id + '.json',4972 data,4973 options4974 );4975 return true;4976 };49774978 var removeCrmInvoice = function (params, ids, options) {4979 addRequest(4980 null,4981 params,4982 REMOVE,4983 'crm/invoice' + (ids && (typeof ids === 'number' || typeof ids === 'string') ? '/' + ids : '') + '.json',4984 ids && typeof ids === 'object' ? { invoiceids: ids } : null,4985 options4986 );4987 return true;4988 };49894990 var getInvoicePdfExistingOrCreate = function (params, id, options) {4991 addRequest(4992 null,4993 params,4994 GET,4995 'crm/invoice/' + id + '/pdf.json',4996 null,4997 options4998 );4999 return true;5000 };50015002 var getInvoiceConverterData = function (params, data, options) {5003 addRequest(5004 null,5005 params,5006 ADD,5007 'crm/invoice/converter/data.json',5008 data,5009 options5010 );5011 return true;5012 };50135014 var addCrmInvoiceLine = function (params, data, options) {5015 addRequest(5016 null,5017 params,5018 ADD,5019 'crm/invoiceline.json',5020 data,5021 options5022 );5023 return true;5024 };50255026 var updateCrmInvoiceLine = function (params, id, data, options) {5027 addRequest(5028 null,5029 params,5030 UPDATE,5031 'crm/invoiceline/' + id + '.json',5032 data,5033 options5034 );5035 return true;5036 };50375038 var removeCrmInvoiceLine = function (params, id, options) {5039 addRequest(5040 null,5041 params,5042 REMOVE,5043 'crm/invoiceline/' + id + '.json',5044 null,5045 options5046 );5047 return true;5048 };50495050 var getCrmInvoiceSettings = function (params, options) {5051 return addRequest(5052 null,5053 params,5054 GET,5055 'crm/invoice/settings.json',5056 null,5057 options5058 );5059 };50605061 var updateCrmInvoiceSettingsName = function (params, data, options) {5062 addRequest(5063 null,5064 params,5065 UPDATE,5066 'crm/invoice/settings/name.json',5067 data,5068 options5069 );5070 return true;5071 };50725073 var updateCrmInvoiceSettingsTerms = function (params, data, options) {5074 addRequest(5075 null,5076 params,5077 UPDATE,5078 'crm/invoice/settings/terms.json',5079 data,5080 options5081 );5082 return true;5083 };50845085 var getCrmCurrencyRates = function (params, options) {5086 return addRequest(5087 null,5088 params,5089 GET,5090 'crm/currency/rates.json',5091 null,5092 options5093 );5094 };50955096 var getCrmCurrencyRateById = function (params, id, options) {5097 addRequest(5098 null,5099 params,5100 GET,5101 'crm/currency/rates/' + id + '.json',5102 null,5103 options5104 );5105 return true;5106 };51075108 var getCrmCurrencyRateByCurrencies = function (params, from, to, options) {5109 addRequest(5110 null,5111 params,5112 GET,5113 'crm/currency/rates/' + from + '/' + to + '.json',5114 null,5115 options5116 );5117 return true;5118 };51195120 var addCrmCurrencyRate = function (params, data, options) {5121 addRequest(5122 null,5123 params,5124 ADD,5125 'crm/currency/rates.json',5126 data,5127 options5128 );5129 return true;5130 };51315132 var updateCrmCurrencyRate = function (params, id, data, options) {5133 addRequest(5134 null,5135 params,5136 UPDATE,5137 'crm/currency/rates/' + id + '.json',5138 data,5139 options5140 );5141 return true;5142 };51435144 var removeCrmCurrencyRate = function (params, id, options) {5145 addRequest(5146 null,5147 params,5148 REMOVE,5149 'crm/currency/rates/' + id + '.json',5150 null,5151 options5152 );5153 return true;5154 };51555156 var getCrmContactTweets = function (params, contactid, count, options) {5157 return addRequest(5158 null,5159 params,5160 GET,5161 'crm/contact/' + contactid + '/tweets.json',5162 { contactid: contactid, count: count },5163 options5164 );5165 };51665167 var getCrmContactTwitterProfiles = function (params, searchText, options) {5168 return addRequest(5169 null,5170 params,5171 GET,5172 'crm/contact/twitterprofile.json',5173 { searchText: searchText },5174 options5175 );5176 };51775178 var removeCrmContactAvatar = function (params, contactid, data, options) {5179 return addRequest(5180 null,5181 params,5182 REMOVE,5183 'crm/contact/' + contactid + '/avatar.json',5184 data,5185 options5186 );5187 };51885189 var updateCrmContactAvatar = function (params, contactid, data, options) {5190 return addRequest(5191 null,5192 params,5193 UPDATE,5194 'crm/contact/' + contactid + '/avatar.json',5195 data,5196 options5197 );5198 };51995200 var getCrmContactSocialMediaAvatar = function (params, data, options) {5201 return addRequest(5202 null,5203 params,5204 ADD,5205 'crm/contact/socialmediaavatar.json',5206 { socialNetworks: data },5207 options5208 );5209 };52105211 var startCrmImportFromCSV = function (params, data, options) {5212 addRequest(5213 null,5214 params,5215 ADD,5216 'crm/' + data.entityType + '/import/start.json',5217 data,5218 options5219 );5220 return true;5221 };52225223 var getStatusCrmImportFromCSV = function (params, data, options) {5224 addRequest(5225 null,5226 params,5227 GET,5228 'crm/' + data.entityType + '/import/status.json',5229 data,5230 options5231 );5232 return true;5233 };52345235 var getCrmImportFromCSVSampleRow = function (params, data, options) {5236 addRequest(5237 null,5238 params,5239 GET,5240 'crm/import/samplerow.json',5241 data,5242 options5243 );5244 return true;5245 };52465247 var uploadFakeCrmImportFromCSV = function (params, data, options) {5248 addRequest(5249 null,5250 params,5251 ADD,5252 'crm/import/uploadfake.json',5253 data,5254 options5255 );5256 return true;5257 };52585259 var getStatusExportToCSV = function (params, options) {5260 addRequest(5261 null,5262 params,5263 GET,5264 'crm/export/status.json',5265 null,5266 options5267 );5268 };52695270 var cancelExportToCSV = function (params, options) {5271 addRequest(5272 null,5273 params,5274 UPDATE,5275 'crm/export/cancel.json',5276 null,5277 options5278 );5279 };52805281 var startCrmExportToCSV = function (params, options) {5282 addRequest(5283 null,5284 params,5285 ADD,5286 'crm/export/start.json',5287 null,5288 options5289 );5290 return true;5291 };52925293 var getCrmPartialExportStatus = function (options) {5294 addRequest(5295 null,5296 null,5297 GET,5298 'crm/export/partial/status.json',5299 null,5300 options5301 );5302 };53035304 var cancelCrmCancelPartialExport = function (options) {5305 addRequest(5306 null,5307 null,5308 UPDATE,5309 'crm/export/partial/cancel.json',5310 null,5311 options5312 );5313 };53145315 var startCrmPartialExport = function (data, options) {5316 addRequest(5317 null,5318 null,5319 ADD,5320 'crm/export/partial/' + data.entityType + '/start.json',5321 data,5322 options5323 );5324 return true;5325 };53265327 //#region VoIP53285329 var getCrmVoipAvailableNumbers = function (params, options) {5330 addRequest(5331 null,5332 params,5333 GET,5334 'crm/voip/numbers/available.json',5335 null,5336 options5337 );5338 return true;5339 };53405341 var getCrmVoipExistingNumbers = function (params, options) {5342 addRequest(5343 null,5344 params,5345 GET,5346 'crm/voip/numbers/existing.json',5347 null,5348 options5349 );5350 return true;5351 };53525353 var getCrmVoipUnlinkedNumbers = function (params, options) {5354 addRequest(5355 null,5356 params,5357 GET,5358 'crm/voip/numbers/unlinked.json',5359 null,5360 options5361 );5362 return true;5363 };53645365 var getCrmCurrentVoipNumber = function (params, options) {5366 addRequest(5367 null,5368 params,5369 GET,5370 'crm/voip/numbers/current.json',5371 null,5372 options5373 );5374 return true;5375 };53765377 var createCrmVoipNumber = function (params, data, options) {5378 addRequest(5379 null,5380 params,5381 ADD,5382 'crm/voip/numbers.json',5383 data,5384 options5385 );5386 return true;5387 };53885389 var linkCrmVoipNumber = function (params, data, options) {5390 addRequest(5391 null,5392 params,5393 ADD,5394 'crm/voip/numbers/link.json',5395 data,5396 options5397 );5398 return true;5399 };54005401 var removeCrmVoipNumber = function (params, id, options) {5402 addRequest(5403 null,5404 params,5405 REMOVE,5406 'crm/voip/numbers/' + id + '.json',5407 null,5408 options5409 );5410 return true;5411 };54125413 var updateCrmVoipNumberSettings = function (params, id, data, options) {5414 addRequest(5415 null,5416 params,5417 UPDATE,5418 'crm/voip/numbers/' + id + '/settings.json',5419 data,5420 options5421 );5422 return true;5423 };54245425 var updateCrmVoipSettings = function (params, data, options) {5426 addRequest(5427 null,5428 params,5429 UPDATE,5430 'crm/voip/numbers/settings.json',5431 data,5432 options5433 );5434 return true;5435 };54365437 var getCrmVoipSettings = function (params, options) {5438 addRequest(5439 null,5440 params,5441 GET,5442 'crm/voip/numbers/settings.json',5443 null,5444 options5445 );5446 return true;5447 };54485449 var getCrmVoipNumberOperators = function (params, id, options) {5450 addRequest(5451 null,5452 params,5453 GET,5454 'crm/voip/numbers/' + id + '/oper.json',5455 null,5456 options5457 );5458 return true;5459 };54605461 var addCrmVoipNumberOperators = function (params, id, data, options) {5462 addRequest(5463 null,5464 params,5465 UPDATE,5466 'crm/voip/numbers/' + id + '/oper.json',5467 data,5468 options5469 );5470 return true;5471 };54725473 var updateCrmVoipOperator = function (params, id, data, options) {5474 addRequest(5475 null,5476 params,5477 UPDATE,5478 'crm/voip/opers/' + id + '.json',5479 data,5480 options5481 );5482 return true;5483 };54845485 var removeCrmVoipNumberOperators = function (params, id, data, options) {5486 addRequest(5487 null,5488 params,5489 REMOVE,5490 'crm/voip/numbers/' + id + '/oper.json',5491 data,5492 options5493 );5494 return true;5495 };54965497 var callVoipNumber = function (params, data, options) {5498 addRequest(5499 null,5500 params,5501 ADD,5502 'crm/voip/call.json',5503 data,5504 options5505 );5506 return true;5507 };55085509 var answerVoipCall = function (params, id, options) {5510 addRequest(5511 null,5512 params,5513 ADD,5514 'crm/voip/call/' + id + '/answer.json',5515 id,5516 options5517 );5518 return true;5519 };55205521 var rejectVoipCall = function (params, id, options) {5522 addRequest(5523 null,5524 params,5525 ADD,5526 'crm/voip/call/' + id + '/reject.json',5527 id,5528 options5529 );5530 return true;5531 };55325533 var redirectVoipCall = function (params, id, data, options) {5534 addRequest(5535 null,5536 params,5537 ADD,5538 'crm/voip/call/' + id + '/redirect.json',5539 data,5540 options5541 );5542 return true;5543 };55445545 var saveVoipCall = function (params, id, data, options) {5546 addRequest(5547 null,5548 params,5549 ADD,5550 'crm/voip/call/' + id + '.json',5551 data,5552 options5553 );5554 return true;5555 };55565557 var saveVoipCallPrice = function (params, id, options) {5558 addRequest(5559 null,5560 params,5561 ADD,5562 'crm/voip/price/' + id + '.json',5563 null,5564 options5565 );5566 return true;5567 };55685569 var getVoipMissedCalls = function (params, options) {5570 addRequest(5571 null,5572 params,5573 GET,5574 'crm/voip/call/missed.json',5575 null,5576 options5577 );5578 };55795580 var getVoipCalls = function (params, data, options) {5581 addRequest(5582 null,5583 params,5584 GET,5585 'crm/voip/call.json',5586 data,5587 options5588 );5589 };55905591 var getVoipCall = function (params, id, options) {5592 addRequest(5593 null,5594 params,5595 GET,5596 'crm/voip/call/' + id + '.json',5597 null,5598 options5599 );5600 };56015602 var getVoipToken = function (params, options) {5603 addRequest(5604 null,5605 params,5606 GET,5607 'crm/voip/token.json',5608 null,5609 options5610 );5611 return true;5612 };56135614 var getVoipUploads = function (params, options) {5615 addRequest(5616 null,5617 params,5618 GET,5619 'crm/voip/uploads.json',5620 null,5621 options5622 );5623 return true;5624 };56255626 var deleteVoipUploads = function (params, data, options) {5627 addRequest(5628 null,5629 params,5630 REMOVE,5631 'crm/voip/uploads.json',5632 data,5633 options5634 );5635 return true;5636 };5637 5638 //#endregion56395640 //#region Reports56415642 var getCrmReportFiles = function (params, options) {5643 return addRequest(5644 null,5645 params,5646 GET,5647 'crm/report/files.json',5648 null,5649 options5650 );5651 };56525653 var removeCrmReportFile = function (params, id, options) {5654 addRequest(5655 null,5656 params,5657 REMOVE,5658 'crm/report/file/' + id + '.json',5659 null,5660 options5661 );5662 return true;5663 };56645665 var getCrmReportStatus = function (options) {5666 addRequest(5667 null,5668 null,5669 GET,5670 'crm/report/status.json',5671 null,5672 options5673 );5674 };56755676 var terminateCrmReport = function (options) {5677 addRequest(5678 null,5679 null,5680 GET,5681 'crm/report/terminate.json',5682 null,5683 options5684 );5685 };56865687 var checkCrmReport = function (data, options) {5688 addRequest(5689 null,5690 null,5691 ADD,5692 'crm/report/check.json',5693 data,5694 options5695 );5696 };56975698 var generateCrmReport = function (data, options) {5699 addRequest(5700 null,5701 null,5702 ADD,5703 'crm/report/generate.json',5704 data,5705 options5706 );5707 };57085709 //#endregion57105711 /* </crm> */57125713 /* <mail> */5714 var getMailFilteredMessages = function (params, filter_data, options) {5715 return addRequest(5716 customEvents.getMailFilteredMessages,5717 params,5718 GET,5719 'mail/messages.json',5720 filter_data,5721 options5722 );5723 };57245725 var getMailFolders = function (params, options) {5726 return addRequest(5727 customEvents.getMailFolders,5728 params,5729 GET,5730 'mail/folders.json',5731 null,5732 options5733 );5734 };57355736 var getAccounts = function (params, options) {5737 return addRequest(5738 customEvents.getAccounts,5739 params,5740 GET,5741 'mail/accounts.json',5742 null,5743 options5744 );5745 };57465747 var getMailTags = function (params, options) {5748 return addRequest(5749 customEvents.getMailTags,5750 params,5751 GET,5752 'mail/tags.json',5753 null,5754 options5755 );5756 };57575758 var getMailMessage = function (params, id, data, options) {5759 return addRequest(5760 customEvents.getMailMessage,5761 params,5762 GET,5763 'mail/messages/' + id + '.json',5764 data,5765 options5766 );5767 };57685769 var getMailboxSignature = function (params, id, data, options) {5770 return addRequest(5771 customEvents.getMailboxSignature,5772 params,5773 GET,5774 'mail/signature/' + id + '.json',5775 data,5776 options5777 );5778 };57795780 var updateMailboxSignature = function (params, id, data, options) {5781 return addRequest(5782 customEvents.updateMailboxSignature,5783 params,5784 ADD,5785 'mail/signature/update/' + id + '.json',5786 data,5787 options5788 );5789 };57905791 var updateMailboxAutoreply = function (params, id, data, options) {5792 return addRequest(5793 customEvents.updateMailboxAutoreply,5794 params,5795 ADD,5796 'mail/autoreply/update/' + id + '.json',5797 data,5798 options5799 );5800 };58015802 var getLinkedCrmEntitiesInfo = function (params, data, options) {5803 return addRequest(5804 customEvents.getLinkedCrmEntitiesInfo,5805 params,5806 GET,5807 'mail/crm/linked/entities.json',5808 data,5809 options5810 );5811 };58125813 var getNextMailMessageId = function (params, id, filter_data, options) {5814 return addRequest(5815 customEvents.getNextMailMessageId,5816 params,5817 GET,5818 'mail/messages/' + id + '/next.json' + (filter_data ? "?" + jq.param(filter_data) : ""),5819 null,5820 options5821 );5822 };58235824 var getPrevMailMessageId = function (params, id, filter_data, options) {5825 return addRequest(5826 customEvents.getPrevMailMessageId,5827 params,5828 GET,5829 'mail/messages/' + id + '/prev.json' + (filter_data ? "?" + jq.param(filter_data) : ""),5830 filter_data,5831 options5832 );5833 };58345835 var getMailConversation = function (params, id, data, options) {5836 return addRequest(5837 customEvents.getMailConversation,5838 params,5839 GET,5840 'mail/conversation/' + id + '.json',5841 data,5842 options5843 );5844 };58455846 var getNextMailConversationId = function (params, id, filter_data, options) {5847 return addRequest(5848 customEvents.getNextMailConversationId,5849 params,5850 GET,5851 'mail/conversation/' + id + '/next.json' + (filter_data ? "?" + jq.param(filter_data) : ""),5852 filter_data,5853 options5854 );5855 };58565857 var getPrevMailConversationId = function (params, id, filter_data, options) {5858 return addRequest(5859 customEvents.getPrevMailConversationId,5860 params,5861 GET,5862 'mail/conversation/' + id + '/prev.json' + (filter_data ? "?" + jq.param(filter_data) : ""),5863 filter_data,5864 options5865 );5866 };58675868 var removeMailFolderMessages = function (params, id, options) {5869 return addRequest(5870 customEvents.removeMailFolderMessages,5871 params,5872 REMOVE,5873 'mail/folders/' + id + '/messages.json',5874 null,5875 options5876 );5877 };58785879 var restoreMailMessages = function (params, data, options) {5880 return addRequest(5881 customEvents.restoreMailMessages,5882 params,5883 UPDATE,5884 'mail/messages/restore.json',5885 data,5886 options5887 );5888 };58895890 var moveMailMessages = function (params, ids, folder, userFolderId, options) {5891 return addRequest(5892 customEvents.moveMailMessages,5893 params,5894 UPDATE,5895 'mail/messages/move.json',5896 { ids: ids, folder: folder, userFolderId: userFolderId },5897 options5898 );5899 };59005901 var removeMailMessages = function (params, ids, options) {5902 return addRequest(5903 customEvents.removeMailMessages,5904 params,5905 UPDATE,5906 'mail/messages/remove.json',5907 { ids: ids },5908 options5909 );5910 };59115912 var markMailMessages = function (params, ids, status, options) {5913 return addRequest(5914 customEvents.markMailMessages,5915 params,5916 UPDATE,5917 'mail/messages/mark.json',5918 { ids: ids, status: status },5919 options5920 );5921 };59225923 var createMailTag = function (params, name, style, addresses, options) {5924 return addRequest(5925 customEvents.createMailTag,5926 params,5927 ADD,5928 'mail/tags.json',5929 { name: name, style: style, addresses: addresses },5930 options5931 );5932 };59335934 var updateMailTag = function (params, id, name, style, addresses, options) {5935 return addRequest(5936 customEvents.updateMailTag,5937 params,5938 UPDATE,5939 'mail/tags/' + id + '.json',5940 { name: name, style: style, addresses: addresses },5941 options5942 );5943 };59445945 var removeMailTag = function (params, id, options) {5946 return addRequest(5947 customEvents.removeMailTag,5948 params,5949 REMOVE,5950 'mail/tags/' + id + '.json',5951 null,5952 options5953 );5954 };59555956 var setMailTag = function (params, messages_ids, tag_id, options) {5957 return addRequest(5958 customEvents.setMailTag,5959 params,5960 UPDATE,5961 'mail/tags/' + tag_id + '/set.json',5962 { messages: messages_ids },5963 options5964 );5965 };59665967 var setMailConversationsTag = function (params, messages_ids, tag_id, options) {5968 return addRequest(5969 customEvents.setMailConversationsTag,5970 params,5971 UPDATE,5972 'mail/conversations/tag/' + tag_id + '/set.json',5973 { messages: messages_ids },5974 options5975 );5976 };59775978 var unsetMailTag = function (params, messages_ids, tag_id, options) {5979 return addRequest(5980 customEvents.unsetMailTag,5981 params,5982 UPDATE,5983 'mail/tags/' + tag_id + '/unset.json',5984 { messages: messages_ids },5985 options5986 );5987 };59885989 var unsetMailConversationsTag = function (params, messages_ids, tag_id, options) {5990 return addRequest(5991 customEvents.unsetMailConversationsTag,5992 params,5993 UPDATE,5994 'mail/conversations/tag/' + tag_id + '/unset.json',5995 { messages: messages_ids },5996 options5997 );5998 };59996000 var addMailDocument = function (params, id, data, options) {6001 return addRequest(6002 customEvents.addMailDocument,6003 params,6004 ADD,6005 'mail/messages/' + id + '/document.json',6006 data,6007 options6008 );6009 };60106011 var removeMailMailbox = function (params, email, options) {6012 return addRequest(6013 customEvents.removeMailMailbox,6014 params,6015 REMOVE,6016 'mail/accounts.json',6017 { email: email },6018 options6019 );6020 };60216022 var getMailDefaultMailboxSettings = function (params, email, options) {6023 return addRequest(6024 customEvents.getMailDefaultMailboxSettings,6025 params,6026 GET,6027 'mail/accounts/setups.json',6028 { email: email, action: params.action },6029 options6030 );6031 };60326033 var getMailMailbox = function (params, email, options) {6034 return addRequest(6035 customEvents.getMailMailbox,6036 params,6037 GET,6038 'mail/accounts/single.json',6039 { email: email },6040 options6041 );6042 };60436044 var setDefaultAccount = function (params, isDefault, email, options) {6045 return addRequest(6046 customEvents.setDefaultAccount,6047 params,6048 UPDATE,6049 'mail/accounts/default.json',6050 { email: email, isDefault: isDefault },6051 options6052 );6053 };60546055 var createMailMailboxSimple = function (params, email, password, options) {6056 return addRequest(6057 customEvents.createMailMailboxSimple,6058 params,6059 ADD,6060 'mail/accounts/simple.json',6061 { email: email, password: password },6062 options6063 );6064 };60656066 var createMailMailboxOAuth = function (params, code, serviceType, options) {6067 return addRequest(6068 customEvents.createMailMailboxOAuth,6069 params,6070 ADD,6071 'mail/accounts/oauth.json',6072 { code: code, type: serviceType },6073 options6074 );6075 };60766077 var updateMailMailboxOAuth = function (params, code, serviceType, mailboxId, options) {6078 return addRequest(6079 customEvents.updateMailMailboxOAuth,6080 params,6081 UPDATE,6082 'mail/accounts/oauth.json',6083 { code: code, type: serviceType, mailboxId: mailboxId },6084 options6085 );6086 };6087 var createMailMailbox = function (params, name, email, pop3_account, pop3_password, pop3_port, pop3_server,6088 smtp_account, smtp_password, smtp_port, smtp_server, smtp_auth, imap, restrict, incoming_encryption_type,6089 outcoming_encryption_type, auth_type_in, auth_type_smtp, options) {6090 var data = {6091 name: name,6092 email: email,6093 account: pop3_account,6094 password: pop3_password,6095 port: pop3_port,6096 server: pop3_server,6097 smtp_account: smtp_account,6098 smtp_password: smtp_password,6099 smtp_port: smtp_port,6100 smtp_server: smtp_server,6101 smtp_auth: smtp_auth,6102 imap: imap,6103 restrict: restrict,6104 incoming_encryption_type: incoming_encryption_type,6105 outcoming_encryption_type: outcoming_encryption_type,6106 auth_type_in: auth_type_in,6107 auth_type_smtp: auth_type_smtp6108 };61096110 return addRequest(6111 customEvents.createMailMailbox,6112 params,6113 ADD,6114 'mail/accounts.json',6115 data,6116 options6117 );6118 };61196120 var updateMailMailbox = function (params, name, email, pop3_account, pop3_password, pop3_port, pop3_server,6121 smtp_account, smtp_password, smtp_port, smtp_server, smtp_auth, restrict, incoming_encryption_type,6122 outcoming_encryption_type, auth_type_in, auth_type_smtp, options) {6123 var data = {6124 name: name,6125 email: email,6126 account: pop3_account,6127 password: pop3_password,6128 port: pop3_port,6129 server: pop3_server,6130 smtp_account: smtp_account,6131 smtp_password: smtp_password,6132 smtp_port: smtp_port,6133 smtp_server: smtp_server,6134 smtp_auth: smtp_auth,6135 restrict: restrict,6136 incoming_encryption_type: incoming_encryption_type,6137 outcoming_encryption_type: outcoming_encryption_type,6138 auth_type_in: auth_type_in,6139 auth_type_smtp: auth_type_smtp6140 };61416142 return addRequest(6143 customEvents.updateMailMailbox,6144 params,6145 UPDATE,6146 'mail/accounts.json',6147 data,6148 options6149 );6150 };61516152 var setMailMailboxState = function (params, email, state, options) {6153 return addRequest(6154 customEvents.setMailMailboxState,6155 params,6156 UPDATE,6157 'mail/accounts/state.json',6158 { email: email, state: state },6159 options6160 );6161 };61626163 var removeMailMessageAttachment = function (params, message_id, attachment_id, options) {6164 return addRequest(6165 customEvents.removeMailMessageAttachment,6166 params,6167 REMOVE,6168 'mail/messages/' + message_id + '/attachments/' + attachment_id + '.json',6169 null,6170 options6171 );6172 };61736174 var sendMailMessage = function (params, message, options) {6175 if (!(message instanceof ASC.Mail.Message)) {6176 console.error("Unsupported message format");6177 return null;6178 }61796180 return addRequest(6181 customEvents.sendMailMessage,6182 params,6183 UPDATE,6184 'mail/messages/send.json',6185 message.ToData(),6186 options6187 );6188 };61896190 var saveMailMessage = function (params, message, options) {6191 if (!(message instanceof ASC.Mail.Message)) {6192 console.error("Unsupported message format");6193 return null;6194 }61956196 return addRequest(6197 customEvents.saveMailMessage,6198 params,6199 UPDATE,6200 'mail/drafts/save.json',6201 message.ToData(),6202 options6203 );6204 };62056206 var saveMailTemplate = function (params, message, options) {6207 if (!(message instanceof ASC.Mail.Message)) {6208 console.error("Unsupported message format");6209 return null;6210 }62116212 return addRequest(6213 customEvents.saveMailTemplate,6214 params,6215 UPDATE,6216 'mail/templates/save.json',6217 message.ToData(),6218 options6219 );6220 };62216222 var reassignMailMessages = function (params, folder, email, options) {6223 return addRequest(6224 customEvents.reassignMailMessages,6225 params,6226 UPDATE,6227 'mail/messages/reassign.json',6228 { folder: folder, email: email },6229 options6230 );6231 };62326233 var searchEmails = function (params, data, options) {6234 return addRequest(6235 customEvents.searchEmails,6236 params,6237 GET,6238 'mail/emails/search.json',6239 data,6240 options6241 );6242 };62436244 var getMailContacts = function (params, filterData, options) {6245 return addRequest(6246 customEvents.getMailContacts,6247 params,6248 GET,6249 'mail/contacts.json',6250 filterData,6251 options6252 );6253 };62546255 var getMailContactsByInfo = function (params, data, options) {6256 return addRequest(6257 customEvents.getMailContactsByInfo,6258 params,6259 GET,6260 'mail/contacts/bycontactinfo.json',6261 data,6262 options6263 );6264 };62656266 var createMailContact = function (params, name, description, emails, phoneNumbers, options) {6267 return addRequest(6268 customEvents.createMailContact,6269 params,6270 ADD,6271 'mail/contact/add.json',6272 { name: name, description: description, emails: emails, phoneNumbers: phoneNumbers },6273 options6274 );6275 };62766277 var deleteMailContacts = function (params, ids, options) {6278 return addRequest(6279 customEvents.deleteMailContacts,6280 params,6281 UPDATE,6282 'mail/contacts/remove.json',6283 { ids: ids },6284 options6285 );6286 };62876288 var updateMailContact = function (params, id, name, description, emails, phoneNumbers, options) {6289 return addRequest(6290 customEvents.updateMailContact,6291 params,6292 UPDATE,6293 'mail/contact/update.json',6294 { id: id, name: name, description: description, emails: emails, phoneNumbers: phoneNumbers },6295 options6296 );6297 };62986299 var getMailAlerts = function (params, options) {6300 return addRequest(6301 customEvents.getMailAlerts,6302 params,6303 GET,6304 'mail/alert.json',6305 null,6306 options6307 );6308 };63096310 var deleteMailAlert = function (params, id, options) {6311 return addRequest(6312 customEvents.deleteMailAlert,6313 params,6314 REMOVE,6315 'mail/alert/' + id + '.json',6316 null,6317 options6318 );6319 };63206321 var getMailFilteredConversations = function (params, filter_data, options) {6322 return addRequest(6323 customEvents.getMailFilteredConversations,6324 params,6325 GET,6326 'mail/conversations.json',6327 filter_data,6328 options6329 );6330 };63316332 var moveMailConversations = function (params, ids, folder, userFolderId, options) {6333 return addRequest(6334 customEvents.moveMailConversations,6335 params,6336 UPDATE,6337 'mail/conversations/move.json',6338 { ids: ids, folder: folder, userFolderId: userFolderId },6339 options6340 );6341 };63426343 var restoreMailConversations = function (params, data, options) {6344 return addRequest(6345 customEvents.restoreMailConversations,6346 params,6347 UPDATE,6348 'mail/conversations/restore.json',6349 data,6350 options6351 );6352 };63536354 var removeMailConversations = function (params, ids, options) {6355 return addRequest(6356 customEvents.removeMailConversations,6357 params,6358 UPDATE,6359 'mail/conversations/remove.json',6360 { ids: ids },6361 options6362 );6363 };63646365 var markMailConversations = function (params, ids, status, options) {6366 return addRequest(6367 customEvents.markMailConversations,6368 params,6369 UPDATE,6370 'mail/conversations/mark.json',6371 { ids: ids, status: status },6372 options6373 );6374 };63756376 var getMailDisplayImagesAddresses = function (params, options) {6377 return addRequest(6378 customEvents.getMailDisplayImagesAddresses,6379 params,6380 GET,6381 'mail/display_images/addresses.json',6382 null,6383 options6384 );6385 };63866387 var createDisplayImagesAddress = function (params, email, options) {6388 return addRequest(6389 customEvents.createDisplayImagesAddress,6390 params,6391 ADD,6392 'mail/display_images/address.json',6393 { address: email },6394 options6395 );6396 };63976398 var removeDisplayImagesAddress = function (params, email, options) {6399 return addRequest(6400 customEvents.removeDisplayImagesAddress,6401 params,6402 REMOVE,6403 'mail/display_images/address.json',6404 { address: email },6405 options6406 );6407 };64086409 var linkChainToCrm = function (params, message_id, crm_contacts_id, options) {6410 return addRequest(6411 customEvents.linkChainToCrm,6412 params,6413 UPDATE,6414 'mail/conversations/crm/link.json',6415 {6416 id_message: message_id,6417 crm_contact_ids: crm_contacts_id6418 },6419 options6420 );6421 };64226423 var markChainAsCrmLinked = function (params, message_id, crm_contacts_id, options) {6424 return addRequest(6425 customEvents.markChainAsCrmLinked,6426 params,6427 UPDATE,6428 'mail/conversations/crm/mark.json',6429 {6430 id_message: message_id,6431 crm_contact_ids: crm_contacts_id6432 },6433 options6434 );6435 };64366437 var unmarkChainAsCrmLinked = function (params, message_id, crm_contacts_id, options) {6438 return addRequest(6439 customEvents.unmarkChainAsCrmLinked,6440 params,6441 UPDATE,6442 'mail/conversations/crm/unmark.json',6443 {6444 id_message: message_id,6445 crm_contact_ids: crm_contacts_id6446 },6447 options6448 );6449 };64506451 var exportMessageToCrm = function (params, message_id, crm_contacts_id, options) {6452 return addRequest(6453 customEvents.exportMessageToCrm,6454 params,6455 UPDATE,6456 'mail/messages/crm/export.json',6457 {6458 id_message: message_id,6459 crm_contact_ids: crm_contacts_id6460 },6461 options6462 );6463 };64646465 var isConversationLinkedWithCrm = function (params, messageId, options) {6466 return addRequest(6467 customEvents.isConversationLinkedWithCrm,6468 params,6469 GET,6470 'mail/conversations/link/crm/status.json',6471 {6472 message_id: messageId6473 },6474 options6475 );6476 };64776478 var getMailHelpCenterHtml = function (params, options) {6479 return addRequest(6480 customEvents.getMailHelpCenterHtml,6481 params,6482 GET,6483 'mail/helpcenter.json',6484 null,6485 options6486 );6487 };64886489 var exportAllAttachmentsToMyDocuments = function (params, message_id, options) {6490 return addRequest(6491 customEvents.exportAllAttachmentsToMyDocuments,6492 params,6493 UPDATE,6494 'mail/messages/attachments/export.json',6495 {6496 id_message: message_id6497 },6498 options6499 );6500 };65016502 var exportAllAttachmentsToDocuments = function (params, message_id, folder_id, options) {6503 return addRequest(6504 customEvents.exportAllAttachmentsToDocuments,6505 params,6506 UPDATE,6507 'mail/messages/attachments/export.json',6508 {6509 id_message: message_id,6510 id_folder: folder_id6511 },6512 options6513 );6514 };65156516 var exportAttachmentToMyDocuments = function (params, attachment_id, options) {6517 return addRequest(6518 customEvents.exportAttachmentToMyDocuments,6519 params,6520 UPDATE,6521 'mail/messages/attachment/export.json',6522 {6523 id_attachment: attachment_id6524 },6525 options6526 );6527 };65286529 var exportAttachmentToDocuments = function (params, attachment_id, folder_id, options) {6530 return addRequest(6531 customEvents.exportAttachmentToDocuments,6532 params,6533 UPDATE,6534 'mail/messages/attachment/export.json',6535 {6536 id_attachment: attachment_id,6537 id_folder: folder_id6538 },6539 options6540 );6541 };65426543 var downloadAttachmentsAll = function (params, message_id, options) {6544 return addRequest(6545 customEvents.downloadAttachmentsAll,6546 params,6547 UPDATE,6548 'mail/messages/attachment/downloadall/' + message_id + '.json',6549 null,6550 options6551 );6552 };65536554 var setEMailInFolder = function (params, mailbox_id, email_in_folder, options) {6555 return addRequest(6556 customEvents.setEMailInFolder,6557 params,6558 UPDATE,6559 'mail/accounts/emailinfolder.json',6560 {6561 mailbox_id: mailbox_id,6562 email_in_folder: email_in_folder6563 },6564 options6565 );6566 };65676568 var getMailServer = function (params, options) {6569 return addRequest(6570 customEvents.getMailServer,6571 params,6572 GET,6573 'mailserver/server.json',6574 null,6575 options6576 );6577 };65786579 var getMailServerFullInfo = function (params, options) {6580 return addRequest(6581 customEvents.getMailServerFullInfo,6582 params,6583 GET,6584 'mailserver/serverinfo/get.json',6585 null,6586 options6587 );6588 };65896590 var getMailServerFreeDns = function (params, options) {6591 return addRequest(6592 customEvents.getMailServerFreeDns,6593 params,6594 GET,6595 'mailserver/freedns/get.json',6596 null,6597 options6598 );6599 };66006601 var getMailDomains = function (params, options) {6602 return addRequest(6603 customEvents.getMailDomains,6604 params,6605 GET,6606 'mailserver/domains/get.json',6607 null,6608 options6609 );6610 };66116612 var getCommonMailDomain = function (params, options) {6613 return addRequest(6614 customEvents.getCommonMailDomain,6615 params,6616 GET,6617 'mailserver/domains/common.json',6618 null,6619 options6620 );6621 };66226623 var addMailDomain = function (params, domain_name, dns_id, options) {6624 return addRequest(6625 customEvents.addMailDomain,6626 params,6627 ADD,6628 'mailserver/domains/add.json',6629 { name: domain_name, id_dns: dns_id },6630 options6631 );6632 };66336634 var removeMailDomain = function (params, id_domain, options) {6635 return addRequest(6636 customEvents.removeMailDomain,6637 params,6638 REMOVE,6639 'mailserver/domains/remove/' + id_domain + '.json',6640 null,6641 options6642 );6643 };66446645 var addMailbox = function (params, name, local_part, domain_id, user_id, notifyCurrent, notifyProfile, options) {6646 return addRequest(6647 customEvents.addMailbox,6648 params,6649 ADD,6650 'mailserver/mailboxes/add.json',6651 {6652 name: name,6653 local_part: local_part,6654 domain_id: domain_id,6655 user_id: user_id,6656 notifyCurrent: notifyCurrent,6657 notifyProfile: notifyProfile6658 },6659 options6660 );6661 };66626663 var addMyMailbox = function (params, mailbox_name, options) {6664 return addRequest(6665 customEvents.addMyMailbox,6666 params,6667 ADD,6668 'mailserver/mailboxes/addmy.json',6669 { name: mailbox_name },6670 options6671 );6672 };66736674 var changeMailboxPassword = function (params, mailboxId, password, options) {6675 return addRequest(6676 customEvents.changeMailboxPassword,6677 params,6678 UPDATE,6679 'mailserver/mailboxes/changepwd.json',6680 { mailbox_id: mailboxId, password: password },6681 options6682 );6683 };66846685 var getRandomPassword = function (params, options) {6686 return addRequest(6687 customEvents.getRandomPassword,6688 params,6689 GET,6690 'portal/randompwd.json',6691 null,6692 options6693 );6694 };6695 var getMailboxes = function (params, options) {6696 return addRequest(6697 customEvents.getMailboxes,6698 params,6699 GET,6700 'mailserver/mailboxes/get.json',6701 null,6702 options6703 );6704 };67056706 var removeMailbox = function (params, id_mailbox, options) {6707 return addRequest(6708 customEvents.removeMailbox,6709 params,6710 REMOVE,6711 'mailserver/mailboxes/remove/' + id_mailbox + '.json',6712 null,6713 options6714 );6715 };67166717 var updateMailbox = function (params, mailbox_id, name, options) {6718 return addRequest(6719 customEvents.updateMailbox,6720 params,6721 UPDATE,6722 'mailserver/mailboxes/update.json',6723 { mailbox_id: mailbox_id, name: name },6724 options6725 );6726 };67276728 var addMailBoxAlias = function (params, mailbox_id, address_name, options) {6729 return addRequest(6730 customEvents.addMailBoxAlias,6731 params,6732 UPDATE,6733 'mailserver/mailboxes/alias/add.json',6734 { mailbox_id: mailbox_id, alias_name: address_name },6735 options6736 );6737 };67386739 var removeMailBoxAlias = function (params, mailbox_id, address_id, options) {6740 return addRequest(6741 customEvents.removeMailBoxAlias,6742 params,6743 UPDATE,6744 'mailserver/mailboxes/alias/remove.json',6745 { mailbox_id: mailbox_id, address_id: address_id },6746 options6747 );6748 };67496750 var addMailGroup = function (params, group_name, domain_id, address_ids, options) {6751 return addRequest(6752 customEvents.addMailGroup,6753 params,6754 ADD,6755 'mailserver/groupaddress/add.json',6756 { name: group_name, domain_id: domain_id, address_ids: address_ids },6757 options6758 );6759 };67606761 var addMailGroupAddress = function (params, group_id, address_id, options) {6762 return addRequest(6763 customEvents.addMailGroupAddress,6764 params,6765 UPDATE,6766 'mailserver/groupaddress/address/add.json',6767 { mailgroup_id: group_id, address_id: address_id },6768 options6769 );6770 };67716772 var removeMailGroupAddress = function (params, group_id, address_id, options) {6773 return addRequest(6774 customEvents.removeMailGroupAddress,6775 params,6776 REMOVE,6777 'mailserver/groupaddress/addresses/remove.json',6778 { mailgroup_id: group_id, address_id: address_id },6779 options6780 );6781 };67826783 var getMailGroups = function (params, options) {6784 return addRequest(6785 customEvents.getMailGroups,6786 params,6787 GET,6788 'mailserver/groupaddress/get.json',6789 null,6790 options6791 );6792 };67936794 var removeMailGroup = function (params, id_group, options) {6795 return addRequest(6796 customEvents.removeMailGroup,6797 params,6798 REMOVE,6799 'mailserver/groupaddress/remove/' + id_group + '.json',6800 null,6801 options6802 );6803 };68046805 var isDomainExists = function (params, domain_name, options) {6806 return addRequest(6807 customEvents.isDomainExists,6808 params,6809 GET,6810 'mailserver/domains/exists.json',6811 { name: domain_name },6812 options6813 );6814 };68156816 var checkDomainOwnership = function (params, domain_name, options) {6817 return addRequest(6818 customEvents.checkDomainOwnership,6819 params,6820 GET,6821 'mailserver/domains/ownership/check.json',6822 { name: domain_name },6823 options6824 );6825 };68266827 var getDomainDnsSettings = function (params, domain_id, options) {6828 return addRequest(6829 customEvents.getDomainDnsSettings,6830 params,6831 GET,6832 'mailserver/domains/dns/get.json',6833 { id: domain_id },6834 options6835 );6836 };68376838 var createNotificationAddress = function (params, address_username, password, domain_id, options) {6839 return addRequest(6840 customEvents.createNotificationAddress,6841 params,6842 ADD,6843 'mailserver/notification/address/add.json',6844 { name: address_username, password: password, domain_id: domain_id },6845 options6846 );6847 };68486849 var removeNotificationAddress = function (params, address, options) {6850 return addRequest(6851 customEvents.removeNotificationAddress,6852 params,6853 REMOVE,6854 'mailserver/notification/address/remove.json',6855 { address: address },6856 options6857 );6858 };68596860 var addCalendarBody = function (params, id_message, ical_body, options) {6861 return addRequest(6862 customEvents.addCalendarBody,6863 params,6864 ADD,6865 'mail/messages/calendarbody/add',6866 { id_message: id_message, ical_body: ical_body },6867 options6868 );6869 };68706871 var setMailConversationEnabledFlag = function (params, enabled, options) {6872 return addRequest(6873 customEvents.setMailConversationEnabledFlag,6874 params,6875 UPDATE,6876 'mail/settings/conversationsEnabled',6877 { enabled: enabled },6878 options6879 );6880 };68816882 var setMailAlwaysDisplayImagesFlag = function (params, enabled, options) {6883 return addRequest(6884 customEvents.setMailAlwaysDisplayImagesFlag,6885 params,6886 UPDATE,6887 'mail/settings/alwaysDisplayImages',6888 { enabled: enabled },6889 options6890 );6891 };68926893 var setMailCacheUnreadMessagesFlag = function (params, enabled, options) {6894 return addRequest(6895 customEvents.setMailCacheUnreadMessagesFlag,6896 params,6897 UPDATE,6898 'mail/settings/cacheMessagesEnabled',6899 { enabled: enabled },6900 options6901 );6902 };69036904 var setMailEnableGoNextAfterMove = function (params, enabled, options) {6905 return addRequest(6906 customEvents.setMailEnableGoNextAfterMove,6907 params,6908 UPDATE,6909 'mail/settings/goNextAfterMoveEnabled',6910 { enabled: enabled },6911 options6912 );6913 };69146915 var setMailEnableReplaceMessageBody = function (params, enabled, options) {6916 return addRequest(6917 customEvents.setMailEnableGoNextAfterMove,6918 params,6919 UPDATE,6920 'mail/settings/replaceMessageBody',6921 { enabled: enabled },6922 options6923 );6924 };6925 69266927 var getMailServerInfo = function (params, options) {6928 return addRequest(6929 null,6930 params,6931 GET,6932 'mail/mailservice/get.json',6933 null,6934 options6935 );6936 };69376938 var connectMailServerInfo = function (params, ip, sqlip, database, user, password, options) {6939 return addRequest(6940 null,6941 params,6942 ADD,6943 'mail/mailservice/connect.json',6944 {6945 ip: ip,6946 sqlip: sqlip,6947 database: database,6948 user: user,6949 password: password6950 },6951 options6952 );6953 };69546955 var saveMailServerInfo = function (params, ip, sqlip, database, user, password, token, host, options) {6956 return addRequest(6957 null,6958 params,6959 ADD,6960 'mail/mailservice/save.json',6961 {6962 ip: ip,6963 sqlip: sqlip,6964 database: database,6965 user: user,6966 password: password,6967 token: token,6968 host: host6969 },6970 options6971 );6972 };69736974 var getMailOperationStatus = function (params, id, options) {6975 return addRequest(6976 customEvents.getMailOperationStatus,6977 null,6978 GET,6979 'mail/operations/' + id + '.json',6980 null,6981 options6982 );6983 };69846985 var createMailFolder = function (params, name, parentId, options) {6986 return addRequest(6987 customEvents.createMailFolder,6988 params,6989 ADD,6990 'mail/userfolders.json',6991 { name: name, parentId: parentId },6992 options6993 );6994 };69956996 var updateMailFolder = function (params, id, name, parentId, options) {6997 return addRequest(6998 customEvents.updateMailFolder,6999 params,7000 UPDATE,7001 'mail/userfolders/' + id + '.json',7002 { name: name, parentId: parentId },7003 options7004 );7005 };70067007 var removeMailFolder = function (params, id, options) {7008 return addRequest(7009 customEvents.removeMailFolder,7010 params,7011 REMOVE,7012 'mail/userfolders/' + id + '.json',7013 null,7014 options7015 );7016 };70177018 var getMailUserFolders = function (params, parentId, ids, options) {7019 var data = {};70207021 if (parentId)7022 data.parentId = parentId;70237024 if (ids) {7025 data.ids = ids;7026 }70277028 return addRequest(7029 customEvents.getMailUserFolders,7030 params,7031 GET,7032 'mail/userfolders.json',7033 data,7034 options7035 );7036 };70377038 var isMailServerAddressExists = function (params, local_part, domain_id, options) {7039 return addRequest(7040 customEvents.isMailServerAddressExists,7041 null,7042 GET,7043 'mailserver/mailboxes/alias/exists.json',7044 { local_part: local_part, domain_id: domain_id },7045 options7046 );7047 };70487049 var isMailServerAddressValid = function (params, local_part, domain_id, options) {7050 return addRequest(7051 customEvents.isMailServerAddressValid,7052 null,7053 GET,7054 'mailserver/mailboxes/alias/valid.json',7055 { local_part: local_part, domain_id: domain_id },7056 options7057 );7058 };70597060 var getMailFilters = function (params, options) {7061 return addRequest(7062 customEvents.getMailFilters,7063 params,7064 GET,7065 'mail/filters.json',7066 {},7067 options7068 );7069 };70707071 var createMailFilter = function (params, filter, options) {7072 return addRequest(7073 customEvents.createMailFilter,7074 params,7075 ADD,7076 'mail/filters.json',7077 { filter: filter },7078 options7079 );7080 };70817082 var updateMailFilter = function (params, filter, options) {7083 return addRequest(7084 customEvents.updateMailFilter,7085 params,7086 UPDATE,7087 'mail/filters.json',7088 { filter: filter },7089 options7090 );7091 };70927093 var deleteMailFilter = function (params, id, options) {7094 return addRequest(7095 customEvents.deleteMailFilter,7096 params,7097 REMOVE,7098 'mail/filters/' + id +'.json',7099 null,7100 options7101 );7102 };71037104 var checkMailFilter = function (params, filter, page, pageSize, options) {7105 return addRequest(7106 customEvents.checkMailFilter,7107 params,7108 GET,7109 'mail/filters/check.json',7110 { filter: filter, page: page, pageSize: pageSize },7111 options7112 );7113 };71147115 var applyMailFilter = function (params, id, options) {7116 return addRequest(7117 customEvents.applyMailFilter,7118 params,7119 GET,7120 'mail/filters/' + id + '/apply.json',7121 null,7122 options7123 );7124 };7125 /* </mail> */71267127 /* <settings> */7128 var getWebItemSecurityInfo = function (params, data, options) {7129 return addRequest(7130 null,7131 params,7132 GET,7133 'settings/security.json',7134 typeof data === 'number' || typeof data === 'string' ? { ids: [data] } : data,7135 options7136 );7137 };71387139 var getEnabledModules = function (params, options) {7140 return addRequest(7141 null,7142 params,7143 GET,7144 'settings/security/modules.json',7145 null,7146 options7147 );7148 };71497150 var getPortalPasswordSettings = function (params, options) {7151 return addRequest(7152 null,7153 params,7154 GET,7155 'settings/security/password.json',7156 null,7157 options7158 );7159 };71607161 var setWebItemSecurity = function (params, data, options) {7162 return addRequest(7163 null,7164 params,7165 UPDATE,7166 'settings/security.json',7167 data,7168 options7169 );7170 };71717172 var setAccessToWebItems = function (params, data, options) {7173 return addRequest(7174 null,7175 params,7176 UPDATE,7177 'settings/security/access.json',7178 data,7179 options7180 );7181 };71827183 var setProductAdministrator = function (params, data, options) {7184 return addRequest(7185 null,7186 params,7187 UPDATE,7188 'settings/security/administrator.json',7189 data,7190 options7191 );7192 };71937194 var isProductAdministrator = function (params, data, options) {7195 return addRequest(7196 null,7197 params,7198 GET,7199 'settings/security/administrator.json',7200 data,7201 options7202 );7203 };7204 var getPortalSettings = function (params, options) {7205 return addRequest(7206 null,7207 params,7208 GET,7209 'settings.json',7210 null,7211 options7212 );7213 };72147215 var getPortalLogo = function (params, options) {7216 return addRequest(7217 null,7218 params,7219 GET,7220 'settings/logo.json',7221 null,7222 options7223 );7224 };72257226 var getIpRestrictions = function (options) {7227 return addRequest(7228 null,7229 null,7230 GET,7231 'settings/iprestrictions.json',7232 null,7233 options7234 );7235 };72367237 var saveIpRestrictions = function (data, options) {7238 return addRequest(7239 null,7240 null,7241 UPDATE,7242 'settings/iprestrictions.json',7243 data,7244 options7245 );7246 };72477248 var updateIpRestrictionsSettings = function (data, options) {7249 return addRequest(7250 null,7251 null,7252 UPDATE,7253 'settings/iprestrictions/settings.json',7254 data,7255 options7256 );7257 };72587259 var updateTipsSettings = function (data, options) {7260 return addRequest(7261 null,7262 null,7263 UPDATE,7264 'settings/tips.json',7265 data,7266 options7267 );7268 };72697270 var updateTipsSubscription = function (options) {7271 return addRequest(7272 null,7273 null,7274 UPDATE,7275 'settings/tips/change/subscription.json',7276 null,7277 options7278 );7279 };72807281 var tfaAppAuthSettings = function (type, options) {7282 return addRequest(7283 null,7284 null,7285 UPDATE,7286 'settings/tfaapp.json',7287 { type: type },7288 options7289 );7290 };72917292 var tfaappcodes = function (options) {7293 return addRequest(7294 null,7295 null,7296 GET,7297 'settings/tfaappcodes.json',7298 null,7299 options7300 );7301 };73027303 var tfaAppRequestNewCodes = function (options) {7304 return addRequest(7305 null,7306 null,7307 UPDATE,7308 'settings/tfaappnewcodes.json',7309 null,7310 options7311 );7312 };73137314 var tfaAppNewApp = function (id, options) {7315 return addRequest(7316 null,7317 null,7318 UPDATE,7319 'settings/tfaappnewapp.json',7320 {id: id},7321 options7322 );7323 };73247325 var telegramLink = function (options) {7326 return addRequest(7327 null,7328 null,7329 GET,7330 'settings/telegramlink.json',7331 null,7332 options7333 );7334 };73357336 var telegramIsConnected = function (options) {7337 return addRequest(7338 null,7339 null,7340 GET,7341 'settings/telegramisconnected.json',7342 null,7343 options7344 );7345 };73467347 var telegramDisconnect = function (options) {7348 return addRequest(7349 null,7350 null,7351 REMOVE,7352 'settings/telegramdisconnect.json',7353 null,7354 options7355 );7356 };73577358 var closeWelcomePopup = function () {7359 return addRequest(7360 null,7361 null,7362 UPDATE,7363 'settings/welcome/close.json',7364 null,7365 null7366 );7367 };73687369 var setColorTheme = function (params, theme, options) {7370 return addRequest(7371 null,7372 params,7373 UPDATE,7374 'settings/colortheme.json',7375 { theme: theme },7376 options7377 );7378 };73797380 var setTimaAndLanguage = function (lng, timeZoneID, options) {7381 return addRequest(7382 null,7383 null,7384 UPDATE,7385 "settings/timeandlanguage.json",7386 { lng: lng, timeZoneID: timeZoneID },7387 options7388 );7389 };73907391 var setDefaultpage = function (params, defaultProductID, options) {7392 return addRequest(7393 null,7394 params,7395 UPDATE,7396 'settings/defaultpage.json',7397 { defaultProductID: defaultProductID },7398 options7399 );74007401 };74027403 var savePortalSmtpSettings = function (params, settings, options) {7404 return addRequest(7405 null,7406 params,7407 ADD,7408 'settings/smtp.json',7409 { smtpSettings: settings },7410 options7411 );7412 };74137414 var resetPortalSmtpSettings = function (params, options) {7415 return addRequest(7416 null,7417 params,7418 REMOVE,7419 'settings/smtp.json',7420 null,7421 options7422 );7423 };7424 var testPortalSmtpSettings = function (params, options) {7425 return addRequest(7426 null,7427 params,7428 GET,7429 'settings/smtp/test.json',7430 null,7431 options7432 );7433 };7434 var getTestPortalSmtpSettingsResult = function (params, options) {7435 return addRequest(7436 null,7437 params,7438 GET,7439 'settings/smtp/test/status.json',7440 null,7441 options7442 );7443 };74447445 var setPrivacyRoom = function (params, enable, options) {7446 return addRequest(7447 null,7448 params,7449 UPDATE,7450 'privacyroom.json',7451 { enable: enable },7452 options7453 );7454 };74557456 var setEncryptionKeys = function (params, data, options) {7457 return addRequest(7458 null,7459 params,7460 UPDATE,7461 'privacyroom/keys.json',7462 data,7463 options7464 );7465 };74667467 var getEncryptionAccess = function (params, fileId, options) {7468 return addRequest(7469 null,7470 params,7471 GET,7472 'privacyroom/access/' + fileId + '.json',7473 null,7474 options7475 );7476 };74777478 // LDAP74797480 var saveLdapSettings = function (params, settings, options) {7481 addRequest(7482 null,7483 params,7484 ADD,7485 'settings/ldap.json',7486 settings,7487 options7488 );7489 return true;7490 };74917492 var getLdapSettings = function (params, options) {7493 addRequest(7494 null,7495 params,7496 GET,7497 'settings/ldap.json',7498 null,7499 options7500 );7501 return true;7502 };75037504 var getLdapCronSettings = function (params, options) {7505 addRequest(7506 null,7507 params,7508 GET,7509 'settings/ldap/cron.json',7510 null,7511 options7512 );7513 return true;7514 };75157516 var setLdapCronSettings = function (params, cron, options) {7517 addRequest(7518 null,7519 params,7520 ADD,7521 'settings/ldap/cron.json',7522 cron,7523 options7524 );7525 return true;7526 };75277528 var getLdapDefaultSettings = function (params, options) {7529 addRequest(7530 null,7531 params,7532 GET,7533 'settings/ldap/default.json',7534 null,7535 options7536 );7537 return true;7538 };75397540 var getLdapStatus = function (params, options) {7541 addRequest(7542 null,7543 params,7544 GET,7545 'settings/ldap/status.json',7546 null,7547 options7548 );7549 return true;7550 };75517552 var syncLdap = function (params, options) {7553 addRequest(7554 null,7555 params,7556 GET,7557 'settings/ldap/sync.json',7558 null,7559 options7560 );7561 return true;7562 };75637564 //SSO75657566 var ssoGenerateCert = function (complete, error, always) {7567 jq.ajax({7568 type: "get",7569 url: "sso/generatecert",7570 complete: complete,7571 error: error7572 }).always(always);7573 };75747575 var ssoValidateCerts = function (data, complete, error, always) {7576 jq.ajax({7577 type: "post",7578 data: JSON.stringify(data),7579 dataType: "json",7580 contentType: "application/json; charset=utf-8",7581 url: "sso/validatecerts",7582 complete: complete,7583 error: error7584 }).always(always);7585 };75867587 var ssoLoadMetadata = function (data, complete, error, always) {7588 jq.ajax({7589 type: "post",7590 data: JSON.stringify(data),7591 dataType: "json",7592 contentType: "application/json; charset=utf-8",7593 url: "sso/loadmetadata",7594 complete: complete,7595 error: error7596 }).always(always);7597 };75987599 var saveSsoSettings = function (params, settings, options) {7600 addRequest(7601 null,7602 params,7603 ADD,7604 'settings/ssov2.json',7605 settings,7606 options7607 );7608 return true;7609 };7610 var deleteSsoSettings = function (options) {7611 addRequest(7612 null,7613 null,7614 REMOVE,7615 'settings/ssov2.json',7616 null,7617 options7618 );7619 return true;7620 };762176227623 var updateEmailActivationSettings = function (data, options) {7624 return addRequest(7625 null,7626 null,7627 UPDATE,7628 'settings/emailactivation.json',7629 data,7630 options7631 );7632 };76337634 var getSpaceUsageStatistics = function (params, id, options) {7635 addRequest(7636 null,7637 params,7638 GET,7639 "settings/statistics/spaceusage/" + id + ".json",7640 null,7641 options7642 );7643 return true;7644 };76457646 var getVisitStatistics = function (params, from, to, options) {7647 addRequest(7648 null,7649 params,7650 GET,7651 "settings/statistics/visit.json",7652 {7653 fromDate: from,7654 toDate: to7655 },7656 options7657 );7658 return true;7659 };76607661 var getAllStorages = function (params, options) {7662 addRequest(7663 null,7664 params,7665 GET,7666 "settings/storage.json",7667 null,7668 options7669 );7670 return true;7671 };76727673 var getAllCdnStorages = function (params, options) {7674 addRequest(7675 null,7676 params,7677 GET,7678 "settings/storage/cdn.json",7679 null,7680 options7681 );7682 return true;7683 };76847685 var updateStorage = function (params, data, options) {7686 addRequest(7687 null,7688 params,7689 UPDATE,7690 "settings/storage.json",7691 data,7692 options7693 );7694 return true;7695 };76967697 var updateCdnStorage = function (params, data, options) {7698 addRequest(7699 null,7700 params,7701 UPDATE,7702 "settings/storage/cdn.json",7703 data,7704 options7705 );7706 return true;7707 };77087709 var resetToDefaultCdn = function (params, options) {7710 addRequest(7711 null,7712 params,7713 REMOVE,7714 "settings/storage/cdn.json",7715 null,7716 options7717 );7718 return true;7719 };77207721 var resetToDefaultStorage = function (params, options) {7722 addRequest(7723 null,7724 params,7725 REMOVE,7726 "settings/storage.json",7727 null,7728 options7729 );7730 return true;7731 };77327733 var resetCdnToDefaultStorage = function (params, options) {7734 addRequest(7735 null,7736 params,7737 REMOVE,7738 "settings/storage.json",7739 null,7740 options7741 );7742 return true;7743 };77447745 var getStorageProgress = function (params, options) {7746 return addRequest(7747 null,7748 params,7749 GET,7750 "settings/storage/progress.json",7751 null,7752 options7753 );7754 };77557756 var getEncryptionProgress = function (params, options) {7757 return addRequest(7758 null,7759 params,7760 GET,7761 "settings/encryption/progress.json",7762 null,7763 options7764 );7765 };77667767 /* </settings> */77687769 //#region Security77707771 var getLoginEvents = function (options) {7772 return addRequest(7773 null,7774 null,7775 GET,7776 'security/audit/login/last.json',7777 null,7778 options7779 );7780 };77817782 var getAuditEvents = function (params, id, options) {7783 return addRequest(7784 null,7785 params,7786 GET,7787 'security/audit/events/last.json',7788 null,7789 options7790 );7791 };77927793 var createLoginHistoryReport = function (params, options) {7794 return addRequest(7795 null,7796 params,7797 ADD,7798 'security/audit/login/report.json',7799 null,7800 options7801 );7802 };78037804 var createAuditTrailReport = function (params, options) {7805 return addRequest(7806 null,7807 params,7808 ADD,7809 'security/audit/events/report.json',7810 null,7811 options7812 );7813 };78147815 var getAuditSettings = function (params, options) {7816 return addRequest(7817 null,7818 params,7819 GET,7820 'security/audit/settings/lifetime.json',7821 null,7822 options7823 );7824 };78257826 var setAuditSettings = function (params, loginLifeTime, auditLifeTime, options) {7827 return addRequest(7828 null,7829 params,7830 ADD,7831 'security/audit/settings/lifetime.json',7832 {7833 settings: {7834 LoginHistoryLifeTime: loginLifeTime,7835 AuditTrailLifeTime: auditLifeTime7836 }7837 },7838 options7839 );7840 };78417842 //#endregion78437844 var getTalkUnreadMessages = function (params, options) {7845 addRequest(7846 customEvents.getTalkUnreadMessages,7847 params,7848 GET,7849 'portal/talk/unreadmessages.json',7850 null,7851 options7852 );7853 return true;7854 };78557856 var registerUserOnPersonal = function (data, options) {7857 addRequest(7858 null,7859 null,7860 ADD,7861 'authentication/register.json',7862 data,7863 options7864 );7865 return true;7866 };78677868 var saveWhiteLabelSettings = function (params, data, options) {7869 addRequest(7870 null,7871 params,7872 ADD,7873 'settings/whitelabel/save.json',7874 data,7875 options7876 );7877 return true;7878 };78797880 var restoreWhiteLabelSettings = function (params, options) {7881 addRequest(7882 null,7883 params,7884 UPDATE,7885 'settings/whitelabel/restore.json',7886 null,7887 options7888 );7889 return true;7890 };78917892 //#region CustomNavigation78937894 var getCustomNavigationItems = function (params, options) {7895 addRequest(7896 null,7897 params,7898 GET,7899 'settings/customnavigation/getall.json',7900 null,7901 options7902 );7903 return true;7904 };79057906 var getCustomNavigationItemSample = function (params, options) {7907 addRequest(7908 null,7909 params,7910 GET,7911 'settings/customnavigation/getsample.json',7912 null,7913 options7914 );7915 return true;7916 };79177918 var getCustomNavigationItem = function(params, id, options) {7919 addRequest(7920 null,7921 params,7922 GET,7923 'settings/customnavigation/get/' + id + '.json',7924 null,7925 options7926 );7927 return true;7928 };79297930 var createCustomNavigationItem = function (params, data, options) {7931 addRequest(7932 null,7933 params,7934 ADD,7935 'settings/customnavigation/create.json',7936 data,7937 options7938 );7939 return true;7940 };79417942 var deleteCustomNavigationItem = function (params, id, options) {7943 addRequest(7944 null,7945 params,7946 REMOVE,7947 'settings/customnavigation/delete/' + id + '.json',7948 null,7949 options7950 );7951 return true;7952 };79537954 //#endregion79557956 var getCalendars = function (params, dateStart, dateEnd, options) {7957 var start = dateStart instanceof Date ? Teamlab.serializeTimestamp(dateStart, true) : dateStart;7958 var end = dateEnd instanceof Date ? Teamlab.serializeTimestamp(dateEnd, true) : dateEnd;79597960 addRequest(7961 null,7962 params,7963 GET,7964 "calendar/calendars/" + start + "/" + end + ".json",7965 null,7966 options7967 );7968 return true;7969 };79707971 var getCalendarEventByUid = function (params, eventUid, options) {7972 addRequest(7973 null,7974 params,7975 GET,7976 "calendar/events/{0}/historybyuid.json".format(eventUid),7977 null,7978 options7979 );7980 return true;7981 };79827983 var getCalendarEventById = function (params, eventId, options) {7984 addRequest(7985 null,7986 params,7987 GET,7988 "calendar/events/{0}/historybyid.json".format(eventId),7989 null,7990 options7991 );7992 return true;7993 };79947995 var importCalendarEventIcs = function (params, calendarId, ics, options) {7996 addRequest(7997 null,7998 params,7999 ADD,8000 "calendar/importIcs.json",8001 { iCalString: ics, calendarId: calendarId },8002 options8003 );8004 return true;8005 };80068007 //#region Bar80088009 var getBarPromotions = function (params, isDesktop, options) {8010 return addRequest(8011 null,8012 params,8013 GET,8014 'portal/bar/promotions.json',8015 {8016 desktop: Boolean(isDesktop),8017 domain: window.location.hostname,8018 page: window.location.pathname + window.location.search8019 },8020 options8021 );8022 };80238024 var markBarPromotion = function (params, id, options) {8025 return addRequest(8026 null,8027 params,8028 ADD,8029 'portal/bar/promotions/mark/{0}.json'.format(id),8030 { id: id },8031 options8032 );8033 };80348035 var getBarTips = function (params, isDesktop, options) {8036 return addRequest(8037 null,8038 params,8039 GET,8040 'portal/bar/tips.json',8041 {8042 desktop: Boolean(isDesktop),8043 domain: window.location.hostname,8044 page: window.location.pathname + window.location.search + window.location.hash,8045 productAdmin: ASC.Resources.Master.IsProductAdmin8046 },8047 options8048 );8049 };80508051 var markBarTip = function (params, id, options) {8052 return addRequest(8053 null,8054 params,8055 ADD,8056 'portal/bar/tips/mark/{0}.json'.format(id),8057 { id: id },8058 options8059 );8060 };80618062 var deleteBarTips = function (params, options) {8063 return addRequest(8064 customEvents.removeNotificationAddress,8065 params,8066 REMOVE,8067 'portal/bar/tips.json',8068 null,8069 options8070 );8071 };80728073 //#endregion80748075 //#region backup80768077 var startbackup = function(params, data, options) {8078 addRequest(8079 null,8080 params,8081 ADD,8082 "portal/startbackup.json",8083 data,8084 options8085 );8086 return true;8087 }80888089 var getBackupProgress = function (params, options) {8090 addRequest(8091 null,8092 params,8093 GET,8094 "portal/getbackupprogress.json",8095 null,8096 options8097 );8098 return true;8099 }81008101 var getBackupSchedule = function (params, options) {8102 addRequest(8103 null,8104 params,8105 GET,8106 "portal/getbackupschedule.json",8107 null,8108 options8109 );8110 return true;8111 }81128113 var createBackupSchedule = function (params, data, options) {8114 addRequest(8115 null,8116 params,8117 ADD,8118 "portal/createbackupschedule.json",8119 data,8120 options8121 );8122 return true;8123 }81248125 var deleteBackupSchedule = function (params, options) {8126 addRequest(8127 null,8128 params,8129 REMOVE,8130 "portal/deletebackupschedule.json",8131 null,8132 options8133 );8134 return true;8135 }81368137 var deleteBackupHistory = function (params, options) {8138 addRequest(8139 null,8140 params,8141 REMOVE,8142 "portal/deletebackupschedule.json",8143 null,8144 options8145 );8146 return true;8147 }81488149 var getBackupHistory = function (params, options) {8150 addRequest(8151 null,8152 params,8153 GET,8154 "portal/getbackuphistory.json",8155 null,8156 options8157 );8158 return true;8159 }81608161 var deleteBackup = function (params, id, options) {8162 addRequest(8163 null,8164 params,8165 REMOVE,8166 "portal/deletebackup/" + id + ".json",8167 null,8168 options8169 );8170 return true;8171 }81728173 var startRestore = function (params, data, options) {8174 addRequest(8175 null,8176 params,8177 ADD,8178 "portal/startrestore.json",8179 data,8180 options8181 );8182 return true;8183 }81848185 var getBackupStorages = function (params, options) {8186 addRequest(8187 null,8188 params,8189 GET,8190 "settings/storage/backup.json",8191 null,8192 options8193 );8194 return true;8195 }81968197 //#endregion81988199 //#region Reassign user data82008201 var getReassignProgress = function (params, userId, options) {8202 addRequest(8203 null,8204 params,8205 GET,8206 "people/reassign/progress.json",8207 { userId: userId },8208 options8209 );8210 return true;8211 };82128213 var terminateReassign = function (params, userId, options) {8214 addRequest(8215 null,8216 params,8217 UPDATE,8218 'people/reassign/terminate.json',8219 { userId: userId },8220 options8221 );8222 return true;8223 };82248225 var startReassign = function (params, fromUserId, toUserId, deleteProfile, options) {8226 addRequest(8227 null,8228 params,8229 ADD,8230 "people/reassign/start.json",8231 { fromUserId: fromUserId, toUserId: toUserId, deleteProfile: deleteProfile },8232 options8233 );8234 return true;8235 };82368237 //#endregion82388239 //#region Remove user data82408241 var getRemoveProgress = function (params, userId, options) {8242 addRequest(8243 null,8244 params,8245 GET,8246 "people/remove/progress.json",8247 { userId: userId },8248 options8249 );8250 return true;8251 };82528253 var terminateRemove = function (params, userId, options) {8254 addRequest(8255 null,8256 params,8257 UPDATE,8258 'people/remove/terminate.json',8259 { userId: userId },8260 options8261 );8262 return true;8263 };82648265 var startRemove = function (params, userId, options) {8266 addRequest(8267 null,8268 params,8269 ADD,8270 "people/remove/start.json",8271 { userId: userId },8272 options8273 );8274 return true;8275 };82768277 //#endregion82788279 var markGiftAsReaded = function (params, options) {8280 addRequest(8281 null,8282 params,8283 ADD,8284 "portal/gift/mark.json",8285 null,8286 options8287 );8288 return true;8289 };82908291 return {8292 events: customEvents,82938294 profile: ServiceFactory.profile, ...

Full Screen

Full Screen

abstract.spec.ts

Source:abstract.spec.ts Github

copy

Full Screen

1import { Plugin } from '../src/lib/abstract'2const profile = { name: 'mock', methods: ['mockMethod', 'slowMockMethod', 'slowMockMethodTwo','failingMockMethod'] }3jest.setTimeout(10000)4class MockPlugin extends Plugin {5 mockRequest = jest.fn() // Needed because we delete the currentRequest key each time6 _currentRequest7 constructor(p) {8 super(p)9 }10 // @ts-ignore11 get currentRequest() {12 return this._currentRequest13 }14 set currentRequest(request) {15 this._currentRequest = request16 this.mockRequest(request)17 }18 mockMethod = jest.fn(() => true)19 failingMockMethod = jest.fn(()=> {20 return new Promise((resolve, reject) => {21 reject('fail')22 })23 })24 slowMockMethod = jest.fn((num: number) => {25 return new Promise((resolve) => {26 setTimeout(() => {27 resolve(true)28 }, num || 1000)29 })30 })31 slowMockMethodTwo = jest.fn((num: number) => {32 return new Promise((resolve) => {33 setTimeout(() => {34 resolve(true)35 }, num || 1000)36 })37 })38 onActivation = jest.fn()39 onDeactivation = jest.fn()40}41describe('Abstract Plugin', () => {42 let plugin: MockPlugin43 beforeEach(() => {44 plugin = new MockPlugin(profile)45 })46 test('Plugin has profile', () => {47 expect(plugin.profile).toEqual(profile)48 expect(plugin.name).toEqual(profile.name)49 })50 test('Activate trigger onActivation hook', () => {51 plugin.activate()52 expect(plugin.onActivation).toHaveBeenCalledTimes(1)53 })54 test('Deactivate trigger onActivation hook', () => {55 plugin.deactivate()56 expect(plugin.onDeactivation).toHaveBeenCalledTimes(1)57 })58 test('Call Method should fail if method does not exist', () => {59 try {60 plugin['callPluginMethod']('fakeMethod', [])61 } catch (err) {62 expect(err.message).toBe('Method fakeMethod is not implemented by mock')63 }64 })65 test('Call Method should succeed if method exist', () => {66 const result = plugin['callPluginMethod']('mockMethod', [])67 expect(result).toBeTruthy()68 })69 test('addRequest should fail is method is not inside methods list', async () => {70 try {71 await plugin['addRequest']({ from: 'fake' }, 'fakeMethod', [])72 } catch (err) {73 expect(err.message).toBe('Method fakeMethod is not implemented by mock')74 }75 })76 test('addRequest should fail is method is not inside methods list', async () => {77 await Promise.all([78 plugin['addRequest']({ from: 'caller1' }, 'mockMethod', []),79 plugin['addRequest']({ from: 'caller2' }, 'mockMethod', []),80 plugin['addRequest']({ from: 'caller3' }, 'mockMethod', []),81 ])82 expect(plugin.mockRequest).toHaveBeenCalledTimes(3)83 expect(plugin.mockRequest.mock.calls[0][0]).toEqual({ from: 'caller1' })84 expect(plugin.mockRequest.mock.calls[1][0]).toEqual({ from: 'caller2' })85 expect(plugin.mockRequest.mock.calls[2][0]).toEqual({ from: 'caller3' })86 })87 test('addRequest should timeout', async (done) => {88 plugin.setOptions({ queueTimeout: 10 })89 plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', []).catch((err) => {90 expect(err).toBe('[TIMEOUT] Timeout for call slowMockMethod from fake')91 done()92 })93 });94 test('addRequest should not timeout', async () => {95 plugin.setOptions({ queueTimeout: 1000 })96 const result = await plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', [500])97 expect(result).toBeTruthy()98 });99 test('first addRequest should timeout, second one should succeed', async (done) => {100 plugin.setOptions({ queueTimeout: 10 })101 plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', []).catch((err) => {102 expect(err).toBe('[TIMEOUT] Timeout for call slowMockMethod from fake')103 done()104 })105 plugin['addRequest']({ from: 'fake' }, 'mockMethod', []).then((x) => {106 expect(x).toBeTruthy()107 })108 });109 test('addRequest should be canceled', async () => {110 try {111 setTimeout(() => {112 plugin['cancelRequests']({ from: 'fake' }, 'slowMockMethod')113 }, 500)114 await plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', [])115 } catch (err) {116 expect(err).toBe('[CANCEL] Canceled call slowMockMethod from fake')117 }118 })119 test('addRequest should be canceled', async () => {120 try {121 setTimeout(() => {122 plugin['cancelRequests']({ from: 'fake' }, '')123 }, 500)124 await plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', [])125 } catch (err) {126 expect(err).toBe('[CANCEL] Canceled call slowMockMethod from fake')127 }128 })129 test('addRequest should be not canceled', async () => {130 setTimeout(() => {131 plugin['cancelRequests']({ from: 'fake' }, 'slowMockMethod')132 }, 500)133 const result = await plugin['addRequest']({ from: 'fake' }, 'slowMockMethodTwo', [])134 expect(result).toBeTruthy()135 })136 137 test('two simultaneously queued requests should return true', async (done) => {138 plugin['addRequest']({ from: 'fake' }, 'mockMethod', []).then((x) => {139 expect(x).toBeTruthy()140 })141 plugin['addRequest']({ from: 'fake' }, 'mockMethod', []).then((x) => {142 expect(x).toBeTruthy()143 done()144 })145 })146 test('two simultaneously queued requests should be canceled', async (done) => {147 setTimeout(() => {148 plugin['cancelRequests']({ from: 'fake' },'')149 }, 500)150 plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', []).catch((err) => {151 expect(err).toBe('[CANCEL] Canceled call slowMockMethod from fake')152 })153 plugin['addRequest']({ from: 'fake' }, 'slowMockMethodTwo', []).catch((err) => {154 expect(err).toBe('[CANCEL] Canceled call slowMockMethodTwo from fake')155 done()156 })157 })158 test('3 simultaneously queued requestsm 2 should be canceled', async (done) => {159 setTimeout(() => {160 plugin['cancelRequests']({ from: 'fake' },'')161 }, 500)162 plugin['addRequest']({ from: 'fake2' }, 'slowMockMethodTwo', []).then((x) => {163 expect(x).toBeTruthy()164 })165 plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', []).catch((err) => {166 expect(err).toBe('[CANCEL] Canceled call slowMockMethod from fake')167 })168 plugin['addRequest']({ from: 'fake' }, 'slowMockMethodTwo', []).catch((err) => {169 expect(err).toBe('[CANCEL] Canceled call slowMockMethodTwo from fake')170 done()171 })172 })173 test('request should be rejected', async (done) => {174 plugin['addRequest']({ from: 'fake' }, 'failingMockMethod', []).catch((err) => {175 expect(err).toBe('fail')176 done()177 })178 })179 test('of two simultaneously queued requests 1 should return true other should be canceled', async (done) => {180 setTimeout(() => {181 plugin['cancelRequests']({ from: 'fake' }, 'slowMockMethod')182 }, 500)183 plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', []).catch((err) => {184 expect(err).toBe('[CANCEL] Canceled call slowMockMethod from fake')185 })186 plugin['addRequest']({ from: 'fake' }, 'slowMockMethodTwo', []).then((x) => {187 expect(x).toBeTruthy()188 done()189 })190 })191 test('one should timeout, one is canceled, and one succeeds', async (done) => {192 plugin.setOptions({ queueTimeout: 500 })193 setTimeout(() => {194 plugin['cancelRequests']({ from: 'fake' }, 'slowMockMethod')195 }, 200)196 plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', []).catch((err) => {197 expect(err).toBe('[CANCEL] Canceled call slowMockMethod from fake')198 })199 plugin['addRequest']({ from: 'fake3' }, 'slowMockMethodTwo', [100]).then((x) => {200 expect(x).toBeTruthy()201 })202 plugin['addRequest']({ from: 'fake2' }, 'slowMockMethod', [600]).catch((err) => {203 expect(err).toBe('[TIMEOUT] Timeout for call slowMockMethod from fake2')204 done()205 })206 });207 test('one should timeout, one is canceled, and one succeeds, one fails', async (done) => {208 plugin.setOptions({ queueTimeout: 500 })209 plugin['addRequest']({ from: 'fake' }, 'failingMockMethod', []).catch((err) => {210 expect(err).toBe('fail')211 })212 setTimeout(() => {213 plugin['cancelRequests']({ from: 'fake' }, 'slowMockMethod')214 }, 200)215 plugin['addRequest']({ from: 'fake' }, 'slowMockMethod', []).catch((err) => {216 expect(err).toBe('[CANCEL] Canceled call slowMockMethod from fake')217 })218 plugin['addRequest']({ from: 'fake3' }, 'slowMockMethodTwo', [100]).then((x) => {219 expect(x).toBeTruthy()220 })221 plugin['addRequest']({ from: 'fake2' }, 'slowMockMethod', [600]).catch((err) => {222 expect(err).toBe('[TIMEOUT] Timeout for call slowMockMethod from fake2')223 done()224 })225 });...

Full Screen

Full Screen

performance_bar_store_spec.js

Source:performance_bar_store_spec.js Github

copy

Full Screen

...6 beforeEach(() => {7 store = new PerformanceBarStore();8 });9 it('ignores trailing slashes', () => {10 store.addRequest('id', 'https://gitlab.com/');11 expect(findUrl('id')).toEqual('gitlab.com');12 });13 it('keeps the last two components of the path when the last component is numeric', () => {14 store.addRequest('id', 'https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/1');15 expect(findUrl('id')).toEqual('merge_requests/1');16 });17 it('uses the last component of the path', () => {18 store.addRequest(19 'id',20 'https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/1.json?serializer=widget',21 );22 expect(findUrl('id')).toEqual('1.json?serializer=widget');23 });24 it('keeps query components', () => {25 store.addRequest('id', 'http://localhost:3001/h5bp/html5-boilerplate/?param');26 expect(findUrl('id')).toEqual('html5-boilerplate?param');27 });28 it('keeps components when query contains a slash', () => {29 store.addRequest('id', 'http://localhost:3001/h5bp/html5-boilerplate?trunc/ated');30 expect(findUrl('id')).toEqual('html5-boilerplate?trunc/ated');31 });32 it('ignores fragments', () => {33 store.addRequest('id', 'http://localhost:3001/h5bp/html5-boilerplate/#frag/ment');34 expect(findUrl('id')).toEqual('html5-boilerplate');35 });36 });37 describe('setRequestDetailsData', () => {38 let store;39 beforeEach(() => {40 store = new PerformanceBarStore();41 });42 it('updates correctly specific details', () => {43 store.addRequest('id', 'https://gitlab.com/');44 store.setRequestDetailsData('id', 'test', {45 calls: 123,46 });47 expect(store.findRequest('id').details.test.calls).toEqual(123);48 });49 });50 describe('canTrackRequest', () => {51 let store;52 beforeEach(() => {53 store = new PerformanceBarStore();54 });55 it('limits to 10 requests for GraphQL', () => {56 expect(store.canTrackRequest('https://gitlab.com/api/graphql')).toBe(true);57 store.addRequest('0', 'https://gitlab.com/api/graphql');58 store.addRequest('1', 'https://gitlab.com/api/graphql');59 store.addRequest('2', 'https://gitlab.com/api/graphql');60 store.addRequest('3', 'https://gitlab.com/api/graphql');61 store.addRequest('4', 'https://gitlab.com/api/graphql');62 store.addRequest('5', 'https://gitlab.com/api/graphql');63 store.addRequest('6', 'https://gitlab.com/api/graphql');64 store.addRequest('7', 'https://gitlab.com/api/graphql');65 store.addRequest('8', 'https://gitlab.com/api/graphql');66 expect(store.canTrackRequest('https://gitlab.com/api/graphql')).toBe(true);67 store.addRequest('9', 'https://gitlab.com/api/graphql');68 expect(store.canTrackRequest('https://gitlab.com/api/graphql')).toBe(false);69 });70 it('limits to 2 requests for all other URLs', () => {71 expect(store.canTrackRequest('https://gitlab.com/api/v4/users/1')).toBe(true);72 store.addRequest('a', 'https://gitlab.com/api/v4/users/1');73 expect(store.canTrackRequest('https://gitlab.com/api/v4/users/1')).toBe(true);74 store.addRequest('b', 'https://gitlab.com/api/v4/users/1');75 expect(store.canTrackRequest('https://gitlab.com/api/v4/users/1')).toBe(false);76 });77 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log(data);7 }8});9var wpt = require('wpt');10var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');11 if (err) {12 console.log('Error: ' + err);13 } else {14 console.log(data);15 }16});17var wpt = require('wpt');18var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');19 if (err) {20 console.log('Error: ' + err);21 } else {22 console.log(data);23 }24});25var wpt = require('wpt');26var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');27 if (err) {28 console.log('Error: ' + err);29 } else {30 console.log(data);31 }32});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt.js');2var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');3 console.log(data);4});5var wpt = require('wpt.js');6var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');7 console.log(data);8});9var wpt = require('wpt.js');10var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');11 console.log(data);12});13var wpt = require('wpt.js');14var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');15 console.log(data);16});17var wpt = require('wpt.js');18var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');

Full Screen

Using AI Code Generation

copy

Full Screen

1var Wpt = require('webpagetest');2var wpt = new Wpt('www.webpagetest.org');3var data = {4};5wpt.addRequest(data, function (err, data) {6 if (err) {7 console.log('Error: ' + err);8 } else {9 console.log('Data: ' + JSON.stringify(data));10 }11});12}13var Wpt = require('webpagetest');14var wpt = new Wpt('www.webpagetest.org');15var data = {16};17wpt.getTestStatus(data, function (err, data) {18 if (err) {19 console.log('Error: ' + err);20 } else {21 console.log('Data: ' + JSON.stringify(data));22 }23});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptService = require('./wptService');2 if (err) {3 console.log(err);4 }5 else {6 console.log(result);7 }8});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful