diff --git a/app/src/main/java/com/p_vacho/neat_calendar/api/RetrofitClient.kt b/app/src/main/java/com/p_vacho/neat_calendar/api/RetrofitClient.kt index 5259ec0..4418ba5 100644 --- a/app/src/main/java/com/p_vacho/neat_calendar/api/RetrofitClient.kt +++ b/app/src/main/java/com/p_vacho/neat_calendar/api/RetrofitClient.kt @@ -16,6 +16,7 @@ import com.p_vacho.neat_calendar.api.converters.ColorConverter import com.p_vacho.neat_calendar.api.services.CategoryService import com.p_vacho.neat_calendar.api.services.EventsService import com.p_vacho.neat_calendar.api.services.InvitationsService +import com.p_vacho.neat_calendar.api.services.NotificationService import com.p_vacho.neat_calendar.api.services.UsersService object RetrofitClient { @@ -45,6 +46,9 @@ object RetrofitClient { val usersService: UsersService get() = retrofitClient!!.create(UsersService::class.java) + val notificationsService: NotificationService + get() = retrofitClient!!.create(NotificationService::class.java) + fun initialize(context: Context) { appContext = context baseUrl = getBaseUrl() diff --git a/app/src/main/java/com/p_vacho/neat_calendar/api/models/NotificationModels.kt b/app/src/main/java/com/p_vacho/neat_calendar/api/models/NotificationModels.kt new file mode 100644 index 0000000..e21d0bc --- /dev/null +++ b/app/src/main/java/com/p_vacho/neat_calendar/api/models/NotificationModels.kt @@ -0,0 +1,14 @@ +package com.p_vacho.neat_calendar.api.models + +import java.time.OffsetDateTime + +data class NotificationResponse( + val id: String, + val user_id: String, + val event_type: String, // "reminder" / "invitation" + val message: String, + val data: String, + val read: Boolean, + val created_at: OffsetDateTime, + val read_at: OffsetDateTime?, +) diff --git a/app/src/main/java/com/p_vacho/neat_calendar/api/services/NotificationService.kt b/app/src/main/java/com/p_vacho/neat_calendar/api/services/NotificationService.kt new file mode 100644 index 0000000..635dfcf --- /dev/null +++ b/app/src/main/java/com/p_vacho/neat_calendar/api/services/NotificationService.kt @@ -0,0 +1,17 @@ +package com.p_vacho.neat_calendar.api.services + +import com.p_vacho.neat_calendar.api.models.NotificationResponse +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.Path + +interface NotificationService { + @GET("users/{user_id}/notifications") + suspend fun getUserNotifications(@Path("user_id") userId: String): List + + @GET("notifications/{notification_id}") + suspend fun getNotificationId(@Path("notification_id") notificationId: String): NotificationResponse + + @POST("notifications/{notification_id}/read") + suspend fun markNotificationRead(@Path("notification_id") notificationId: String): NotificationResponse +} \ No newline at end of file