From 7332805caeaa832ec66a038afebb2f6ff6b7a926 Mon Sep 17 00:00:00 2001 From: dmitrysufrai Date: Sat, 16 Mar 2024 05:26:51 +0200 Subject: [PATCH] format --- src/main/kotlin/model/AuditLog.kt | 2 +- src/main/kotlin/model/Organization.kt | 3 +- src/main/kotlin/resource/Databases.kt | 24 +++++++-------- .../serializer/LocalDateTimeSerializer.kt | 4 +-- src/test/kotlin/resource/ApiTokensTest.kt | 2 +- src/test/kotlin/resource/AuditLogsTest.kt | 2 +- src/test/kotlin/resource/DatabasesTest.kt | 30 +++++++++---------- src/test/kotlin/resource/GroupsTest.kt | 2 +- src/test/kotlin/resource/LocationsTest.kt | 2 +- src/test/kotlin/resource/OrganizationsTest.kt | 4 +-- 10 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/main/kotlin/model/AuditLog.kt b/src/main/kotlin/model/AuditLog.kt index b6ce85e..adb9061 100644 --- a/src/main/kotlin/model/AuditLog.kt +++ b/src/main/kotlin/model/AuditLog.kt @@ -6,10 +6,10 @@ package com.jeliuc.turso.sdk.model import com.jeliuc.turso.sdk.serializer.LocalDateTimeSerializer -import java.time.LocalDateTime import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement +import java.time.LocalDateTime @Serializable data class ListAuditLogsResponse( diff --git a/src/main/kotlin/model/Organization.kt b/src/main/kotlin/model/Organization.kt index 53d580d..6dc1aa6 100644 --- a/src/main/kotlin/model/Organization.kt +++ b/src/main/kotlin/model/Organization.kt @@ -6,9 +6,9 @@ package com.jeliuc.turso.sdk.model import com.jeliuc.turso.sdk.serializer.LocalDateTimeSerializer -import java.time.LocalDateTime import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +import java.time.LocalDateTime @Serializable data class Organization( @@ -60,7 +60,6 @@ enum class MemberRole { @SerialName("admin") ADMIN, - @Suppress("unused") @SerialName("member") MEMBER, diff --git a/src/main/kotlin/resource/Databases.kt b/src/main/kotlin/resource/Databases.kt index 3892faf..b69c3a9 100644 --- a/src/main/kotlin/resource/Databases.kt +++ b/src/main/kotlin/resource/Databases.kt @@ -233,18 +233,18 @@ class Databases(private val client: TursoClient) : ResponseHandler() { contentType(ContentType.MultiPart.FormData) setBody( body = - MultiPartFormDataContent( - formData { - append( - "file", - file.readBytes(), - Headers.build { - append(HttpHeaders.ContentType, ContentType.Application.OctetStream.toString()) - append(HttpHeaders.ContentDisposition, "form-data; name=file; filename=${file.name}") - }, - ) - }, - ), + MultiPartFormDataContent( + formData { + append( + "file", + file.readBytes(), + Headers.build { + append(HttpHeaders.ContentType, ContentType.Application.OctetStream.toString()) + append(HttpHeaders.ContentDisposition, "form-data; name=file; filename=${file.name}") + }, + ) + }, + ), ) }.let { response -> handleResponse(response) diff --git a/src/main/kotlin/serializer/LocalDateTimeSerializer.kt b/src/main/kotlin/serializer/LocalDateTimeSerializer.kt index a9f99c1..a573eaa 100644 --- a/src/main/kotlin/serializer/LocalDateTimeSerializer.kt +++ b/src/main/kotlin/serializer/LocalDateTimeSerializer.kt @@ -5,13 +5,13 @@ package com.jeliuc.turso.sdk.serializer -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializer import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter @OptIn(ExperimentalSerializationApi::class) @Serializer(forClass = LocalDateTime::class) diff --git a/src/test/kotlin/resource/ApiTokensTest.kt b/src/test/kotlin/resource/ApiTokensTest.kt index cd148c5..7189911 100644 --- a/src/test/kotlin/resource/ApiTokensTest.kt +++ b/src/test/kotlin/resource/ApiTokensTest.kt @@ -16,9 +16,9 @@ import io.ktor.client.engine.mock.respond import io.ktor.http.ContentType import io.ktor.http.HttpMethod import io.ktor.http.headersOf +import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertIs -import kotlinx.coroutines.runBlocking private fun mockEngine() = MockEngine { request -> diff --git a/src/test/kotlin/resource/AuditLogsTest.kt b/src/test/kotlin/resource/AuditLogsTest.kt index 4761a60..6bc11f6 100644 --- a/src/test/kotlin/resource/AuditLogsTest.kt +++ b/src/test/kotlin/resource/AuditLogsTest.kt @@ -14,9 +14,9 @@ import io.ktor.client.engine.mock.respond import io.ktor.http.ContentType import io.ktor.http.HttpMethod import io.ktor.http.headersOf +import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertIs -import kotlinx.coroutines.runBlocking private fun mockEngine(): HttpClientEngine = MockEngine { request -> diff --git a/src/test/kotlin/resource/DatabasesTest.kt b/src/test/kotlin/resource/DatabasesTest.kt index bf4c6a6..0aa9558 100644 --- a/src/test/kotlin/resource/DatabasesTest.kt +++ b/src/test/kotlin/resource/DatabasesTest.kt @@ -24,9 +24,9 @@ import io.ktor.client.engine.mock.respond import io.ktor.http.ContentType import io.ktor.http.HttpMethod import io.ktor.http.headersOf +import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertIs -import kotlinx.coroutines.runBlocking private fun mockEngine(): HttpClientEngine = MockEngine { request -> @@ -41,7 +41,7 @@ private fun mockEngine(): HttpClientEngine = val data = Fixture.content("$fixturesBasePath/list.json") respond( data, - headers = headersOf("Content-Type" to listOf(ContentType.Application.Json.toString())) + headers = headersOf("Content-Type" to listOf(ContentType.Application.Json.toString())), ) } @@ -49,7 +49,7 @@ private fun mockEngine(): HttpClientEngine = val data = Fixture.content("$fixturesBasePath/create.json") respond( data, - headers = headersOf("Content-Type" to listOf(ContentType.Application.Json.toString())) + headers = headersOf("Content-Type" to listOf(ContentType.Application.Json.toString())), ) } @@ -107,9 +107,9 @@ private fun mockEngine(): HttpClientEngine = respond( data, headers = - headersOf( - "Content-Type" to listOf(ContentType.Application.Json.toString()), - ), + headersOf( + "Content-Type" to listOf(ContentType.Application.Json.toString()), + ), ) } @@ -123,9 +123,9 @@ private fun mockEngine(): HttpClientEngine = respond( "", headers = - headersOf( - "Content-Type" to listOf(ContentType.Application.Json.toString()), - ), + headersOf( + "Content-Type" to listOf(ContentType.Application.Json.toString()), + ), ) } @@ -140,9 +140,9 @@ private fun mockEngine(): HttpClientEngine = respond( data, headers = - headersOf( - "Content-Type" to listOf(ContentType.Application.Json.toString()), - ), + headersOf( + "Content-Type" to listOf(ContentType.Application.Json.toString()), + ), ) } @@ -157,9 +157,9 @@ private fun mockEngine(): HttpClientEngine = respond( data, headers = - headersOf( - "Content-Type" to listOf(ContentType.Application.Json.toString()), - ), + headersOf( + "Content-Type" to listOf(ContentType.Application.Json.toString()), + ), ) } diff --git a/src/test/kotlin/resource/GroupsTest.kt b/src/test/kotlin/resource/GroupsTest.kt index 1ec0a64..e6a2fc6 100644 --- a/src/test/kotlin/resource/GroupsTest.kt +++ b/src/test/kotlin/resource/GroupsTest.kt @@ -16,9 +16,9 @@ import io.ktor.client.engine.mock.respond import io.ktor.http.ContentType import io.ktor.http.HttpMethod import io.ktor.http.headersOf +import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertIs -import kotlinx.coroutines.runBlocking private fun mockEngine() = MockEngine { request -> diff --git a/src/test/kotlin/resource/LocationsTest.kt b/src/test/kotlin/resource/LocationsTest.kt index 29fdb35..8242023 100644 --- a/src/test/kotlin/resource/LocationsTest.kt +++ b/src/test/kotlin/resource/LocationsTest.kt @@ -14,9 +14,9 @@ import io.ktor.client.engine.mock.respond import io.ktor.http.ContentType import io.ktor.http.HttpMethod import io.ktor.http.headersOf +import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertIs -import kotlinx.coroutines.runBlocking private fun mockEngine(): HttpClientEngine = MockEngine { request -> diff --git a/src/test/kotlin/resource/OrganizationsTest.kt b/src/test/kotlin/resource/OrganizationsTest.kt index 26dba90..d96240d 100644 --- a/src/test/kotlin/resource/OrganizationsTest.kt +++ b/src/test/kotlin/resource/OrganizationsTest.kt @@ -23,10 +23,10 @@ import io.ktor.client.engine.mock.respond import io.ktor.http.ContentType import io.ktor.http.HttpMethod import io.ktor.http.headersOf -import kotlin.test.Test -import kotlin.test.assertIs import kotlinx.coroutines.runBlocking import org.junit.jupiter.api.assertThrows +import kotlin.test.Test +import kotlin.test.assertIs private fun mockEngine() = MockEngine { request ->