feat(main-home): 추천 홈 데이터 계층을 추가한다
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import Foundation
|
||||
|
||||
struct FollowRecommendedCreatorsRequest: Encodable {
|
||||
let creatorIds: [Int]?
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import Foundation
|
||||
|
||||
struct HomeRecommendationResponse: Decodable {
|
||||
let lives: [HomeLiveItem]
|
||||
let banners: [HomeBannerItem]
|
||||
let recentlyActiveCreators: [HomeActiveCreatorItem]
|
||||
let recentDebutCreators: [HomeCreatorItem]
|
||||
let firstAudioContents: [HomeFirstAudioContentItem]
|
||||
let aiCharacters: [HomeAiCharacterItem]
|
||||
let genreCreators: [HomeGenreCreatorGroupItem]
|
||||
let cheerCreators: [HomeCreatorItem]
|
||||
let popularCommunityPosts: [HomePopularCommunityPostItem]
|
||||
}
|
||||
|
||||
struct HomeLiveItem: Decodable, Hashable {
|
||||
let liveRoomId: Int?
|
||||
let roomId: Int?
|
||||
let creatorId: Int?
|
||||
let creatorNickname: String?
|
||||
let title: String?
|
||||
let profileImageUrl: String?
|
||||
let thumbnailUrl: String?
|
||||
let imageUrl: String?
|
||||
let beginDateTime: String?
|
||||
let participantCount: Int?
|
||||
}
|
||||
|
||||
struct HomeBannerItem: Decodable, Hashable {
|
||||
let bannerId: Int?
|
||||
let type: String?
|
||||
let title: String?
|
||||
let imageUrl: String?
|
||||
let link: String?
|
||||
let eventId: Int?
|
||||
let creatorId: Int?
|
||||
let seriesId: Int?
|
||||
}
|
||||
|
||||
struct HomeActiveCreatorItem: Decodable, Hashable {
|
||||
let creatorId: Int?
|
||||
let creatorNickname: String?
|
||||
let profileImageUrl: String?
|
||||
let activityType: RecommendedActivityType?
|
||||
let activityAt: String?
|
||||
}
|
||||
|
||||
struct HomeCreatorItem: Decodable, Hashable {
|
||||
let creatorId: Int?
|
||||
let creatorNickname: String?
|
||||
let nickname: String?
|
||||
let profileImageUrl: String?
|
||||
let imageUrl: String?
|
||||
let description: String?
|
||||
let followerCount: Int?
|
||||
let cheerCount: Int?
|
||||
let debutDate: String?
|
||||
}
|
||||
|
||||
struct HomeFirstAudioContentItem: Decodable, Hashable {
|
||||
let contentId: Int?
|
||||
let creatorId: Int?
|
||||
let creatorNickname: String?
|
||||
let title: String?
|
||||
let imageUrl: String?
|
||||
let coverImageUrl: String?
|
||||
let releaseDate: String?
|
||||
}
|
||||
|
||||
struct HomeAiCharacterItem: Decodable, Hashable {
|
||||
let characterId: Int?
|
||||
let name: String?
|
||||
let description: String?
|
||||
let profileImageUrl: String?
|
||||
let imageUrl: String?
|
||||
let chatCount: Int?
|
||||
let originalTitle: String?
|
||||
}
|
||||
|
||||
struct HomeGenreCreatorGroupItem: Decodable, Hashable {
|
||||
let genreId: Int?
|
||||
let genreName: String?
|
||||
let title: String?
|
||||
let creators: [HomeCreatorItem]?
|
||||
}
|
||||
|
||||
struct HomePopularCommunityPostItem: Decodable, Hashable {
|
||||
let postId: Int?
|
||||
let creatorId: Int?
|
||||
let creatorNickname: String?
|
||||
let creatorProfileImageUrl: String?
|
||||
let content: String?
|
||||
let imageUrl: String?
|
||||
let price: Int?
|
||||
let existOrdered: Bool?
|
||||
let likeCount: Int?
|
||||
let commentCount: Int?
|
||||
let createdAt: String?
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import Foundation
|
||||
|
||||
enum RecommendedActivityType: Decodable, Hashable {
|
||||
case live
|
||||
case audio
|
||||
case community
|
||||
case unknown(String)
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
let code = try container.decode(String.self)
|
||||
|
||||
switch code {
|
||||
case "LIVE", "LIVE_REPLAY":
|
||||
self = .live
|
||||
case "AUDIO":
|
||||
self = .audio
|
||||
case "COMMUNITY":
|
||||
self = .community
|
||||
default:
|
||||
self = .unknown(code)
|
||||
}
|
||||
}
|
||||
|
||||
var title: String {
|
||||
switch self {
|
||||
case .live:
|
||||
return I18n.HomeRecommendation.activityLive
|
||||
case .audio:
|
||||
return I18n.HomeRecommendation.activityAudio
|
||||
case .community:
|
||||
return I18n.HomeRecommendation.activityCommunity
|
||||
case .unknown:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user