feat(categoryCreate): Add API patch request logic
This commit is contained in:
parent
cc1f4b0628
commit
03e7021c1a
|
@ -20,4 +20,9 @@ data class CategoryResponse(
|
||||||
data class CategoryRequest(
|
data class CategoryRequest(
|
||||||
val name: String,
|
val name: String,
|
||||||
val color: Color,
|
val color: Color,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class PartialCategoryRequest(
|
||||||
|
val name: String?,
|
||||||
|
val color: Color?,
|
||||||
)
|
)
|
|
@ -2,9 +2,11 @@ package com.p_vacho.neat_calendar.api.services
|
||||||
|
|
||||||
import com.p_vacho.neat_calendar.api.models.CategoryRequest
|
import com.p_vacho.neat_calendar.api.models.CategoryRequest
|
||||||
import com.p_vacho.neat_calendar.api.models.CategoryResponse
|
import com.p_vacho.neat_calendar.api.models.CategoryResponse
|
||||||
|
import com.p_vacho.neat_calendar.api.models.PartialCategoryRequest
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.DELETE
|
import retrofit2.http.DELETE
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.PATCH
|
||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
||||||
import retrofit2.http.Path
|
import retrofit2.http.Path
|
||||||
|
|
||||||
|
@ -21,6 +23,9 @@ interface CategoryService {
|
||||||
@POST("/categories")
|
@POST("/categories")
|
||||||
suspend fun createCategory(@Body categoryData: CategoryRequest): CategoryResponse
|
suspend fun createCategory(@Body categoryData: CategoryRequest): CategoryResponse
|
||||||
|
|
||||||
|
@PATCH("/categories/{category_id}")
|
||||||
|
suspend fun createCategory(@Path("category_id") categoryId: String, @Body categoryData: PartialCategoryRequest): CategoryResponse
|
||||||
|
|
||||||
@DELETE("/categories/{category_id}")
|
@DELETE("/categories/{category_id}")
|
||||||
suspend fun deleteCategory(@Path("category_id") categoryId: String): Unit
|
suspend fun deleteCategory(@Path("category_id") categoryId: String): Unit
|
||||||
}
|
}
|
Loading…
Reference in a new issue