Built motion from commit 522ec06.|0.0.85
[motion.git] / server / api / zendesk_account / zendesk_account.controller.js
1 var _0x25a0=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x6E\x6F\x64\x65\x2D\x7A\x65\x6E\x64\x65\x73\x6B","\x5A\x65\x6E\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x5A\x65\x6E\x64\x65\x73\x6B\x46\x69\x65\x6C\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x7A\x65\x6E\x64\x65\x73\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x63\x6F\x75\x6E\x74","\x63\x68\x65\x63\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x61\x75\x74\x68\x54\x79\x70\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x74\x6F\x6B\x65\x6E","\x63\x72\x65\x61\x74\x65\x43\x6C\x69\x65\x6E\x74","\x65\x72\x72\x6F\x72","\x76\x65\x72\x69\x66\x69\x65\x64","\x61\x75\x74\x68","\x75\x73\x65\x72\x73","\x67\x65\x74\x46\x69\x65\x6C\x64\x73","\x6C\x69\x73\x74","\x74\x69\x63\x6B\x65\x74\x66\x69\x65\x6C\x64\x73","\x67\x65\x74\x41\x63\x63\x6F\x75\x6E\x74\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x61\x63\x63\x6F\x75\x6E\x74","\x67\x65\x74\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x63\x69\x64","\x64\x65\x73\x74\x72\x6F\x79\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x63\x72\x65\x61\x74\x65\x46\x69\x65\x6C\x64","\x53\x75\x62\x6A\x65\x63\x74\x49\x64","\x73\x75\x62\x6A\x65\x63\x74","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E\x49\x64","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64\x49\x64","\x74\x79\x70\x65","\x75\x70\x64\x61\x74\x65\x46\x69\x65\x6C\x64","\x66\x69\x64","\x64\x65\x73\x74\x72\x6F\x79\x46\x69\x65\x6C\x64","\x61\x64\x64\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x54\x61\x67\x73","\x73\x65\x74\x54\x61\x67\x73"];_0x25a0[0];var _=require(_0x25a0[1]);var Util=require(_0x25a0[2]);var zendesk=require(_0x25a0[3]);var ZendeskAccount=require(_0x25a0[5])[_0x25a0[4]];var ZendeskConfiguration=require(_0x25a0[5])[_0x25a0[6]];var ZendeskField=require(_0x25a0[5])[_0x25a0[7]];function handleError(_0x7633x8,_0x7633x9){_0x7633x9=_0x7633x9||500;return function(_0x7633xa){_0x7633x8[_0x25a0[9]](_0x7633x9)[_0x25a0[8]](_0x7633xa)}}function responseWithResult(_0x7633x8,_0x7633x9){_0x7633x9=_0x7633x9||200;return function(_0x7633xc){if(_0x7633xc){_0x7633x8[_0x25a0[9]](_0x7633x9)[_0x25a0[10]](_0x7633xc)}}}function responseWithoutResult(_0x7633x8,_0x7633x9){_0x7633x9=_0x7633x9||200;return function(){_0x7633x8[_0x25a0[11]](_0x7633x9)}}function handleEntityNotFound(_0x7633x8){return function(_0x7633xc){if(!_0x7633xc){_0x7633x8[_0x25a0[9]](404)[_0x25a0[12]]();return null};return _0x7633xc}}function saveUpdates(_0x7633x10){return function(_0x7633xc){return _0x7633xc[_0x25a0[14]](_0x7633x10)[_0x25a0[13]](function(_0x7633x11){return _0x7633x11})}}function removeEntity(_0x7633x8){return function(_0x7633xc){if(_0x7633xc){return _0x7633xc[_0x25a0[15]]()[_0x25a0[13]](function(){_0x7633x8[_0x25a0[9]](204)[_0x25a0[12]]()})}}}exports[_0x25a0[16]]=function(_0x7633x13,_0x7633x8,_0x7633x14){return ZendeskAccount[_0x25a0[22]](_0x25a0[21])[_0x25a0[20]](Util[_0x25a0[19]](_0x7633x13[_0x25a0[18]]))[_0x25a0[13]](responseWithResult(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[23]]=function(_0x7633x13,_0x7633x8){return ZendeskAccount[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[24]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](responseWithResult(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[27]]=function(_0x7633x13,_0x7633x8){return ZendeskAccount[_0x25a0[27]](_0x7633x13[_0x25a0[28]])[_0x25a0[13]](responseWithResult(_0x7633x8,201))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[29]]=function(_0x7633x13,_0x7633x8){if(_0x7633x13[_0x25a0[28]][_0x25a0[24]]){delete _0x7633x13[_0x25a0[28]][_0x25a0[24]]};return ZendeskAccount[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[24]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](saveUpdates(_0x7633x13[_0x25a0[28]]))[_0x25a0[13]](responseWithResult(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[15]]=function(_0x7633x13,_0x7633x8){return ZendeskAccount[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[24]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](removeEntity(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[30]]=function(_0x7633x13,_0x7633x8){return ZendeskAccount[_0x25a0[15]]({where:{id:_0x7633x13[_0x25a0[18]][_0x25a0[31]]},individualHooks:true})[_0x25a0[13]](responseWithResult(_0x7633x8,204))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[32]]=function(_0x7633x13,_0x7633x8){var _0x7633x15={};_0x7633x15[_0x7633x13[_0x25a0[25]][_0x25a0[33]]]=_0x7633x13[_0x25a0[28]][_0x25a0[34]];return ZendeskAccount[_0x25a0[20]]({where:_0x7633x15})[_0x25a0[13]](function(_0x7633x16){if(_0x7633x16[_0x25a0[35]]){return _0x7633x8[_0x25a0[9]](200)[_0x25a0[8]]({isValid:false,value:_0x7633x13[_0x25a0[28]][_0x25a0[34]]})};return _0x7633x8[_0x25a0[9]](200)[_0x25a0[8]]({isValid:true,value:_0x7633x13[_0x25a0[28]][_0x25a0[34]]})})[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[36]]=function(_0x7633x13,_0x7633x8){return ZendeskAccount[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[24]])[_0x25a0[13]](function(_0x7633x17){var _0x7633x18={username:_0x7633x17[_0x25a0[37]],remoteUri:_0x7633x17[_0x25a0[38]]};if(_0x7633x17[_0x25a0[39]]===_0x25a0[40]){_0x7633x18[_0x25a0[40]]=_0x7633x17[_0x25a0[40]]}else {if(_0x7633x17[_0x25a0[39]]===_0x25a0[41]){_0x7633x18[_0x25a0[41]]=_0x7633x17[_0x25a0[41]]}};var _0x7633x19=zendesk[_0x25a0[42]](_0x7633x18);_0x7633x19[_0x25a0[46]][_0x25a0[45]](function(_0x7633xa,_0x7633x1a,_0x7633x16){if(_0x7633xa){console[_0x25a0[43]](_0x7633xa);return handleError(_0x7633x8,_0x7633xa)};if(!_0x7633x16[_0x25a0[44]]){return _0x7633x8[_0x25a0[11]](500)};return _0x7633x8[_0x25a0[11]](204)})})[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[47]]=function(_0x7633x13,_0x7633x8){return ZendeskAccount[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[24]])[_0x25a0[13]](function(_0x7633x17){var _0x7633x18={username:_0x7633x17[_0x25a0[37]],remoteUri:_0x7633x17[_0x25a0[38]]};if(_0x7633x17[_0x25a0[39]]===_0x25a0[40]){_0x7633x18[_0x25a0[40]]=_0x7633x17[_0x25a0[40]]}else {if(_0x7633x17[_0x25a0[39]]===_0x25a0[41]){_0x7633x18[_0x25a0[41]]=_0x7633x17[_0x25a0[41]]}};var _0x7633x19=zendesk[_0x25a0[42]](_0x7633x18);_0x7633x19[_0x25a0[49]][_0x25a0[48]](function(_0x7633xa,_0x7633x1a,_0x7633x16){if(_0x7633xa){console[_0x25a0[43]](_0x7633xa);return handleError(_0x7633x8,_0x7633xa)};return _0x7633x8[_0x25a0[9]](200)[_0x25a0[8]](_0x7633x16)})})[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[50]]=function(_0x7633x13,_0x7633x8){return ZendeskConfiguration[_0x25a0[22]]({method:[_0x25a0[51],_0x7633x13[_0x25a0[25]][_0x25a0[24]]]})[_0x25a0[20]](Util[_0x25a0[19]](_0x7633x13[_0x25a0[18]]))[_0x25a0[13]](responseWithResult(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[52]]=function(_0x7633x13,_0x7633x8){return ZendeskConfiguration[_0x25a0[22]]({method:[_0x25a0[51],_0x7633x13[_0x25a0[25]][_0x25a0[24]]]})[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[53]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](responseWithResult(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[54]]=function(_0x7633x13,_0x7633x8){return ZendeskConfiguration[_0x25a0[22]]({method:[_0x25a0[51],_0x7633x13[_0x25a0[25]][_0x25a0[24]]]})[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[53]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](removeEntity(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[55]]=function(_0x7633x13,_0x7633x8){return ZendeskConfiguration[_0x25a0[15]]({where:{id:_0x7633x13[_0x25a0[18]][_0x25a0[31]]},individualHooks:true})[_0x25a0[13]](responseWithResult(_0x7633x8,204))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[56]]=function(_0x7633x13,_0x7633x8){_0x7633x13[_0x25a0[28]][_0x25a0[57]]=_0x7633x13[_0x25a0[25]][_0x25a0[24]];return ZendeskConfiguration[_0x25a0[27]](_0x7633x13[_0x25a0[28]])[_0x25a0[13]](responseWithResult(_0x7633x8,201))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[58]]=function(_0x7633x13,_0x7633x8){return ZendeskConfiguration[_0x25a0[22]]({method:[_0x25a0[51],_0x7633x13[_0x25a0[25]][_0x25a0[24]]]})[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[53]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](function(_0x7633x1b){switch(_0x7633x13[_0x25a0[25]][_0x25a0[64]]){case _0x25a0[60]:_0x7633x13[_0x25a0[28]][_0x25a0[59]]=_0x7633x13[_0x25a0[25]][_0x25a0[53]];break;case _0x25a0[62]:_0x7633x13[_0x25a0[28]][_0x25a0[61]]=_0x7633x13[_0x25a0[25]][_0x25a0[53]];break;case _0x25a0[33]:_0x7633x13[_0x25a0[28]][_0x25a0[63]]=_0x7633x13[_0x25a0[25]][_0x25a0[53]];break};return ZendeskField[_0x25a0[27]](_0x7633x13[_0x25a0[28]])})[_0x25a0[13]](responseWithResult(_0x7633x8,201))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[65]]=function(_0x7633x13,_0x7633x8){if(_0x7633x13[_0x25a0[28]][_0x25a0[24]]){delete _0x7633x13[_0x25a0[28]][_0x25a0[24]]};return ZendeskField[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[66]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](saveUpdates(_0x7633x13[_0x25a0[28]]))[_0x25a0[13]](responseWithResult(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[67]]=function(_0x7633x13,_0x7633x8){return ZendeskField[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[66]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](removeEntity(_0x7633x8))[_0x25a0[17]](handleError(_0x7633x8))};exports[_0x25a0[68]]=function(_0x7633x13,_0x7633x8,_0x7633x14){return ZendeskConfiguration[_0x25a0[26]](_0x7633x13[_0x25a0[25]][_0x25a0[53]])[_0x25a0[13]](handleEntityNotFound(_0x7633x8))[_0x25a0[13]](function(_0x7633x1b){return _0x7633x1b[_0x25a0[69]](_0x7633x13[_0x25a0[28]])})[_0x25a0[13]](responseWithoutResult(_0x7633x8,200))[_0x25a0[17]](function(_0x7633xa){console[_0x25a0[43]](_0x7633xa);return handleError(_0x7633x8,_0x7633xa)})}