feat(content): 전체보기 API 계층을 추가한다
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package kr.co.vividnext.sodalive.v2.main.content.overview.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 ContentOverviewApi {
|
||||
@GET("/api/v2/contents")
|
||||
fun getContents(
|
||||
@Header("Authorization") authHeader: String,
|
||||
@Query("page") page: Int,
|
||||
@Query("size") size: Int,
|
||||
@Query("type") type: ContentOverviewType
|
||||
): Single<ApiResponse<ContentOverviewPageResponse>>
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package kr.co.vividnext.sodalive.v2.main.content.overview.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
@Keep
|
||||
data class ContentOverviewPageResponse(
|
||||
@SerializedName("type") val type: ContentOverviewType,
|
||||
@SerializedName("items") val items: List<ContentOverviewItemResponse>,
|
||||
@SerializedName("page") val page: Int,
|
||||
@SerializedName("size") val size: Int,
|
||||
@SerializedName("hasNext") val hasNext: Boolean
|
||||
)
|
||||
|
||||
enum class ContentOverviewType {
|
||||
NEW_AND_HOT_AUDIO,
|
||||
FIRST_AUDIO_CONTENT
|
||||
}
|
||||
|
||||
@Keep
|
||||
data class ContentOverviewItemResponse(
|
||||
@SerializedName("contentId") val contentId: Long,
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("coverImage") val coverImage: String?,
|
||||
@SerializedName("price") val price: Int,
|
||||
@SerializedName("isAdult") val isAdult: Boolean,
|
||||
@SerializedName("isPointAvailable") val isPointAvailable: Boolean,
|
||||
@SerializedName("isFirstContent") val isFirstContent: Boolean,
|
||||
@SerializedName("isOriginalSeries") val isOriginalSeries: Boolean,
|
||||
@SerializedName("creatorNickname") val creatorNickname: String
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
package kr.co.vividnext.sodalive.v2.main.content.overview.data
|
||||
|
||||
class ContentOverviewRepository(private val api: ContentOverviewApi) {
|
||||
fun getContents(
|
||||
token: String,
|
||||
page: Int,
|
||||
size: Int,
|
||||
type: ContentOverviewType
|
||||
) = api.getContents(
|
||||
authHeader = token,
|
||||
page = page,
|
||||
size = size,
|
||||
type = type
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user