feat(data): add Retrofit API, DTOs and mappers

This commit is contained in:
nk
2026-06-01 12:11:15 +03:00
parent 828cdf9a50
commit 62674fcc3f
4 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package com.radiola.data.remote
import com.radiola.data.remote.dto.NowPlayingItemDto
import com.radiola.data.remote.dto.StationDto
import com.radiola.domain.model.Station
import com.radiola.domain.model.Track
object ApiMapper {
fun StationDto.toDomain(): Station {
val cover = iconPng ?: iconSvg ?: ""
return Station(
id = id,
name = name,
prefix = prefix,
streamUrl = "https://air.radiorecord.ru:805/${prefix}_128",
coverUrl = cover,
genre = genre ?: "",
tags = emptyList(),
sortOrder = id
)
}
fun NowPlayingItemDto.toDomain(): Track {
return Track(
artist = artist,
song = song,
coverUrl = image600 ?: image100,
stationName = prefix
)
}
}