Newer Version Available

This content describes an older version of this product. View Latest

Assigned Games

Get a list of eligible, expired, and played games, such as Spin the Wheel, or Scratch card, for a loyalty program member, an account, or a contact.

Resource

1getGames(participantId:version:devMode:mockFileName:)

Signature

1public func getGames(
2           participantId: String,
3           version: String = APIVersion.defaultVersion,
4           devMode: Bool = false,
5           mockFileName: String = "GetGames_Success"
6       ) async throws -> GameModel

Input Parameters

Parameter Type Description Required or Optional
devMode Boolean Indicates whether the method is run in the developer mode (true) or not (false). Optional
mockFileName String The name of the file that has the sample response. Optional
participantId String The ID of a loyalty program member, an account, or a contact whose eligible games are to be retrieved. Required
version String Version of the API. The request body is available in version 60.0 and later. Optional

Return Value

GameModel instance.

1public struct GameModel : Codable

Sample Output

1{
2   "message":null,
3   "gameDefinitions":[
4      {
5         "description":"Play Spin The Wheel to get amazing rewards",
6         "endDate":"2024-07-31T19:00:00.000Z",
7         "gameRewards":[
8            {
9               "color":"FF5733",
10               "description":"Get 10%  Off Voucher",
11               "imageUrl":null,
12               "name":"10 % Off",
13               "rewardType":"Voucher",
14               "rewardValue":null
15            },
16            {
17               "color":"000000",
18               "description":"Loyalty Points",
19               "imageUrl":null,
20               "name":"1000 Reward Points",
21               "rewardType":"LoyaltyPoints",
22               "rewardValue":"100.0"
23            },
24            {
25               "color":"762E2E",
26               "description":"Better Luck Next Time",
27               "imageUrl":null,
28               "name":"No Reward",
29               "rewardType":"NoReward",
30               "rewardValue":null
31            }
32         ],
33         "participantGameRewards":[
34            {
35               "expirationDate":"2024-01-04T20:00:00.000Z",
36               "gameParticipantRewardId":"3PRSB0000000hjJ4AQ",
37               "gameRewardId":null,
38               "issuedRewardReference":null,
39               "sourceActivity":null,
40               "status":"YetToReward"
41            }
42         ],
43         "name":"Spin The Wheel",
44         "startDate":"2023-10-01T19:00:00.000Z",
45         "timeoutDuration":10,
46         "type":"SpintheWheel"
47      },
48      {
49         "description":"Play Scratch card to get amazing rewards",
50         "endDate":"2024-07-31T19:00:00.000Z",
51         "gameRewards":[
52                        {
53               "color":"",
54               "description":"Get 10%  Off Voucher",
55               "imageUrl":null,
56               "name":"10 % Off",
57               "rewardType":"Voucher",
58               "rewardValue":null
59            },
60            {
61               "color":"",
62               "description":"Better Luck Next Time",
63               "imageUrl":null,
64               "name":"No Reward",
65               "rewardType":"NoReward",
66               "rewardValue":null
67            }
68         ],
69         "participantGameRewards":[
70            {
71               "expirationDate":"2024-01-04T20:00:00.000Z",
72               "gameParticipantRewardId":"2ABSB0000000hjJ3AM",
73               "gameRewardId":"2GRSB0000000Caf4AB",
74               "issuedRewardReference":"0lVSB000000032j2AA",
75               "sourceActivity":"0c85i0000009c6D",
76               "status":"Rewarded"
77            }
78         ],
79         "name":"Scratch Card",
80         "startDate":"2023-10-01T19:00:00.000Z",
81         "timeoutDuration":20,
82         "type":"Scratchcard"
83      }
84   ],
85   "status":true
86}

Output Parameters

Property Name Type Description Filter Group and Version Available Version
message String Message that provides the reason why a list of games weren't found for the participant. Small, 60.0 60.0
gameDefinitions GameDefinition[] List of game definitions associated with the games assigned to the member.

A game definition has the details of a game, including:

  • The list of possible rewards for the game.
  • The participant game reward records that contain details of the game reward the participant has won for each game play, or can win after playing the game.
Small, 60.0 60.0
status Boolean Indicates whether the request succeeded (true) or failed (false). Small, 60.0 60.0
Table 1. GameDefinition
Property Name Type Description Filter Group and Version Available Version
description String Description of the game. Small, 60.0 60.0
endDate String Date until which participants are eligible to play the game. Small, 60.0 60.0
gameDefinitionId String ID of the game definition associated with the game. Small, 60.0 60.0
gameRewards GameReward [] List of possible rewards for a game. Small, 60.0 60.0
name String Name of the game definition. Small, 60.0 60.0
participantGameRewards ParticipantGameReward[] List of participant game reward records that contain the details of the game reward the participant has won for each game play, or can win after playing the game. Small, 60.0 60.0
startDate String Date from which participants are eligible to play the game. Small, 60.0 60.0
timeoutDuration Integer Duration of the game in seconds before the game session times out. Small, 60.0 60.0
type String Type of the game. Possible values are:
  • Scratchcard
  • SpintheWheel
Small, 60.0 60.0
Table 2. GameReward
Property Name Type Description Filter Group and Version Available Version
color String Color of the segment in the Spin the Wheel game that represents the game reward. Small, 60.0 60.0
description String Description of the game reward. Small, 60.0 60.0
imageUrl String Image URL of the segment in the Spin the Wheel game that represents the game reward. Small, 60.0 60.0
name String Name of the game reward. Small, 60.0 60.0
gameRewardId String ID of the game reward. Small, 60.0 60.0
rewardType String Type of the game reward. Possible values are:
  • CustomReward
  • LoyaltyPoints
  • NoReward
  • Raffle
  • Voucher
Small, 60.0 60.0
rewardValue String Value of the voucher, or the number of points to credit as a game reward to participants. Small, 60.0 60.0
Table 3. ParticipantGameReward
Property Name Type Description Filter Group and Version Available Version
expirationDate String Date until which the game reward is valid. Small, 60.0 60.0
gameParticipantRewardId String ID of the participant game reward object. Small, 60.0 60.0
gameRewardId String ID of the game reward won. This field is null for a game yet to be played. Small, 60.0 60.0
issuedRewardReference String Voucher ID, or the transaction journal ID associated with the voucher, or the loyalty points rewarded to the participant. This field is null for a game yet to be played. Small, 60.0 60.0
sourceActivity String ID of the promotion, or the transaction journal that is associated with the activity because of which the participant was eligible to play the game. Examples of source activities include purchasing a product, and reviewing on social media.

This field is null for a game yet to be played.

Small, 60.0 60.0
status String Status of the reward. Possible values are:
  • Expired
  • NoReward
  • Rewarded
  • YetToReward
Small, 60.0 60.0