File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
shared/src/commonMain/kotlin/app/opass/ccip Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,26 @@ class PortalHelper {
130
130
}
131
131
}
132
132
133
+ /* *
134
+ * Uses Scenario for specified event using given token from event's FastPass feature
135
+ * @param eventId ID of the event
136
+ * @param token Token to identify attendee
137
+ * @param scenarioId ID of the scenario
138
+ * @return [Attendee] on success, null otherwise
139
+ */
140
+ suspend fun useScenario (
141
+ eventId : String ,
142
+ token : String ,
143
+ scenarioId : String
144
+ ): Attendee ? {
145
+ val eventConfig = dbHelper.getEventConfig(eventId) ? : return null
146
+ val feat = eventConfig.features.find { f -> f.type == FeatureType .FAST_PASS } ? : return null
147
+
148
+ return client.useScenario(feat.url!! , token, scenarioId).also {
149
+ dbHelper.addAttendee(eventId, it)
150
+ }
151
+ }
152
+
133
153
/* *
134
154
* Deletes an attendee's information from the database
135
155
*
Original file line number Diff line number Diff line change @@ -66,4 +66,11 @@ internal class PortalClient {
66
66
if (token != null ) parameter(" token" , token)
67
67
}.body()
68
68
}
69
+
70
+ suspend fun useScenario (url : String , token : String , scenarioId : String ): Attendee {
71
+ return universalClient.get {
72
+ url(" $url /use/$scenarioId " )
73
+ parameter(" token" , token)
74
+ }.body()
75
+ }
69
76
}
You can’t perform that action at this time.
0 commit comments