Adds isValid method in data class

This commit is contained in:
Julien Lengrand-Lambert
2025-05-01 11:36:16 +02:00
parent 9cb783d2b7
commit 428405bee0
3 changed files with 6 additions and 9 deletions

View File

@@ -6,19 +6,12 @@ plugins {
group = "nl.lengrand"
version = "1.0-SNAPSHOT"
val ksoupVersion = "0.2.3"
repositories {
mavenCentral()
}
dependencies {
// implementation("com.fleeksoft.ksoup:ksoup:$ksoupVersion")
//// implementation("com.fleeksoft.ksoup:ksoup-kotlinx:$ksoupVersion")
// implementation("com.fleeksoft.ksoup:ksoup-okio:$ksoupVersion")
// implementation("com.fleeksoft.ksoup:ksoup-network:$ksoupVersion")
implementation("org.jsoup:jsoup:1.20.1")
testImplementation(kotlin("test"))
}

View File

@@ -19,5 +19,4 @@ class DocumentFetcher {
fun fromFile() : Document {
TODO()
}
}

View File

@@ -9,6 +9,7 @@ data class OpenGraphTag(
)
data class OpenGraph(
// Tags can have multiple values for the same property, so we cannot use a Map.
val rawTags: Elements,
val tags: List<OpenGraphTag>,
@@ -19,7 +20,11 @@ data class OpenGraph(
val url: String? = null,
// TODO : Continue with more
)
){
fun isValid(): Boolean {
return title != null && type != null && image != null && url != null
}
}
class Parser {