feat(home): 홈 추천 API 데이터 계층을 추가한다
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.main.home.data
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Header
|
||||||
|
import retrofit2.http.POST
|
||||||
|
|
||||||
|
interface HomeRecommendationApi {
|
||||||
|
@GET("/api/v2/home/recommendations")
|
||||||
|
fun getRecommendations(
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<HomeRecommendationResponse>>
|
||||||
|
|
||||||
|
@POST("/api/v2/home/recommendations/creators/follow")
|
||||||
|
fun followRecommendedCreators(
|
||||||
|
@Body request: FollowRecommendedCreatorsRequest,
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<Any>>
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.main.home.data
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeRecommendationResponse(
|
||||||
|
@SerializedName("lives") val lives: List<HomeLiveItem>,
|
||||||
|
@SerializedName("banners") val banners: List<HomeBannerItem>,
|
||||||
|
@SerializedName("recentlyActiveCreators") val recentlyActiveCreators: List<HomeActiveCreatorItem>,
|
||||||
|
@SerializedName("recentDebutCreators") val recentDebutCreators: List<HomeCreatorItem>,
|
||||||
|
@SerializedName("firstAudioContents") val firstAudioContents: List<HomeFirstAudioContentItem>,
|
||||||
|
@SerializedName("aiCharacters") val aiCharacters: List<HomeAiCharacterItem>,
|
||||||
|
@SerializedName("genreCreators") val genreCreators: List<HomeGenreCreatorGroupItem>,
|
||||||
|
@SerializedName("cheerCreators") val cheerCreators: List<HomeCreatorItem>,
|
||||||
|
@SerializedName("popularCommunityPosts") val popularCommunityPosts: List<HomePopularCommunityPostItem>
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeLiveItem(
|
||||||
|
@SerializedName("liveId") val liveId: Long,
|
||||||
|
@SerializedName("creatorId") val creatorId: Long,
|
||||||
|
@SerializedName("imageUrl") val imageUrl: String?,
|
||||||
|
@SerializedName("title") val title: String,
|
||||||
|
@SerializedName("creatorNickname") val creatorNickname: String,
|
||||||
|
@SerializedName("beginDateTime") val beginDateTime: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeBannerItem(
|
||||||
|
@SerializedName("bannerId") val bannerId: String?,
|
||||||
|
@SerializedName("imageUrl") val imageUrl: String?,
|
||||||
|
@SerializedName("type") val type: String?,
|
||||||
|
@SerializedName("linkUrl") val linkUrl: String?,
|
||||||
|
@SerializedName("targetId") val targetId: Long?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeActiveCreatorItem(
|
||||||
|
@SerializedName("creatorId") val creatorId: Long,
|
||||||
|
@SerializedName("nickname") val nickname: String,
|
||||||
|
@SerializedName("profileImage") val profileImage: String?,
|
||||||
|
@SerializedName("title") val title: String?,
|
||||||
|
@SerializedName("activityType") val activityType: String,
|
||||||
|
@SerializedName("activityAt") val activityAt: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeCreatorItem(
|
||||||
|
@SerializedName("creatorId") val creatorId: Long,
|
||||||
|
@SerializedName("nickname") val nickname: String,
|
||||||
|
@SerializedName("profileImage") val profileImage: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeFirstAudioContentItem(
|
||||||
|
@SerializedName("contentId") val contentId: Long,
|
||||||
|
@SerializedName("creatorId") val creatorId: Long,
|
||||||
|
@SerializedName("creatorNickname") val creatorNickname: String,
|
||||||
|
@SerializedName("creatorProfileImage") val creatorProfileImage: String?,
|
||||||
|
@SerializedName("title") val title: String,
|
||||||
|
@SerializedName("price") val price: Int,
|
||||||
|
@SerializedName("coverImage") val coverImage: String?,
|
||||||
|
@SerializedName("releaseDate") val releaseDate: String,
|
||||||
|
@SerializedName("isPointAvailable") val isPointAvailable: Boolean
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeAiCharacterItem(
|
||||||
|
@SerializedName("characterId") val characterId: Long,
|
||||||
|
@SerializedName("name") val name: String,
|
||||||
|
@SerializedName("description") val description: String,
|
||||||
|
@SerializedName("profileImage") val profileImage: String?,
|
||||||
|
@SerializedName("totalChatCount") val totalChatCount: Long,
|
||||||
|
@SerializedName("originalWorkTitle") val originalWorkTitle: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomeGenreCreatorGroupItem(
|
||||||
|
@SerializedName("genre") val genre: String,
|
||||||
|
@SerializedName("creators") val creators: List<HomeCreatorItem>
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class HomePopularCommunityPostItem(
|
||||||
|
@SerializedName("postId") val postId: Long,
|
||||||
|
@SerializedName("creatorId") val creatorId: Long,
|
||||||
|
@SerializedName("creatorNickname") val creatorNickname: String,
|
||||||
|
@SerializedName("creatorProfileImage") val creatorProfileImage: String?,
|
||||||
|
@SerializedName("imageUrl") val imageUrl: String?,
|
||||||
|
@SerializedName("audioUrl") val audioUrl: String?,
|
||||||
|
@SerializedName("content") val content: String,
|
||||||
|
@SerializedName("price") val price: Int,
|
||||||
|
@SerializedName("createdAt") val createdAt: String,
|
||||||
|
@SerializedName("likeCount") val likeCount: Long,
|
||||||
|
@SerializedName("commentCount") val commentCount: Long,
|
||||||
|
@SerializedName("existOrdered") val existOrdered: Boolean
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class FollowRecommendedCreatorsRequest(
|
||||||
|
@SerializedName("creatorIds") val creatorIds: List<Long>
|
||||||
|
)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.main.home.data
|
||||||
|
|
||||||
|
class HomeRecommendationRepository(private val api: HomeRecommendationApi) {
|
||||||
|
fun getRecommendations(token: String) = api.getRecommendations(authHeader = token)
|
||||||
|
|
||||||
|
fun followRecommendedCreators(
|
||||||
|
request: FollowRecommendedCreatorsRequest,
|
||||||
|
token: String
|
||||||
|
) = api.followRecommendedCreators(
|
||||||
|
request = request,
|
||||||
|
authHeader = token
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user