From 852d4b2b86b1bd497a3ccf79123a2599984d708f Mon Sep 17 00:00:00 2001 From: Deftu Date: Sat, 14 Sep 2024 20:41:51 +0200 Subject: [PATCH] Add build, changelog and GitHub data models --- .../one/devos/osuv2kt/models/GithubUser.kt | 11 +++++++++ .../one/devos/osuv2kt/models/build/Build.kt | 19 +++++++++++++++ .../osuv2kt/models/build/BuildUpdateStream.kt | 12 ++++++++++ .../osuv2kt/models/build/BuildVersions.kt | 6 +++++ .../models/changelog/ChangelogEntry.kt | 23 +++++++++++++++++++ 5 files changed, 71 insertions(+) create mode 100644 src/main/kotlin/one/devos/osuv2kt/models/GithubUser.kt create mode 100644 src/main/kotlin/one/devos/osuv2kt/models/build/Build.kt create mode 100644 src/main/kotlin/one/devos/osuv2kt/models/build/BuildUpdateStream.kt create mode 100644 src/main/kotlin/one/devos/osuv2kt/models/build/BuildVersions.kt create mode 100644 src/main/kotlin/one/devos/osuv2kt/models/changelog/ChangelogEntry.kt diff --git a/src/main/kotlin/one/devos/osuv2kt/models/GithubUser.kt b/src/main/kotlin/one/devos/osuv2kt/models/GithubUser.kt new file mode 100644 index 0000000..b2dc639 --- /dev/null +++ b/src/main/kotlin/one/devos/osuv2kt/models/GithubUser.kt @@ -0,0 +1,11 @@ +package one.devos.osuv2kt.models + +public data class GithubUser( + public val displayName: String, + public val githubUrl: String?, + public val githubUsername: String?, + public val id: Int?, + public val osuUsername: String?, + public val userId: Int?, + public val userUrl: String? +) diff --git a/src/main/kotlin/one/devos/osuv2kt/models/build/Build.kt b/src/main/kotlin/one/devos/osuv2kt/models/build/Build.kt new file mode 100644 index 0000000..e53cfcd --- /dev/null +++ b/src/main/kotlin/one/devos/osuv2kt/models/build/Build.kt @@ -0,0 +1,19 @@ +package one.devos.osuv2kt.models.build + +import com.google.gson.annotations.SerializedName +import one.devos.osuv2kt.models.changelog.ChangelogEntry +import java.time.OffsetDateTime + +public data class Build( + public val createdAt: OffsetDateTime, + public val displayVersion: String, + public val id: Int, + public val updateStream: BuildUpdateStream?, + @SerializedName("users") public val userCount: Int, + public val version: String?, + public val youtubeId: String?, + + // Optionals + public val changelogEntries: Set?, + public val versions: BuildVersions? +) diff --git a/src/main/kotlin/one/devos/osuv2kt/models/build/BuildUpdateStream.kt b/src/main/kotlin/one/devos/osuv2kt/models/build/BuildUpdateStream.kt new file mode 100644 index 0000000..5743262 --- /dev/null +++ b/src/main/kotlin/one/devos/osuv2kt/models/build/BuildUpdateStream.kt @@ -0,0 +1,12 @@ +package one.devos.osuv2kt.models.build + +public data class BuildUpdateStream( + public val displayVersion: String, + public val id: Int, + public val isFeatured: Boolean, + public val name: String, + + // Optionals + public val latestBuild: Build?, + public val userCount: Int +) diff --git a/src/main/kotlin/one/devos/osuv2kt/models/build/BuildVersions.kt b/src/main/kotlin/one/devos/osuv2kt/models/build/BuildVersions.kt new file mode 100644 index 0000000..d51a67a --- /dev/null +++ b/src/main/kotlin/one/devos/osuv2kt/models/build/BuildVersions.kt @@ -0,0 +1,6 @@ +package one.devos.osuv2kt.models.build + +public data class BuildVersions( + public val next: Build, + public val previous: Build +) diff --git a/src/main/kotlin/one/devos/osuv2kt/models/changelog/ChangelogEntry.kt b/src/main/kotlin/one/devos/osuv2kt/models/changelog/ChangelogEntry.kt new file mode 100644 index 0000000..f874d1c --- /dev/null +++ b/src/main/kotlin/one/devos/osuv2kt/models/changelog/ChangelogEntry.kt @@ -0,0 +1,23 @@ +package one.devos.osuv2kt.models.changelog + +import com.google.gson.annotations.SerializedName +import one.devos.osuv2kt.models.GithubUser +import java.time.OffsetDateTime + +public data class ChangelogEntry( + public val category: String, + public val createdAt: OffsetDateTime, + public val githubPullRequestId: Int?, + public val githubUrl: String?, + public val id: Int?, + @SerializedName("major") public val isMajor: Boolean, + public val repository: String?, + public val title: String?, + public val type: String, + public val url: String?, + + // Optionals + public val githubUser: GithubUser?, + public val message: String?, + public val messageHtml: String? +)