generate Spots
abstract suspend fun generateSpots(situationIds: List<Long>, symptomIds: List<Long>, timestampInSeconds: Long): SpotItResult
Generates a list of "spots" (coping mechanisms) for the Spot It technique.
Return
SpotItResult with a request ID and generated spots.
Parameters
situation Ids
IDs representing the situations the user is experiencing.
symptom Ids
IDs representing the symptoms the user is experiencing.
timestamp In Seconds
Epoch timestamp (seconds) when the request is made.
Throws
if generation fails.
Android (Kotlin)
lifecycleScope.launch {
try {
val result = AFCore.mentalFitness().generateSpots(
situationIds = listOf(1, 2),
symptomIds = listOf(3, 4),
timestampInSeconds = System.currentTimeMillis() / 1000
)
showGeneratedSpots(result.spots)
} catch (t: Throwable) {
showError("Could not generate spots: ${t.message}")
}
}Content copied to clipboard
iOS (Swift)
Task {
do {
let result = try await AFCore.shared.mentalFitness().generateSpots(
situationIds: [1, 2],
symptomIds: [3, 4],
timestampInSeconds: Int64(Date().timeIntervalSince1970)
)
self.showGeneratedSpots(result.spots)
} catch {
self.showError("Could not generate spots: \\(error.localizedDescription)")
}
}Content copied to clipboard