Built motion from commit 3baf9eb.|0.0.62
[motion.git] / server / api / zendesk_account / zendesk_account.controller.js
1 var _0x6f1c=["\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","\x45\x72\x72\x6F\x72\x3A","\x65\x72\x72\x6F\x72","\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","\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"];_0x6f1c[0];var _=require(_0x6f1c[1]);var Util=require(_0x6f1c[2]);var zendesk=require(_0x6f1c[3]);var ZendeskAccount=require(_0x6f1c[5])[_0x6f1c[4]];var ZendeskConfiguration=require(_0x6f1c[5])[_0x6f1c[6]];var ZendeskField=require(_0x6f1c[5])[_0x6f1c[7]];function handleError(_0x43cfx8,_0x43cfx9){_0x43cfx9=_0x43cfx9||500;return function(_0x43cfxa){console[_0x6f1c[9]](_0x6f1c[8],_0x43cfxa);_0x43cfx8[_0x6f1c[11]](_0x43cfx9)[_0x6f1c[10]](_0x43cfxa)}}function responseWithResult(_0x43cfx8,_0x43cfx9){_0x43cfx9=_0x43cfx9||200;return function(_0x43cfxc){if(_0x43cfxc){_0x43cfx8[_0x6f1c[11]](_0x43cfx9)[_0x6f1c[12]](_0x43cfxc)}}}function responseWithoutResult(_0x43cfx8,_0x43cfx9){_0x43cfx9=_0x43cfx9||200;return function(){_0x43cfx8[_0x6f1c[13]](_0x43cfx9)}}function handleEntityNotFound(_0x43cfx8){return function(_0x43cfxc){if(!_0x43cfxc){_0x43cfx8[_0x6f1c[11]](404)[_0x6f1c[14]]();return null};return _0x43cfxc}}function saveUpdates(_0x43cfx10){return function(_0x43cfxc){return _0x43cfxc[_0x6f1c[16]](_0x43cfx10)[_0x6f1c[15]](function(_0x43cfx11){return _0x43cfx11})}}function removeEntity(_0x43cfx8){return function(_0x43cfxc){if(_0x43cfxc){return _0x43cfxc[_0x6f1c[17]]()[_0x6f1c[15]](function(){_0x43cfx8[_0x6f1c[11]](204)[_0x6f1c[14]]()})}}}exports[_0x6f1c[18]]=function(_0x43cfx13,_0x43cfx8,_0x43cfx14){return ZendeskAccount[_0x6f1c[24]](_0x6f1c[23])[_0x6f1c[22]](Util[_0x6f1c[21]](_0x43cfx13[_0x6f1c[20]]))[_0x6f1c[15]](responseWithResult(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[25]]=function(_0x43cfx13,_0x43cfx8){return ZendeskAccount[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](responseWithResult(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[29]]=function(_0x43cfx13,_0x43cfx8){return ZendeskAccount[_0x6f1c[29]](_0x43cfx13[_0x6f1c[30]])[_0x6f1c[15]](responseWithResult(_0x43cfx8,201))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[31]]=function(_0x43cfx13,_0x43cfx8){if(_0x43cfx13[_0x6f1c[30]][_0x6f1c[26]]){delete _0x43cfx13[_0x6f1c[30]][_0x6f1c[26]]};return ZendeskAccount[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](saveUpdates(_0x43cfx13[_0x6f1c[30]]))[_0x6f1c[15]](responseWithResult(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[17]]=function(_0x43cfx13,_0x43cfx8){return ZendeskAccount[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](removeEntity(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[32]]=function(_0x43cfx13,_0x43cfx8){return ZendeskAccount[_0x6f1c[17]]({where:{id:_0x43cfx13[_0x6f1c[20]][_0x6f1c[33]]},individualHooks:true})[_0x6f1c[15]](responseWithResult(_0x43cfx8,204))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[34]]=function(_0x43cfx13,_0x43cfx8){var _0x43cfx15={};_0x43cfx15[_0x43cfx13[_0x6f1c[27]][_0x6f1c[35]]]=_0x43cfx13[_0x6f1c[30]][_0x6f1c[36]];return ZendeskAccount[_0x6f1c[22]]({where:_0x43cfx15})[_0x6f1c[15]](function(_0x43cfx16){if(_0x43cfx16[_0x6f1c[37]]){return _0x43cfx8[_0x6f1c[11]](200)[_0x6f1c[10]]({isValid:false,value:_0x43cfx13[_0x6f1c[30]][_0x6f1c[36]]})};return _0x43cfx8[_0x6f1c[11]](200)[_0x6f1c[10]]({isValid:true,value:_0x43cfx13[_0x6f1c[30]][_0x6f1c[36]]})})[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[38]]=function(_0x43cfx13,_0x43cfx8){return ZendeskAccount[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]])[_0x6f1c[15]](function(_0x43cfx17){var _0x43cfx18={username:_0x43cfx17[_0x6f1c[39]],remoteUri:_0x43cfx17[_0x6f1c[40]]};if(_0x43cfx17[_0x6f1c[41]]===_0x6f1c[42]){_0x43cfx18[_0x6f1c[42]]=_0x43cfx17[_0x6f1c[42]]}else {if(_0x43cfx17[_0x6f1c[41]]===_0x6f1c[43]){_0x43cfx18[_0x6f1c[43]]=_0x43cfx17[_0x6f1c[43]]}};var _0x43cfx19=zendesk[_0x6f1c[44]](_0x43cfx18);_0x43cfx19[_0x6f1c[47]][_0x6f1c[46]](function(_0x43cfxa,_0x43cfx1a,_0x43cfx16){if(_0x43cfxa){console[_0x6f1c[9]](_0x43cfxa);return handleError(_0x43cfx8,_0x43cfxa)};if(!_0x43cfx16[_0x6f1c[45]]){return _0x43cfx8[_0x6f1c[13]](500)};return _0x43cfx8[_0x6f1c[13]](204)})})[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[48]]=function(_0x43cfx13,_0x43cfx8){return ZendeskAccount[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]])[_0x6f1c[15]](function(_0x43cfx17){var _0x43cfx18={username:_0x43cfx17[_0x6f1c[39]],remoteUri:_0x43cfx17[_0x6f1c[40]]};if(_0x43cfx17[_0x6f1c[41]]===_0x6f1c[42]){_0x43cfx18[_0x6f1c[42]]=_0x43cfx17[_0x6f1c[42]]}else {if(_0x43cfx17[_0x6f1c[41]]===_0x6f1c[43]){_0x43cfx18[_0x6f1c[43]]=_0x43cfx17[_0x6f1c[43]]}};var _0x43cfx19=zendesk[_0x6f1c[44]](_0x43cfx18);_0x43cfx19[_0x6f1c[50]][_0x6f1c[49]](function(_0x43cfxa,_0x43cfx1a,_0x43cfx16){if(_0x43cfxa){console[_0x6f1c[9]](_0x43cfxa);return handleError(_0x43cfx8,_0x43cfxa)};return _0x43cfx8[_0x6f1c[11]](200)[_0x6f1c[10]](_0x43cfx16)})})[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[51]]=function(_0x43cfx13,_0x43cfx8){return ZendeskConfiguration[_0x6f1c[24]]({method:[_0x6f1c[52],_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]]]})[_0x6f1c[22]](Util[_0x6f1c[21]](_0x43cfx13[_0x6f1c[20]]))[_0x6f1c[15]](responseWithResult(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[53]]=function(_0x43cfx13,_0x43cfx8){return ZendeskConfiguration[_0x6f1c[24]]({method:[_0x6f1c[52],_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]]]})[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[54]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](responseWithResult(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[55]]=function(_0x43cfx13,_0x43cfx8){return ZendeskConfiguration[_0x6f1c[24]]({method:[_0x6f1c[52],_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]]]})[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[54]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](removeEntity(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[56]]=function(_0x43cfx13,_0x43cfx8){return ZendeskConfiguration[_0x6f1c[17]]({where:{id:_0x43cfx13[_0x6f1c[20]][_0x6f1c[33]]},individualHooks:true})[_0x6f1c[15]](responseWithResult(_0x43cfx8,204))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[57]]=function(_0x43cfx13,_0x43cfx8){_0x43cfx13[_0x6f1c[30]][_0x6f1c[58]]=_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]];return ZendeskConfiguration[_0x6f1c[29]](_0x43cfx13[_0x6f1c[30]])[_0x6f1c[15]](responseWithResult(_0x43cfx8,201))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[59]]=function(_0x43cfx13,_0x43cfx8){return ZendeskConfiguration[_0x6f1c[24]]({method:[_0x6f1c[52],_0x43cfx13[_0x6f1c[27]][_0x6f1c[26]]]})[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[54]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](function(_0x43cfx1b){switch(_0x43cfx13[_0x6f1c[27]][_0x6f1c[65]]){case _0x6f1c[61]:_0x43cfx13[_0x6f1c[30]][_0x6f1c[60]]=_0x43cfx13[_0x6f1c[27]][_0x6f1c[54]];break;case _0x6f1c[63]:_0x43cfx13[_0x6f1c[30]][_0x6f1c[62]]=_0x43cfx13[_0x6f1c[27]][_0x6f1c[54]];break;case _0x6f1c[35]:_0x43cfx13[_0x6f1c[30]][_0x6f1c[64]]=_0x43cfx13[_0x6f1c[27]][_0x6f1c[54]];break};return ZendeskField[_0x6f1c[29]](_0x43cfx13[_0x6f1c[30]])})[_0x6f1c[15]](responseWithResult(_0x43cfx8,201))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[66]]=function(_0x43cfx13,_0x43cfx8){if(_0x43cfx13[_0x6f1c[30]][_0x6f1c[26]]){delete _0x43cfx13[_0x6f1c[30]][_0x6f1c[26]]};return ZendeskField[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[67]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](saveUpdates(_0x43cfx13[_0x6f1c[30]]))[_0x6f1c[15]](responseWithResult(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[68]]=function(_0x43cfx13,_0x43cfx8){return ZendeskField[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[67]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](removeEntity(_0x43cfx8))[_0x6f1c[19]](handleError(_0x43cfx8))};exports[_0x6f1c[69]]=function(_0x43cfx13,_0x43cfx8,_0x43cfx14){return ZendeskConfiguration[_0x6f1c[28]](_0x43cfx13[_0x6f1c[27]][_0x6f1c[54]])[_0x6f1c[15]](handleEntityNotFound(_0x43cfx8))[_0x6f1c[15]](function(_0x43cfx1b){return _0x43cfx1b[_0x6f1c[70]](_0x43cfx13[_0x6f1c[30]])})[_0x6f1c[15]](responseWithoutResult(_0x43cfx8,200))[_0x6f1c[19]](function(_0x43cfxa){console[_0x6f1c[9]](_0x43cfxa);return handleError(_0x43cfx8,_0x43cfxa)})}