refactor(kanban): unify KanbanApiService with HermesApiService and update E2E integration test
This commit is contained in:
1 parent
dd5ce10796
commit
3cc5cc6574
5 files changed
+23
-23
No files matched your search
@@ -22,9 +22,6 @@ object ApiClient {
|
||||
@Volatile
|
||||
private var service: HermesApiService? = null
|
||||
|
||||
@Volatile
|
||||
private var kanbanService: KanbanApiService? = null
|
||||
|
||||
/** The current [HermesApiService] instance. Lazily created on first access. */
|
||||
val hermesApi: HermesApiService
|
||||
get() {
|
||||
@@ -33,20 +30,15 @@ object ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
/** The current [KanbanApiService] instance. Lazily created on first access. */
|
||||
/** The current [KanbanApiService] instance. Reuses [hermesApi]. */
|
||||
val kanbanApi: KanbanApiService
|
||||
get() {
|
||||
return kanbanService ?: synchronized(this) {
|
||||
kanbanService ?: buildRetrofit().create(KanbanApiService::class.java).also { kanbanService = it }
|
||||
}
|
||||
}
|
||||
get() = hermesApi
|
||||
|
||||
/** Force-rebuild the Retrofit client (e.g. after settings change). */
|
||||
fun rebuild() {
|
||||
synchronized(this) {
|
||||
retrofit = null
|
||||
service = null
|
||||
kanbanService = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ import retrofit2.http.Path
|
||||
import retrofit2.http.Query
|
||||
import retrofit2.http.Streaming
|
||||
|
||||
interface HermesApiService {
|
||||
interface HermesApiService : KanbanApiService {
|
||||
@GET("api/skills/content")
|
||||
suspend fun getSkillContent(
|
||||
@Query("name") name: String,
|
||||
|
||||
@@ -163,7 +163,7 @@ interface KanbanApiService {
|
||||
): Response<ResponseBody>
|
||||
|
||||
@GET("api/plugins/kanban/profiles")
|
||||
suspend fun getProfiles(): Response<KanbanProfilesResponse>
|
||||
suspend fun getKanbanProfiles(): Response<KanbanProfilesResponse>
|
||||
|
||||
@PATCH("api/plugins/kanban/profiles/{name}")
|
||||
suspend fun updateProfileDescription(
|
||||
|
||||
@@ -323,7 +323,7 @@ class KanbanRepositoryImpl(
|
||||
|
||||
override suspend fun getProfiles(): NetworkResult<KanbanProfilesResponse> =
|
||||
withContext(ioDispatcher) {
|
||||
safeApiCall { apiProvider().getProfiles() }
|
||||
safeApiCall { apiProvider().getKanbanProfiles() }
|
||||
}
|
||||
|
||||
override suspend fun updateProfileDescription(
|
||||
|
||||
Reference in new issue
Block a user