feat(categoryCreate): Add API post request logic
This commit is contained in:
parent
2e83463190
commit
cc1f4b0628
|
@ -16,3 +16,8 @@ data class CategoryResponse(
|
|||
val owner_user_id: String,
|
||||
val created_at: OffsetDateTime
|
||||
): Parcelable
|
||||
|
||||
data class CategoryRequest(
|
||||
val name: String,
|
||||
val color: Color,
|
||||
)
|
|
@ -1,8 +1,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 retrofit2.http.Body
|
||||
import retrofit2.http.DELETE
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
|
||||
interface CategoryService {
|
||||
|
@ -15,6 +18,9 @@ interface CategoryService {
|
|||
@GET("/categories/{category_id}")
|
||||
suspend fun getCategory(@Path("category_id") categoryId: String): CategoryResponse
|
||||
|
||||
@POST("/categories")
|
||||
suspend fun createCategory(@Body categoryData: CategoryRequest): CategoryResponse
|
||||
|
||||
@DELETE("/categories/{category_id}")
|
||||
suspend fun deleteCategory(@Path("category_id") categoryId: String): Unit
|
||||
}
|
Loading…
Reference in a new issue