sodalive-ios/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentReposi...

43 lines
1.3 KiB
Swift

//
// ContentMainTabContentRepository.swift
// SodaLive
//
// Created by klaus on 2/21/25.
//
import Foundation
import CombineMoya
import Combine
import Moya
final class ContentMainTabContentRepository {
private let api = MoyaProvider<ContentApi>()
func getContentMainContent() -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getContentMainContent)
}
func getNewContentOfTheme(theme: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(
.getContentMainNewContentOfTheme(
theme: theme,
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL
)
)
}
func getContentRanking(sortType: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getDailyContentRanking(sortType: sortType))
}
func getRecommendContentByTag(tag: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getRecommendContentByTag(tag: tag))
}
func getPopularContentByCreator(creatorId: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getPopularContentByCreator(creatorId: creatorId))
}
}