Reports
Create Reports
Asleep.createReports
: Sleep Tracking에 대한 결과를 가져오기 위한 Reports를 생성합니다.
fun createReports(asleepConfig: AsleepConfig?): Reports?
Parameter Name | Type | Description |
---|---|---|
asleepConfig | AsleepConfig? | initAsleepConfig 호출에서 콜백 받은 설정 값을 입력 |
Get Single Report
Asleep.Reports.getReport
: sessionId
에 해당하는 Report를 가져옵니다.
fun getReport(sessionId: String, reportListener: ReportListener)
Parameter Name | Type | Description |
---|---|---|
sessionId | String | Sleep Tracking을 정지할 때 받을 수 있는 sessionId 의 값 |
reportListener | ReportListener | Report를 콜백 받을 리스너 |
Asleep.Reports.ReportListener
Asleep.Reports.ReportListener
interface ReportListener {
fun onSuccess(report: Report?)
fun onFail(errorCode: Int, detail: String)
}
성공 시, onSuccess()
가 호출됩니다.
onSuccess()
가 호출됩니다.data class Report(
val timezone: String,
val peculiarities: List<String>,
val missingDataRatio: Float,
val session: Session?,
val stat: Stat?
)
Parameter Name | Type | Description |
---|---|---|
timezone | String | 타임존 (Timezone List) |
peculiarities | List<String> | 해당 수면 세션의 특이사항을 설명하는 필드. 여러 개의 라벨 포함 가능. |
missingDataRatio | Float | 오디오 업로드 누락 등의 이유로 인한 수면 분석 결과 오류율 |
session | Session? | 세션 분석 정보 |
stat | Stat? | 분석 통계 정보 |
실패 시, onFail()
이 호출됩니다.
onFail()
이 호출됩니다.Parameter Name | Type | Description |
---|---|---|
errorCode | Int | AsleepErrorCode 참조 |
detail | String | errorCode 에 관련된 메시지 |
Get Multiple Reports
Asleep.Reports.getReports
: 입력한 날짜의 범위 내에 있는 Report 목록을 가져옵니다.
fun getReports(
fromDate: String,
toDate: String,
orderBy: String = "DESC",
offset: Int = 0,
limit: Int = 20,
reportsListener: ReportsListener?)
Parameter Name | Type | Description |
---|---|---|
fromDate | String (YYYY-MM-DD) | 조회 시작 날짜 |
toDate | String (YYYY-MM-DD) | 조회 마지막 날짜 |
orderBy | String | DESC : 내림차순 정렬 ASC : 오름차순 정렬 |
offset | Int | 스킵할 Report 개수 (default: 0 ) |
limit | Int | 최대 받을 Report 개수 (0~100, default: 20 ) |
reportsListener | ReportsListener? | Report 목록을 콜백 받을 리스너 |
Asleep.Reports.ReportsListener
Asleep.Reports.ReportsListener
interface ReportsListener {
fun onSuccess(reports: List<SleepSession>?)
fun onFail(errorCode: Int, detail: String)
}
성공 시, onSuccess()
가 호출됩니다.
onSuccess()
가 호출됩니다.data class SleepSession(
val sessionId: String?,
val lastReceivedSeqNum: Int?,
val sessionEndTime: String?,
val sessionStartTime: String?,
val state: String?,
val timeInBed: Int?,
val createdTimezone: String,
val unexpectedEndTime: String?
)
Parameter Name | Type | Description |
---|---|---|
sessionId | String? | 세션 ID |
lastReceivedSeqNum | Int? | 마지막으로 업로드 받은 오디오 파일의 순서 번호 |
sessionEndTime | String? | 세션 종료 시각 |
sessionStartTime | String? | 세션 시작 시각 |
state | String? | 수면 세션 상태 (OPEN , CLOSED , COMPLETE ) |
timeInBed | Int? | 침대에 있었던 시간 |
createdTimezone | String | 세션이 생성된 타임존 (Timezone List) |
unexpectedEndTime | String? | 비정상 세션 종료 시각. 추후 initAsleepConfig 될 때의 시각이 저장. |
실패 시, onFail()
이 호출됩니다.
onFail()
이 호출됩니다.Parameter Name | Type | Description |
---|---|---|
errorCode | Int | AsleepErrorCode 참조 |
detail | String | errorCode 에 관련된 메시지 |
Average-stats
Asleep.Reports.getAverageReport
: 사용자의 특정 기간 내 수면 메트릭들의 평균을 확인할 수 있습니다.
fun getAverageReport(fromDate: String, toDate: String, averageReportListener: AverageReportListener?)
Parameter Name | Type | Description |
---|---|---|
fromDate | String | 평균을 확인하고자 하는 기간의 시작 시간 |
toDate | String | 평균을 확인하고자 하는 기간의 종료 시간 |
averageReportListener | AverageReportListener | Average Report를 콜백 받을 listener |
Asleep.Reports.AverageReportListener
Asleep.Reports.AverageReportListener
interface AverageReportListener {
fun onSuccess(averageReport: AverageReport?)
fun onFail(errorCode: Int, detail: String)
}
성공 시, onSuccess()
가 호출됩니다.
onSuccess()
가 호출됩니다.data class AverageReport (
val period: Period,
val peculiarities: List<String>,
val averageStats: AverageStats?,
val neverSleptSessions: List<NeverSleptSessions>,
val sleptSessions: List<SleptSessions>
)
Parameter Name | Type | Description |
---|---|---|
period | Period | 타임존 |
peculiarities | List<String> | 수면 세션들의 평균을 구할 때 특이사항 |
averageStats | AverageStats? | sleptSessions의 수면 메트릭들의 평균들을 가지는 객체 |
neverSleptSessions | List<NeverSleptSession> | 세션 측정시간 동안 전혀 잠을 자지 않았다고 판단 되는 세션들의 목록 |
sleptSessions | List<SleptSession> | 세션 측정시간 동안 잠을 잤다고 판단 되는 세션들의 목록 |
Period
Period
data class Period (
val timezone: String,
val endDate: String,
val startDate: String,
)
Parameter Name | Type | Description |
---|---|---|
timezone | String | 요청한 타임존 예. UTC, Asia/Seoul |
startDate | String | 요청한 시작 시간 |
endDate | String | 요청한 종료 시간 |
AverageStats
AverageStats
data class AverageStats(
val startTime: String,
val endTime: String,
val sleepTime: String,
val wakeTime: String,
val sleepLatency: Int,
val wakeupLatency: Int,
val timeInBed: Int,
val timeInSleepPeriod: Int,
val timeInSleep: Int,
val timeInWake: Int,
val timeInLight: Int?,
val timeInDeep: Int?,
val timeInRem: Int?,
val sleepEfficiency: Float,
val wakeRatio: Float,
val sleepRatio: Float,
val lightRatio: Float?,
val deepRatio: Float?,
val remRatio: Float?,
val wasoCount: Int?,
val longestWaso: Int?,
val sleepCycleCount: Int?,
val timeInSnoring: Int?,
val timeInNoSnoring: Int?,
val snoringRatio: Float?,
val noSnoringRatio: Float?,
val snoringCount: Int?
)
Parameter Name | Type | Description |
---|---|---|
startTime | String | 세션 시작 시각 |
endTime | String | 세션 종료 시각 |
sleepTime | String | 잠이 든 시각 |
wakeTime | String | 잠에서 깨어각난 시각 |
sleepLatency | Int | 잠들때까지 걸린 시간 |
wakeupLatency | Int | 잠에서 깨어난 후 수면 측정을 종료하기까지 걸린 시간 |
timeInBed | Int | 수면 측정 시작 시각부터 수면 측정 종료 시각 까지의 시간 |
timeInSleepPeriod | Int | 수면 측정 시간 중 수면 측정 시작으로부터 잠들기 까지 걸린 시간과 잠에서 깨어난 후로부터 수면 측정을 종료하기까지 걸린 시간을 제외한 시간 (time_in_bed - sleep_latency - wakeup_latency) |
timeInSleep | Int | 수면 측정 시간 중 실제로 수면 중이었던 시간 이 시간이 deep, light, rem의 3단계로 구분됨 |
timeInWake | Int | 수면 도중에 깬 시간 |
timeInLight | Int? | 면 단계가 light 로 진행된 총 시간 |
timeInDeep | Int? | 수면 단계가 deep로 진행된 총 시간 |
timeInRem | Int? | 수면 단계가 rem 으로 진행된 총 시간 |
sleepEfficiency | Float | 수면 측정 시간 중 실제로 잠든 시간의 비율 |
wakeRatio | Float | 수면 단계 도중 중간에 깬 시간의 비율 |
sleepRatio | Float | 수면 단계 도중 깨지 않고 잔 시간의 비율 |
lightRatio | Float? | 수면 단계 도중 light 수면의 비율 |
deepRatio | Float? | 수면 단계 도중 deep 수면의 비율 |
remRatio | Float? | rem sleep 비율 |
wasoCount | Int? | 수면 구간 중 wake가 발생한 횟수 |
longestWaso | Int? | 수면 구간 중 가장 긴 wake의 시간 |
sleepCycleCount | Int? | 수면 주기의 횟수 |
timeInSnoring | Int? | 코골이가 발생한 총 시간 |
timeInNoSnoring | Int? | 코골이가 발생하지 않은 총 시간 |
snoringRatio | Float? | 수면 단계 도중 코골이었던 시간의 비율 |
noSnoringRatio | Float? | 수면 단계 도중 코골이가 아니었던 시간의 비율 |
snoringCount | Int? | 코골이 구간의 발생한 횟수 |
NeverSleptSessions
NeverSleptSessions
data class NeverSleptSessions (
val id: String,
val startTime: String,
val endTime: String,
val completedTime: String
)
Parameter Name | Type | Description |
---|---|---|
id | String | session id |
startTime | String | 세션 시작 시각 |
endTime | String | 세션 종료 시각 |
completedTime | String | 세션 분석 완료 시각 |
SleptSessions
SleptSessions
data class SleptSessions (
val id: String,
val createdTimezone: String,
val startTime: String,
val endTime: String,
val completedTime: String,
val sleepEfficiency: Float,
val sleepLatency: Int?,
val sleepTime: String?,
val wakeupLatency: Int?,
val wakeTime: String?,
val lightLatency: Int?,
val deepLatency: Int?,
val remLatency: Int?,
val timeInWake: Int,
val timeInSleepPeriod: Int,
val timeInSleep: Int,
val timeInBed: Int,
val timeInRem: Int?,
val timeInLight: Int?,
val timeInDeep: Int?,
val wakeRatio: Float,
val sleepRatio: Float,
val remRatio: Float?,
val lightRatio: Float?,
val deepRatio: Float?,
val sleepCycle: Int?,
val sleepCycleCount: Int?,
val wasoCount: Int?,
val longestWaso: Int?,
val timeInSnoring: Int?,
val timeInNoSnoring: Int?,
val snoringRatio: Float?,
val noSnoringRatio: Float?,
val snoringCount: Int?,
)
Parameter Name | Type | Description |
---|---|---|
id | String | session id |
createdTimezone | String | 세션이 생성된 타임존 (Timezone List) |
startTime | String | 세션 종료 시각 |
endTime | String | 세션 종료 시각 |
completedTime | String | 세션 분석 완료 시각 |
sleepEfficiency | Float | 수면 측정 시간 중 실제로 잠든 시간의 비율 |
sleepLatency | Int? | 잠들때까지 걸린 시각 |
sleepTime | String? | 수면 측정 시작 후 잠들기 까지 걸린 시간 |
wakeupLatency | Int? | 잠에서 깨어난 후 수면 측정을 종료하기까지 걸린 시간 |
wakeTime | String? | 잠에서 깨어난 시각 |
lightLatency | Int? | 첫 수면 시작으로부터 첫 번째 light가 발생하기까지의 시간 |
deepLatency | Int? | 첫 수면 시작으로부터 첫 번째 deep이 발생하기까지의 시간 |
remLatency | Int? | 첫 수면 시작으로부터 첫 번째 rem이 발생하기까지의 시간 |
timeInWake | Int | 수면 도중에 깬 시간 |
timeInSleepPeriod | Int | 수면 측정 시간 중 수면 측정 시작으로부터 잠들기 까지 걸린 시간과 잠에서 깨어난 후로부터 수면 측정을 종료하기까지 걸린 시간을 제외한 시간 (time_in_bed - sleep_latency - wakeup_latency) |
timeInSleep | Int | 수면 측정 시간 중 실제로 수면 중이었던 시간 이 시간이 deep, light, rem의 3단계로 구분됨 |
timeInBed | Int | 수면 측정 시작 시각부터 수면 측정 종료 시각 까지의 시간 |
timeInRem | Int? | 수면 단계가 rem 으로 진행된 총 시간 |
timeInLight | Int? | 수면 단계가 light 로 진행된 총 시간 |
timeInDeep | Int? | 수면 단계가 deep로 진행된 총 시간 |
wakeRatio | Float | 수면 단계 도중 중간에 깬 시간의 비율 |
sleepRatio | Float | 수면 단계 도중 깨지 않고 잔 시간의 비율 |
remRatio | Float? | rem sleep 비율 |
lightRatio | Float? | 수면 단계 도중 light 수면의 비율 |
deepRatio | Float? | 수면 단계 도중 deep 수면의 비율 |
sleepCycle | Int? | 수면 주기 1회당 평균 시간 |
sleepCycleCount | Int? | 수면 주기의 횟수 |
wasoCount | Int? | 수면 구간 중 wake가 발생한 횟수 |
longestWaso | Int? | 수면 구간 중 가장 긴 wake의 시간 |
timeInSnoring | Int? | 코골이가 발생한 총 시간 |
timeInNoSnoring | Int? | 코골이가 발생하지 않은 총 시간 |
snoringRatio | Float? | 수면 단계 도중 코골이었던 시간의 비율 |
noSnoringRatio | Float? | 수면 단계 도중 코골이가 아니었던 시간의 비율 |
snoringCount | Int? | 코골이 구간의 발생한 횟수 |
Delete Report
데이터 삭제 주의
세션 데이터 삭제 요청에 따라 에이슬립 서버에서 세션 데이터가 삭제된 경우, 추후 과금 사용량 분석 시 삭제된 세션에 대한 구체적인 근거 제공이 어렵습니다.
Asleep.deleteReport
: sessionId
에 해당하는 Report를 삭제합니다.
fun deleteReport(sessionId: String, deleteReportListener: DeleteReportListener)
Parameter Name | Type | Description |
---|---|---|
sessionId | String | 삭제할 sessionId 의 값 |
deleteReportListener | DeleteReportListener | Report 삭제에 대한 콜백을 받을 리스너 |
Asleep.Reports.DeleteReportListener
Asleep.Reports.DeleteReportListener
interface DeleteReportListener {
fun onSuccess(sessionId: String?)
fun onFail(errorCode: Int, detail: String)
}
성공 시, onSuccess()
가 호출됩니다.
onSuccess()
가 호출됩니다.Parameter Name | Type | Description |
---|---|---|
sessionId | String? | 삭제된 sessionId 의 값 |
실패 시, onFail()
이 호출됩니다.
onFail()
이 호출됩니다.Parameter Name | Type | Description |
---|---|---|
errorCode | Int | AsleepErrorCode 참조 |
detail | String | errorCode 에 관련된 메시지 |
Updated about 2 months ago