Get All Rewards By User

0 votes

Hi,

I am Confused on how the Reward Management Service works.

1. If I have a reward that I can give to player multiple times.

For example, player redeem sword as reward. Then he reddem another sword as reward, which make him have sword x2. 

How would I implement a counter to that so that when I fetch user reward, I can see that this user have sword x2?

2. The Get All Rewards By user function ask for Reward Name as a parameter. So what do I call if I simply want to fetch all reward that this user have without knowning the reward name.

For example, If the user have sword, axe, shield as reward. Calling Get All Rewards By User will return me sword, axe and shield.

Or do I have to call Get All Rewards By user multiple times to listen to wether it return sucess or not.

eg. 

rewardService.getAllRewardsByUser(userName, swordnew App42CallBack() 
rewardService.getAllRewardsByUser(userName, axe , new App42CallBack() 
rewardService.getAllRewardsByUser(userName, shield, new App42CallBack() 

It doesn't seem efficient haing to do this.

Requring Reward Name for Get All Rewards By User make no sense to me.

 

Any help would be appreciate.

Thank You,

Jinz

asked Jul 8, 2014 in App42 Cloud API-BaaS by jinzhao.wu (10 points)

1 Answer

0 votes

Hi Jinz,

Thanks for writing to us.

Here is my answer to your questions:

You can call the earnRewards API which will add rewards contentiously to user when you pay the rewards to him. 

Fetching all rewards of user method without passing reward name is not available in the SDK. You have to first fetch all Reward then can call getAllRewardsByUser method.

You can also write an aggregated method using custom code to perform those operation in Single API Call. Please find the link for details description of how you can use custom code in your app

Let me know if it answer your question.

Thanks.

answered Jul 8, 2014 by hs00105 (517 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...