Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
tweak: Change GofileChildContent.Folder#tags to List<String>
Browse files Browse the repository at this point in the history
  • Loading branch information
sya-ri committed Aug 12, 2022
1 parent f157215 commit cd881b0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/dev/s7a/gofile/GofileChildContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ sealed class GofileChildContent {
val password: Boolean = false,
val description: String? = null,
val expire: Long? = null,
val tags: String? = null
val tags: List<String> = emptyList()
) : GofileChildContent() {
override val type = GofileContentType.Folder
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class GofileChildContentSerializer : KSerializer<GofileChildContent> {
val password = element["password"]?.jsonPrimitive?.boolean ?: false
val description = element["description"]?.jsonPrimitive?.content
val expire = element["expire"]?.jsonPrimitive?.long
val tags = element["tags"]?.jsonPrimitive?.content
val tags = element["tags"]?.jsonPrimitive?.content?.split(",").orEmpty()
GofileChildContent.Folder(id, name, parentFolder, createTime, childs, code, public, password, description, expire, tags)
}
}
Expand Down Expand Up @@ -125,7 +125,7 @@ class GofileChildContentSerializer : KSerializer<GofileChildContent> {
if (value.password) put("password", true)
if (value.description != null) put("description", value.description)
if (value.expire != null) put("expire", value.expire)
if (value.tags != null) put("tags", value.tags)
if (value.tags.isNotEmpty()) put("tags", value.tags.joinToString(","))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commonTest/kotlin/ChildContentTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ChildContentTests {
password = true,
"_description",
987654321,
"t,a,g,s"
listOf("t", "a", "g", "s")
)
)
)
Expand Down Expand Up @@ -241,7 +241,7 @@ class ChildContentTests {
password = true,
"_description",
987654321,
"t,a,g,s"
listOf("t", "a", "g", "s")
),
json.decodeFromString(
GofileChildContent.serializer(),
Expand Down
4 changes: 2 additions & 2 deletions src/commonTest/kotlin/ContentTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ContentTests {
password = true,
"_description3",
12345,
"t,a,g,s,3"
listOf("t", "a", "g", "s", "3")
)
)
)
Expand Down Expand Up @@ -299,7 +299,7 @@ class ContentTests {
password = true,
"_description3",
12345,
"t,a,g,s,3"
listOf("t", "a", "g", "s", "3")
)
)
),
Expand Down

0 comments on commit cd881b0

Please sign in to comment.