feat(content): 랭킹 API 계약을 추가한다

This commit is contained in:
2026-06-24 13:35:20 +09:00
parent 8bc1ec5830
commit 0d0bec1904
4 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
package kr.co.vividnext.sodalive.v2.main.content.data
import io.reactivex.rxjava3.core.Single
import kr.co.vividnext.sodalive.common.ApiResponse
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Query
interface AudioRankingsApi {
@GET("/api/v2/audio/rankings")
fun getRankings(
@Header("Authorization") authHeader: String,
@Query("type") type: AudioRankingType
): Single<ApiResponse<AudioRankingResponse>>
}

View File

@@ -0,0 +1,34 @@
package kr.co.vividnext.sodalive.v2.main.content.data
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
@Keep
data class AudioRankingResponse(
@SerializedName("showRankChange") val showRankChange: Boolean,
@SerializedName("type") val type: AudioRankingType,
@SerializedName("items") val items: List<AudioRankingItemResponse>
)
enum class AudioRankingType(
val queryValue: String,
val label: String
) {
WEEKLY_POPULAR("WEEKLY_POPULAR", "주간 인기"),
RISING("RISING", "지금 뜨는 중"),
REVENUE("REVENUE", "매출"),
SALES_COUNT("SALES_COUNT", "판매량"),
COMMENT_COUNT("COMMENT_COUNT", "댓글수"),
LIKE_COUNT("LIKE_COUNT", "좋아요")
}
@Keep
data class AudioRankingItemResponse(
@SerializedName("contentId") val contentId: Long,
@SerializedName("title") val title: String,
@SerializedName("creatorNickname") val creatorNickname: String,
@SerializedName("rank") val rank: Int,
@SerializedName("rankChange") val rankChange: Int?,
@SerializedName("isNew") val isNew: Boolean,
@SerializedName("coverImageUrl") val coverImageUrl: String?
)

View File

@@ -0,0 +1,8 @@
package kr.co.vividnext.sodalive.v2.main.content.data
class AudioRankingsRepository(private val api: AudioRankingsApi) {
fun getRankings(token: String, type: AudioRankingType) = api.getRankings(
authHeader = token,
type = type
)
}