Coverage Summary for Class: TwitchResponse (io.github.captnblubber.twitchkt.helix.internal)

Class Method, % Branch, % Line, % Instruction, %
TwitchResponse 100% (1/1) 27.8% (5/18) 100% (4/4) 69.4% (93/134)
TwitchResponse$Companion 100% (1/1) 100% (1/1) 100% (7/7)
Total 100% (2/2) 27.8% (5/18) 100% (5/5) 70.9% (100/141)


 package io.github.captnblubber.twitchkt.helix.internal
 
 import io.github.captnblubber.twitchkt.error.TwitchApiException
 import kotlinx.serialization.Serializable
 
 @Serializable
 internal data class TwitchResponse<T>(
     val data: List<T>,
     val pagination: Pagination? = null,
     val total: Int? = null,
 )
 
 internal fun <T> TwitchResponse<T>.requireFirst(endpoint: String): T = data.firstOrNull() ?: throw TwitchApiException.EmptyResponse(endpoint)
 
 @Serializable
 internal data class Pagination(
     val cursor: String? = null,
 )