Co-authored-by: ronia <ronia@m57>
This commit is contained in:
1 parent
261ee6379a
commit
113467a99d
3 files changed
+8
-6
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
package com.m57.hermescontrol.data.model
|
package com.m57.hermescontrol.data.model
|
||||||
|
|
||||||
data class SaveSkillContentRequest(
|
data class SaveSkillContentRequest(
|
||||||
|
val name: String,
|
||||||
val content: String,
|
val content: String,
|
||||||
)
|
)
|
||||||
@@ -54,14 +54,13 @@ import retrofit2.http.Path
|
|||||||
import retrofit2.http.Query
|
import retrofit2.http.Query
|
||||||
|
|
||||||
interface HermesApiService {
|
interface HermesApiService {
|
||||||
@GET("api/skills/{name}/content")
|
@GET("api/skills/content")
|
||||||
suspend fun getSkillContent(
|
suspend fun getSkillContent(
|
||||||
@Path("name") name: String,
|
@Query("name") name: String,
|
||||||
): Response<SkillContentResponse>
|
): Response<SkillContentResponse>
|
||||||
|
|
||||||
@PUT("api/skills/{name}/content")
|
@PUT("api/skills/content")
|
||||||
suspend fun saveSkillContent(
|
suspend fun saveSkillContent(
|
||||||
@Path("name") name: String,
|
|
||||||
@Body body: SaveSkillContentRequest,
|
@Body body: SaveSkillContentRequest,
|
||||||
): Response<Unit>
|
): Response<Unit>
|
||||||
|
|
||||||
|
|||||||
@@ -143,9 +143,11 @@ class SkillsViewModel : ViewModel() {
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
safeApiCall {
|
safeApiCall {
|
||||||
ApiClient.hermesApi.saveSkillContent(
|
ApiClient.hermesApi.saveSkillContent(
|
||||||
skillName,
|
|
||||||
com.m57.hermescontrol.data.model
|
com.m57.hermescontrol.data.model
|
||||||
.SaveSkillContentRequest(content),
|
.SaveSkillContentRequest(
|
||||||
|
name = skillName,
|
||||||
|
content = content,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user