Incentives #

Read more about the Incentive system in Hiro here.

Sender incentives #

Listing sender incentives #

You can list all sender incentives for the user.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
var incentivesList = await hiro.incentivesSenderList(session!);
for (var incentive in incentivesList) {
  // Iterate over the key-value pairs in the Claims object
  for (var key in incentive.Claims.keys) {
    var value = incentive.Claims[key];
    print("$key claimed at ${value.ClaimTimeSec}.");
  }

  // Iterate over the UnclaimedRecipients array
  for (var userId in incentive.UnclaimedRecipients) {
    print("$userId has not yet claimed.");
  }
}

Creating sender incentives #

You can create a sender incentive for the user.

1
2
3
4
5
var incentive_sender_create_request = IncentiveSenderCreateRequest();
incentive_sender_create_request.id = "coin-invite";

var result = await hiro.incentivesSenderCreate(session!, incentive_sender_create_request);
print(result.incentives[0].code); // <- code to send to another player!;

Claiming sender incentives #

You can claim a sender incentive for the user.

1
2
3
4
var incentive_sender_claim_request = IncentiveSenderClaimRequest();
incentive_sender_claim_request.code = code;

var result = await hiro.incentivesSenderClaim(session!, incentive_sender_claim_request);

Deleting sender incentives #

You can delete a sender incentive for the user.

1
2
3
4
var incentive_sender_delete_request = IncentiveSenderDeleteRequest();
incentive_sender_delete_request.code = code;

var result = await hiro.incentivesSenderDelete(session!, incentive_sender_delete_request);

Recipient incentives #

Getting recipient incentives #

You can get a recipient incentive for the user.

1
2
3
4
var incentives_recipient_get_request = IncentivesRecipientGetRequest();
incentives_recipient_get_request.code = code;

var result = await hiro.incentivesRecipientGet(session!, incentives_recipient_get_request);

Claiming #

You can claim a receiver incentive for the user.

1
2
3
4
5
var incentives_recipient_claim_request = IncentiveRecipientClaimRequest();
incentives_recipient_claim_request.code = code;

var result = await hiro.incentivesRecipientClaim(session!, incentives_recipient_claim_request);
print(result.reward);