Skip to content

Commit 369e6ea

Browse files
committed
update kotlin samples
1 parent 032c252 commit 369e6ea

File tree

10 files changed

+20
-20
lines changed
  • samples/client/petstore
    • kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth
    • kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth
    • kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth
    • kotlin-enum-integers-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth
    • kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/auth
    • kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/auth
    • kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/auth
    • kotlin-multiplatform-allOf-discriminator/src/commonMain/kotlin/org/openapitools/client/auth
    • kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/auth
    • kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth

10 files changed

+20
-20
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.openapitools.client.auth
22

3-
import io.ktor.util.encodeBase64
3+
import kotlin.io.encoding.Base64
44

55
class HttpBasicAuth : Authentication {
66
var username: String? = null
@@ -9,7 +9,7 @@ class HttpBasicAuth : Authentication {
99
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
1010
if (username == null && password == null) return
1111
val str = (username ?: "") + ":" + (password ?: "")
12-
val auth = str.encodeBase64()
12+
val auth = Base64.encode(str.encodeToByteArray())
1313
headers["Authorization"] = "Basic $auth"
1414
}
1515
}

0 commit comments

Comments
 (0)