forked from loafle/openapi-generator-original
[kotlin][client] update dependencies (#9629)
* [kotlin][client] update dependencies * [kotlin][client] update sample projects * [kotlin][client] fix update dependencies
This commit is contained in:
@@ -7,18 +7,18 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
{{#jvm-retrofit2}}
|
||||
ext.retrofitVersion = '2.7.2'
|
||||
ext.retrofitVersion = '2.9.0'
|
||||
{{/jvm-retrofit2}}
|
||||
{{#useRxJava}}
|
||||
ext.rxJavaVersion = '1.3.8'
|
||||
{{/useRxJava}}
|
||||
{{#useRxJava2}}
|
||||
ext.rxJava2Version = '2.2.20'
|
||||
ext.rxJava2Version = '2.2.21'
|
||||
{{/useRxJava2}}
|
||||
{{#useRxJava3}}
|
||||
ext.rxJava3Version = '3.0.10'
|
||||
ext.rxJava3Version = '3.0.12'
|
||||
{{/useRxJava3}}
|
||||
|
||||
repositories {
|
||||
@@ -52,67 +52,67 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
{{#moshi}}
|
||||
{{^moshiCodeGen}}
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
{{/moshiCodeGen}}
|
||||
{{#moshiCodeGen}}
|
||||
compile "com.squareup.moshi:moshi:1.11.0"
|
||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0"
|
||||
implementation "com.squareup.moshi:moshi:1.12.0"
|
||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0"
|
||||
{{/moshiCodeGen}}
|
||||
{{/moshi}}
|
||||
{{#gson}}
|
||||
compile "com.google.code.gson:gson:2.8.6"
|
||||
implementation "com.google.code.gson:gson:2.8.7"
|
||||
{{/gson}}
|
||||
{{#jackson}}
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1"
|
||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.1"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.3"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3"
|
||||
{{/jackson}}
|
||||
{{#kotlinx_serialization}}
|
||||
compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
||||
{{/kotlinx_serialization}}
|
||||
{{#jvm-okhttp3}}
|
||||
compile "com.squareup.okhttp3:okhttp:3.12.13"
|
||||
implementation "com.squareup.okhttp3:okhttp:3.12.13"
|
||||
{{/jvm-okhttp3}}
|
||||
{{#jvm-okhttp4}}
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
{{/jvm-okhttp4}}
|
||||
{{#threetenbp}}
|
||||
compile "org.threeten:threetenbp:1.5.0"
|
||||
implementation "org.threeten:threetenbp:1.5.1"
|
||||
{{/threetenbp}}
|
||||
{{#jvm-retrofit2}}
|
||||
{{#hasOAuthMethods}}
|
||||
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0"
|
||||
implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
|
||||
{{/hasOAuthMethods}}
|
||||
compile "com.squareup.okhttp3:logging-interceptor:4.9.0"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
|
||||
{{#useRxJava}}
|
||||
compile "io.reactivex:rxjava:$rxJavaVersion"
|
||||
compile "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
|
||||
implementation "io.reactivex:rxjava:$rxJavaVersion"
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
|
||||
{{/useRxJava}}
|
||||
{{#useRxJava2}}
|
||||
compile "io.reactivex.rxjava2:rxjava:$rxJava2Version"
|
||||
compile "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
|
||||
implementation "io.reactivex.rxjava2:rxjava:$rxJava2Version"
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
|
||||
{{/useRxJava2}}
|
||||
{{#useRxJava3}}
|
||||
compile "io.reactivex.rxjava3:rxjava:$rxJava3Version"
|
||||
compile "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||||
implementation "io.reactivex.rxjava3:rxjava:$rxJava3Version"
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||||
{{/useRxJava3}}
|
||||
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
{{#gson}}
|
||||
compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
|
||||
{{/gson}}
|
||||
{{#moshi}}
|
||||
compile "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
|
||||
{{/moshi}}
|
||||
{{#kotlinx_serialization}}
|
||||
compile "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
|
||||
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
|
||||
{{/kotlinx_serialization}}
|
||||
compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
{{/jvm-retrofit2}}
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
{{#kotlinx_serialization}}
|
||||
|
||||
|
||||
@@ -13,14 +13,13 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
|
||||
|
||||
class OAuthOkHttpClient(
|
||||
private var client: OkHttpClient
|
||||
private var client: OkHttpClient = OkHttpClient()
|
||||
) : HttpClient {
|
||||
|
||||
constructor() : this(OkHttpClient())
|
||||
|
||||
@Throws(OAuthSystemException::class, OAuthProblemException::class)
|
||||
override fun <T : OAuthClientResponse?> execute(
|
||||
request: OAuthClientRequest,
|
||||
@@ -39,7 +38,7 @@ class OAuthOkHttpClient(
|
||||
}
|
||||
}
|
||||
|
||||
val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null
|
||||
val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null
|
||||
requestBuilder.method(requestMethod, body)
|
||||
|
||||
try {
|
||||
@@ -48,6 +47,7 @@ class OAuthOkHttpClient(
|
||||
response.body?.string(),
|
||||
response.body?.contentType()?.toString(),
|
||||
response.code,
|
||||
response.headers.toMultimap(),
|
||||
responseClass)
|
||||
} catch (e: IOException) {
|
||||
throw OAuthSystemException(e)
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,8 +28,8 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "com.google.code.gson:gson:2.8.6"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "com.google.code.gson:gson:2.8.7"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,10 +28,10 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1"
|
||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.1"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.3"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -29,9 +29,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,8 +28,8 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "com.google.code.gson:gson:2.8.6"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "com.google.code.gson:gson:2.8.7"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -29,9 +29,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi:1.11.0"
|
||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi:1.12.0"
|
||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,9 +28,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,9 +28,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,9 +28,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:3.12.13"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:3.12.13"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.retrofitVersion = '2.7.2'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
ext.retrofitVersion = '2.9.0'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -31,14 +31,14 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
||||
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0"
|
||||
compile "com.squareup.okhttp3:logging-interceptor:4.9.0"
|
||||
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
compile "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
|
||||
compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
||||
implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
|
||||
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
||||
|
||||
@@ -13,14 +13,13 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
|
||||
|
||||
class OAuthOkHttpClient(
|
||||
private var client: OkHttpClient
|
||||
private var client: OkHttpClient = OkHttpClient()
|
||||
) : HttpClient {
|
||||
|
||||
constructor() : this(OkHttpClient())
|
||||
|
||||
@Throws(OAuthSystemException::class, OAuthProblemException::class)
|
||||
override fun <T : OAuthClientResponse?> execute(
|
||||
request: OAuthClientRequest,
|
||||
@@ -39,7 +38,7 @@ class OAuthOkHttpClient(
|
||||
}
|
||||
}
|
||||
|
||||
val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null
|
||||
val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null
|
||||
requestBuilder.method(requestMethod, body)
|
||||
|
||||
try {
|
||||
@@ -48,6 +47,7 @@ class OAuthOkHttpClient(
|
||||
response.body?.string(),
|
||||
response.body?.contentType()?.toString(),
|
||||
response.code,
|
||||
response.headers.toMultimap(),
|
||||
responseClass)
|
||||
} catch (e: IOException) {
|
||||
throw OAuthSystemException(e)
|
||||
|
||||
@@ -7,9 +7,9 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.retrofitVersion = '2.7.2'
|
||||
ext.rxJava3Version = '3.0.10'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
ext.retrofitVersion = '2.9.0'
|
||||
ext.rxJava3Version = '3.0.12'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -30,15 +30,15 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0"
|
||||
compile "com.squareup.okhttp3:logging-interceptor:4.9.0"
|
||||
compile "io.reactivex.rxjava3:rxjava:$rxJava3Version"
|
||||
compile "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||||
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
compile "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
|
||||
compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
|
||||
implementation "io.reactivex.rxjava3:rxjava:$rxJava3Version"
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -13,14 +13,13 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
|
||||
|
||||
class OAuthOkHttpClient(
|
||||
private var client: OkHttpClient
|
||||
private var client: OkHttpClient = OkHttpClient()
|
||||
) : HttpClient {
|
||||
|
||||
constructor() : this(OkHttpClient())
|
||||
|
||||
@Throws(OAuthSystemException::class, OAuthProblemException::class)
|
||||
override fun <T : OAuthClientResponse?> execute(
|
||||
request: OAuthClientRequest,
|
||||
@@ -39,7 +38,7 @@ class OAuthOkHttpClient(
|
||||
}
|
||||
}
|
||||
|
||||
val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null
|
||||
val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null
|
||||
requestBuilder.method(requestMethod, body)
|
||||
|
||||
try {
|
||||
@@ -48,6 +47,7 @@ class OAuthOkHttpClient(
|
||||
response.body?.string(),
|
||||
response.body?.contentType()?.toString(),
|
||||
response.code,
|
||||
response.headers.toMultimap(),
|
||||
responseClass)
|
||||
} catch (e: IOException) {
|
||||
throw OAuthSystemException(e)
|
||||
|
||||
@@ -7,8 +7,8 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.retrofitVersion = '2.7.2'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
ext.retrofitVersion = '2.9.0'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -29,13 +29,13 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0"
|
||||
compile "com.squareup.okhttp3:logging-interceptor:4.9.0"
|
||||
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
compile "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
|
||||
compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -13,14 +13,13 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
|
||||
|
||||
class OAuthOkHttpClient(
|
||||
private var client: OkHttpClient
|
||||
private var client: OkHttpClient = OkHttpClient()
|
||||
) : HttpClient {
|
||||
|
||||
constructor() : this(OkHttpClient())
|
||||
|
||||
@Throws(OAuthSystemException::class, OAuthProblemException::class)
|
||||
override fun <T : OAuthClientResponse?> execute(
|
||||
request: OAuthClientRequest,
|
||||
@@ -39,7 +38,7 @@ class OAuthOkHttpClient(
|
||||
}
|
||||
}
|
||||
|
||||
val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null
|
||||
val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null
|
||||
requestBuilder.method(requestMethod, body)
|
||||
|
||||
try {
|
||||
@@ -48,6 +47,7 @@ class OAuthOkHttpClient(
|
||||
response.body?.string(),
|
||||
response.body?.contentType()?.toString(),
|
||||
response.code,
|
||||
response.headers.toMultimap(),
|
||||
responseClass)
|
||||
} catch (e: IOException) {
|
||||
throw OAuthSystemException(e)
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,9 +28,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,10 +28,10 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
compile "org.threeten:threetenbp:1.5.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
implementation "org.threeten:threetenbp:1.5.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,9 +28,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ wrapper {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.10'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
@@ -28,9 +28,9 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
|
||||
compile "com.squareup.okhttp3:okhttp:4.9.0"
|
||||
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
||||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user