라이브 메인 - UI, Api 적용
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package kr.co.vividnext.sodalive.settings.event
|
||||
|
||||
import io.reactivex.rxjava3.core.Flowable
|
||||
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 EventApi {
|
||||
@GET("/event")
|
||||
fun getEvents(
|
||||
@Query("page") page: Int,
|
||||
@Query("size") size: Int,
|
||||
@Header("Authorization") authHeader: String
|
||||
): Flowable<ApiResponse<GetEventResponse>>
|
||||
|
||||
@GET("/event/popup")
|
||||
fun getEventPopup(@Header("Authorization") authHeader: String): Single<ApiResponse<EventItem>>
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package kr.co.vividnext.sodalive.settings.event
|
||||
|
||||
class EventRepository(private val api: EventApi) {
|
||||
fun getEvents(
|
||||
page: Int,
|
||||
size: Int,
|
||||
token: String
|
||||
) = api.getEvents(page, size, authHeader = token)
|
||||
|
||||
fun getEventPopup(token: String) = api.getEventPopup(authHeader = token)
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package kr.co.vividnext.sodalive.settings.event
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
data class GetEventResponse(
|
||||
@SerializedName("totalCount") val totalCount: Int,
|
||||
@SerializedName("eventList") val eventList: List<EventItem>
|
||||
)
|
||||
|
||||
@Parcelize
|
||||
data class EventItem(
|
||||
@SerializedName("id") val id: Long,
|
||||
@SerializedName("thumbnailImageUrl") val thumbnailImageUrl: String,
|
||||
@SerializedName("detailImageUrl") val detailImageUrl: String? = null,
|
||||
@SerializedName("popupImageUrl") val popupImageUrl: String? = null,
|
||||
@SerializedName("link") val link: String? = null
|
||||
) : Parcelable
|
Reference in New Issue
Block a user