File tree Expand file tree Collapse file tree 5 files changed +7
-5
lines changed
common/src/main/kotlin/com/lambda Expand file tree Collapse file tree 5 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,8 @@ object Network : Module(
103103
104104 enum class ApiVersion (val value : String ) {
105105 // We can use @Deprecated("Not supported") to remove old API versions in the future
106- V1 (" v1" ),
106+ V1 (" v1" );
107+
108+ override fun toString () = value
107109 }
108110}
Original file line number Diff line number Diff line change @@ -34,5 +34,5 @@ import java.util.UUID
3434 * @return results of cape
3535 */
3636suspend fun getCape (uuid : UUID ) = runCatching {
37- LambdaHttp .get(" $apiUrl /api/${ apiVersion.value} /cape?id=$uuid " ).body<Cape >()
37+ LambdaHttp .get(" $apiUrl /api/$apiVersion /cape?id=$uuid " ).body<Cape >()
3838}
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import io.ktor.http.*
3535 * @return result of [Authentication]
3636 */
3737suspend fun linkDiscord (discordToken : String ) = runCatching {
38- LambdaHttp .post(" ${apiUrl} /api/${ apiVersion.value} /link/discord" ) {
38+ LambdaHttp .post(" ${apiUrl} /api/$apiVersion /link/discord" ) {
3939 setBody(""" { "token": "$discordToken " }""" )
4040 bearerAuth(NetworkManager .accessToken)
4141 contentType(ContentType .Application .Json )
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import io.ktor.http.*
3535 * @return result of [Authentication]
3636 */
3737suspend fun login (username : String , hash : String ) = runCatching {
38- LambdaHttp .post(" ${apiUrl} /api/${ apiVersion.value} /login" ) {
38+ LambdaHttp .post(" ${apiUrl} /api/$apiVersion /login" ) {
3939 setBody(""" { "username": "$username ", "hash": "$hash " }""" )
4040 contentType(ContentType .Application .Json )
4141 }.body<Authentication >()
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import io.ktor.http.*
3333 * @return nothing
3434 */
3535suspend fun setCape (id : String ) = runCatching {
36- val resp = LambdaHttp .put(" $apiUrl /api/${ apiVersion.value} /cape?id=$id " ) {
36+ val resp = LambdaHttp .put(" $apiUrl /api/$apiVersion /cape?id=$id " ) {
3737 bearerAuth(NetworkManager .accessToken)
3838 contentType(ContentType .Application .Json )
3939 }
You can’t perform that action at this time.
0 commit comments