suspend fun readSessionDetails()

in health-platform-v1/HealthPlatformSample/app/src/main/java/com/example/healthplatformsample/data/HealthPlatformManager.kt [164:189]


    suspend fun readSessionDetails(uid: String): SessionDetails {
        requestAndCheckPermissions(readPermissions)

        val request = ReadAssociatedDataRequest.builder()
            .setSourceDataUid(uid)
            .setSourceDataType(IntervalDataTypes.ACTIVITY_SESSION)
            .addCumulativeDataType(IntervalDataTypes.STEPS)
            .addCumulativeDataType(IntervalDataTypes.DISTANCE)
            .addCumulativeDataType(IntervalDataTypes.TOTAL_ENERGY_BURNED)
            .addSampleDataType(SampleDataTypes.SPEED)
            .addStatisticalDataType(SampleDataTypes.SPEED)
            .addSeriesDataType(SeriesDataTypes.HEART_RATE)
            .addStatisticalDataType(SeriesDataTypes.HEART_RATE)
            .build()

        val response = healthDataClient.readAssociatedData(request).await()
        return SessionDetails(
            response.cumulativeData[0],
            response.cumulativeData[1],
            response.cumulativeData[2],
            response.statisticalData[0],
            response.sampleDataSets[0],
            response.statisticalData[1],
            response.seriesDataSets[0]
        )
    }