ListResponse

@Serializable
data class ListResponse<T>(val count: Int, val next: String? = null, val previous: String? = null, val results: List<T> = listOf())

A generic response wrapper for paginated API results.

Parameters

T

The type of items contained in the results list.

Constructors

Link copied to clipboard
constructor(count: Int, next: String? = null, previous: String? = null, results: List<T> = listOf())

Properties

Link copied to clipboard
val count: Int

The total number of items available in the resource.

Link copied to clipboard
@Serializable(with = NullableStringSerializer::class)
val next: String? = null

The URL for the next page of results, if available. null if there are no more pages.

Link copied to clipboard
@Serializable(with = NullableStringSerializer::class)
val previous: String? = null

The URL for the previous page of results, if available. null if on the first page.

Link copied to clipboard
val results: List<T>

A list of items of type T returned by the API.