-
Notifications
You must be signed in to change notification settings - Fork 1
/
socketioapi.txt
87 lines (74 loc) · 4.51 KB
/
socketioapi.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
------------------------------------------------------------------
All gateways must return a true or false based on success
=============
App Callbacks
=============
// The user's data
updateUserData({ id: string, username: string, score: number, groupId: string, rewardIds: string[], trackedEventIds: string[], authType: "device" | "apple" | "google", ignoreIdLists: boolean })
// Data relating to a redeemable award for the current user
updateRewardData({ rewards: { eventId: string, description: string, redeemInfo: string, isRedeemed: boolean }[] })
// Data relating to a user's progress on various events
updateEventTrackerData({ eventTrackers: { eventId: string, isRanked: boolean, cooldownMinimum: string, curChallengeId: string, prevChallengeIds: string[] }[] })
// Data relating to a user's group. If "update" is true, then only members listed in "members" are updated, rather than setting the members list to "members".
updateGroupData({ curEventId: string, members: { id: string, name: string, points: number, host: boolean, curChallengeId: string }[], update: boolean })
// Data relating to any completed or uncompleted challenges. "name" and "completionDate" will be === "" for incomplete challenges.
updateChallengeData({ challenges: { id: string, name: string, description: string, imageUrl: string, lat: number, long: number, awardingRadius: number, closeRadius: number, completionDate: string } })
// Data relating to events in the database
updateEventData({ events: { id: string, skippingEnabled: boolean, hasStarChallenge: boolean, name: string, description: string, rewardType: "limited_time_event" | "win_on_completion" | "race_to_win" | "no_rewards", time: string, topCount: number, minMembers: number, rewards: { id: string, description: string }[], challengeIds: string[] })
// Data relating to user positions on a leaderboard. For "eventId" === "", list will be global.
updateLeaderData({ eventId: string, offset: number, users: { userId: string, username: string, score: number }[] })
// Called when a user receives a reward
userRewarded({ rewardId: string, rewardDescription: string })
// Called when previously received data should be considered invalid
invalidateData({ userRewardData: boolean, winnerRewardData: boolean, userEventData: boolean, groupData: boolean, challengeData: boolean, leaderboardData: boolean })
=============
User Gateway
=============
// To refresh user data on the front end
requestUserData({ accessToken: string })
// To set the user's username
setUsername({ accessToken: string, newUsername: string })
// Sets auth type to device
setAuthToDevice({ accessToken: string, deviceId: string })
// Sets auth type to OAuth provider
setAuthToOAuth({ accessToken: string, provider: "apple" | "google", authId: string })
// Deletes an account's authentication method
closeAccount({ accessToken: string })
// To request data for global leaders
requestGlobalLeaderData({ accessToken: string, offset: number, count: number })
=============
Group Gateway
=============
// To refresh a user's group data on the front end
requestGroupData({ accessToken: string })
// To join a group and leave the current one
joinGroup({ accessToken: string, groupId: string })
// To leave a group and join a new one
leaveGroup({ accessToken: string })
// To set the current group's event as a host
setCurrentEvent({ accessToken: string, eventId: string })
=============
Event Gateway
=============
// To request data for specific events
requestEventData({ accessToken: string, eventIds: string[] })
// To request data for leaders of a specific event
requestEventLeaderData({ accessToken: string, offset: number, count: number, eventId: string })
// To request data for all events in a database
requestAllEventData({ accessToken: string, offset: number, count: number, rewardTypes: string[], closestToEnding: boolean, shortestFirst: boolean, skippableOnly: boolean })
// To request data for specific event trackers
requestEventTrackerData({ accessToken: string, trackedEventIds: string[] })
=============
Reward Gateway
=============
// To request data for specific challenges awarded to the player
requestRewardData({ accessToken: string, rewardIds: string[] })
=============
Challenge Gateway
=============
// To request data for specific challenges
requestChallengeData({ accessToken: string, challengeIds: string[] })
// To select a further challenge for a skippable event or to backtrack in an event
setCurrentChallenge({ accessToken: string, challengeId: string })
// Called when user completes a challenge
completedChallenge({ accessToken: string, challengeId: string })