diff --git a/app/src/main/java/com/p_vacho/neat_calendar/api/models/CategoryModels.kt b/app/src/main/java/com/p_vacho/neat_calendar/api/models/CategoryModels.kt index 859c546..fb9db4e 100644 --- a/app/src/main/java/com/p_vacho/neat_calendar/api/models/CategoryModels.kt +++ b/app/src/main/java/com/p_vacho/neat_calendar/api/models/CategoryModels.kt @@ -20,4 +20,9 @@ data class CategoryResponse( data class CategoryRequest( val name: String, val color: Color, +) + +data class PartialCategoryRequest( + val name: String?, + val color: Color?, ) \ No newline at end of file diff --git a/app/src/main/java/com/p_vacho/neat_calendar/api/services/CategoryService.kt b/app/src/main/java/com/p_vacho/neat_calendar/api/services/CategoryService.kt index 338a9a2..4dee324 100644 --- a/app/src/main/java/com/p_vacho/neat_calendar/api/services/CategoryService.kt +++ b/app/src/main/java/com/p_vacho/neat_calendar/api/services/CategoryService.kt @@ -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 } \ No newline at end of file