Skip to content

Commit

Permalink
Update datatype V0.19 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
MV-GH authored Dec 15, 2023
1 parent 900323d commit 161c575
Show file tree
Hide file tree
Showing 20 changed files with 18 additions and 38 deletions.
10 changes: 7 additions & 3 deletions GeneratorScripts/src/main/kotlin/autogenscripts/GenTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fun getTypesPath(
temp: Boolean = true,
) = "$ROOT_PATH$ROOT_PACKAGE_PATH$version/datatypes" + if (temp) "/temp" else ""

fun isInteger(_l: String) = true
fun isInteger(@Suppress("UNUSED_PARAMETER") _l: String) = true

fun getDownloadLink(tag: String) = "https://github.com/LemmyNet/lemmy-js-client/archive/refs/tags/$tag.zip"

Expand All @@ -41,6 +41,10 @@ suspend fun downloadTypes(
.copyAndClose(lemmyJsClient.writeChannel())

val dest = File(getTypesPath(vShort))

for (typeFile in dest.listFiles() ?: emptyArray<File>()) {
typeFile.delete()
}
dest.mkdirs()

withContext(Dispatchers.IO) {
Expand Down Expand Up @@ -79,7 +83,7 @@ suspend fun downloadTypes(
println(String(proc.inputStream.readAllBytes()))

for (typeFile in datatypes.listFiles()!!) {
if (typeFile.name.startsWith("lib")) {
if (typeFile.name.startsWith("lib") || !typeFile.name.contains("module")) {
typeFile.delete()
} else if (typeFile.name.endsWith(".kt") && typeFile.isFile()) {
val fileName = typeFile.name.substringBefore(".")
Expand Down Expand Up @@ -217,5 +221,5 @@ suspend fun downloadTypes(
}

suspend fun main() {
downloadTypes("0.19.0-rc.14", "v0x19")
downloadTypes("0.19.0", "v0x19")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const val TIMEOUT_MS = 20000L
// TODO think about this
val ktorJson =
Json {
// ignoreUnknownKeys = true
ignoreUnknownKeys = true
}

val lenientJson =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,6 @@ internal class Transformer(var auth: String) : DatatypesMapper {

override fun toV0x19(d: V0x18DatatypesCustomEmojiKeyword): V0x19DatatypesCustomEmojiKeyword =
it.vercruysse.lemmyapi.v0x19.datatypes.CustomEmojiKeyword(
id = d.id,
custom_emoji_id = d.custom_emoji_id,
keyword = d.keyword,
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.RegistrationMode
import it.vercruysse.lemmyapi.dto.ListingType
import kotlinx.serialization.Serializable

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import kotlinx.serialization.Serializable

@Serializable
data class CustomEmojiKeyword(
val id: Int,
val custom_emoji_id: CustomEmojiId,
val keyword: String,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.RegistrationMode
import it.vercruysse.lemmyapi.dto.ListingType
import kotlinx.serialization.Serializable

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.SortType
import it.vercruysse.lemmyapi.dto.ListingType
import kotlinx.serialization.Serializable

@Serializable
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.SortType
import it.vercruysse.lemmyapi.dto.ListingType
import kotlinx.serialization.Serializable

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.RegistrationMode
import it.vercruysse.lemmyapi.dto.ListingType
import kotlinx.serialization.Serializable

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.PostListingMode
import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.SortType
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ data class LocalUserView(
val local_user: LocalUser,
val person: Person,
val counts: PersonAggregates,

)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import kotlinx.serialization.Serializable

@Serializable
data class LoginToken(
val id: Int,
val user_id: LocalUserId,
val published: String,
val ip: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package it.vercruysse.lemmyapi.v0x19.datatypes

import kotlinx.serialization.Serializable


@Serializable
data class ReadableFederationState(
val instance_id: InstanceId,
val last_successful_id: ActivityId? = null,
val last_successful_published_time: String? = null,
val fail_count: Long,
val fail_count: Int,
val last_retry: String? = null,
val next_retry: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ data class Register(
val captcha_answer: String? = null,
val honeypot: String? = null,
val answer: String? = null,
val collapse_bot_comments: Boolean? = null,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.PostListingMode
import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.SortType
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package it.vercruysse.lemmyapi.v0x19.datatypes

import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.SearchType
import it.vercruysse.lemmyapi.dto.SortType
import it.vercruysse.lemmyapi.dto.SearchType
import kotlinx.serialization.Serializable

@Serializable
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ POM_DEVELOPER_URL=https://github.com/MV-GH

POM_ARTIFACT_ID=lemmy-api
GROUP=it.vercruysse.lemmyapi
VERSION_NAME=0.1.0-SNAPSHOT
VERSION_NAME=0.2.0-SNAPSHOT

0 comments on commit 161c575

Please sign in to comment.