diff --git a/build.gradle b/build.gradle index c0dbdb5..53a1101 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.jetbrains.kotlin.jvm' version '1.3.61' + id 'org.jetbrains.kotlin.jvm' version '1.4.0' } group 'si.ksoft' @@ -12,9 +12,9 @@ repositories { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - implementation "io.ktor:ktor-client-gson:1.3.2" - implementation "io.ktor:ktor-client-core:1.3.2" - implementation "io.ktor:ktor-client-apache:1.3.2" + implementation "io.ktor:ktor-client-gson:1.4.0" + implementation "io.ktor:ktor-client-core:1.4.0" + implementation "io.ktor:ktor-client-apache:1.4.0" } compileKotlin { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 44e7c4d..12d38de 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/si/ksoft/ksoftlin/builder/Ksoftlin.kt b/src/main/kotlin/si/ksoft/ksoftlin/builder/Ksoftlin.kt index cdeb678..4a7091c 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/builder/Ksoftlin.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/builder/Ksoftlin.kt @@ -1,9 +1,8 @@ package si.ksoft.ksoftlin.builder -import io.ktor.client.HttpClient -import io.ktor.client.engine.apache.Apache -import io.ktor.client.features.json.GsonSerializer -import io.ktor.client.features.json.Json +import io.ktor.client.* +import io.ktor.client.engine.apache.* +import io.ktor.client.features.json.* import si.ksoft.ksoftlin.endpoints.KsoftEndpoints /** diff --git a/src/main/kotlin/si/ksoft/ksoftlin/data/dbl/vote/list/ListVoteData.kt b/src/main/kotlin/si/ksoft/ksoftlin/data/dbl/vote/list/ListVoteData.kt index d10fdc9..6969d97 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/data/dbl/vote/list/ListVoteData.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/data/dbl/vote/list/ListVoteData.kt @@ -3,6 +3,11 @@ package si.ksoft.ksoftlin.data.dbl.vote.list import com.google.gson.annotations.SerializedName import si.ksoft.ksoftlin.data.dbl.vote.Vote -data class Vote(val expiry: String, val extras: List, @SerializedName("user") val id: Long, val isWeekend: Boolean) +data class Vote( + val expiry: String, + val extras: List, + @SerializedName("user") val id: Long, + val isWeekend: Boolean +) data class ListVoteResponse(val votes: List) \ No newline at end of file diff --git a/src/main/kotlin/si/ksoft/ksoftlin/data/image/reddit/RedditPostData.kt b/src/main/kotlin/si/ksoft/ksoftlin/data/image/reddit/RedditPostData.kt index 9c5f0f4..d5d3dae 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/data/image/reddit/RedditPostData.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/data/image/reddit/RedditPostData.kt @@ -18,5 +18,6 @@ data class RedditPost( val createdAt: Long, @SerializedName("nsfw") val isNsfw: Boolean, - val author: String + val author: String, + val awards: Int ) \ No newline at end of file diff --git a/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/LocationData.kt b/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/LocationData.kt index b656d71..48a8a7f 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/LocationData.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/LocationData.kt @@ -2,14 +2,16 @@ package si.ksoft.ksoftlin.data.kumo.location import com.google.gson.annotations.SerializedName -data class Location(val address: String, - @SerializedName("lat") - val latitude: Double, - @SerializedName("lon") - val longitude: Double, - @SerializedName("bounding_box") - val boundingBox: List, - val type: List, - val map: String) +data class Location( + val address: String, + @SerializedName("lat") + val latitude: Double, + @SerializedName("lon") + val longitude: Double, + @SerializedName("bounding_box") + val boundingBox: List, + val type: List, + val map: String +) data class LocationResponse(val error: Boolean, val code: Int, val message: String? = null, val data: Location) \ No newline at end of file diff --git a/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/geoip/LocationData.kt b/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/geoip/LocationData.kt index ef0dcd9..6eaba5a 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/geoip/LocationData.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/data/kumo/location/geoip/LocationData.kt @@ -4,7 +4,9 @@ import com.google.gson.annotations.SerializedName data class LocationLinks( val weather: String, - val gis: String, @SerializedName("openstreetmap") val openStreetMap: String, @SerializedName("googlemaps") val googleMaps: String + val gis: String, + @SerializedName("openstreetmap") val openStreetMap: String, + @SerializedName("googlemaps") val googleMaps: String ) data class Location( @@ -31,4 +33,9 @@ data class Location( val apis: LocationLinks ) -data class GeoIPLocationResponse(val error: Boolean, val code: Int, @SerializedName("data") val location: Location, val message: String? = null) \ No newline at end of file +data class GeoIPLocationResponse( + val error: Boolean, + val code: Int, + @SerializedName("data") val location: Location, + val message: String? = null +) \ No newline at end of file diff --git a/src/main/kotlin/si/ksoft/ksoftlin/data/music/track/lyrics/LyricData.kt b/src/main/kotlin/si/ksoft/ksoftlin/data/music/track/lyrics/LyricData.kt index df8264f..9058275 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/data/music/track/lyrics/LyricData.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/data/music/track/lyrics/LyricData.kt @@ -4,21 +4,64 @@ import com.google.gson.annotations.SerializedName data class SongResponse(val data: List) -data class Song(val artist: String, - val artistId: Int, - val album: String, - @SerializedName("album_ids") - val albumIds: String, - @SerializedName("album_year") - val albumYear: String, - val name: String, - val lyrics: String, - @SerializedName("search_str") - val searchString: String, - @SerializedName("album_art") - val albumArt: String, - val popularity: Int, - val id: String, - @SerializedName("search_score") - val searchScore: Double) +data class Song( + val artist: String, + val artistId: Int, + val album: String, + @SerializedName("album_ids") + val albumIds: String, + @SerializedName("album_year") + val albumYear: String, + val name: String, + val lyrics: String, + @SerializedName("search_str") + val searchString: String, + @SerializedName("album_art") + val albumArt: String, + val popularity: Int, + val id: String, + @SerializedName("search_score") + val searchScore: Double, + val url: String, + val singalongStamp: List?, + val meta: Metadata +) +data class Metadata( + val spotify: SpotifyMetadata, + val deezer: DeezerMetadata, + val artist: List, + val other: OtherMetadata +) + +data class SpotifyMetadata( + val artists: List?, + val track: String?, + val album: String? +) + +data class DeezerMetadata( + val artist: List?, + val track: String?, + val album: String? +) + + +data class Artist( + val name: String?, + @SerializedName("is_primary") + val isPrimary: Boolean? +) + +data class OtherMetadata( + val gain: Double, + val bpm: Double +) + +data class SingalongStamp( + @SerializedName("lrc_timestamp") + val lyricTimestamp: String, + val milliseconds: String, + val duration: String, + val line: String +) \ No newline at end of file diff --git a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/DiscordBotListEndpoint.kt b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/DiscordBotListEndpoint.kt index ac81bf4..c16f2db 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/DiscordBotListEndpoint.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/DiscordBotListEndpoint.kt @@ -1,8 +1,6 @@ package si.ksoft.ksoftlin.endpoints -import io.ktor.client.request.get -import io.ktor.client.request.header -import io.ktor.client.request.parameter +import io.ktor.client.request.* import si.ksoft.ksoftlin.builder.client import si.ksoft.ksoftlin.data.dbl.vote.VoteResponse import si.ksoft.ksoftlin.data.dbl.vote.list.ListVoteResponse diff --git a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/ImageEndpoint.kt b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/ImageEndpoint.kt index 78449f1..9c9cccd 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/ImageEndpoint.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/ImageEndpoint.kt @@ -1,8 +1,6 @@ package si.ksoft.ksoftlin.endpoints -import io.ktor.client.request.get -import io.ktor.client.request.header -import io.ktor.client.request.parameter +import io.ktor.client.request.* import si.ksoft.ksoftlin.builder.client import si.ksoft.ksoftlin.data.image.ImageResponse import si.ksoft.ksoftlin.data.image.reddit.RedditPost @@ -19,11 +17,12 @@ import si.ksoft.ksoftlin.util.api */ class ImageEndpoint(private val token: String) { - suspend fun getRandomImage(tag: String, isNsfw: Boolean = false) = client.get("$api/images/random-image") { - parameter("tag", tag) - parameter("nsfw", isNsfw) - header("Authorization", token) - } + suspend fun getRandomImage(tag: String, isNsfw: Boolean = false) = + client.get("$api/images/random-image") { + parameter("tag", tag) + parameter("nsfw", isNsfw) + header("Authorization", token) + } suspend fun getTags() = client.get("$api/images/tags") { header("Authorization", token) } diff --git a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/KumoEndpoint.kt b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/KumoEndpoint.kt index 37ad3a0..b8631f4 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/KumoEndpoint.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/KumoEndpoint.kt @@ -1,8 +1,6 @@ package si.ksoft.ksoftlin.endpoints -import io.ktor.client.request.get -import io.ktor.client.request.header -import io.ktor.client.request.parameter +import io.ktor.client.request.* import si.ksoft.ksoftlin.builder.client import si.ksoft.ksoftlin.data.kumo.currency.CurrencyResponse import si.ksoft.ksoftlin.data.kumo.location.LocationResponse diff --git a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/LyricsEndpoint.kt b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/LyricsEndpoint.kt index 608b3d2..35e8f4d 100644 --- a/src/main/kotlin/si/ksoft/ksoftlin/endpoints/LyricsEndpoint.kt +++ b/src/main/kotlin/si/ksoft/ksoftlin/endpoints/LyricsEndpoint.kt @@ -1,8 +1,6 @@ package si.ksoft.ksoftlin.endpoints -import io.ktor.client.request.get -import io.ktor.client.request.header -import io.ktor.client.request.parameter +import io.ktor.client.request.* import si.ksoft.ksoftlin.builder.client import si.ksoft.ksoftlin.data.music.artist.Artist import si.ksoft.ksoftlin.data.music.track.Track