feat(categoryCreate): Add API post request logic

This commit is contained in:
Peter Vacho 2025-01-04 23:45:10 +01:00
parent 2e83463190
commit cc1f4b0628
Signed by: school
GPG key ID: 8CFC3837052871B4
2 changed files with 12 additions and 1 deletions

View file

@ -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,
)

View file

@ -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
}