File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
scryfall/src/commonMain/kotlin/client Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 1- import arrow.core.continuations.either
21import arrow.core.getOrElse
3- import arrow.core.getOrHandle
2+ import arrow.core.raise.either
43import client.ScryfallApi
54import com.mfriend.collection.CollectionImporter
65import com.mfriend.db.Card
@@ -34,7 +33,7 @@ class CliViewModel(
3433 }
3534 return @either cardRows.size
3635 }
37- succ.getOrHandle { throw Exception (it) }
36+ succ.getOrElse { throw Exception (it) }
3837 }
3938
4039 suspend fun searchAndAddCards (query : String ) {
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ import arrow.core.Either
44import arrow.core.left
55import arrow.core.right
66import co.touchlab.kermit.Logger
7- import models.CardDto
87import io.ktor.client.call.body
98import io.ktor.client.request.HttpRequestBuilder
109import io.ktor.client.request.get
1110import io.ktor.client.request.parameter
1211import io.ktor.client.statement.HttpResponse
1312import io.ktor.http.encodedPath
1413import io.ktor.http.takeFrom
14+ import models.CardDto
1515import models.ListResp
1616import models.SetDto
1717
@@ -21,11 +21,10 @@ interface ScryfallApi {
2121 suspend fun sets (): Either <String , List <SetDto >>
2222}
2323
24- suspend inline fun <reified T > HttpResponse.toEither (): Either <String , T > =
25- when (this .status.value) {
26- in 200 .. 299 -> this .body<T >().right()
27- else -> this .body<String >().left()
28- }
24+ suspend inline fun <reified T > HttpResponse.toEither (): Either <String , T > = when (this .status.value) {
25+ in 200 .. 299 -> this .body<T >().right()
26+ else -> this .body<String >().left()
27+ }
2928
3029class ScryfallApiImpl : ScryfallApi {
3130 private val client = newKtorClient()
@@ -72,4 +71,4 @@ class ScryfallApiImpl : ScryfallApi {
7271 encodedPath = path
7372 }
7473 }
75- }
74+ }
You can’t perform that action at this time.
0 commit comments