feat(categoryCreate): Add API patch request logic
This commit is contained in:
parent
cc1f4b0628
commit
03e7021c1a
|
@ -21,3 +21,8 @@ data class CategoryRequest(
|
|||
val name: String,
|
||||
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.CategoryResponse
|
||||
import com.p_vacho.neat_calendar.api.models.PartialCategoryRequest
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.DELETE
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.PATCH
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
|
||||
|
@ -21,6 +23,9 @@ interface CategoryService {
|
|||
@POST("/categories")
|
||||
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}")
|
||||
suspend fun deleteCategory(@Path("category_id") categoryId: String): Unit
|
||||
}
|
Loading…
Reference in a new issue