mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-22 16:23:50 +00:00
start migration onto ktor 3.0
This commit is contained in:
parent
24bd403549
commit
fce7ec8912
@ -1,6 +1,6 @@
|
||||
[versions]
|
||||
|
||||
kt = "2.0.20"
|
||||
kt = "2.0.21"
|
||||
kt-serialization = "1.7.3"
|
||||
kt-coroutines = "1.9.0"
|
||||
|
||||
@ -15,7 +15,7 @@ sqlite = "3.46.1.3"
|
||||
korlibs = "5.4.0"
|
||||
uuid = "0.8.4"
|
||||
|
||||
ktor = "2.3.12"
|
||||
ktor = "3.0.0"
|
||||
|
||||
gh-release = "2.5.2"
|
||||
|
||||
|
@ -3,9 +3,10 @@ package dev.inmo.micro_utils.ktor.client
|
||||
import dev.inmo.micro_utils.common.MPPFile
|
||||
import dev.inmo.micro_utils.ktor.common.*
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.content.*
|
||||
|
||||
expect suspend fun HttpClient.tempUpload(
|
||||
fullTempUploadDraftPath: String,
|
||||
file: MPPFile,
|
||||
onUpload: OnUploadCallback = { _, _ -> }
|
||||
onUpload: ProgressListener = { _, _ -> }
|
||||
): TemporalFileId
|
||||
|
@ -5,6 +5,7 @@ import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||
import dev.inmo.micro_utils.ktor.common.TemporalFileId
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.content.*
|
||||
import kotlinx.coroutines.*
|
||||
import org.w3c.dom.mediasource.ENDED
|
||||
import org.w3c.dom.mediasource.ReadyState
|
||||
@ -14,7 +15,7 @@ import org.w3c.xhr.XMLHttpRequest.Companion.DONE
|
||||
suspend fun tempUpload(
|
||||
fullTempUploadDraftPath: String,
|
||||
file: MPPFile,
|
||||
onUpload: OnUploadCallback
|
||||
onUpload: ProgressListener
|
||||
): TemporalFileId {
|
||||
val formData = FormData()
|
||||
val answer = CompletableDeferred<TemporalFileId>(currentCoroutineContext().job)
|
||||
@ -60,5 +61,5 @@ suspend fun tempUpload(
|
||||
actual suspend fun HttpClient.tempUpload(
|
||||
fullTempUploadDraftPath: String,
|
||||
file: MPPFile,
|
||||
onUpload: OnUploadCallback
|
||||
onUpload: ProgressListener
|
||||
): TemporalFileId = dev.inmo.micro_utils.ktor.client.tempUpload(fullTempUploadDraftPath, file, onUpload)
|
||||
|
@ -4,6 +4,7 @@ import dev.inmo.micro_utils.common.MPPFile
|
||||
import dev.inmo.micro_utils.common.filename
|
||||
import dev.inmo.micro_utils.ktor.common.TemporalFileId
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.content.*
|
||||
import io.ktor.client.plugins.onUpload
|
||||
import io.ktor.client.request.forms.formData
|
||||
import io.ktor.client.request.forms.submitFormWithBinaryData
|
||||
@ -18,7 +19,7 @@ internal val MPPFile.mimeType: String
|
||||
actual suspend fun HttpClient.tempUpload(
|
||||
fullTempUploadDraftPath: String,
|
||||
file: MPPFile,
|
||||
onUpload: OnUploadCallback
|
||||
onUpload: ProgressListener
|
||||
): TemporalFileId {
|
||||
val inputProvider = file.inputProvider()
|
||||
val fileId = submitFormWithBinaryData(
|
||||
|
@ -18,7 +18,7 @@ internal val MPPFile.mimeType: String
|
||||
actual suspend fun HttpClient.tempUpload(
|
||||
fullTempUploadDraftPath: String,
|
||||
file: MPPFile,
|
||||
onUpload: OnUploadCallback
|
||||
onUpload: ProgressListener
|
||||
): TemporalFileId {
|
||||
val inputProvider = file.inputProvider()
|
||||
val fileId = submitFormWithBinaryData(
|
||||
|
Loading…
Reference in New Issue
Block a user