-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
1,001 additions
and
921 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[*.{kt,kts}] | ||
root = true | ||
|
||
[*] | ||
indent_size = 2 | ||
insert_final_newline = true | ||
max_line_length = 280 | ||
disabled_rules=no-wildcard-imports | ||
continuation_indent_size = 4 | ||
ij_kotlin_name_count_to_use_star_import = unset |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package app.domain | ||
|
||
import kotlinx.serialization.* | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class LibraryCount(val count: Long) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
app/src/commonMain/kotlin/app/util/kodein.kt → ...rc/commonMain/kotlin/app/util/DIModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
package app.service | ||
|
||
import app.domain.* | ||
import app.util.* | ||
import io.ktor.client.* | ||
import io.ktor.client.request.* | ||
import kamp.domain.* | ||
import app.domain.LibraryCount | ||
import app.domain.PagedResponse | ||
import app.util.toApi | ||
import io.ktor.client.HttpClient | ||
import io.ktor.client.request.get | ||
import kamp.domain.KotlinMPPLibrary | ||
|
||
actual class LibraryService(private val client: HttpClient) { | ||
actual suspend fun getAll(page: Int, size: Int, search: String?, targets: Set<String>?): PagedResponse<KotlinMPPLibrary> { | ||
actual suspend fun getAll( | ||
page: Int, | ||
size: Int, | ||
search: String?, | ||
targets: Set<String>?, | ||
): PagedResponse<KotlinMPPLibrary> { | ||
val pagination = "page=$page&size=$size" | ||
val searchQuery = search?.let { "search=$it" } ?: "" | ||
val targetsQuery = targets?.joinToString(prefix = "target=", separator = "&target=") ?: "" | ||
|
||
return client.get("${path}${buildQuery(pagination, searchQuery, targetsQuery)}".toApi()) | ||
} | ||
|
||
actual suspend fun getCount(search: String?, targets: Set<String>?): LibraryCount { | ||
val searchQuery = search?.let { "search=$it" } | ||
val targetsQuery = targets?.joinToString(prefix = "target=", separator = "&target=") | ||
return client.get("${path}/count${buildQuery(searchQuery, targetsQuery)}".toApi()) | ||
|
||
return client.get("$path/count${buildQuery(searchQuery, targetsQuery)}".toApi()) | ||
} | ||
|
||
private fun buildQuery(vararg query: String?): String { | ||
return query.toSet().filterNotNull().takeIf(List<String>::isNotEmpty)?.joinToString("&", prefix = "?") ?: "" | ||
} | ||
|
||
actual companion object | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.