BrowseResult.kt
Each line, with the release that last changed it.
| 0.5.0 | 1 | package dev.stave.upnp |
| 2 | ||
| 3 | import dev.stave.domain.model.DidlItem | |
| 4 | ||
| 5 | /** | |
| 6 | * Result of a Browse() or Search() call against a UPnP ContentDirectory service. | |
| 7 | * | |
| 8 | * [Success.totalMatches] is the server-reported total count — different from [Success.items] | |
| 9 | * size when pagination is in play. A search returning the first 25 matches out of 5000 | |
| 10 | * has items.size == 25 and totalMatches == 5000. Random sampling uses this to pick a | |
| 11 | * valid offset without fetching the whole library. | |
| 12 | * | |
| 13 | * The default makes totalMatches == items.size for callers that don't care (Browse on | |
| 14 | * small containers where everything returns in one page). | |
| 15 | */ | |
| 16 | sealed interface BrowseResult { | |
| 17 | data class Success( | |
| 18 | val items: List<DidlItem>, | |
| 19 | val totalMatches: Long = items.size.toLong(), | |
| 20 | ) : BrowseResult | |
| 21 | ||
| 22 | data class Failure(val message: String) : BrowseResult | |
| 23 | } |


