-
Notifications
You must be signed in to change notification settings - Fork 2
/
App42-all-2.3.min.js
1 lines (1 loc) · 145 KB
/
App42-all-2.3.min.js
1
function App42Score(){App42Service.call(this);var e=this;this.addScore=function(t,n,r,i){var s=App42.URL("game/score/add");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"gameScore");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"game":{"name":"'+t+'","scores":{"score":{"userName":"'+n+'","value":"'+r+'"}}}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.deductScore=function(t,n,r,i){var s=App42.URL("game/score/deduct");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"gameScore");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"game":{"name":"'+t+'", "scores":{"score":{"userName":"'+n+'","value":"'+r+'"}}}}}';o.body=f;App42Connection.post(s,o,f,i,a)}}function App42Reward(){App42Service.call(this);var e=this;this.createReward=function(t,n,r){var i=App42.URL("game/reward");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"rewardName");App42Fault.throwExceptionIfNullOrBlank(n,"rewardDescription");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"rewards":{"reward":{"name":"'+t+'","description":"'+n+'"}}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.getAllRewards=function(t){var n=App42.URL("game/reward");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.getAllRewardsWithPaging=function(t,n,r){var i=App42.URL("game/reward/paging/"+t+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.max=t;s.offset=n;App42Connection.get(i,s,r,null,u)};this.getAllRewardsCount=function(t){var n=App42.URL("game/reward/count");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.getRewardByName=function(t,n){var r=App42.URL("game/reward/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"rewardName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.name=t;App42Connection.get(r,i,n,null,o)};this.earnRewards=function(t,n,r,i,s){var o=App42.URL("game/reward/earn");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"rewardName");App42Fault.throwExceptionIfNullOrBlank(i,"rewardPoints");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"rewards":{"reward":{"gameName":"'+t+'","userName":"'+n+'","name":"'+r+'","points":"'+i+'"}}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.redeemRewards=function(t,n,r,i,s){var o=App42.URL("game/reward/redeem");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"rewardName");App42Fault.throwExceptionIfNullOrBlank(i,"rewardPoints");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"rewards":{"reward":{"gameName":"'+t+'","userName":"'+n+'","name":"'+r+'","points":"'+i+'"}}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.getGameRewardPointsForUser=function(t,n,r){var i=App42.URL("game/reward/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.gameName=t;s.userName=n;App42Connection.get(i,s,r,null,u)};this.getTopNRewardEarners=function(t,n,r,i){var s=App42.URL("game/reward/"+t+"/"+n+"/"+r);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null||r==null||r==""){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"rewardName");App42Fault.throwExceptionIfNullOrBlank(r,"max");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.gameName=t;o.rewardName=n;o.max=r;App42Connection.get(s,o,i,null,a)};this.getAllRewardsByUser=function(t,n,r){var i=App42.URL("game/reward/"+t+"/points/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"rewardName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.rewardName=n;App42Connection.get(i,s,r,null,u)};this.getUserRankingOnReward=function(t,n,r,i){var s=App42.URL("game/reward/"+t+"/"+n+"/"+"rank"+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||t==null||n==""||n==null||r==null||r==""){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"rewardName");App42Fault.throwExceptionIfNullOrBlank(r,"userName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.gameName=t;o.rewardName=n;o.userName=r;App42Connection.get(s,o,i,null,a)};this.getTopNRewardEarnersByGroup=function(t,n,r,i){var s=App42.URL("game/reward/"+t+"/"+n+"/group/points");if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null||r==null||r==""){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"rewardName");App42Fault.throwExceptionIfNullOrBlank(r,"userList");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.userList="["+r.toString()+"]";o.gameName=t;o.rewardName=n;App42Connection.get(s,o,i,null,a)}}function App42Review(){App42Service.call(this);var e=this;this.createReview=function(t,n,r,i,s){var o=App42.URL("review");if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(n,"itemID");App42Fault.throwExceptionIfNullOrBlank(t,"userID");App42Fault.throwExceptionIfNullOrBlank(r,"reviewComment");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"review":{"userId":"'+t+'","itemId":"'+n+'","comment":"'+r+'","rating":"'+i+'"}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.addComment=function(t,n,r,i){var s=App42.URL("review"+"/comment");if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(n,"itemID");App42Fault.throwExceptionIfNullOrBlank(t,"userID");App42Fault.throwExceptionIfNullOrBlank(r,"comment");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"review":{"userId":"'+t+'","itemId":"'+n+'","comment":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.getAllReviewsByPaging=function(t,n,r){var i=App42.URL("review"+"/paging"+"/"+t+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.max=t;s.offset=n;App42Connection.get(i,s,r,null,u)};this.getAllReviews=function(t){var n=App42.URL("review");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.getAllReviewsCount=function(t){var n=App42.URL("review"+"/"+"count");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.getReviewsByItem=function(t,n){var r=App42.URL("review"+"/item"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"itemID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.itemId=t;App42Connection.get(r,i,n,null,o)};this.getReviewsByItemByPaging=function(t,n,r,i){var s=App42.URL("review"+"/item"+"/"+t+"/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"itemID");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.itemId=t;o.max=n;o.offset=r;App42Connection.get(s,o,i,null,a)};this.getCommentsByItem=function(t,n){var r=App42.URL("review"+"/comment/item"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"itemId");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.itemId=t;App42Connection.get(r,i,n,null,o)};this.getReviewsCountByItem=function(t,n){var r=App42.URL("review"+"/item"+"/"+t+"/"+"count");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"itemID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.itemId=t;App42Connection.get(r,i,n,null,o)};this.getHighestReviewByItem=function(t,n){var r=App42.URL("review"+"/"+t+"/highest");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"itemID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.itemId=t;App42Connection.get(r,i,n,null,o)};this.getLowestReviewByItem=function(t,n){var r=App42.URL("review"+"/"+t+"/lowest");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"itemID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.itemId=t;App42Connection.get(r,i,n,null,o)};this.getAverageReviewByItem=function(t,n){var r=App42.URL("review"+"/"+t+"/average");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"itemID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.itemId=t;App42Connection.get(r,i,n,null,o)};this.mute=function(t,n){var r=App42.URL("review"+"/mute");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"reviewId");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"review":{"id":"'+t+'"}}}';i.body=u;App42Connection.put(r,i,u,n,o)};this.unmute=function(t,n){var r=App42.URL("review"+"/unmute");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"reviewId");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"review":{"id":"'+t+'"}}}';i.body=u;App42Connection.put(r,i,u,n,o)};this.getReviewsCountByItemAndRating=function(t,n,r){var i=App42.URL("review"+"/item"+"/"+t+"/rating"+"/"+n);if(t!=null&&n!=null){t=t.trim()}if(t==""||t==null||n==null||n==""){App42Fault.throwExceptionIfNullOrBlank(t,"itemID");App42Fault.throwExceptionIfNullOrBlank(n,"rating");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.itemId=t;s.rating=n;App42Connection.get(i,s,r,null,u)};this.deleteReviewByReviewId=function(t,n){if(t!=null){t=t.trim()}if(t==null||t==""){App42Fault.throwExceptionIfNullOrBlank(t,"reviewId");return}var r=App42.URL("review/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.reviewId=t;App42Connection.del(r,i,n,o)};this.deleteCommentByCommentId=function(t,n){if(t!=null){t=t.trim()}if(t==null||t==""){App42Fault.throwExceptionIfNullOrBlank(t,"commentId");return}var r=App42.URL("review/"+"deleteComment/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.commentId=t;App42Connection.del(r,i,n,o)}}function checkDeviceType(e){if(myObject.ANDROID==e||myObject.iOS==e||myObject.WP7==e){return e}else{throw new App42Exception("DeviceType",e)}}function App42Push(){App42Service.call(this);var e=this;this.storeDeviceToken=function(t,n,r,i){var s=App42.URL("push"+"/storeDeviceToken/"+t);checkDeviceType(r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"deviceToken");App42Fault.throwExceptionIfNullOrBlank(r,"deviceType");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"push":{"userName":"'+t+'","deviceToken":"'+n+'","type":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.createChannelForApp=function(t,n,r){var i=App42.URL("push"+"/createAppChannel");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"channel");App42Fault.throwExceptionIfNullOrBlank(n,"description");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"push":{"channel":{"name":"'+t+'","description":"'+n+'"}}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.subscribeToChannel=function(t,n,r){var i=App42.URL("push"+"/subscribeToChannel/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"channel");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"push":{"channel":{"userName":"'+n+'","name":"'+t+'"}}}';s.body=a;console.log(a);App42Connection.post(i,s,a,r,u)};this.unsubscribeFromChannel=function(t,n,r){var i=App42.URL("push"+"/unsubscribeToChannel/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"channel");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"push":{"channel":{"userName":"'+n+'","name":"'+t+'"}}}';s.body=a;App42Connection.put(i,s,a,r,u)};this.sendPushMessageToChannel=function(t,n,r){var i=App42.URL("push"+"/sendPushMessageToChannel/"+t);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"channel");App42Fault.throwExceptionIfNullOrBlank(n,"message");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"push":{"message":{"channel":"'+t+'","payload":"'+n+'","expiry":"'+getODataUTCDateFilter(new Date)+'"}}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.sendPushMessageToAllByType=function(t,n,r){var i=App42.URL("push"+"/sendMessageToAllByType");checkDeviceType(n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"message");App42Fault.throwExceptionIfNullOrBlank(n,"deviceType");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"push":{"message":{"payload":"'+t+'","type":"'+n+'","expiry":"'+getODataUTCDateFilter(new Date)+'"}}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.sendPushMessageToUser=function(t,n,r){var i=App42.URL("push"+"/sendMessage/"+t);if(n!=null&&t!=null){n=n.trim();t=t.trim()}if(n==""||t==""||n==null||t==null){App42Fault.throwExceptionIfNullOrBlank(n,"message");App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"push":{"message":{"userName":"'+t+'","payload":"'+n+'","expiry":"'+getODataUTCDateFilter(new Date)+'"}}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.sendPushMessageToAll=function(t,n){var r=App42.URL("push"+"/sendPushMessageToAll");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"message");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"push":{"message":{"payload":"'+t+'","expiry":"'+getODataUTCDateFilter(new Date)+'"}}}}';i.body=u;App42Connection.post(r,i,u,n,o)};this.registerAndSubscribe=function(t,n,r,i,s){var o=App42.URL("push"+"/subscribeDeviceToChannel/");checkDeviceType(i);if(n!=null&&t!=null&&r!=null){n=n.trim();t=t.trim();r=r.trim()}if(n==""||t==""||n==null||t==null||r==""||i==""||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"channel");App42Fault.throwExceptionIfNullOrBlank(r,"deviceToken");App42Fault.throwExceptionIfNullOrBlank(i,"deviceType");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"push":{"userName":"'+t+'","channelName":"'+n+'","deviceToken":"'+r+'","type":"'+i+'"}}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.unsubscribeDeviceToChannel=function(t,n,r,i){var s=App42.URL("push"+"/unsubscribeDeviceToChannel/");if(n!=null&&t!=null&&r!=null){n=n.trim();t=t.trim();r=r.trim()}if(n==""||t==""||n==null||t==null||r==""||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"channel");App42Fault.throwExceptionIfNullOrBlank(r,"deviceToken");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"push":{"userName":"'+t+'","channelName":"'+n+'","deviceToken":"'+r+'"}}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.deleteDeviceToken=function(t,n,r){var i=App42.URL("push");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"deviceToken");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.deviceToken=n;App42Connection.del(i,s,r,u)};this.sendPushMessageToGroup=function(t,n,r){var i=App42.URL("push"+"/sendPushMessageToGroup/");if(t!=null){t=t.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"message");App42Fault.throwExceptionIfNullOrBlank(n,"userList");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a=JSON.stringify(n);var f='{"app42":{"push":{"message":{"payload":"'+t+'","expiry":"'+getODataUTCDateFilter(new Date)+'","users":{"user":'+a+"}}}}}";s.body=f;App42Connection.post(i,s,f,r,u)};this.sendPushToTargetUsers=function(t,n,r,i,s){var o=App42.URL("push"+"/sendTargetPush/"+n+"/"+r);var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"push":{"message":{"payload":"'+t+'","expiry":"'+getODataUTCDateFilter(new Date)+'"}}}}';u.jsonQuery=getStr(i);u.body=l;App42Connection.post(o,u,l,s,f)};this.sendMessageToInActiveUsers=function(t,n,r,i){strStartDate=getODataUTCDateFilter(t);strEndDate=getODataUTCDateFilter(n);var s=App42.URL("push"+"/sendMessageToInActiveUsers");if(r!=null&&userName!=null){r=r.trim()}if(t==""||n==""||t==null||n==null||r==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"startDate");App42Fault.throwExceptionIfNullOrBlank(n,"endDate");App42Fault.throwExceptionIfNullOrBlank(r,"message");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"push":{"message":{"startDate":"'+strStartDate+'","endDate":"'+strEndDate+'","payload":"'+r+'","expiry":"'+getODataUTCDateFilter(new Date)+'"}}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.scheduleMessageToUser=function(t,n,r,i){var s=App42.URL("push"+"/sendMessage/"+t);if(n!=null&&t!=null){n=n.trim();t=t.trim()}if(n==""||t==""||n==null||t==null){App42Fault.throwExceptionIfNullOrBlank(n,"message");App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"push":{"message":{"userName":"'+t+'","payload":"'+n+'","expiry":"'+getODataUTCDateFilter(r)+'"}}}}';o.body=f;App42Connection.post(s,o,f,i,a)}}function App42Photo(){App42Service.call(this);var e=this;this.addPhoto=function(t,n,r,i,s,o){var u=App42.URL("gallery"+"/"+t);if(t!=null&&n!=null&&i!=null&&r!=null&&s!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||i==""||s==null||s==""||t==null||n==null||i==null||r==null||r==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");App42Fault.throwExceptionIfNullOrBlank(r,"photoName");App42Fault.throwExceptionIfNullOrBlank(i,"photoDescription");App42Fault.throwExceptionIfNullOrBlank(s,"filePath");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.userName=t;a.albumName=n;a.name=r;a.description=i;App42Connection.multipart(u,a,s,o,l)};this.addTagToPhoto=function(t,n,r,i,s){var o=App42.URL("gallery"+"/"+"tag");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null||r==null||r==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");App42Fault.throwExceptionIfNullOrBlank(r,"photoName");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l=JSON.stringify(i);var c='{"tag":'+l+"}";var h=JSON.stringify(c);var p='{"app42":{"photo":{"userName":"'+t+'","albumName":"'+n+'","photoName":"'+r+'","tags":'+h+"}}}";u.body=p;App42Connection.post(o,u,p,s,f)};this.getPhotos=function(t,n){var r=App42.URL("gallery"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getPhotosByAlbumName=function(t,n,r){var i=App42.URL("gallery"+"/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.albumName=n;App42Connection.get(i,s,r,null,u)};this.getPhotosCountByAlbumName=function(t,n,r){var i=App42.URL("gallery"+"/"+t+"/"+n+"/count");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.albumName=n;App42Connection.get(i,s,r,null,u)};this.getPhotosByAlbumNameByPaging=function(t,n,r,i,s){var o=App42.URL("gallery/album"+"/"+t+"/"+n+"/paging"+"/"+r+"/"+i);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.userName=t;u.albumName=n;u.max=r;u.offset=i;App42Connection.get(o,u,s,null,f)};this.getTaggedPhotos=function(t,n,r){var i=App42.URL("gallery"+"/"+"tag"+"/"+n+"/userName/"+t);if(t!=null&&n!=null){t=t.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(albumName,"albumName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.tag=n;App42Connection.get(i,s,r,null,u)};this.getPhotosByAlbumAndPhotoName=function(t,n,r,i){var s=App42.URL("gallery"+"/"+t+"/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");App42Fault.throwExceptionIfNullOrBlank(r,"photoName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.userName=t;o.albumName=n;o.name=r;App42Connection.get(s,o,i,null,a)};this.removePhoto=function(t,n,r,i){var s=App42.URL("gallery"+"/"+t+"/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");App42Fault.throwExceptionIfNullOrBlank(r,"photoName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.userName=t;o.albumName=n;o.name=r;App42Connection.del(s,o,i,a)};this.grantAccess=function(t,n,r,i,s){var o=App42.URL("gallery/grantAccess/"+r+"/"+t+"/"+n);if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"albumName");App42Fault.throwExceptionIfNullOrBlank(n,"photoName");App42Fault.throwExceptionIfNullOrBlank(r,"userName");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.albumName=t;u.photoName=n;u.userName=r;var l=new Array;if(i instanceof Array){for(var c=0;c<i.length;c++){var h=i[c].user;var p;checkPermissionType(p);p=i[c].permission;var d={user:h,permission:p};l.push(d)}}else{var v=i.user;var m;checkPermissionType(m);m=i.permission;var g={user:v,permission:m};l.push(g)}var y=JSON.stringify(l);var b='{"acl":'+y+"}";var w=JSON.stringify(b);var E='{"app42":{"photo":{"acls":'+w+"}}}}";u.body=E;App42Connection.put(o,u,E,s,f)};this.revokeAccess=function(t,n,r,i,s){var o=App42.URL("gallery/revokeAccess/"+r+"/"+t+"/"+n);if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"albumName");App42Fault.throwExceptionIfNullOrBlank(n,"photoName");App42Fault.throwExceptionIfNullOrBlank(r,"userName");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.albumName=t;u.photoName=n;u.userName=r;var l=new Array;if(i instanceof Array){for(var c=0;c<i.length;c++){var h=i[c].user;var p;checkPermissionType(p);p=i[c].permission;var d={user:h,permission:p};l.push(d)}}else{var v=i.user;var m;checkPermissionType(m);m=i.permission;var g={user:v,permission:m};l.push(g)}var y=JSON.stringify(l);var b='{"acl":'+y+"}";var w=JSON.stringify(b);var E='{"app42":{"photo":{"acls":'+w+"}}}}";u.body=E;App42Connection.put(o,u,E,s,f)};this.updatePhoto=function(t,n,r,i,s,o){var u=App42.URL("gallery"+"/"+"update/"+t);if(t!=null&&n!=null&&i!=null&&r!=null&&s!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||i==""||s==null||s==""||t==null||n==null||i==null||r==null||r==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");App42Fault.throwExceptionIfNullOrBlank(r,"photoName");App42Fault.throwExceptionIfNullOrBlank(i,"photoDescription");App42Fault.throwExceptionIfNullOrBlank(s,"filePath");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.userName=t;a.albumName=n;a.name=r;a.description=i;App42Connection.multipart(u,a,s,o,l)}}function buildAndSend(e,t,n,r){App42Service.call(this);var i=this;var s=App42.URL("log"+"/"+n);if(e!=null&&t!=null&&n!=null){e=e.trim();t=t.trim();n=n.trim()}if(e==""||t==""||n==""||e==null||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(e,"msg");App42Fault.throwExceptionIfNullOrBlank(t,"module");App42Fault.throwExceptionIfNullOrBlank(n,"level");return}var o=i.populateSignParams(),u=i.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"log":{"message":"'+e+'","appModule":"'+t+'"}}}';o.body=f;App42Connection.post(s,o,f,r,a)}function fetchLogsByLevel(e,t){App42Service.call(this);var n=this;if(e!=null){e=e.trim()}if(e==""||e==null){App42Fault.throwExceptionIfNullOrBlank(e,"level");return}var r=App42.URL("log"+"/"+"type"+"/"+e);var i=n.populateSignParams(),s=n.populateMetaHeaderParams(),o=__merge(i,s);i.type=e;App42Connection.get(r,i,t,null,o)}function fetchLogsByLevelByPaging(e,t,n,r){App42Service.call(this);var i=this;if(e!=null){e=e.trim()}if(e==""||e==null){App42Fault.throwExceptionIfNullOrBlank(e,"level");return}var s=App42.URL("log"+"/"+"paging"+"/"+"type"+"/"+e+"/"+t+"/"+n);var o=i.populateSignParams(),u=i.populateMetaHeaderParams(),a=__merge(o,u);o.type=e;o.max=t;o.offset=n;App42Connection.get(s,o,r,null,a)}function fetchLogsCountByLevel(e,t){App42Service.call(this);var n=this;if(e!=null){e=e.trim()}if(e==""||e==null){App42Fault.throwExceptionIfNullOrBlank(e,"level");return}var r=App42.URL("log"+"/"+"type"+"/"+e+"/count");var i=n.populateSignParams(),s=n.populateMetaHeaderParams(),o=__merge(i,s);i.type=e;App42Connection.get(r,i,t,null,o)}function App42Log(){App42Service.call(this);var e=this;this.info=function(e,t,n){return buildAndSend(e,t,"info",n)};this.debug=function(e,t,n){return buildAndSend(e,t,"debug",n)};this.fatal=function(e,t,n){return buildAndSend(e,t,"fatal",n)};this.error=function(e,t,n){return buildAndSend(e,t,"error",n)};this.fetchLogsByModule=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"moduleName");return}var r=App42.URL("log"+"/"+"module"+"/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.moduleName=t;App42Connection.get(r,i,n,null,o)};this.fetchLogsByModuleByPaging=function(t,n,r,i){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"moduleName");return}var s=App42.URL("log"+"/"+"paging"+"/"+"module"+"/"+t+"/"+n+"/"+r);var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.moduleName=t;o.max=n;o.offset=r;App42Connection.get(s,o,i,null,a)};this.fetchLogsCountByModule=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"moduleName");return}var r=App42.URL("log"+"/"+"module"+"/"+t+"/count");var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.moduleName=t;App42Connection.get(r,i,n,null,o)};this.fetchLogsByModuleAndText=function(t,n,r){if(t!=null||t!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"moduleName");App42Fault.throwExceptionIfNullOrBlank(n,"text");return}var i=App42.URL("log"+"/"+"module"+"/"+t+"/"+"text"+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.moduleName=t;s.text=n;App42Connection.get(i,s,r,null,u)};this.fetchLogsByModuleAndTextByPaging=function(t,n,r,i,s){if(t!=null||t!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"moduleName");App42Fault.throwExceptionIfNullOrBlank(n,"text");return}var o=App42.URL("log"+"/"+"paging"+"/"+"module"+"/"+t+"/"+"text"+"/"+n+"/"+r+"/"+i);var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.moduleName=t;u.text=n;u.max=r;u.offset=i;App42Connection.get(o,u,s,null,f)};this.fetchLogsCountByModuleAndText=function(t,n,r){if(t!=null||t!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"moduleName");App42Fault.throwExceptionIfNullOrBlank(n,"text");return}var i=App42.URL("log"+"/"+"module"+"/"+t+"/"+"text"+"/"+n+"/count");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.moduleName=t;s.text=n;App42Connection.get(i,s,r,null,u)};this.fetchLogsCountByInfo=function(e){return fetchLogsCountByLevel("INFO",e)};this.fetchLogsCountByDebug=function(e){return fetchLogsCountByLevel("DEBUG",e)};this.fetchLogsCountByError=function(e){return fetchLogsCountByLevel("ERROR",e)};this.fetchLogsCountByFatal=function(e){return fetchLogsCountByLevel("FATAL",e)};this.fetchLogsByInfo=function(e){return fetchLogsByLevel("INFO",e)};this.fetchLogsByInfoByPaging=function(e,t,n){return fetchLogsByLevelByPaging("INFO",e,t,n)};this.fetchLogsByDebug=function(e){return fetchLogsByLevel("DEBUG",e)};this.fetchLogsByDebugByPaging=function(e,t,n){return fetchLogsByLevelByPaging("DEBUG",e,t,n)};this.fetchLogsByError=function(e){return fetchLogsByLevel("ERROR",e)};this.fetchLogsByErrorByPaging=function(e,t,n){return fetchLogsByLevelByPaging("ERROR",e,t,n)};this.fetchLogsByFatal=function(e){return fetchLogsByLevel("FATAL",e)};this.fetchLogsByFatalByPaging=function(e,t,n){return fetchLogsByLevelByPaging("FATAL",e,t,n)};this.fetchLogByDateRange=function(t,n,r){if(t!=null||n!=null){}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"startDate");App42Fault.throwExceptionIfNullOrBlank(n,"endDate");return}strStartDate=getODataUTCDateFilter(t);strEndDate=getODataUTCDateFilter(n);var i=App42.URL("log"+"/"+"startDate"+"/"+strStartDate+"/"+"endDate"+"/"+strEndDate);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.startDate=strStartDate;s.endDate=strEndDate;App42Connection.get(i,s,r,null,u)};this.fetchLogByDateRangeByPaging=function(t,n,r,i,s){if(t!=null||n!=null){}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"startDate");App42Fault.throwExceptionIfNullOrBlank(n,"endDate");return}strStartDate=getODataUTCDateFilter(t);strEndDate=getODataUTCDateFilter(n);var o=App42.URL("log"+"/"+"paging"+"/"+"startDate"+"/"+strStartDate+"/"+"endDate"+"/"+strEndDate+"/"+r+"/"+i);var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.startDate=strStartDate;u.endDate=strEndDate;u.max=r;u.offset=i;App42Connection.get(o,u,s,null,f)};this.fetchLogCountByDateRange=function(t,n,r){if(t!=null||n!=null){}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"startDate");App42Fault.throwExceptionIfNullOrBlank(n,"endDate");return}strStartDate=getODataUTCDateFilter(t);strEndDate=getODataUTCDateFilter(n);var i=App42.URL("log"+"/"+"startDate"+"/"+strStartDate+"/"+"endDate"+"/"+strEndDate+"/count");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.startDate=strStartDate;s.endDate=strEndDate;App42Connection.get(i,s,r,null,u)};this.setEventWithModuleName=function(t,n,r){if(n!=null){n=n.trim()}if(n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(n,"eventName");return}e.setModuleEvent(n);return this.info("EventMessage",t,r)};this.setEvent=function(e,t){return this.info(e,"_App42_Event",t)}}function App42ImageProcessor(){App42Service.call(this);var e=this;this.resize=function(t,n,r,i,s){var o=App42.URL("image"+"/"+"resize");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim()}if(t==""||n==""||r==""||i==null||i==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"width");App42Fault.throwExceptionIfNullOrBlank(i,"height");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.name=t;u.width=r;u.height=i;App42Connection.multipart(o,u,n,s,f)};this.thumbnail=function(t,n,r,i,s){var o=App42.URL("image"+"/"+"thumbnail");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim()}if(t==""||n==""||r==""||i==null||i==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"width");App42Fault.throwExceptionIfNullOrBlank(i,"height");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.name=t;u.width=r;u.height=i;App42Connection.multipart(o,u,n,s,f)};this.scale=function(t,n,r,i,s){var o=App42.URL("image"+"/"+"scale");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim()}if(t==""||n==""||r==""||i==null||i==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"width");App42Fault.throwExceptionIfNullOrBlank(i,"height");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.name=t;u.width=r;u.height=i;App42Connection.multipart(o,u,n,s,f)};this.crop=function(t,n,r,i,s,o,u){var a=App42.URL("image"+"/"+"crop");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim()}if(t==""||n==""||r==""||i==null||i==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"width");App42Fault.throwExceptionIfNullOrBlank(i,"height");return}var f=e.populateSignParams(),l=e.populateMetaHeaderParams(),c=__merge(f,l);f.name=t;f.width=r;f.height=i;f.x=s;f.y=o;App42Connection.multipart(a,f,n,u,c)};this.resizeByPercentage=function(t,n,r,i){var s=App42.URL("image"+"/"+"resizePercentage");if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"percentage");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.name=t;o.percentage=r;App42Connection.multipart(s,o,n,i,a)};this.thumbnailByPercentage=function(t,n,r,i){var s=App42.URL("image"+"/"+"thumbnailPercentage");if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"percentage");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.name=t;o.percentage=r;App42Connection.multipart(s,o,n,i,a)};this.scaleByPercentage=function(t,n,r,i){var s=App42.URL("image"+"/"+"scalePercentage");if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"percentage");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.name=t;o.percentage=r;App42Connection.multipart(s,o,n,i,a)};this.convertFormat=function(t,n,r,i){var s=App42.URL("image"+"/"+"convertformat");if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||n==""||r==""||r==null||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"imagePath");App42Fault.throwExceptionIfNullOrBlank(r,"formatToConvert");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.name=t;o.formatToConvert=r;App42Connection.multipart(s,o,n,i,a)}}function clean_hex(e,t){e=e.toUpperCase();if(t){e=e.replace(/0x/gi,"")}var n=e;e=e.replace(/[^A-Fa-f0-9]/g,"");if(n!=e)alert("Warning! Non-hex characters in input string ignored.");return e}function binary_to_base64(e){var t=new Array;var n=0;var r=0;var i=new Array(3);var s=new Array(4);var o=e.length;var u=0;while(o--){i[n++]=e[u++];if(n==3){s[0]=(i[0]&252)>>2;s[1]=((i[0]&3)<<4)+((i[1]&240)>>4);s[2]=((i[1]&15)<<2)+((i[2]&192)>>6);s[3]=i[2]&63;for(n=0;n<4;n++)t+=base64_chars.charAt(s[n]);n=0}}if(n){for(r=n;r<3;r++)i[r]=0;s[0]=(i[0]&252)>>2;s[1]=((i[0]&3)<<4)+((i[1]&240)>>4);s[2]=((i[1]&15)<<2)+((i[2]&192)>>6);s[3]=i[2]&63;for(r=0;r<n+1;r++)t+=base64_chars.charAt(s[r]);while(n++<3)t+="="}return t}function Convert(e){var t=clean_hex(e,false);if(t.length%2){alert("Error: cleaned hex string length is odd.");document.frmConvert.base64.value="";return false}var n=new Array;for(var r=0;r<t.length/2;r++){var i=t.substr(r*2,2);n[r]=parseInt(i,16)}return binary_to_base64(n)}function App42Geo(){App42Service.call(this);var e=this;this.createGeoPoints=function(t,n,r){var i=App42.URL("geo"+"/"+"createGeoPoints");if(t!=null){t=t.trim()}if(t==""||t==null||n==null||n==""){App42Fault.throwExceptionIfNullOrBlank(t,"geoStorageName");App42Fault.throwExceptionIfNullOrBlank(n,"geoPointsList");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a=new Array;if(n instanceof Array){for(var f=0;f<n.length;f++){var l=n[f].lat;var c=n[f].lng;var h=n[f].marker;var p={lat:l,lng:c,marker:h};a.push(p)}}else{var d=n.lat;var v=n.lng;var m=n.marker;var g={lat:d,lng:v,marker:m};a.push(g)}var y=JSON.stringify(a);var b='{"app42":{ "geo": {"storage":{"storageName":"'+t+'" , "points": { "point": '+y+"}}}}}";s.body=b;App42Connection.post(i,s,b,r,u)};this.getNearByPointsByMaxDistance=function(t,n,r,i,s){var o=App42.URL("geo"+"/"+"getNearByPoints"+"/"+"storageName"+"/"+t+"/"+"lat"+"/"+n+"/"+"lng"+"/"+r+"/"+"distanceInKM"+"/"+i);if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim()}if(t==""||t==null||n==null||n==""||r==null||r==""||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"storageName");App42Fault.throwExceptionIfNullOrBlank(n,"lat");App42Fault.throwExceptionIfNullOrBlank(r,"lng");App42Fault.throwExceptionIfNullOrBlank(i,"distanceInKM");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.storageName=t;u.lat=n;u.lng=r;u.distanceInKM=i;App42Connection.get(o,u,s,null,f)};this.getNearByPoint=function(t,n,r,i,s){var o=App42.URL("geo"+"/"+"getNearByPoint"+"/"+"storageName"+"/"+t+"/"+"lat"+"/"+n+"/"+"lng"+"/"+r+"/"+"limit"+"/"+i);if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim()}if(t==""||t==null||n==null||n==""||r==null||r==""||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"storageName");App42Fault.throwExceptionIfNullOrBlank(n,"lat");App42Fault.throwExceptionIfNullOrBlank(r,"lng");App42Fault.throwExceptionIfNullOrBlank(i,"resultLimit");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.storageName=t;u.lat=n;u.lng=r;u.resultLimit=i;App42Connection.get(o,u,s,null,f)};this.getPointsWithInCircle=function(t,n,r,i,s,o){var u=App42.URL("geo"+"/"+"getPointsWithInCircle"+"/"+"storageName"+"/"+t+"/"+"lat"+"/"+n+"/"+"lng"+"/"+r+"/"+"radiusInKM"+"/"+i+"/"+"limit"+"/"+s);if(t!=null&&n!=null&&r!=null&&i!=null&&s!=null){t=t.trim()}if(t==""||t==null||n==null||n==""||r==null||r==""||i==""||i==null||s==""||s==null){App42Fault.throwExceptionIfNullOrBlank(t,"storageName");App42Fault.throwExceptionIfNullOrBlank(n,"lat");App42Fault.throwExceptionIfNullOrBlank(r,"lng");App42Fault.throwExceptionIfNullOrBlank(i,"radiusInKM");App42Fault.throwExceptionIfNullOrBlank(s,"resultLimit");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.storageName=t;a.lat=n;a.lng=r;a.resultLimit=s;a.radiusInKM=i;App42Connection.get(u,a,o,null,l)};this.getAllPoints=function(t,n){var r=App42.URL("geo"+"/"+"points"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"storageName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.storageName=t;App42Connection.get(r,i,n,null,o)};this.getAllStorage=function(t){var n=App42.URL("geo"+"/"+"storage");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.getAllStorageByPaging=function(t,n,r){var i=App42.URL("geo"+"/paging"+"/"+t+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.max=t;s.offset=n;App42Connection.get(i,s,r,null,u)};this.deleteStorage=function(t,n){var r=App42.URL("geo"+"/storage"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"storageName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.storageName=t;App42Connection.del(r,i,n,o)};this.deleteGeoPoints=function(t,n,r){var i=App42.URL("geo"+"/"+"points"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"storageName");return}var s=new Array;if(n instanceof Array){for(var o=0;o<n.length;o++){var u=n[o].lat;var a=n[o].lng;var f=n[o].marker;var l={lat:u,lng:a,marker:f};s.push(l)}}else{var c=n.lat;var h=n.lng;var p=n.marker;var d={lat:c,lng:h,marker:p};s.push(d)}var v=JSON.stringify(s);var m='{ "point": '+v+"}";var g=JSON.stringify(m);var y='{"app42":{ "geo": {"storage":{"points": '+g+"}}}}";var b=e.populateSignParams(),w=e.populateMetaHeaderParams(),E=__merge(b,w);b.geoPoints=y;App42Connection.del(i,b,r,E)}}function App42Game(){App42Service.call(this);var e=this;this.createGame=function(t,n,r){var i=App42.URL("game");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"gameDescription");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"game":{"name":"'+t+'","description":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.getAllGames=function(t){var n=App42.URL("game");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.getAllGamesWithPaging=function(t,n,r){var i=App42.URL("game/paging/"+t+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.max=t;s.offset=n;App42Connection.get(i,s,r,null,u)};this.getGameByName=function(t,n){var r=App42.URL("game/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.name=t;App42Connection.get(r,i,n,null,o)};this.getAllGamesCount=function(t){var n=App42.URL("game"+"/count");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)}}function App42CustomCodeService(){App42Service.call(this);var e=this;this.runJavaCode=function(t,n,r){var i=App42.CustomCodeURL("1.0/run/java/"+t);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a=JSON.stringify(n);App42Connection.executeCustomCode(i,s,a,r,u)}}function App42Catalogue(){App42Service.call(this);var e=this;this.createCatalogue=function(t,n,r){var i=App42.URL("catalogue");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(n,"catalogueDescription");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"catalogue":{"name":"'+t+'","description":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.createCategory=function(t,n,r,i){var s=App42.URL("catalogue"+"/"+t+"/"+"category");if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||r==""||n==""||t==null||r==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(r,"categoryDescription");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"catalogue":{"categories":{"category":{"name":"'+n+'","description":"'+r+'"}}}}}';o.catalogueName=t;o.body=f;App42Connection.post(s,o,f,i,a)};this.addItem=function(t,n,r,i){var s=App42.URL("catalogue"+"/"+t+"/"+n+"/item");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.catalogueName=t;o.categoryName=n;o.itemId=r.getItemId();o.name=r.getName();o.description=r.getDescription();o.price=r.getPrice();var f=r.getImage();App42Connection.multipart(s,o,f,i,a)};this.getItems=function(t,n){var r=App42.URL("catalogue"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.catalogueName=t;App42Connection.get(r,i,n,null,o)};this.getItemsByCategory=function(t,n,r){var i=App42.URL("catalogue"+"/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.catalogueName=t;s.categoryName=n;App42Connection.get(i,s,r,null,u)};this.getItemsByCategoryWithPaging=function(t,n,r,i,s){var o=App42.URL("catalogue"+"/"+"paging"+"/"+t+"/"+n+"/"+r+"/"+i);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||r==null||i==""||i==null||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");App42Fault.throwExceptionIfNullOrBlank(r,"max");App42Fault.throwExceptionIfNullOrBlank(i,"offset");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.catalogueName=t;u.categoryName=n;u.max=r;u.offset=i;App42Connection.get(o,u,s,null,f)};this.getItemsCountByCategory=function(t,n,r){var i=App42.URL("catalogue"+"/"+t+"/"+n+"/count");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.catalogueName=t;s.categoryName=n;App42Connection.get(i,s,r,null,u)};this.getItemById=function(t,n,r,i){var s=App42.URL("catalogue"+"/"+t+"/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||r==""||n==""||t==null||r==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(r,"itemId");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.catalogueName=t;o.categoryName=n;o.itemId=r;App42Connection.get(s,o,i,null,a)};this.removeAllItems=function(t,n){var r=App42.URL("catalogue"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.catalogueName=t;App42Connection.del(r,i,n,o)};this.removeItemsByCategory=function(t,n,r){var i=App42.URL("catalogue"+"/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.catalogueName=t;s.categoryName=n;App42Connection.del(i,s,r,u)};this.removeItemById=function(t,n,r,i){var s=App42.URL("catalogue"+"/"+t+"/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||r==""||n==""||t==null||r==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(r,"itemId");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.catalogueName=t;o.categoryName=n;o.itemId=r;App42Connection.del(s,o,i,a)};this.deleteCategory=function(t,n,r){var i=App42.URL("catalogue"+"/"+t+"/category"+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"catalogueName");App42Fault.throwExceptionIfNullOrBlank(n,"categoryName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.catalogueName=t;s.categoryName=n;App42Connection.del(i,s,r,u)}}function checkStatus(e){if(_status.DECLINED==e||_status.AUTHORIZED==e||_status.PENDING==e){return e}else{throw new App42Exception("PaymentStatus",e)}}function App42Cart(){App42Service.call(this);var e=this;this.createCart=function(t,n){var r=App42.URL("cart");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"user");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"cart":{"userName":"'+t+'"}}}';i.body=u;App42Connection.post(r,i,u,n,o)};this.getCartDetails=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartId");return}var r=App42.URL("cart"+"/"+t+"/details");var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.cartId=t;App42Connection.get(r,i,n,null,o)};this.addItem=function(t,n,r,i,s){var o=App42.URL("cart"+"/item/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null||r==""||r==null||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");App42Fault.throwExceptionIfNullOrBlank(n,"itemID");App42Fault.throwExceptionIfNullOrBlank(r,"itemQuantity");App42Fault.throwExceptionIfNullOrBlank(i,"price");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.itemId=n;var l='{"app42":{"cart":{"cartId":"'+t+'", "item":{"quantity":"'+r+'","amount":"'+i+'"}}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.getItems=function(t,n){var r=App42.URL("cart"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.cartId=t;App42Connection.get(r,i,n,null,o)};this.getItem=function(t,n,r){var i=App42.URL("cart"+"/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");App42Fault.throwExceptionIfNullOrBlank(n,"itemID");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.cartId=t;s.itemId=n;App42Connection.get(i,s,r,null,u)};this.removeAllItems=function(t,n){var r=App42.URL("cart"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.cartId=t;App42Connection.del(r,i,n,o)};this.removeItem=function(t,n,r){var i=App42.URL("cart"+"/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");App42Fault.throwExceptionIfNullOrBlank(n,"itemID");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.cartId=t;s.itemId=n;App42Connection.del(i,s,r,u)};this.isEmpty=function(t,n){var r=App42.URL("cart"+"/"+t+"/isEmpty");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.cartId=t;App42Connection.get(r,i,n,null,o)};this.checkOut=function(t,n){var r=App42.URL("cart"+"/checkOut");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"cart":{"cartId":"'+t+'"}}}';i.body=u;App42Connection.put(r,i,u,n,o)};this.payment=function(t,n,r,i){var s=App42.URL("cart"+"/payment");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");App42Fault.throwExceptionIfNullOrBlank(n,"transactionID");App42Fault.throwExceptionIfNullOrBlank(r,"paymentStatus");return}checkStatus(r);var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"cart":{"cartId":"'+t+'","transactionId":"'+n+'","status":"'+r+'"}}}';o.body=f;App42Connection.put(s,o,f,i,a)};this.getPaymentsByUser=function(t,n){var r=App42.URL("cart"+"/payments"+"/user"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userId=t;App42Connection.get(r,i,n,null,o)};this.getPaymentByCart=function(t,n){var r=App42.URL("cart"+"/payments/cart/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.cartId=t;App42Connection.get(r,i,n,null,o)};this.getPaymentsByUserAndStatus=function(t,n,r){var i=App42.URL("cart"+"/payments"+"/user"+"/"+t+"/"+n);if(t!=null){t=t.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userID");App42Fault.throwExceptionIfNullOrBlank(n,"paymentStatus");return}checkStatus(n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userId=t;s.status=n;App42Connection.get(i,s,r,null,u)};this.getPaymentsByStatus=function(t,n){var r=App42.URL("cart"+"/payments"+"/status"+"/"+t);if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"paymentStatus");return}checkStatus(t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.status=t;App42Connection.get(r,i,n,null,o)};this.getPaymentHistoryByUser=function(t,n){var r=App42.URL("cart"+"/payment"+"/history"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userID");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userId=t;App42Connection.get(r,i,n,null,o)};this.getPaymentHistoryAll=function(t){var n=App42.URL("cart"+"/payment"+"/history");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.increaseQuantity=function(t,n,r,i){var s=App42.URL("cart"+"/increaseQuantity");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");App42Fault.throwExceptionIfNullOrBlank(n,"itemID");App42Fault.throwExceptionIfNullOrBlank(r,"itemQuantity");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"cart":{"cartId":"'+t+'","itemId":"'+n+'","quantity":"'+r+'"}}}';o.body=f;App42Connection.put(s,o,f,i,a)};this.decreaseQuantity=function(t,n,r,i){var s=App42.URL("cart"+"/decreaseQuantity");if(t!=null&&n!=null){t=t.trim();n=n.trim();if(t==""||n==""||r==""||t==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"cartID");App42Fault.throwExceptionIfNullOrBlank(n,"itemID");App42Fault.throwExceptionIfNullOrBlank(r,"itemQuantity");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"cart":{"cartId":"'+t+'","itemId":"'+n+'","quantity":"'+r+'"}}}';o.body=f;App42Connection.put(s,o,f,i,a)}}}function App42Buddy(){App42Service.call(this);var e=this;this.sendFriendRequest=function(t,n,r,i){var s=App42.URL("buddy");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"buddy":{"userName":"'+t+'","buddyName":"'+n+'","message":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.getFriendRequest=function(t,n){var r=App42.URL("buddy"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.acceptFriendRequest=function(t,n,r){var i=App42.URL("buddy");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"buddy":{"userName":"'+t+'","buddyName":"'+n+'"}}}';s.body=a;App42Connection.put(i,s,a,r,u)};this.rejectFriendRequest=function(t,n,r){var i=App42.URL("buddy"+"/userName/"+t+"/buddyName/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.buddyName=n;App42Connection.del(i,s,r,u)};this.getAllFriends=function(t,n){var r=App42.URL("buddy"+"/friends/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.createGroupByUser=function(t,n,r){var i=App42.URL("buddy"+"/group");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"groupName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"buddy":{"userName":"'+t+'","groupName":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.addFriendToGroup=function(t,n,r,i){var s=App42.URL("buddy"+"/group/friends");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"groupName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f=JSON.stringify(r);var l='{"app42":{"buddy":{"userName":"'+t+'","groupName":"'+n+'","friends":{"friend":'+f+"}}}}";o.body=l;App42Connection.post(s,o,l,i,a)};this.checkedInGeoLocation=function(t,n,r){var i=App42.URL("buddy"+"/checkedIn");if(t!=null){t=t.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"geoPointsList");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a={};var f=n.lat;var l=n.lng;var c=n.marker;var h={lat:f,lng:l,marker:c};var p=JSON.stringify(h);var d='{"point":'+p+"}";var v='{"app42":{"buddy":{"userName":"'+t+'","points":'+d+"}}}";s.body=v;App42Connection.post(i,s,v,r,u)};this.getFriendsByLocation=function(t,n,r,i,s,o){var u=App42.URL("buddy"+"/friends/location/"+t+"/"+i+"/"+n+"/"+r+"/"+s);var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.userName=t;a.maxDistance=i;a.latitude=n;a.longitude=r;a.max=s;App42Connection.get(u,a,o,null,l)};this.getAllGroups=function(t,n){var r=App42.URL("buddy"+"/groupall/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getAllFriendsInGroup=function(t,n,r,i){var s=App42.URL("buddy"+"/friends/"+t+"/group/"+n+"/"+r);var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.userName=t;o.ownerName=n;o.groupName=r;App42Connection.get(s,o,i,null,a)};this.blockFriendRequest=function(t,n,r){var i=App42.URL("buddy"+"/block/userName/"+t+"/buddyName/"+n);if(n!=null&&t!=null){n=n.trim();t=t.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.buddyName=n;App42Connection.del(i,s,r,u)};this.blockUser=function(t,n,r){var i=App42.URL("buddy"+"/block");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==+""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"buddy":{"userName":"'+t+'","buddyName":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.unblockUser=function(t,n,r){var i=App42.URL("buddy"+"/unblock");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==+""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"buddy":{"userName":"'+t+'","buddyName":"'+n+'"}}}';s.body=a;App42Connection.put(i,s,a,r,u)};this.sendMessageToGroup=function(t,n,r,i,s){var o=App42.URL("buddy"+"/groupmessage");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||r==null||i==null||t==""||n==""||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"ownerName");App42Fault.throwExceptionIfNullOrBlank(r,"groupName");App42Fault.throwExceptionIfNullOrBlank(i,"message");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"buddy":{"userName":"'+t+'","ownerName":"'+n+'","groupName":"'+r+'","message":"'+i+'"}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.sendMessageToFriend=function(t,n,r,i){var s=App42.URL("buddy"+"/friendmessage");if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==null||t==""||n==""||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");App42Fault.throwExceptionIfNullOrBlank(r,"message");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"buddy":{"userName":"'+t+'","buddyName":"'+n+'","message":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.sendMessageToFriends=function(t,n,r){var i=App42.URL("buddy"+"/messageAll");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==null||t==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"message");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"buddy":{"userName":"'+t+'","message":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.getAllMessages=function(t,n){var r=App42.URL("buddy"+"/message/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getAllMessagesFromBuddy=function(t,n,r){var i=App42.URL("buddy"+"/buddyMessage/"+t+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.buddyName=n;App42Connection.get(i,s,r,null,u)};this.getAllMessagesFromGroup=function(t,n,r,i){var s=App42.URL("buddy"+"/"+t+"/groupMassaage/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==null||t==""||n==""||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"groupOwner");App42Fault.throwExceptionIfNullOrBlank(r,"groupName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.userName=t;o.ownerName=n;o.groupName=r;App42Connection.get(s,o,i,null,a)};this.unFriend=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==null||t==""||n==null||n==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"buddyName");return}var i=App42.URL("buddy/"+"unfriend/userName/"+t+"/buddyName/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.buddyName=n;App42Connection.del(i,s,r,u)};this.deleteMessageById=function(t,n,r){if(t!=null&&n!=null){t=t.trim()}if(t==null||t==""||n==null||n==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"messageId");return}var i=App42.URL("buddy/"+"deleteMessageById/"+t);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a=new Array;a.push(n);s.userName=t;s.messageIds="["+a.toString()+"]";console.log(a.toString());App42Connection.del(i,s,r,u)};this.deleteMessageByIds=function(t,n,r){if(t!=null&&n!=null){t=t.trim()}if(t==null||t==""||n==null||n==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"messageIds");return}var i=App42.URL("buddy/"+"deleteMessageById/"+t);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.messageIds="["+n.toString()+"]";App42Connection.del(i,s,r,u)}}function App42Avatar(){App42Service.call(this);var e=this;this.createAvatar=function(t,n,r,i,s){var o=App42.URL("avatar"+"/file/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"AvatarName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"filePath");App42Fault.throwExceptionIfNullOrBlank(i,"description");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.avatarName=t;u.userName=n;u.description=i;App42Connection.multipart(o,u,r,s,f)};this.createAvatarFromFacebook=function(t,n,r,i,s){if(t!=null&&n!=null){name=name.trim();n=n.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"avatarName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"accessToken");App42Fault.throwExceptionIfNullOrBlank(i,"description");return}var o=App42.URL("avatar"+"/facebook");var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"avatar":{"userName":"'+n+'","avatarName":"'+t+'","accessToken":"'+r+'","description":"'+i+'"}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.createAvatarFromWebURL=function(t,n,r,i,s){if(t!=null&&n!=null){name=name.trim();n=n.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"avatarName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"webUrl");App42Fault.throwExceptionIfNullOrBlank(i,"description");return}var o=App42.URL("avatar"+"/weburl");var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"avatar":{"userName":"'+n+'","avatarName":"'+t+'","webUrl":"'+r+'","description":"'+i+'"}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.getAvatarByName=function(t,n,r){var i=App42.URL("avatar"+"/"+n+"/"+t);if(n!=null&&t!=null){n=n.trim();t=t.trim()}if(n==""||t==""||n==null||t==null){App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(t,"avatarName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=n;s.avatarName=t;App42Connection.get(i,s,r,null,u)};this.getAllAvatars=function(t,n){var r=App42.URL("avatar"+"/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getCurrentAvatar=function(t,n){var r=App42.URL("avatar"+"/current/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.changeCurrentAvatar=function(t,n,r){var i=App42.URL("avatar");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"avatarName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"avatar":{"userName":"'+t+'","avatarName":"'+n+'"}}}';s.body=a;App42Connection.put(i,s,a,r,u)}}function App42Album(){App42Service.call(this);var e=this;this.createAlbum=function(t,n,r,i){var s=App42.URL("gallery"+"/"+"album"+"/"+t);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");App42Fault.throwExceptionIfNullOrBlank(r,"albumDescription");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"album":{"name":"'+n+'","description":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.getAlbums=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var r=App42.URL("gallery"+"/album"+"/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getAlbumsByPaging=function(t,n,r,i){var s=App42.URL("gallery"+"/album"+"/"+t+"/"+n+"/"+r);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.userName=t;o.offset=r;o.max=n;App42Connection.get(s,o,i,null,a)};this.getAlbumsCount=function(t,n){var r=App42.URL("gallery"+"/album"+"/"+t+"/"+"count");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getAlbumByName=function(t,n,r){var i=App42.URL("gallery"+"/album"+"/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.albumName=n;App42Connection.get(i,s,r,null,u)};this.removeAlbum=function(t,n,r){var i=App42.URL("gallery"+"/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"albumName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.albumName=n;App42Connection.del(i,s,r,u)}}function App42Achievement(){App42Service.call(this);var e=this;this.createAchievement=function(t,n,r){var i=App42.URL("achievement");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"name");App42Fault.throwExceptionIfNullOrBlank(n,"description");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"achievement":{"name":"'+t+'","description":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.earnAchievement=function(t,n,r,i,s){var o=App42.URL("achievement"+"/earn");if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||t==null||n==null||r==""||r==null||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"achievementName");App42Fault.throwExceptionIfNullOrBlank(r,"gameName");App42Fault.throwExceptionIfNullOrBlank(i,"description");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"achievement":{"userName":"'+t+'","name":"'+n+'","gameName":"'+r+'","description":"'+i+'"}}}';u.body=l;App42Connection.post(o,u,l,s,f)};this.getAllAchievementsForUser=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var r=App42.URL("achievement/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getAllAchievementsForUserInGame=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"gameName");return}var i=App42.URL("achievement/"+t+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userName=t;s.gameName=n;App42Connection.get(i,s,r,null,u)};this.getAllAchievements=function(t){var n=App42.URL("achievement"+"/all");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.getAchievementByName=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"achievementName");return}var r=App42.URL("achievement/"+"achievementName/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.achievementName=t;App42Connection.get(r,i,n,null,o)};this.getUsersAchievement=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"achievementName");App42Fault.throwExceptionIfNullOrBlank(n,"gameName");return}var i=App42.URL("achievement/"+"users/"+t+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.achievementName=t;s.game=n;App42Connection.get(i,s,r,null,u)}}function App42ABTest(){App42Service.call(this);var e=this;this.goalAchieved=function(t,n,r){var i=App42.URL("abtest"+"/goal-achieved");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"testName");App42Fault.throwExceptionIfNullOrBlank(n,"variantName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"abtest":{"name":"'+t+'","variantName":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.executeDataDriven=function(t,n){var r=App42.URL("abtest"+"/execute/data-driven");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"testName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"abtest":{"name":"'+t+'"}}}';i.body=u;App42Connection.post(r,i,u,n,o)};this.execute=function(t,n){var r=App42.URL("abtest"+"/execute");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"testName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"abtest":{"name":"'+t+'"}}}';i.body=u;App42Connection.post(r,i,u,n,o)};this.isActive=function(t,n){var r=App42.URL("abtest"+"/isActive/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"testName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.testName=t;App42Connection.get(r,i,n,null,o)}}function checkPermissionType(e){if(Permission.READ==e){return"R"}else if(Permission.WRITE==e){return"W"}else{return null}}function App42Exception(e,t){this.name="App42Exception";var n;if(e==""){n=t+" parameter can not be blank"}else if(e==null){n=t+" parameter can not be null"}else if(e=="PaymentStatus"){n="Invalid Status ("+t+"). Could be either AUTHORIZED or UNAUTHORIZED or DECLINED"}else if(e=="DeviceType"){n="Invalid device ("+t+"). Could be either ANDROID or WP7 or iOS"}else if(e=="FileType"){n="Invalid fileType ("+t+").Could be either AUDIO or VIDEO or IMAGE or BINARY or TXT or XML or CSV or JSON or OTHER"}else if(e!=t){n=t+" address is not valid"}n=n;this.message=n||""}function getODataUTCDateFilter(e){var t;var n=(e.getUTCMonth()+1).toString();if(n.length==1){t="0"+n}else{t=n}var r;var i=e.getUTCDate().toString();if(i.length==1){r="0"+i}else{r=i}var s="";s+=e.getUTCFullYear()+"-";s+=t+"-";s+=r;s+="T"+e.getUTCHours()+":";s+=e.getUTCMinutes()+":";s+=e.getUTCSeconds()+".";s+=e.getUTCMilliseconds();s+="Z";return s}function sortAssoc(e){var t=[];for(var n in e)t.push([n,e[n]]);t.sort(function(e,t){return e[0]>t[0]?-1:e[0]<t[0]?1:0});var r="";var i=[];for(var s=t.length-1;s>=0;s--){i[t[s][0]]=t[s][1];r+=t[s][0]+t[s][1]}return r}function createCORSRequest(e,t,n,r,i,s,o,u,a,f,l,c){var h=createXMLHTTPObject();h.open(e,t,true);h.setRequestHeader("Accept","application/json");h.setRequestHeader("signature",r);if(e=="POST"||e=="PUT"){h.setRequestHeader("Content-Type","application/json")}for(var p in c){var d=c[p];h.setRequestHeader(p.toString(),d)}h.onreadystatechange=function(){if(h.readyState==4){if(h.status==200){if(sessionRequest==true){sessionRequest=false;var e=JSON.parse(h.responseText);if(e.app42.response.users!=undefined){var t=e.app42.response.users.user.sessionId;if(localStorage!=undefined){localStorage.setItem("_App42_SessionId",t)}}}if(sessionInvalidate==true){sessionInvalidate=false;var n=JSON.parse(h.responseText);var r=n.app42.response.success;if(r){localStorage.removeItem("_App42_SessionId")}}o.success(h.responseText)}else if(h.status!=200){o.error(h.responseText)}}};h.send(s)}function multipartCORSRequest(e,t,n,r,i,s,o,u,a,f,l,c,h){var p=new FormData;if(s.userName!=null){p.append("userName",s.userName)}if(s.type!=null){p.append("uploadFile",o);p.append("name",s.name);p.append("type",s.type);p.append("description",s.description)}else if(s.itemId!=null){p.append("imageFile",o);p.append("name",s.name);p.append("itemId",s.itemId);p.append("description",s.description);p.append("price",s.price)}else if(s.avatarName!=null){p.append("createAvatar",o);p.append("avatarName",s.avatarName);p.append("userName",s.userName);p.append("description",s.description)}else if(s.accessToken!=null){if(s.userId!=null){p.append("uploadFile",o);p.append("name",s.name);p.append("accessToken",s.accessToken);p.append("userId",s.userId);p.append("message",s.message)}else{p.append("uploadFile",o);p.append("name",s.name);p.append("accessToken",s.accessToken);p.append("message",s.message)}}else{p.append("imageFile",o);p.append("name",s.name);p.append("height",s.height);p.append("width",s.width);p.append("x",s.x);p.append("y",s.y);p.append("percentage",s.percentage);p.append("formatToConvert",s.formatToConvert)}__createMultipartCORSRequest(e,t,r,p,u,h)}function multipartCORSRequestForPhoto(e,t,n,r,i,s,o,u,a,f,l,c,h){var p=new FormData;p.append("imageFile",o);p.append("userName",s.userName);p.append("albumName",s.albumName);p.append("name",s.name);p.append("description",s.description);__createMultipartCORSRequest(e,t,r,p,u,h)}function __createMultipartCORSRequest(e,t,n,r,i,s){var o=createXMLHTTPObject();o.open(e,t,true);o.setRequestHeader("Accept","application/json");o.setRequestHeader("signature",n);for(var u in s){var a=s[u];o.setRequestHeader(u.toString(),a)}o.onreadystatechange=function(){if(o.readyState==4){if(o.status==200){i.success(o.responseText)}else if(o.status!=200){i.error(o.responseText)}}};o.send(r)}function createXMLHTTPObject(){var e=false;for(var t=0;t<XMLHttpFactories.length;t++){try{e=XMLHttpFactories[t]()}catch(n){continue}break}return e}function pair(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}function guid(){return pair()+pair()+"-"+pair()+"-"+pair()+"-"+pair()+"-"+pair()+pair()+pair()}function checkOperatorType(e){if(myObject.EQUALS==e){return"$eq"}else if(myObject.NOT_EQUALS==e){return"$ne"}else if(myObject.GREATER_THAN==e){return"$gt"}else if(myObject.LESS_THAN==e){return"$lt"}else if(myObject.GREATER_THAN_EQUALTO==e){return"$gte"}else if(myObject.LESS_THAN_EQUALTO==e){return"$lte"}else if(myObject.LIKE==e){return"$lk"}else if(myObject.AND==e){return"$and"}else if(myObject.OR==e){return"$or"}else{return null}}function checkGeoOperatorType(e){if(GeoOperator.NEAR==e){return"$near"}else if(GeoOperator.WITHIN==e){return"$within"}else{return null}}function getStr(e){var t=JSON.stringify(e);return t}function QueryBuilder(){this.build=function(e,t,n){if(e!=null&&t!=null&&t!=null){e=e.trim();n=n.trim()}if(e==""||n==""||e==null||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(e,"key");App42Fault.throwExceptionIfNullOrBlank(t,"value");App42Fault.throwExceptionIfNullOrBlank(n,"operator");return}var r=[];var i={key:e,operator:n,value:t};r.push(i);return r};this.buildGeoQuery=function(e,t,n){checkGeoOperatorType(t);var r=[];var i={lat:e.getLat(),lng:e.getLng(),operator:t,maxDistance:n};r.push(i);return r};this.compoundOperator=function(e,t,n){var r=[];var i={compoundOpt:t};for(var s=0;s<e.length;s++){r.push(e[s])}r.push(i);for(var o=0;o<n.length;o++){r.push(n[o])}return r}}function App42User(){function n(e){var t={};t.dateOfBirth=e.dateOfBirth;t.lastName=e.lastName;t.sex=e.sex;t.officeLandLine=e.officeLandLine;t.homeLandLine=e.homeLandLine;t.state=e.state;t.firstName=e.firstName;t.country=e.country;t.city=e.city;t.mobile=e.mobile;return JSON.stringify(t)}t={};App42Service.call(this);var e=this;this.createUser=function(t,n,r,i){var s=App42.URL("user");if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(n,"pwd");App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"email");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"user":{"userName":"'+t+'","password":"'+n+'","email":"'+r+'"}}}';o.body=f;sessionRequest=true;App42Connection.post(s,o,f,i,a)};this.createOrUpdateProfile=function(r,i){var s=App42.URL("user/profile");if(r!=null){r=r.trim()}if(r==""||r==null){App42Fault.throwExceptionIfNullOrBlank(r,"userName");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f=n(t);var l='{"app42":{"user":{"userName":"'+r+'","profileData":'+f+"}}}";o.body=l;App42Connection.put(s,o,l,i,a)};this.getUser=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var r=App42.URL("user/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getUserByEmailId=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"emailId");return}var r=App42.URL("user/email/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.emailId=t;App42Connection.get(r,i,n,null,o)};this.getAllUsers=function(t){var n=App42.URL("user");var r=e.populateSignParams(),i=e.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(n,r,t,null,s)};this.changeUserPassword=function(t,n,r,i){if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"oldPwd");App42Fault.throwExceptionIfNullOrBlank(r,"newPwd");return}var s=App42.URL("user/changeUserPassword");var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"user":{"userName":"'+t+'","newPassword":"'+r+'","oldPassword":"'+n+'"}}}';o.body=f;App42Connection.put(s,o,f,i,a)};this.authenticate=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"uName");App42Fault.throwExceptionIfNullOrBlank(n,"pwd");return}var i=App42.URL("user/authenticate");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"user":{"userName":"'+t+'","password":"'+n+'"}}}';s.body=a;sessionRequest=true;App42Connection.post(i,s,a,r,u)};this.deleteUser=function(t,n){if(t!=null){t=t.trim()}if(t==null||t==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var r=App42.URL("user/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.del(r,i,n,o)};this.resetUserPassword=function(t,n){var r=App42.URL("user/"+"resetAppUserPassword");if(t!=null){t=t.trim()}if(t==null||t==""){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"user":{"userName":"'+t+'"}}}';i.body=u;App42Connection.put(r,i,u,n,o)};this.logout=function(t,n){var r=App42.URL("session");var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"session":{"id":"'+t+'"}}}';i.body=u;sessionInvalidate=true;App42Connection.put(r,i,u,n,o)};this.setFirstName=function(e){t.firstName=e};this.setLastName=function(e){t.lastName=e};this.setSex=function(e){t.sex=e};this.setState=function(e){t.state=e};this.setDateOfBirth=function(e){t.dateOfBirth=getODataUTCDateFilter(e)};this.setOfficeLandLine=function(e){t.officeLandLine=e};this.setCountry=function(e){t.country=e};this.setCity=function(e){t.city=e};this.setMobile=function(e){t.mobile=e};this.setHomeLandLine=function(e){t.homeLandLine=e};var t={}}function App42Upload(){function t(t){if(e.AUDIO==t||e.VIDEO==t||e.IMAGE==t||e.BINARY==t||e.TXT==t||e.XML==t||e.CSV==t||e.JSON==t||e.OTHER==t){return t}else{throw new App42Exception("FileType",t)}}var e={AUDIO:"AUDIO",VIDEO:"VIDEO",IMAGE:"IMAGE",BINARY:"BINARY",TXT:"TXT",XML:"XML",CSV:"CSV",JSON:"JSON",OTHER:"OTHER"};App42Service.call(this);var n=this;this.uploadFile=function(e,r,i,s,o){var u=App42.URL("upload");t(i);if(e!=null&&i!=null&&s!=null){e=e.trim();i=i.trim();s=s.trim()}if(e==""||e==null||s==null||s==""||r==null||r==""||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(e,"name");App42Fault.throwExceptionIfNullOrBlank(i,"fileType");App42Fault.throwExceptionIfNullOrBlank(s,"description");return}var a=n.populateSignParams(),f=n.populateMetaHeaderParams(),l=__merge(a,f);a.name=e;a.type=i;a.description=s;App42Connection.multipart(u,a,r,o,l)};this.uploadFileForUser=function(e,r,i,s,o,u){var a=App42.URL("upload"+"/"+r);t(s);if(e!=null&&r!=null&&s!=null&&o!=null){e=e.trim();r=r.trim();s=s.trim();o=o.trim()}if(e==""||e==null||r==""||r==null||o==null||o==""||i==null||i==""||s==""||s==null){App42Fault.throwExceptionIfNullOrBlank(e,"name");App42Fault.throwExceptionIfNullOrBlank(r,"userName");App42Fault.throwExceptionIfNullOrBlank(s,"fileType");App42Fault.throwExceptionIfNullOrBlank(o,"description");return}var f=n.populateSignParams(),l=n.populateMetaHeaderParams(),c=__merge(f,l);f.name=e;f.userName=r;f.type=s;f.description=o;App42Connection.multipart(a,f,i,u,c)};this.getAllFiles=function(e){var t=App42.URL("upload");var r=n.populateSignParams(),i=n.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(t,r,e,null,s)};this.getAllFilesByPaging=function(e,t,r){var i=App42.URL("upload"+"/"+"paging"+"/"+e+"/"+t);var s=n.populateSignParams(),o=n.populateMetaHeaderParams(),u=__merge(s,o);s.max=e;s.offset=t;App42Connection.get(i,s,r,null,u)};this.getFileByUser=function(e,t,r){var i=App42.URL("upload"+"/"+t+"/"+e);if(e!=null&&t!=null){e=e.trim();t=t.trim()}if(e==""||e==null||t==null||t==""){App42Fault.throwExceptionIfNullOrBlank(e,"fileName");App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var s=n.populateSignParams(),o=n.populateMetaHeaderParams(),u=__merge(s,o);s.name=e;s.userName=t;App42Connection.get(i,s,r,null,u)};this.getFileByName=function(e,t){var r=App42.URL("upload"+"/"+e);if(e!=null){e=e.trim()}if(e==""||e==null){App42Fault.throwExceptionIfNullOrBlank(e,"fileName");return}var i=n.populateSignParams(),s=n.populateMetaHeaderParams(),o=__merge(i,s);i.name=e;App42Connection.get(r,i,t,null,o)};this.getFilesByType=function(e,r){var i=App42.URL("upload"+"/"+"type"+"/"+t(e));t(e);if(e!=null){e=e.trim()}if(e==""||e==null){App42Fault.throwExceptionIfNullOrBlank(e,"fileType");return}var s=n.populateSignParams(),o=n.populateMetaHeaderParams(),u=__merge(s,o);s.type=t(e);App42Connection.get(i,s,r,null,u)};this.getFilesCountByType=function(e,r){t(e);var i=App42.URL("upload"+"/"+"type"+"/"+t(e)+"/count");if(e!=null){e=e.trim()}if(e==""||e==null){App42Fault.throwExceptionIfNullOrBlank(e,"fileType");return}var s=n.populateSignParams(),o=n.populateMetaHeaderParams(),u=__merge(s,o);s.type=t(e);App42Connection.get(i,s,r,null,u)};this.getFilesByTypeByPaging=function(e,r,i,s){var o=App42.URL("upload"+"/"+"type"+"/"+t(e)+"/"+r+"/"+i);if(e!=null&&r!=null&&i!=null){e=e.trim()}if(e==""||e==null||r==""||r==null||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(e,"fileType");App42Fault.throwExceptionIfNullOrBlank(r,"max");App42Fault.throwExceptionIfNullOrBlank(i,"offset");return}var u=n.populateSignParams(),a=n.populateMetaHeaderParams(),f=__merge(u,a);u.type=t(e);u.max=r;u.offset=i;App42Connection.get(o,u,s,null,f)};this.getAllFilesCountByUser=function(e,t){var r=App42.URL("upload"+"/"+"user"+"/"+e+"/"+"count");if(e!=null){e=e.trim()}if(e==null||e==""){App42Fault.throwExceptionIfNullOrBlank(e,"userName");return}var i=n.populateSignParams(),s=n.populateMetaHeaderParams(),o=__merge(i,s);i.userName=e;App42Connection.get(r,i,t,null,o)};this.removeAllFiles=function(e){var t=App42.URL("upload");var r=n.populateSignParams(),i=n.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.del(t,r,e,s)};this.removeFileByName=function(e,t){var r=App42.URL("upload"+"/"+e);if(e!=null){e=e.trim()}if(e==null||e==""){App42Fault.throwExceptionIfNullOrBlank(e,"file Name");return}var i=n.populateSignParams(),s=n.populateMetaHeaderParams(),o=__merge(i,s);i.name=e;App42Connection.del(r,i,t,o)};this.removeAllFilesByUser=function(e,t){var r=App42.URL("upload"+"/"+"user"+"/"+e);if(e!=null){e=e.trim()}if(e==null||e==""){App42Fault.throwExceptionIfNullOrBlank(e,"userName");return}var i=n.populateSignParams(),s=n.populateMetaHeaderParams(),o=__merge(i,s);i.userName=e;App42Connection.del(r,i,t,o)};this.removeFileByUser=function(e,t,r){var i=App42.URL("upload"+"/"+t+"/"+e);if(t!=null&&e!=null){e=e.trim();t=t.trim()}if(e==null||e==""||t==null||t==""){App42Fault.throwExceptionIfNullOrBlank(e,"fileName");App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var s=n.populateSignParams(),o=n.populateMetaHeaderParams(),u=__merge(s,o);s.name=e;s.userName=t;App42Connection.del(i,s,r,u)};this.getAllFilesByUser=function(e,t){var r=App42.URL("upload"+"/"+"user"+"/"+e);if(e!=null){e=e.trim()}if(e==null||e==""){App42Fault.throwExceptionIfNullOrBlank(e,"userName");return}var i=n.populateSignParams(),s=n.populateMetaHeaderParams(),o=__merge(i,s);i.userName=e;App42Connection.get(r,i,t,null,o)};this.getAllFilesCount=function(e){var t=App42.URL("upload"+"/"+"count");var r=n.populateSignParams(),i=n.populateMetaHeaderParams(),s=__merge(r,i);App42Connection.get(t,r,e,null,s)};this.getAllFilesByUserWithPaging=function(e,t,r,i){var s=App42.URL("upload"+"/"+"user"+"/"+e+"/"+t+"/"+r);if(e!=null){e=e.trim()}if(e==null||e==""){App42Fault.throwExceptionIfNullOrBlank(e,"userName");return}var o=n.populateSignParams(),u=n.populateMetaHeaderParams(),a=__merge(o,u);o.userName=e;o.max=t;o.offset=r;App42Connection.get(s,o,i,null,a)};this.grantAccess=function(e,t,r,i){var s=App42.URL("upload/grantAccess/"+t+"/"+e);if(t!=null&&e!=null){t=t.trim();e=e.trim()}if(t==""||e==""||t==null||e==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(e,"fileName");return}var o=n.populateSignParams(),u=n.populateMetaHeaderParams(),a=__merge(o,u);o.fileName=e;o.userName=t;var f=new Array;if(r instanceof Array){for(var l=0;l<r.length;l++){var c=r[l].user;var h;checkPermissionType(h);h=r[l].permission;var p={user:c,permission:h};f.push(p)}}else{var d=r.user;var v;checkPermissionType(v);v=r.permission;var m={user:d,permission:v};f.push(m)}var g=JSON.stringify(f);var y='{"acl":'+g+"}";var b=JSON.stringify(y);var w='{"app42":{"upload":{"acls":'+b+"}}}}";o.body=w;App42Connection.put(s,o,w,i,a)};this.revokeAccess=function(e,t,r,i){var s=App42.URL("upload/revokeAccess/"+t+"/"+e);if(t!=null&&e!=null){t=t.trim();e=e.trim()}if(t==""||e==""||t==null||e==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(e,"fileName");return}var o=n.populateSignParams(),u=n.populateMetaHeaderParams(),a=__merge(o,u);o.fileName=e;o.userName=t;var f=new Array;if(r instanceof Array){for(var l=0;l<r.length;l++){var c=r[l].user;var h;checkPermissionType(h);h=r[l].permission;var p={user:c,permission:h};f.push(p)}}else{var d=r.user;var v;checkPermissionType(v);v=r.permission;var m={user:d,permission:v};f.push(m)}var g=JSON.stringify(f);var y='{"acl":'+g+"}";var b=JSON.stringify(y);var w='{"app42":{"upload":{"acls":'+b+"}}}}";o.body=w;App42Connection.put(s,o,w,i,a)};this.uploadFileForGroup=function(e,r,i,s,o,u,a,f){t(u);var l=App42.URL("upload"+"/group/"+r);if(e!=null&&r!=null&&i!=null&&s!=null&&u!=null&&a!=null){e=e.trim();r=r.trim();i=i.trim();s=s.trim();u=u.trim();a=a.trim()}if(r==""||r==null||i==""||i==null||s==null||s==""||e==""||e==null||a==null||a==""||o==null||o==""||u==""||u==null){App42Fault.throwExceptionIfNullOrBlank(e,"name");App42Fault.throwExceptionIfNullOrBlank(u,"fileType");App42Fault.throwExceptionIfNullOrBlank(a,"description");App42Fault.throwExceptionIfNullOrBlank(r,"userName");App42Fault.throwExceptionIfNullOrBlank(i,"ownerName");App42Fault.throwExceptionIfNullOrBlank(s,"groupName");return}var c=n.populateSignParams(),h=n.populateMetaHeaderParams(),p=__merge(c,h);c.name=e;c.userName=r;c.ownerName=i;c.groupName=s;t(u);c.type=u;c.description=a;App42Connection.multipart(l,c,o,f,p)};this.uploadFileForFriend=function(e,r,i,s,o,u,a){var f=App42.URL("upload"+"/friend/"+r);t(o);if(e!=null&&r!=null&&i!=null&&o!=null&&u!=null){e=e.trim();r=r.trim();i=i.trim();o=o.trim();u=u.trim()}if(r==""||r==null||i==""||i==null||e==""||e==null||u==null||u==""||s==null||s==""||o==""||o==null){App42Fault.throwExceptionIfNullOrBlank(e,"name");App42Fault.throwExceptionIfNullOrBlank(o,"fileType");App42Fault.throwExceptionIfNullOrBlank(u,"description");App42Fault.throwExceptionIfNullOrBlank(r,"userName");App42Fault.throwExceptionIfNullOrBlank(i,"buddyName");return}var l=n.populateSignParams(),c=n.populateMetaHeaderParams(),h=__merge(l,c);l.name=e;l.userName=r;l.buddyName=i;t(o);l.type=o;l.description=u;App42Connection.multipart(f,l,s,a,h)};this.uploadFileForFriends=function(e,r,i,s,o,u){var a=App42.URL("upload"+"/friend/"+r);t(s);if(e!=null&&r!=null&&s!=null&&o!=null){e=e.trim();r=r.trim();s=s.trim();o=o.trim()}if(r==""||r==null||e==""||e==null||o==null||o==""||i==null||i==""||s==""||s==null){App42Fault.throwExceptionIfNullOrBlank(e,"name");App42Fault.throwExceptionIfNullOrBlank(s,"fileType");App42Fault.throwExceptionIfNullOrBlank(o,"description");App42Fault.throwExceptionIfNullOrBlank(r,"userName");return}var f=n.populateSignParams(),l=n.populateMetaHeaderParams(),c=__merge(f,l);f.name=e;f.userName=r;t(s);f.type=s;f.description=o;App42Connection.multipart(a,f,i,u,c)}}function checkOrderByType(e){if(OrderByType.ASCENDING==e){return"ASCENDING"}else if(OrderByType.DESCENDING==e){return"DESCENDING"}else{return App42Exception}}function App42Storage(){App42Service.call(this);var e=this;this.insertJSONDocument=function(t,n,r,i){var s=App42.URL("storage/insert/dbName/"+t+"/"+"collectionName"+"/"+n);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"json");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.dbName=t;o.collectionName=n;if(r instanceof Object){r=JSON.stringify(r)}var f='{"app42":{"storage":{"jsonDoc":'+r+"}}}";o.body=f;App42Connection.post(s,o,f,i,a)};this.findAllDocuments=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");return}var i=App42.URL("storage/findAll/dbName/"+t+"/"+"collectionName"+"/"+n);var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.dbName=t;s.collectionName=n;App42Connection.get(i,s,r,null,u)};this.findAllCollections=function(t,n){var r=App42.URL("storage/findCollections/dbName/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.dbName=t;App42Connection.get(r,i,n,null,o)};this.findAllDocumentsCount=function(t,n,r){var i=App42.URL("storage"+"/findAll/count/dbName/"+t+"/collectionName/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.dbName=t;s.collectionName=n;App42Connection.get(i,s,r,null,u)};this.findAllDocumentsByPaging=function(t,n,r,i,s){if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");return}var o=App42.URL("storage/findAll/dbName"+"/"+t+"/"+"collectionName"+"/"+n+"/"+r+"/"+i);var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.dbName=t;u.collectionName=n;u.max=r;u.offset=i;App42Connection.get(o,u,s,null,f)};this.findDocumentById=function(t,n,r,i){var s=App42.URL("storage/findDocById/dbName"+"/"+t+"/collectionName/"+n+"/docId/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"docId");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.dbName=t;o.collectionName=n;o.docId=r;App42Connection.get(s,o,i,null,a)};this.findDocumentsByQuery=function(t,n,r,i){var s=App42.URL("storage/findDocsByQuery/dbName/"+t+"/collectionName/"+n);if(t!=null&&n!=null&&r!=null){n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"query");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.jsonQuery=getStr(r);o.dbName=t;o.collectionName=n;App42Connection.get(s,o,i,null,a)};this.findDocumentsByQueryWithPaging=function(t,n,r,i,s,o){var u=App42.URL("storage/findDocsByQuery/dbName/"+t+"/collectionName/"+n+"/"+i+"/"+s);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"query");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.jsonQuery=getStr(r);a.dbName=t;a.collectionName=n;a.max=i;a.offset=s;App42Connection.get(u,a,o,null,l)};this.findDocsWithQueryPagingOrderBy=function(t,n,r,i,s,o,u,a){var f=App42.URL("storage/findDocsByQuery/dbName/"+t+"/collectionName/"+n+"/"+i+"/"+s);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"query");return}var l={};c.apiKey=apiKey;var c=e.populateSignParams(),h=e.populateMetaHeaderParams(),p=__merge(c,h);c.jsonQuery=getStr(r);if(o!=null){l.orderByKey=o}if(u!=null){l.orderByType=u}if(fbAccessToken!=null){c.fbAccessToken=fbAccessToken}c.dbName=t;c.collectionName=n;c.max=i;c.offset=s;App42Connection.get(f,c,a,l,p)};this.findDocumentByKeyValue=function(t,n,r,i,s){var o=App42.URL("storage/findDocByKV/dbName/"+t+"/collectionName/"+n+"/"+r+"/"+i);if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"key");App42Fault.throwExceptionIfNullOrBlank(i,"value");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.dbName=t;u.collectionName=n;u.key=r;u.value=i;App42Connection.get(o,u,s,null,f)};this.updateDocumentByKeyValue=function(t,n,r,i,s,o){var u=App42.URL("storage/update/dbName/"+t+"/collectionName/"+n+"/"+r+"/"+i);if(t!=null&&n!=null&&r!=null&&i!=null&&s!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||r==""||i==""||s==""||t==null||n==null||r==null||i==null||s==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"key");App42Fault.throwExceptionIfNullOrBlank(i,"value");App42Fault.throwExceptionIfNullOrBlank(s,"newJsonDoc");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.dbName=t;a.collectionName=n;a.key=r;a.value=i;if(s instanceof Object){s=JSON.stringify(s)}var c='{"app42":{"storage":{"jsonDoc":'+s+"}}}}";a.body=c;App42Connection.put(u,a,c,o,l)};this.updateDocumentByDocId=function(t,n,r,i,s){var o=App42.URL("storage/updateByDocId/dbName/"+t+"/collectionName/"+n+"/docId/"+r);if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"docId");App42Fault.throwExceptionIfNullOrBlank(i,"newJsonDoc");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.dbName=t;u.collectionName=n;u.docId=r;if(i instanceof Object){i=JSON.stringify(i)}var l='{"app42":{"storage":{"jsonDoc":'+i+"}}}}";u.body=l;App42Connection.put(o,u,l,s,f)};this.deleteDocumentById=function(t,n,r,i){var s=App42.URL("storage/deleteDocById/dbName/"+t+"/collectionName/"+n+"/docId/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==null||r==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"docId");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.dbName=t;o.collectionName=n;o.docId=r;App42Connection.del(s,o,i,a)};this.grantAccessOnDoc=function(t,n,r,i,s){var o=App42.URL("storage/grantAccessOnDoc/"+t+"/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==null||r==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"docId");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.dbName=t;u.collectionName=n;u.docId=r;var l=new Array;if(i instanceof Array){for(var c=0;c<i.length;c++){var h=i[c].user;var p;checkPermissionType(p);p=i[c].permission;var d={user:h,permission:p};l.push(d)}}else{var v=i.user;var m;checkPermissionType(m);m=i.permission;var g={user:v,permission:m};l.push(g)}var y=JSON.stringify(l);var b='{"acl":'+y+"}";var w=JSON.stringify(b);var E='{"app42":{"storage":{"acls":'+w+"}}}";u.body=E;App42Connection.put(o,u,E,s,f)};this.revokeAccessOnDoc=function(t,n,r,i,s){var o=App42.URL("storage/revokeAccessOnDoc/"+t+"/"+n+"/"+r);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==null||r==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"docId");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.dbName=t;u.collectionName=n;u.docId=r;var l=new Array;if(i instanceof Array){for(var c=0;c<i.length;c++){var h=i[c].user;var p;checkPermissionType(p);p=i[c].permission;var d={user:h,permission:p};l.push(d)}}else{var v=i.user;var m;checkPermissionType(m);m=i.permission;var g={user:v,permission:m};l.push(g)}var y=JSON.stringify(l);var b='{"acl":'+y+"}";var w=JSON.stringify(b);var E='{"app42":{"storage":{"acls":'+w+"}}}}";u.body=E;App42Connection.put(o,u,E,s,f)};this.deleteDocumentsByKeyValue=function(t,n,r,i,s){var o=App42.URL("storage/deletebykey/dbName/"+t+"/collectionName/"+n+"/"+r);var u='{"key":"'+i+'"}';if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.value=u;a.dbName=t;a.collectionName=n;a.key=r;App42Connection.del(o,a,s,l)};this.deleteAllDocuments=function(t,n,r){var i=App42.URL("storage/deleteAll/dbName/"+t+"/collectionName/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.dbName=t;s.collectionName=n;App42Connection.del(i,s,r,u)};this.findDocumentsByLocation=function(t,n,r,i){var s=App42.URL("storage/findDocsBylocation/dbName/"+t+"/collectionName/"+n);if(t!=null&&n!=null&&r!=null){n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"query");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.jsonQuery=getStr(r);o.dbName=t;o.collectionName=n;App42Connection.get(s,o,i,null,a)};this.saveOrUpdateDocumentByKeyValue=function(t,n,r,i,s,o){var u=App42.URL("storage/saveorupdate/dbName/"+t+"/collectionName/"+n+"/"+r+"/"+i);if(t!=null&&n!=null&&r!=null&&i!=null&&s!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||r==""||i==""||s==""||t==null||n==null||r==null||i==null||s==null){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"key");App42Fault.throwExceptionIfNullOrBlank(i,"value");App42Fault.throwExceptionIfNullOrBlank(s,"newJsonDoc");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.dbName=t;a.collectionName=n;a.key=r;a.value=i;if(s instanceof Object){s=JSON.stringify(s)}var c='{"app42":{"storage":{"jsonDoc":'+s+"}}}}";a.body=c;App42Connection.put(u,a,c,o,l)};this.updateDocumentByQuery=function(t,n,r,i,s){var o=App42.URL("storage"+"/updateDocsByQuery/dbName/"+t+"/collectionName/"+n);if(t!=null&&n!=null&&i!=null){t=t.trim();n=n.trim()}if(t==""||n==""||i==""||t==null||n==null||i==null||r==null||r==""){App42Fault.throwExceptionIfNullOrBlank(t,"dbName");App42Fault.throwExceptionIfNullOrBlank(n,"collectionName");App42Fault.throwExceptionIfNullOrBlank(r,"query");App42Fault.throwExceptionIfNullOrBlank(i,"newJsonDoc");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.dbName=t;u.collectionName=n;if(i instanceof Object){i=JSON.stringify(i)}var l=new Object;l.jsonQuery=r;l.jsonDoc=i;var c=JSON.stringify(l);var h='{"app42":{"storage":'+c+"}}";u.body=h;App42Connection.put(o,u,h,s,f)}}function App42Social(){App42Service.call(this);var e=this;this.linkUserFacebookAccount=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"accessToken");return}var i=App42.URL("social/facebook/linkuser/accesscredentials");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"social":{"userName":"'+t+'","accessToken":"'+n+'"}}}';s.body=a;if(localStorage!=undefined){localStorage.removeItem("_App42_SessionId");localStorage.setItem("_App42_FbAccessToken",n);fbAccessToken=n}else if(localStorage=undefined){localStorage.setItem("_App42_FbAccessToken",n);fbAccessToken=n}App42Connection.post(i,s,a,r,u)};this.linkUserFacebookAccountWithCredentials=function(t,n,r,i,s){if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||n==""||r==""||i==""||t==null||n==null||r==null||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"accessToken");App42Fault.throwExceptionIfNullOrBlank(r,"appId");App42Fault.throwExceptionIfNullOrBlank(i,"appSecret");return}var o=App42.URL("social/facebook/linkuser");var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);var l='{"app42":{"social":{"userName":"'+t+'","accessToken":"'+n+'","appId":"'+r+'","appSecret":"'+i+'"}}}';u.body=l;if(localStorage!=undefined){localStorage.removeItem("_App42_SessionId");localStorage.setItem("_App42_FbAccessToken",n);fbAccessToken=n}else if(localStorage=undefined){localStorage.setItem("_App42_FbAccessToken",n);fbAccessToken=n;console.log("here")}App42Connection.post(o,u,l,s,f)};this.updateFacebookStatus=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"status");return}var i=App42.URL("social/facebook/updatestatus");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"social":{"userName":"'+t+'","status":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.linkUserTwitterAccount=function(t,n,r,i){if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"accessToken");App42Fault.throwExceptionIfNullOrBlank(r,"accessTokenSecret");return}var s=App42.URL("social/twitter/linkuser/accesscredentials");var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"social":{"userName":"'+t+'","accessToken":"'+n+'" ,"accessTokenSecret":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.linkUserTwitterAccountWithCredentials=function(t,n,r,i,s,o){if(t!=null&&n!=null&&r!=null&&i!=null&&s!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim();s=s.trim()}if(t==""||n==""||i==""||s==""||r==""||t==null||n==null||i==null||s==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"accessToken");App42Fault.throwExceptionIfNullOrBlank(i,"consumerKey");App42Fault.throwExceptionIfNullOrBlank(s,"consumerSecret");App42Fault.throwExceptionIfNullOrBlank(r,"accessTokenSecret");return}var u=App42.URL("social/twitter/linkuser");var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);var c='{"app42":{"social":{"userName":"'+t+'","consumerKey":"'+i+'" ,"consumerSecret":"'+s+'","accessToken":"'+n+'" ,"accessTokenSecret":"'+r+'"}}}';a.body=c;App42Connection.post(u,a,c,o,l)};this.updateTwitterStatus=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"status");return}var i=App42.URL("social/twitter/updatestatus");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"social":{"userName":"'+t+'","status":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.linkUserLinkedInAccountWithCredentials=function(t,n,r,i,s,o){if(t!=null&&n!=null&&r!=null&&i!=null&&s!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim();s=s.trim()}if(t==""||n==""||r==""||i==""||s==""||t==null||n==null||r==null||i==null||s==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"accessToken");App42Fault.throwExceptionIfNullOrBlank(r,"accessTokenSecret");App42Fault.throwExceptionIfNullOrBlank(i,"apiKey");App42Fault.throwExceptionIfNullOrBlank(s,"secretKey");return}var u=App42.URL("social/linkedin/linkuser");var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);var c='{"app42":{"social":{"userName":"'+t+'","apiKey":"'+i+'" ,"secretKey":"'+s+'","accessToken":"'+n+'" ,"accessTokenSecret":"'+r+'"}}}';a.body=c;App42Connection.post(u,a,c,o,l)};this.linkUserLinkedInAccount=function(t,n,r,i){if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"accessToken");App42Fault.throwExceptionIfNullOrBlank(r,"accessTokenSecret");return}var s=App42.URL("social/linkedin/linkuser/accesscredentials");var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"social":{"userName":"'+t+'","accessToken":"'+n+'" ,"accessTokenSecret":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.updateLinkedInStatus=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"status");return}var i=App42.URL("social/linkedin/updatestatus");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"social":{"userName":"'+t+'","status":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.updateSocialStatusForAll=function(t,n,r){if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");App42Fault.throwExceptionIfNullOrBlank(n,"status");return}var i=App42.URL("social/social/updatestatus/all");var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"social":{"userName":"'+t+'","status":"'+n+'"}}}';s.body=a;App42Connection.post(i,s,a,r,u)};this.getFacebookFriendsFromLinkUser=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var r=App42.URL("social/facebook/friends/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.getFacebookFriendsFromAccessToken=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"accessToken");return}var r=App42.URL("social/facebook/friends/OAuth/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.accessToken=t;App42Connection.get(r,i,n,null,o)};this.facebookPublishStream=function(t,n,r,i,s){if(t!=null&&n!=null&&i!=null){t=t.trim();n=n.trim();i=i.trim()}if(t==""||t==null||n==""||n==null||r==""||r==null||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"accessToken");App42Fault.throwExceptionIfNullOrBlank(n,"name");App42Fault.throwExceptionIfNullOrBlank(r,"filePath");App42Fault.throwExceptionIfNullOrBlank(i,"message");return}var o=App42.URL("social"+"/facebook/wallpost");var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.name=n;u.accessToken=t;u.message=i;App42Connection.multipart(o,u,r,s,f)};this.facebookLinkPost=function(t,n,r,i){if(t!=null&&r!=null){t=t.trim();r=r.trim()}if(t==""||t==null||n==""||n==null||r==""||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"accessToken");App42Fault.throwExceptionIfNullOrBlank(n,"link");App42Fault.throwExceptionIfNullOrBlank(r,"message");return}var s=App42.URL("social"+"/facebook/publishstream");var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"social":{"link":"'+n+'","accessToken":"'+t+'","message":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.facebookLinkPostWithCustomThumbnail=function(t,n,r,i,s,o,u){if(t!=null&&n!=null&&r!=null&&s!=null&&o!=null){t=t.trim();n=n.trim();s=s.trim();r=r.trim();o=o.trim()}if(t==""||t==null||n==""||n==null||s==""||s==null||filePath==""||filePath==null||r==""||r==null||i==""||i==null||o==""||o==null){App42Fault.throwExceptionIfNullOrBlank(t,"accessToken");App42Fault.throwExceptionIfNullOrBlank(friendFacebookId,"friendFacebookId");App42Fault.throwExceptionIfNullOrBlank(s,"name");App42Fault.throwExceptionIfNullOrBlank(filePath,"filePath");App42Fault.throwExceptionIfNullOrBlank(r,"message");return}var a=App42.URL("social"+"/facebook/publishstream");var f=e.populateSignParams(),l=e.populateMetaHeaderParams(),c=__merge(f,l);var h='{"app42":{"social":{"link":"'+n+'","accessToken":"'+t+'","message":"'+r+'","picture":"'+i+'","name":"'+s+'","description":"'+o+'"}}}';f.body=h;App42Connection.post(a,f,h,u,c)};this.getFacebookProfile=function(t,n){if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"accessToken");return}var r=App42.URL("social"+"/"+"facebook/me/OAuth/"+t);var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.accessToken=t;App42Connection.get(r,i,n,null,o)};this.getFacebookProfilesFromIds=function(t,n){if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"facebookIds");return}var r=App42.URL("social"+"/"+"facebook/ids");var i=e.populateSignParams();var s=e.populateMetaHeaderParams();var o=__merge(i,s);o.userList="["+t+"]";App42Connection.get(r,i,n,null,o)}}function App42Session(){App42Service.call(this);var e=this;this.getSession=function(t,n){var r=App42.URL("session");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"session":{"userName":"'+t+'"}}}';i.body=u;App42Connection.post(r,i,u,n,o)};this.invalidate=function(t,n){var r=App42.URL("session");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"sessionId");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);var u='{"app42":{"session":{"id":"'+t+'"}}}';i.body=u;sessionInvalidate=true;App42Connection.put(r,i,u,n,o)};this.setAttribute=function(t,n,r,i){var s=App42.URL("session/id/"+t);if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim();r=r.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"sessionId");App42Fault.throwExceptionIfNullOrBlank(n,"attributeName");App42Fault.throwExceptionIfNullOrBlank(r,"attributeValue");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.sessionId=t;var f='{"app42":{"session":{"name":"'+n+'","value":"'+r+'"}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.getAttribute=function(t,n,r){var i=App42.URL("session/id/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"sessionId");App42Fault.throwExceptionIfNullOrBlank(n,"attributeName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.sessionId=t;s.name=n;App42Connection.get(i,s,r,null,u)};this.getAllAttributes=function(t,n){var r=App42.URL("session/id/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"sessionId");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.sessionId=t;App42Connection.get(r,i,n,null,o)};this.removeAttribute=function(t,n,r){var i=App42.URL("session/id/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"sessionId");App42Fault.throwExceptionIfNullOrBlank(n,"attributeName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.sessionId=t;s.name=n;App42Connection.del(i,s,r,u)};this.removeAllAttributes=function(t,n){var r=App42.URL("session/id/"+t);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"sessionId");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.sessionId=t;App42Connection.del(r,i,n,o)}}function App42Service(){var e=null,t=null,n=null,r,i,s,o=null,u=null,a=[],f=-1,l=-1,c={},h=null;this.setPageOffset=function(e){f=e};this.getPageOffset=function(){return f};this.setPageMaxRecords=function(e){l=e};this.getPageMaxRecords=function(){return l};this.setOtherMetaHeaders=function(e){c=e};this.getOtherMetaHeaders=function(){return c};this.setSessionId=function(t){e=t};this.getSessionId=function(){return e};this.getDbName=function(){return r};this.setDbName=function(e){r=e};this.getCollectionName=function(){return collectionName};this.setCollectionName=function(e){collectionName=e};this.setMetaInfoQuery=function(e,t,n){r=e;collectionName=t;s=getStr(n)};this.setModuleEvent=function(e){e=e};this.getEvent=function(){return h};this.setAdminKey=function(e){t=e};this.getAdminKey=function(){return t};this.setFbAccessToken=function(e){n=e};this.getFbAccessToken=function(){return n};this.setGeoTag=function(e){if(e instanceof GeoTag){var t={};if(e.getLat()!=null&&e.getLng()!=null){t.lat=e.getLat();t.lng=e.getLng();o=t}}};this.getGeoTag=function(){return o};this.setAclList=function(e){var t=new Array;var n;if(e instanceof Array){for(var r=0;r<e.length;r++){var i=e[r].user;var s;n={};s=e[r].permission;n[i]=s;t.push(n)}}else{n={};var o=e.user;var a;a=e.permission;n[o]=a;t.push(n)}u=t};this.getAclList=function(){return u};this.setSelectKeys=function(e){a=e};this.getSelectKeys=function(){return a};this.populateSignParams=function(){var r={};r.apiKey=apiKey;r.version=version;var i=new Date;r.timeStamp=getODataUTCDateFilter(i);if(e!=null){r.sessionId=e}if(t!=null){r.adminKey=t}if(n!=null){r.fbAccessToken=n}if(localStorage!=undefined){if(e==null&&localStorage.getItem("_App42_SessionId")!=undefined){var s=localStorage.getItem("_App42_SessionId");r.sessionId=s}}if(localStorage!=undefined){if(n==null&&localStorage.getItem("_App42_FbAccessToken")!=undefined){var o=localStorage.getItem("_App42_FbAccessToken");r.fbAccessToken=o}}if(h!=null&&h!=""){r.event=h}return r};this.populateMetaHeaderParams=function(){var e={};if(u!=null){var t=JSON.stringify(u);e.dataACL=t}if(f!=-1&&!isNaN(l)){e.pageOffset=f}if(l!=-1&&!isNaN(l)){e.pageMaxRecords=l}if(o!=null&&Object.prototype.toString.call(o)=="[object Object]"){var n=JSON.stringify(o);e.geoTag=n}if(a.length>0){var i={};for(var h=0;h<a.length;h++){i[a[h]]="1"}var p=JSON.stringify(i);e.selectKeys=p}if(Object.keys(c).length>0){for(var d in c){var v=c[d];if(d!=null&&d!=""&&v!=null&&v!=""){e[d]=v}}}if(localStorage!=undefined){if(localStorage.getItem("_App42_DeviceId")!=undefined){var m=localStorage.getItem("_App42_DeviceId");e.deviceId=m}}if(App42.getLoggedInUser()!=null&&App42.getLoggedInUser()!=""){e.loggedInUser=App42.getLoggedInUser()}if(s!=null&&s!=""){e.metaQuery=s}if(r!=null&&r!=""&&collectionName!=null&&collectionName!=""){var g=new Object;g.dbName=r;g.collectionName=collectionName;e.dbCredentials=JSON.stringify(g);console.log(g)}e.SDKName="javascript";return e}}function GeoTag(){var e=null,t=null;this.setLat=function(t){e=t};this.getLat=function(){return e};this.setLng=function(e){t=e};this.getLng=function(){return t}}function ItemData(){var e=null,t=null,n=null,r=null,i=null,s=null;this.getItemId=function(){return e};this.setItemId=function(t){e=t};this.getName=function(){return t};this.setName=function(e){t=e};this.getDescription=function(){return n};this.setDescription=function(e){n=e};this.getImage=function(){return r};this.setImage=function(e){r=e};this.getPrice=function(){return i};this.setPrice=function(e){i=e};this.getImageName=function(){return s};this.setImageName=function(e){s=e}}function __merge(e,t){var n={};for(var r in e){n[r]=e[r]}for(var r in t){n[r]=t[r]}return n}function App42ScoreBoard(){App42Service.call(this);var e=this;this.saveUserScore=function(t,n,r,i){var s=App42.URL("game/scoreboard");if(t!=null&&n!=null&&r!=null){t=t.trim();n=n.trim()}if(t==""||n==""||r==""||t==null||n==null||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"gameScore");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);var f='{"app42":{"game":{"name":"'+t+'", "scores":{"score":{"value":"'+r+'","userName":"'+n+'"}}}}}';o.body=f;App42Connection.post(s,o,f,i,a)};this.getScoresByUser=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/"+n);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.userName=n;App42Connection.get(i,s,r,null,u)};this.getHighestScoreByUser=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/"+n+"/"+"highest");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.userName=n;App42Connection.get(i,s,r,null,u)};this.getLowestScoreByUser=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/"+n+"/"+"lowest");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.userName=n;App42Connection.get(i,s,r,null,u)};this.getTopRankings=function(t,n){var r=App42.URL("game/scoreboard/"+t+"/ranking");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName")}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.name=t;App42Connection.get(r,i,n,null,o)};this.getTopRankingsByDate=function(t,n,r,i){strStartDate=getODataUTCDateFilter(n);strEndDate=getODataUTCDateFilter(r);if(t!=null&&n!=null&&r!=null){t=t.trim()}if(t==""||t==null||n==""||n==null||r==""||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"startDate");App42Fault.throwExceptionIfNullOrBlank(r,"endDate")}var s=App42.URL("game/scoreboard/"+t+"/ranking"+"/"+strStartDate+"/"+strEndDate);var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.name=t;o.startDate=strStartDate;o.endDate=strEndDate;App42Connection.get(s,o,i,null,a)};this.getTopNRankings=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/ranking/"+n);if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.max=n;App42Connection.get(i,s,r,null,u)};this.getTopNRankersBetweenDate=function(t,n,r,i,s){strStartDate=getODataUTCDateFilter(n);strEndDate=getODataUTCDateFilter(r);var o=App42.URL("game/scoreboard/"+t+"/rankers"+"/"+strStartDate+"/"+strEndDate+"/"+i);if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim()}if(t==""||t==null||n==""||n==null||r==""||r==null||i==null||i==""){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"startDate");App42Fault.throwExceptionIfNullOrBlank(r,"endDate");App42Fault.throwExceptionIfNullOrBlank(i,"max")}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.name=t;u.startDate=strStartDate;u.endDate=strEndDate;u.max=i;App42Connection.get(o,u,s,null,f)};this.getTopNRankers=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/rankers"+"/"+n);if(t!=null&&n!=null){t=t.trim()}if(t==""||t==null||n==null||n==""){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"max")}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.max=n;App42Connection.get(i,s,r,null,u)};this.getUserRanking=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/"+n+"/ranking");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.userName=n;App42Connection.get(i,s,r,null,u)};this.getAverageScoreByUser=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/"+n+"/average");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.userName=n;App42Connection.get(i,s,r,null,u)};this.getLastScoreByUser=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/"+n+"/lastscore");if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||n==""||t==null||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.userName=n;App42Connection.get(i,s,r,null,u)};this.getLastGameScore=function(t,n){var r=App42.URL("game/scoreboard/"+t+"/lastgame");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"userName");return}var i=e.populateSignParams(),s=e.populateMetaHeaderParams(),o=__merge(i,s);i.userName=t;App42Connection.get(r,i,n,null,o)};this.editScoreValueById=function(t,n,r){var i=App42.URL("game/scoreboard"+"/editscore");if(t==""||t==null||n==""||n==null){App42Fault.throwExceptionIfNullOrBlank(t,"scoreId");App42Fault.throwExceptionIfNullOrBlank(n,"gameScore");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);var a='{"app42":{"game":{"scores":{"score":{"scoreId":"'+t+'","value":"'+n+'"}}}}}';s.body=a;App42Connection.put(i,s,a,r,u)};this.getTopRankingsByGroup=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/"+"group");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userList="["+n.toString()+"]";s.name=t;App42Connection.get(i,s,r,null,u)};this.getTopNRankersByGroup=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/rankers/group");if(t!=null){t=t.trim()}if(t==""||t==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");return}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.userList="["+n.toString()+"]";s.name=t;App42Connection.get(i,s,r,null,u)};this.getTopRankersFromBuddyGroup=function(t,n,r,i,s){var o=App42.URL("game/scoreboard/"+t+"/rankers"+"/"+n+"/group/"+r+"/"+i);if(t!=null&&n!=null&&r!=null&&i!=null){t=t.trim();n=n.trim();r=r.trim();i=i.trim()}if(t==""||t==null||n==""||n==null||r==""||r==null||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"userName");App42Fault.throwExceptionIfNullOrBlank(r,"ownerName");App42Fault.throwExceptionIfNullOrBlank(i,"groupName");return}var u=e.populateSignParams(),a=e.populateMetaHeaderParams(),f=__merge(u,a);u.name=t;u.userName=n;u.ownerName=r;u.groupName=i;App42Connection.get(o,u,s,null,f)};this.getTopNRankersFromFacebook=function(t,n,r,i){localStorage.setItem("_App42_FbAccessToken",n);var s=App42.URL("game/scoreboard/"+t+"/rankers/facebook/"+r);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null||r==""||r==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"fbAccessToken");App42Fault.throwExceptionIfNullOrBlank(r,"max");return}var o=e.populateSignParams(),u=e.populateMetaHeaderParams(),a=__merge(o,u);o.name=t;o.max=r;App42Connection.get(s,o,i,null,a)};this.getTopNRankersFromFacebookByDateRange=function(t,n,r,i,s,o){strStartDate=getODataUTCDateFilter(r);strEndDate=getODataUTCDateFilter(i);localStorage.setItem("_App42_FbAccessToken",n);var u=App42.URL("game/scoreboard/"+t+"/rankers/facebook/"+strStartDate+"/"+strEndDate+"/"+s);if(t!=null&&n!=null){t=t.trim();n=n.trim()}if(t==""||t==null||n==""||n==null||s==""||s==null||r==""||r==null||i==""||i==null){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"fbAccessToken");App42Fault.throwExceptionIfNullOrBlank(r,"startDate");App42Fault.throwExceptionIfNullOrBlank(i,"endDate");App42Fault.throwExceptionIfNullOrBlank(s,"max");return}var a=e.populateSignParams(),f=e.populateMetaHeaderParams(),l=__merge(a,f);a.name=t;a.startDate=strStartDate;a.endDate=strEndDate;a.max=s;App42Connection.get(u,a,o,null,l)};this.getTopNTargetRankers=function(t,n,r){var i=App42.URL("game/scoreboard/"+t+"/targetedrankers"+"/"+n);if(t!=null&&n!=null){t=t.trim()}if(t==""||t==null||n==null||n==""){App42Fault.throwExceptionIfNullOrBlank(t,"gameName");App42Fault.throwExceptionIfNullOrBlank(n,"max")}var s=e.populateSignParams(),o=e.populateMetaHeaderParams(),u=__merge(s,o);s.name=t;s.max=n;App42Connection.get(i,s,r,null,u)}}var myObject={ANDROID:"ANDROID",iOS:"iOS",WP7:"WP7"};var base64_chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var _status={DECLINED:"DECLINED",AUTHORIZED:"AUTHORIZED",PENDING:"PENDING"};var Permission={READ:"R",WRITE:"W"};var App42Connection={};var App42Fault={};var App42={};var apiKey;var secretKey;var customeCodeURL="https://customcode.shephertz.com/";var uri="https://api.shephertz.com/cloud/1.0/";var name;var geoTag;var sessionRequest=false;var sessionInvalidate=false;var loggedInUser=null;(function(){this.initialize=function(e,t){apiKey=e;secretKey=t;if(localStorage.getItem("_App42_DeviceId")==undefined){localStorage.setItem("_App42_DeviceId",guid())}};this.setLoggedInUser=function(e){loggedInUser=e};this.getLoggedInUser=function(){return loggedInUser};this.setBaseUrl=function(e){uri=e};this.setCustomeCodeURL=function(e){customeCodeURL=e};this.URL=function(e){var t=uri;var n=t+e;return n};this.CustomCodeURL=function(e){var t=customeCodeURL;var n=t+e;return n};if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}}).apply(App42);App42Exception.prototype=Error.prototype;(function(){function e(){this.name="App42Exception";var e="Set your apiKey and secretKey correctly in App42.initialize( )";this.message=e||""}this.throwExceptionIfNullOrBlank=function(e,t){if(e==""||e==null){var n=new App42Exception(e,t);throw n}};this.appError=function(){var t=new e;throw t};e.prototype=Error.prototype}).apply(App42Fault);var version="1.0";var XMLHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];(function(){this.get=function(e,t,n,r,i){if(t.apiKey==null||secretKey==null||secretKey==""||t.apiKey==""){App42Fault.appError();return}var s=new jsSHA(sortAssoc(t),"ASCII");var o=s.getHMAC(secretKey,"ASCII","HEX");var u=Convert(o);t.signature=u;var a="";if(t.userList){a="&userList="+t.userList}else if(t.jsonQuery){a="&jsonQuery="+t.jsonQuery}else{a=""}var f="";var l="";if(r!=null){if(r.orderByKey){f="&orderByKey="+r.orderByKey}else{f=""}if(r.orderByType){l="&orderByType="+r.orderByType}else{l=""}}createCORSRequest("GET",e+"?version="+t.version+a+f+l,t.timeStamp,u,t.apiKey,null,n,t.sessionId,t.adminKey,t.fbAccessToken,geoTag,i)};this.post=function(e,t,n,r,i){if(t.apiKey==null||secretKey==null||secretKey==""||t.apiKey==""){App42Fault.appError();return}var s="";if(t.jsonQuery){s="&jsonQuery="+t.jsonQuery}var o=new jsSHA(sortAssoc(t),"ASCII");var u=o.getHMAC(secretKey,"ASCII","HEX");var a=Convert(u);t.signature=a;createCORSRequest("POST",e+"?version="+t.version+s,t.timeStamp,a,t.apiKey,n,r,t.sessionId,t.adminKey,t.fbAccessToken,geoTag,i)};this.put=function(e,t,n,r,i){if(t.apiKey==null||secretKey==null||secretKey==""||t.apiKey==""){App42Fault.appError();return}var s=new jsSHA(sortAssoc(t),"ASCII");var o=s.getHMAC(secretKey,"ASCII","HEX");var u=Convert(o);t.signature=u;createCORSRequest("PUT",e+"?version="+t.version,t.timeStamp,u,t.apiKey,n,r,t.sessionId,t.adminKey,t.fbAccessToken,geoTag,i)};this.del=function(e,t,n,r){if(t.apiKey==null||secretKey==null||secretKey==""||t.apiKey==""){App42Fault.appError();return}var i=new jsSHA(sortAssoc(t),"ASCII");var s=i.getHMAC(secretKey,"ASCII","HEX");var o=Convert(s);t.signature=o;if(t.geoPoints){var u="&geoPoints="+t.geoPoints;e=e+"?version="+t.version+u}else if(t.deviceToken){u="?deviceToken="+t.deviceToken+"&userName="+t.userName+"&";e=e+u+"?version="+t.version}else if(t.messageIds){u="&messageIds="+t.messageIds;var a="";e=e+"?version="+t.version+"&timeStamp="+t.timeStamp+u+"&apiKey="+t.apiKey+"&"}else{u="";e=e+"?version="+t.version+u}createCORSRequest("DELETE",e,t.timeStamp,o,t.apiKey,null,n,t.sessionId,t.adminKey,t.fbAccessToken,geoTag,r)};this.multipart=function(e,t,n,r,i){if(t.apiKey==null||secretKey==null||secretKey==""||t.apiKey==""){App42Fault.appError();return}var s=new jsSHA(sortAssoc(t),"ASCII");var o=s.getHMAC(secretKey,"ASCII","HEX");var u=Convert(o);t.signature=u;if(t.albumName){multipartCORSRequestForPhoto("POST",e+"?version="+t.version,t.timeStamp,u,t.apiKey,t,n,r,t.sessionId,t.adminKey,t.fbAccessToken,geoTag,i)}else{multipartCORSRequest("POST",e+"?version="+t.version,t.timeStamp,u,t.apiKey,t,n,r,t.sessionId,t.adminKey,t.fbAccessToken,geoTag,i)}};this.executeCustomCode=function(e,t,n,r,i){if(i.apiKey==null||secretKey==null||secretKey==""||i.apiKey==""){App42Fault.appError();return}var s=new jsSHA(sortAssoc(t),"ASCII");var o=s.getHMAC(secretKey,"ASCII","HEX");var u=Convert(o);createCORSRequest("POST",e+"?",t.timeStamp,u,t.apiKey,n,r,t.sessionId,t.adminKey,t.fbAccessToken,geoTag,i)}}).apply(App42Connection);(function(){var e=8,t="",n=0,r=function(t){var n=[],r=(1<<e)-1,i=t.length*e,s;for(s=0;s<i;s+=e){n[s>>5]|=(t.charCodeAt(s/e)&r)<<32-e-s%32}return n},i=function(e){var t=[],n=e.length,r,i;for(r=0;r<n;r+=2){i=parseInt(e.substr(r,2),16);if(!isNaN(i)){t[r>>3]|=i<<24-4*(r%8)}else{return"INVALID HEX STRING"}}return t},s=function(e){var t=n?"0123456789ABCDEF":"0123456789abcdef",r="",i=e.length*4,s,o;for(s=0;s<i;s+=1){o=e[s>>2]>>(3-s%4)*8;r+=t.charAt(o>>4&15)+t.charAt(o&15)}return r},o=function(e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"+"0123456789+/",r="",i=e.length*4,s,o,u;for(s=0;s<i;s+=3){u=(e[s>>2]>>8*(3-s%4)&255)<<16|(e[s+1>>2]>>8*(3-(s+1)%4)&255)<<8|e[s+2>>2]>>8*(3-(s+2)%4)&255;for(o=0;o<4;o+=1){if(s*8+o*6<=e.length*32){r+=n.charAt(u>>6*(3-o)&63)}else{r+=t}}}return r},u=function(e,t){return e<<t|e>>>32-t},a=function(e,t,n){return e^t^n},f=function(e,t,n){return e&t^~e&n},l=function(e,t,n){return e&t^e&n^t&n},c=function(e,t){var n=(e&65535)+(t&65535),r=(e>>>16)+(t>>>16)+(n>>>16);return(r&65535)<<16|n&65535},h=function(e,t,n,r,i){var s=(e&65535)+(t&65535)+(n&65535)+(r&65535)+(i&65535),o=(e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(i>>>16)+(s>>>16);return(o&65535)<<16|s&65535},p=function(e,t){var n=[],r,i,s,o,p,d,v,m,g,y=[1732584193,4023233417,2562383102,271733878,3285377520],b=[1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782];e[t>>5]|=128<<24-t%32;e[(t+65>>9<<4)+15]=t;g=e.length;for(v=0;v<g;v+=16){r=y[0];i=y[1];s=y[2];o=y[3];p=y[4];for(m=0;m<80;m+=1){if(m<16){n[m]=e[m+v]}else{n[m]=u(n[m-3]^n[m-8]^n[m-14]^n[m-16],1)}if(m<20){d=h(u(r,5),f(i,s,o),p,b[m],n[m])}else if(m<40){d=h(u(r,5),a(i,s,o),p,b[m],n[m])}else if(m<60){d=h(u(r,5),l(i,s,o),p,b[m],n[m])}else{d=h(u(r,5),a(i,s,o),p,b[m],n[m])}p=o;o=s;s=u(i,30);i=r;r=d}y[0]=c(r,y[0]);y[1]=c(i,y[1]);y[2]=c(s,y[2]);y[3]=c(o,y[3]);y[4]=c(p,y[4])}return y},d=function(t,n){this.sha1=null;this.strBinLen=null;this.strToHash=null;if("HEX"===n){if(0!==t.length%2){return"TEXT MUST BE IN BYTE INCREMENTS"}this.strBinLen=t.length*4;this.strToHash=i(t)}else if("ASCII"===n||"undefined"===typeof n){this.strBinLen=t.length*e;this.strToHash=r(t)}else{return"UNKNOWN TEXT INPUT TYPE"}};d.prototype={getHash:function(e){var t=null,n=this.strToHash.slice();switch(e){case"HEX":t=s;break;case"B64":t=o;break;default:return"FORMAT NOT RECOGNIZED"}if(null===this.sha1){this.sha1=p(n,this.strBinLen)}return t(this.sha1)},getHMAC:function(t,n,u){var a,f,l,c,h,d=[],v=[];switch(u){case"HEX":a=s;break;case"B64":a=o;break;default:return"FORMAT NOT RECOGNIZED"}if("HEX"===n){if(0!==t.length%2){return"KEY MUST BE IN BYTE INCREMENTS"}f=i(t);h=t.length*4}else if("ASCII"===n){f=r(t);h=t.length*e}else{return"UNKNOWN KEY INPUT TYPE"}if(64<h/8){f=p(f,h);f[15]&=4294967040}else if(64>h/8){f[15]&=4294967040}for(l=0;l<=15;l+=1){d[l]=f[l]^909522486;v[l]=f[l]^1549556828}c=p(d.concat(this.strToHash),512+this.strBinLen);c=p(v.concat(c),672);return a(c)}};window.jsSHA=d})();var Operator={EQUALS:"$eq",NOT_EQUALS:"$ne",GREATER_THAN:"$gt",LESS_THAN:"$lt",GREATER_THAN_EQUALTO:"$gte",LESS_THAN_EQUALTO:"$lte",LIKE:"$lk",AND:"$and",OR:"$or"};var GeoOperator={NEAR:"$near",WITHIN:"$within"};if(!this.JSON){this.JSON={}}(function(){function f(e){return e<10?"0"+e:e}function quote(e){escapable.lastIndex=0;return escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t==="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];if(a&&typeof a==="object"&&typeof a.toJSON==="function"){a=a.toJSON(e)}if(typeof rep==="function"){a=rep.call(t,e,a)}switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a){return"null"}gap+=indent;u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1){u[n]=str(n,a)||"null"}i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]";gap=o;return i}if(rep&&typeof rep==="object"){s=rep.length;for(n=0;n<s;n+=1){r=rep[n];if(typeof r==="string"){i=str(r,a);if(i){u.push(quote(r)+(gap?": ":":")+i)}}}}else{for(r in a){if(Object.hasOwnProperty.call(a,r)){i=str(r,a);if(i){u.push(quote(r)+(gap?": ":":")+i)}}}}i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}";gap=o;return i}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;if(typeof JSON.stringify!=="function"){JSON.stringify=function(e,t,n){var r;gap="";indent="";if(typeof n==="number"){for(r=0;r<n;r+=1){indent+=" "}}else if(typeof n==="string"){indent=n}rep=t;if(t&&typeof t!=="function"&&(typeof t!=="object"||typeof t.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":e})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i==="object"){for(n in i){if(Object.hasOwnProperty.call(i,n)){r=walk(i,n);if(r!==undefined){i[n]=r}else{delete i[n]}}}}return reviver.call(e,t,i)}var j;text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})();var Base64=function(){var e=76;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var n=function(e){var n={};for(var r=0;r<64;r++)n[t.substr(r,1)]=r;e=e.replace(/\s+/g,"");var i="";var s=new Array;var o=0;var u=e.length;var a;for(var r=0;r<u;r+=4){a=(n[e.charAt(r)]&255)<<18;a|=(n[e.charAt(r+1)]&255)<<12;a|=(n[e.charAt(r+2)]&255)<<6;a|=(n[e.charAt(r+3)]&255)<<0;i+=String.fromCharCode((a&16711680)>>16);if(e.charAt(r+2)!="=")i+=String.fromCharCode((a&65280)>>8);if(e.charAt(r+3)!="=")i+=String.fromCharCode((a&255)>>0);if(i.length>1024){s.push(i);i=""}}if(i.length>0){s.push(i)}var f=new Array;for(;s.length>1;){var l=s.length;for(var c=0;c<l;c+=2){if(c+1==l){f.push(s[c])}else{f.push(""+s[c]+s[c+1])}}s=f;f=new Array}return s[0]};var r=function(n){var r=new Array;var i,s,o=0,u="";var a=0;var u="";while(n.length>=o+3){i=(n.charCodeAt(o++)&255)<<16|(n.charCodeAt(o++)&255)<<8|n.charCodeAt(o++)&255;u+=t.charAt((i&16515072)>>18)+t.charAt((i&258048)>>12)+t.charAt((i&4032)>>6)+t.charAt(i&63);a+=4;if(a>e-3){u+="\n";r.push(u);u="";a=0}}if(n.length-o>0&&n.length-o<3){s=Boolean(n.length-o-1);i=(n.charCodeAt(o++)&255)<<16|(s?(n.charCodeAt(o)&255)<<8:0);u+=t.charAt((i&16515072)>>18)+t.charAt((i&258048)>>12)+(s?t.charAt((i&4032)>>6):"=")+"="}r.push(u);var f=new Array;for(;r.length>1;){var l=r.length;for(var c=0;c<l;c+=2){if(c+1==l){f.push(r[c])}else{f.push(""+r[c]+r[c+1])}}r=f;f=new Array}return r[0]};return{encode:r,decode:n}}();var OrderByType={ASCENDING:"ASCENDING",DESCENDING:"DESCENDING"}