feat: auth screen with auto-redirect, sync favorites/history with backend

This commit is contained in:
nk
2026-06-02 19:12:07 +03:00
parent d4adb1e7be
commit a83672b455
2934 changed files with 97351 additions and 163 deletions

View File

@@ -0,0 +1,48 @@
package com.radiola.data.remote
import com.radiola.data.remote.dto.AuthResponseDto
import com.radiola.data.remote.dto.BackendStationDto
import com.radiola.data.remote.dto.HistoryResponseDto
import com.radiola.data.remote.dto.MagicLinkRequestDto
import com.radiola.data.remote.dto.MagicLinkVerifyDto
import com.radiola.data.remote.dto.UserSettingsDto
import kotlinx.serialization.json.JsonObject
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PATCH
import retrofit2.http.Path
interface RadiolaApi {
@POST("auth/magic-link")
suspend fun requestMagicLink(@Body dto: MagicLinkRequestDto): JsonObject
@POST("auth/verify")
suspend fun verifyMagicLink(@Body dto: MagicLinkVerifyDto): AuthResponseDto
@GET("users/me")
suspend fun getMe(): JsonObject
@GET("users/me/settings")
suspend fun getSettings(): UserSettingsDto
@PATCH("users/me/settings")
suspend fun updateSettings(@Body dto: UserSettingsDto): UserSettingsDto
@GET("users/me/favorites")
suspend fun getFavorites(): List<BackendStationDto>
@POST("users/me/favorites/{stationId}")
suspend fun addFavorite(@Path("stationId") stationId: String): JsonObject
@DELETE("users/me/favorites/{stationId}")
suspend fun removeFavorite(@Path("stationId") stationId: String): JsonObject
@GET("users/me/history")
suspend fun getHistory(): HistoryResponseDto
@POST("users/me/history/{stationId}")
suspend fun addHistory(@Path("stationId") stationId: String): JsonObject
}