feat: auth screen with auto-redirect, sync favorites/history with backend
This commit is contained in:
48
app/src/main/java/com/radiola/data/remote/RadiolaApi.kt
Normal file
48
app/src/main/java/com/radiola/data/remote/RadiolaApi.kt
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user