diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationApi.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationApi.kt new file mode 100644 index 00000000..f8a52cc7 --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationApi.kt @@ -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> + + @POST("/api/v2/home/recommendations/creators/follow") + fun followRecommendedCreators( + @Body request: FollowRecommendedCreatorsRequest, + @Header("Authorization") authHeader: String + ): Single> +} diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationModels.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationModels.kt new file mode 100644 index 00000000..6f2eaa87 --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationModels.kt @@ -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, + @SerializedName("banners") val banners: List, + @SerializedName("recentlyActiveCreators") val recentlyActiveCreators: List, + @SerializedName("recentDebutCreators") val recentDebutCreators: List, + @SerializedName("firstAudioContents") val firstAudioContents: List, + @SerializedName("aiCharacters") val aiCharacters: List, + @SerializedName("genreCreators") val genreCreators: List, + @SerializedName("cheerCreators") val cheerCreators: List, + @SerializedName("popularCommunityPosts") val popularCommunityPosts: List +) + +@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 +) + +@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 +) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationRepository.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationRepository.kt new file mode 100644 index 00000000..f1a28a29 --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/data/HomeRecommendationRepository.kt @@ -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 + ) +}