mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-09 13:47:26 +08:00
[O] Separate register function
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package ext
|
package ext
|
||||||
|
|
||||||
|
import io.ktor.client.request.*
|
||||||
|
import io.ktor.client.statement.*
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import kotlin.random.nextInt
|
import kotlin.random.nextInt
|
||||||
|
|
||||||
@@ -17,4 +19,16 @@ catch (e: Exception) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun String.jsonMap(): Map<String, Any?> = json()
|
fun String.jsonMap(): Map<String, Any?> = json()
|
||||||
fun String.jsonArray(): List<Map<String, Any?>> = json()
|
fun String.jsonArray(): List<Map<String, Any?>> = json()
|
||||||
|
|
||||||
|
suspend fun registerUser(): Long {
|
||||||
|
val resp = HTTP.post(HOST.ensureEndingSlash() + "api/v2/frontier/register-card") {
|
||||||
|
parameter("ftk", FTK)
|
||||||
|
parameter("accessCode", ACCESS_CODE)
|
||||||
|
}.bodyAsText()
|
||||||
|
|
||||||
|
val userId = (resp.jsonMap()["id"] as Number).toLong()
|
||||||
|
println("User ID: $userId")
|
||||||
|
|
||||||
|
return userId
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user