Update versions
This commit is contained in:
parent
f500d4eb61
commit
62f6436cf6
@ -1,7 +1,7 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.6.10"
|
||||
kotlin("jvm") version "1.8.22"
|
||||
application
|
||||
}
|
||||
|
||||
@ -13,15 +13,11 @@ repositories {
|
||||
maven("https://maven.pkg.jetbrains.space/public/p/space/maven")
|
||||
}
|
||||
|
||||
val ktorVersion = "1.6.4"
|
||||
|
||||
dependencies {
|
||||
implementation("io.ktor:ktor-client-core:$ktorVersion")
|
||||
implementation("io.ktor:ktor-client-cio:$ktorVersion")
|
||||
implementation("io.ktor:ktor-client-auth:$ktorVersion")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-cli:0.3.4")
|
||||
implementation("org.jetbrains:space-sdk-jvm:98244-beta")
|
||||
implementation("ch.qos.logback:logback-classic:1.2.10")
|
||||
implementation("org.jetbrains:space-sdk-jvm:159302-beta")
|
||||
implementation("io.ktor:ktor-client-cio-jvm:2.3.1")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-cli:0.3.5")
|
||||
implementation("ch.qos.logback:logback-classic:1.4.8")
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -14,6 +14,7 @@ import space.jetbrains.api.runtime.types.FolderIdentifier
|
||||
import space.jetbrains.api.runtime.types.ProjectIdentifier
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.Path
|
||||
|
||||
suspend fun main(args: Array<String>) {
|
||||
val parser = ArgParser("space-document-extractor")
|
||||
@ -47,7 +48,7 @@ suspend fun main(args: Array<String>) {
|
||||
|
||||
parser.parse(args)
|
||||
|
||||
val target: Path = path?.let { Path.of(path) } ?: Path.of("output/$project")
|
||||
val target: Path = path?.let { Path(it) } ?: Path.of("output/$project")
|
||||
|
||||
Files.createDirectories(target)
|
||||
|
||||
|
@ -4,6 +4,7 @@ import io.ktor.client.request.header
|
||||
import io.ktor.client.request.request
|
||||
import io.ktor.client.request.url
|
||||
import io.ktor.client.statement.HttpResponse
|
||||
import io.ktor.client.statement.bodyAsChannel
|
||||
import io.ktor.client.statement.readBytes
|
||||
import io.ktor.http.HttpHeaders
|
||||
import io.ktor.http.HttpMethod
|
||||
@ -33,7 +34,7 @@ internal suspend fun SpaceClient.extractImage(
|
||||
imageFileName: String,
|
||||
) {
|
||||
logger.info("Downloading image file $imageFileName to $parent")
|
||||
val response = ktorClient.request<HttpResponse> {
|
||||
val response = ktorClient.request {
|
||||
url("${server.serverUrl}/d/$imageId")
|
||||
method = HttpMethod.Get
|
||||
header(HttpHeaders.Authorization, "Bearer ${token().accessToken}")
|
||||
@ -53,14 +54,14 @@ internal suspend fun SpaceClient.extractFile(
|
||||
) {
|
||||
//https://mipt-npm.jetbrains.space/drive/files/3qe9i43qtPq2
|
||||
logger.info("Downloading document file $documentFileName to $parent")
|
||||
val response = ktorClient.request<HttpResponse> {
|
||||
val response = ktorClient.request {
|
||||
url("${server.serverUrl}/drive/files/$documentId")
|
||||
method = HttpMethod.Get
|
||||
header(HttpHeaders.Authorization, "Bearer ${token().accessToken}")
|
||||
}
|
||||
val file = parent.resolve(documentFileName)
|
||||
file.outputStream().use {
|
||||
response.content.copyTo(it)
|
||||
response.bodyAsChannel().copyTo(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user