feat: Add notifications api service
This commit is contained in:
parent
5cd48cfed6
commit
28211abe93
|
@ -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.CategoryService
|
||||||
import com.p_vacho.neat_calendar.api.services.EventsService
|
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.InvitationsService
|
||||||
|
import com.p_vacho.neat_calendar.api.services.NotificationService
|
||||||
import com.p_vacho.neat_calendar.api.services.UsersService
|
import com.p_vacho.neat_calendar.api.services.UsersService
|
||||||
|
|
||||||
object RetrofitClient {
|
object RetrofitClient {
|
||||||
|
@ -45,6 +46,9 @@ object RetrofitClient {
|
||||||
val usersService: UsersService
|
val usersService: UsersService
|
||||||
get() = retrofitClient!!.create(UsersService::class.java)
|
get() = retrofitClient!!.create(UsersService::class.java)
|
||||||
|
|
||||||
|
val notificationsService: NotificationService
|
||||||
|
get() = retrofitClient!!.create(NotificationService::class.java)
|
||||||
|
|
||||||
fun initialize(context: Context) {
|
fun initialize(context: Context) {
|
||||||
appContext = context
|
appContext = context
|
||||||
baseUrl = getBaseUrl()
|
baseUrl = getBaseUrl()
|
||||||
|
|
|
@ -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?,
|
||||||
|
)
|
|
@ -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<NotificationResponse>
|
||||||
|
|
||||||
|
@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
|
||||||
|
}
|
Loading…
Reference in a new issue