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
var incentives_list = await hiro.incentivesSenderList(session)
for incentive in incentives_list:
    # Iterate over the key-value pairs in the Claims object
    for key in incentive.Claims.keys():
        var value = incentive.Claims[key]
        print("%s claimed at %s." % [key, value.ClaimTimeSec])

    # Iterate over the UnclaimedRecipients array
    for user_id in incentive.UnclaimedRecipients:
        print("%s has not yet claimed." % user_id)

Creating sender incentives #

You can create a sender incentive for the user.

1
2
3
4
5
var incentive_sender_create_request = Hiro.IncentiveSenderCreateRequest.new()
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 = Hiro.IncentiveSenderClaimRequest.new()
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 = Hiro.IncentiveSenderDeleteRequest.new()
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 = Hiro.IncentivesRecipientGetRequest.new()
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 = Hiro.IncentiveRecipientClaimRequest.new()
incentives_recipient_claim_request.code = code

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