Files
RSSuper/android/src/main/java/com/rssuper/services/FetchResult.kt
Michael Freno c2e1622bd8
Some checks failed
CI - Multi-Platform Native / Build iOS (RSSuper) (push) Has been cancelled
CI - Multi-Platform Native / Build macOS (push) Has been cancelled
CI - Multi-Platform Native / Build Android (push) Has been cancelled
CI - Multi-Platform Native / Build Linux (push) Has been cancelled
CI - Multi-Platform Native / Build Summary (push) Has been cancelled
restructure
2026-03-30 16:39:18 -04:00

32 lines
919 B
Kotlin

package com.rssuper.services
import okhttp3.CacheControl
import okhttp3.Response
data class FetchResult(
val feedXml: String,
val url: String,
val cacheControl: CacheControl?,
val isCached: Boolean,
val etag: String? = null,
val lastModified: String? = null
) {
companion object {
fun fromResponse(response: Response, url: String, isCached: Boolean = false): FetchResult {
val body = response.body?.string() ?: ""
val cacheControl = response.cacheControl
val etag = response.header("ETag")
val lastModified = response.header("Last-Modified")
return FetchResult(
feedXml = body,
url = url,
cacheControl = cacheControl,
isCached = isCached,
etag = etag,
lastModified = lastModified
)
}
}
}