mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-10-26 04:22:38 +00:00
[O] Separate register function
This commit is contained in:
parent
ad13875137
commit
b7d2a97f05
@ -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
Loading…
x
Reference in New Issue
Block a user