Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
ChachyDev committed Sep 6, 2020
1 parent 41ee01c commit 261908c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 33 deletions.
7 changes: 3 additions & 4 deletions src/main/kotlin/si/ksoft/ksoftlin/builder/Ksoftlin.kt
Original file line number Diff line number Diff line change
@@ -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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>, @SerializedName("user") val id: Long, val isWeekend: Boolean)
data class Vote(
val expiry: String,
val extras: List<String>,
@SerializedName("user") val id: Long,
val isWeekend: Boolean
)

data class ListVoteResponse(val votes: List<Vote>)
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
val type: List<String>,
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<String>,
val type: List<String>,
val map: String
)

data class LocationResponse(val error: Boolean, val code: Int, val message: String? = null, val data: Location)
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
data class GeoIPLocationResponse(
val error: Boolean,
val code: Int,
@SerializedName("data") val location: Location,
val message: String? = null
)
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 7 additions & 8 deletions src/main/kotlin/si/ksoft/ksoftlin/endpoints/ImageEndpoint.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<ImageResponse>("$api/images/random-image") {
parameter("tag", tag)
parameter("nsfw", isNsfw)
header("Authorization", token)
}
suspend fun getRandomImage(tag: String, isNsfw: Boolean = false) =
client.get<ImageResponse>("$api/images/random-image") {
parameter("tag", tag)
parameter("nsfw", isNsfw)
header("Authorization", token)
}

suspend fun getTags() = client.get<TagResponse>("$api/images/tags") { header("Authorization", token) }

Expand Down
4 changes: 1 addition & 3 deletions src/main/kotlin/si/ksoft/ksoftlin/endpoints/KumoEndpoint.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 261908c

Please sign in to comment.